Git Product home page Git Product logo

php-sepa-xml's Introduction

##THIS PROJECT IS NO LONGER MAINTAINED Please use https://github.com/php-sepa-xml/php-sepa-xml

php-sepa-xml

Master: Build Status

SEPA file generator for PHP.

Creates an XML file for a Single Euro Payments Area (SEPA) Credit Transfer and Direct Debit.

License: GNU Lesser General Public License v3.0

The versions of the standard followed are:

  • pain.001.002.03 (or pain.001.001.03) for credits
  • and pain.008.002.02 (or pain.008.001.02) for debits

Institutions and associations that should accept this format:

  • Deutsche Kreditwirtschaft
  • Fédération bancaire française

However, always verify generated files with your bank before using!

##Installation ###Composer This library is available in packagist.org, you can add it to your project via Composer.

In the "require" section of your composer.json file:

Always up to date (bleeding edge, API not guaranteed stable)

"digitick/sepa-xml" : "dev-master"

No namespaces, only bugfixes

"digitick/sepa-xml" : "dev-no_namespace"

Specific minor version, API stability

"digitick/sepa-xml" : "0.10.*"

##Sample Usage DirectDebit with Factory

//Set the initial information
$directDebit = TransferFileFacadeFactory::createDirectDebit('test123', 'Me');

// create a payment, it's possible to create multiple payments,
// "firstPayment" is the identifier for the transactions
$directDebit->addPaymentInfo('firstPayment', array(
	'id' 					=> 'firstPayment',
	'creditorName' 			=> 'My Company',
	'creditorAccountIBAN'	=> 'FI1350001540000056',
	'creditorAgentBIC' 		=> 'PSSTFRPPMON',
	'seqType'				=> PaymentInformation::S_ONEOFF,
	'creditorId'			=> 'DE21WVM1234567890'
));
// Add a Single Transaction to the named payment
$directDebit->addTransfer('firstPayment', array(
	'amount'				=> '500',
	'debtorIban'			=> 'FI1350001540000056',
	'debtorBic'				=> 'OKOYFIHH',
	'debtorName'			=> 'Their Company',
	'debtorMandate'			=>  'AB12345',
	'debtorMandateSignDate'	=> '13.10.2012',
	'remittanceInformation'	=> 'Purpose of this direct debit'
));
// Retrieve the resulting XML
$directDebit->asXML();

##Extended Usage Credit Transfer

// Create the initiating information
$groupHeader = new GroupHeader('SEPA File Identifier', 'Your Company Name');
$sepaFile = new CustomerCreditTransferFile($groupHeader);

$transfer = new CustomerCreditTransferInformation(
    '0.02', // Amount
    'FI1350001540000056', //IBAN of creditor
    'Their Corp' //Name of Creditor
);
$transfer->setBic('OKOYFIHH'); // Set the BIC explicitly
$transfer->setRemittanceInformation('Transaction Description');

// Create a PaymentInformation the Transfer belongs to
$payment = new PaymentInformation(
    'Payment Info ID',
    'FR1420041010050500013M02606', // IBAN the money is transferred from
    'PSSTFRPPMON',  // BIC
    'My Corp' // Debitor Name
);
// It's possible to add multiple Transfers in one Payment
$payment->addTransfer($transfer);

// It's possible to add multiple payments to one SEPA File
$sepaFile->addPaymentInformation($payment);

// Attach a dombuilder to the sepaFile to create the XML output
$domBuilder = DomBuilderFactory::createDomBuilder($sepaFile);

// Or if you want to use the format 'pain.001.001.03' instead
// $domBuilder = DomBuilderFactory::createDomBuilder($sepaFile, 'pain.001.001.03');

$domBuilder->asXml();

php-sepa-xml's People

Contributors

beinbm avatar bobbxy avatar ch3ric avatar denis-sokolov avatar ianare avatar leonex-cs1 avatar mclois avatar momobulle avatar monofone avatar nannehuiges avatar ruudk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-sepa-xml's Issues

number of transaction is false

The number of transaction is incorrect.

There is two incrementation of the number
in SepaPaymentInfo :
$this->numberOfTransactions++;

This is the way i've corrected it
in SepaTransferFile
//$this->numberOfTransactions += $this->payment->getNumberOfTransactions();

Two Exception classes

Not sure if this is a question or an issue. You have two Exception classes, one in Sepa, the other in Sepa/Exception. The first one doesn't seem to be used at all. Why is this necessary?

Thx for a great lib.

Add Composer.json

Add a composer.json file so that others can require the package using composer.

Also, start tagging, even if it's not stable yet (0.1.0?)

PS: Kudos for this! Thanks 👍

Removing warning on empty SEPA

When creating a $stf = new SepaTransferFile() and calling $stf->asXML() without any $stf->addPaymentInfo(), the following warning occurs :
SepaTransferFile.php:139 [PhpWarning] Invalid argument supplied for foreach()

While there is no real use of making an empty SEPA, the case should be handled, eventually throwing an exception.

Here under this only patches the warning.

diff --git a/SepaTransferFile.php b/SepaTransferFile.php
index f442af7..5c15d74 100644
--- a/SepaTransferFile.php
+++ b/SepaTransferFile.php
@@ -75,5 +75,5 @@ class SepaTransferFile extends SepaFileBlock
        /**
         * @var SepaPaymentInfo[]
         */
-       protected $payments;
+       protected $payments = array();

I tried using GIT to push a request but I did not succeed.

Fatal error: Class 'TransferFileFacadeFactory' not found

Hi, When I try to use this libraries, make me this error and I write
require_once (MI_URL.'/php-sepa-xml/lib/Digitick/Sepa/TransferFile/Factory/TransferFileFacadeFactory.php'); but don't recognize the class.

I use it in my php project inside a function

Adding a new child in the XML tree

Hello,

Is it possible to add a new child in the XML tree? I need to add <UltmtCdtr>.

Normally in pain.008.001.02 The UltimateCreditor (UltmtCdtr) field is mandatory and it seems in php-sepa-xml it is missing :)

Thank you!

allow other sepa formats

I have tried changing the PAIN_FORMAT tot pain.008.001.02 and works great, can you build in a settings to set this version?

Trailing Z in CreDtTm tag

The generated file contains a trailing 'Z' in the CreDtTm tag:
CreDtTm 2014-05-06T16:40:04Z /CreDtTm

This doesn't validate, at least not by the Rabobank under scheme PAIN.008.001.02.

Is the 'Z' PAIN.008.002 specific? So..... the whole lib is .002 specific, even when I specify PAIN.008.001.02 when I do createDirectDebit(...)?

If no timezone is specified, could you just leave the 'Z' out?

PHP Strict error on missing BIC

If you dont specify a bic for addTransfer/Directdebit, php throws a strict notice for missing debtorBic for file /lib/Digitick/Sepa/TransferFile/Facade/CustomerDirectDebitFacade.php on line 103.
The further processing of the missing bic seems ok, so this is only a minor issue.

Shouldn't SepaFileBlock->intToCurrency() better be locale unaware?

I currently get errors in validating the XML file, because sprintf generates floating point numbers for each amount value with comma as decimal point (in my environment).

I think this:
sprintf("%01.2f", ($amount / 100));

Sould be replaced with:
sprintf("%01.2F", ($amount / 100));

...in SepaFileBlock.php

Validation against XSD file

Hello, after running your sample code with pain.001.001.03 spefication and validating generated XML against this XSD file (using different validators) I get this error:

Cannot Find The Declaration Of Element 'Document'.. Line '1', Column '120'.

Which is weird, as actually I can see it's the first element defined in XSD file.

I'm not sure this is an issue of your code but I ask just in case somebody else found this. I have no other way to check validity right now.

Thanks

InitgPty, Spanish banks and organizations

Hello,

Several Spanish banks (pain.008.001.02) require to add additional data related to the organization ID and other data, but the ID seems mandatory so far, when the initiating party is an organization so the final result looks like this

<InitgPty>
    <Nm>Initiating Party Name</Nm>
    <Id>
        <OrgId>
            <Othr>
                <Id>CCNNNNNXZZZZZZZZ</Id>
            </Othr>
        </OrgId>
    </Id>
</InitgPty>

Source: Spanish Bank Association (pdf) page 18, in Spanish only, sorry :-/

The "InitgPty" can not show correctly

I use the code in the example

$groupHeader = new GroupHeader('SEPA File Identifier', 'Your company name');

$sepaFile = new CustomerCreditTransferFile($groupHeader);

$transfer = new CustomerCreditTransferInformation(
    '0.02', // Amount
    'FI1350001540000056', //IBAN of creditor
    'Their Corp' //Name of Creditor
    );
$transfer->setBic('OKOYFIHH'); // Set the BIC explicitly
$transfer->setRemittanceInformation('Transaction Description');

// Create a PaymentInformation the Transfer belongs to
$payment = new PaymentInformation(
    'Payment Info ID',
    'FR1420041010050500013M02606', // IBAN the money is transferred from
    'PSSTFRPPMON',  // BIC
    'My Corp' // Debitor Name
    );
// It's possible to add multiple Transfers in one Payment
$payment->addTransfer($transfer);

// It's possible to add multiple payments to one SEPA File
$sepaFile->addPaymentInformation($payment);

// Attach a dombuilder to the sepaFile to create the XML output
$domBuilder = DomBuilderFactory::createDomBuilder($sepaFile);

$a = $domBuilder->asXml();

And here is the xml it output

<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.002.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CstmrCdtTrfInitn>
    <GrpHdr>
       .....
      </InitgPty>
    </GrpHdr>
........

The "InitgPty" in GroupHeader should be

<InitgPty>
        <Nm>Your company name</Nm>
</InitgPty>

While here is

</InitgPty>

Is it a bug for the "InitgPty"?

Direct debit special character

Thank you for this great contribution.

In direct debit, when creditor or debtor name contains a '&' char, XML won't generate.

As in lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php line 83 & 137, we should use htmlentites.

Refund?

Hi! I'm working with the 008.001.02 schema. It's posible to do a refund? multiply by -1 the amount? thanks!

BtchBookg tag for SDD

Hello,
Thank you for the work you've done on this library.

Maybe I misunderstood or missed something but I think the CustomerDirectDebitTransferDomBuilder -> visitPaymentInformation method do not add the BatchBooking element ('BtchBookg' tag) whereas the
CustomerCreditTransferDomBuilder does it.
Is it normal ?
Miaina

CustomerCreditFacade Implementation?

I am trying to create a new Customer Credit with your Library, but the CustomerCreditFacade is missing.

include_once(Digitick/Sepa/TransferFile/Factory/CustomerCreditFacade.php): failed to open stream: No such file or directory in

Is this feature not implemented yet? There is no definition of this class.

Sepa Debits

Hi !

Sorry, that i use the 'Issues' to post this.
But i didn't found any other way to post a message.

Is it also possible to process direct debits the this sepa lib ?
If not, could you extend the lib to process direct debits ?

Regards
Ralf

PHP Fatal error: Class 'TransferFileFacadeFactory' not found

Hi, I'm new in php an composer. It'd be great if someone could help with this error. I made:

$ git clone git://github.com/digitick/php-sepa-xml

$ cd php-sepa-xml

$ composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev)
Nothing to install or update
Generating autoload files

$ vim example.php

$ php example.php
PHP Fatal error: Class 'TransferFileFacadeFactory' not found in /var/www/php-sepa-xml/example.php on line 6

Add new maintainers

@ianare: I noticed you are not maintaining this package anymore. If you are not interested in maintaining this could you please add some new maintainers that some of the pull requests get merged? We're using this in production and need some slightly changes which were proposed as pull requests already (Pull Request #40). Using my own fork and not letting others benefit from my changes feels wrong.

I know that time is something that everyone of us might need more of so let's share maintenance work. I personally would suggest adding the top 2 committers beneath yourself to the project if they also like this idea or someone who is fine with proposing himself to maintain this.

Thanks for your time and effort in coding this.

/cc @monofone, @ch3ric

New release Tag ?

Hi,
Any chance that you could release a new tag with the last modification (March 2014) ?
Could be great to update the package without using the tag dev-master in composer.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.