digitick / php-sepa-xml Goto Github PK
View Code? Open in Web Editor NEW* THIS PROJECT IS NO LONGER MAINTAINED* SEPA file generator in PHP
* THIS PROJECT IS NO LONGER MAINTAINED* SEPA file generator in PHP
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"?
hi,
You may have rounding errors in the constructor of BaseTransferInformation :
$amount = (integer) ($amount * 100); //may cause rounding errors
should be replaced with:
$amount = (integer) (round($amount * 100, 0));
see why computers suck at math :
http://www.techradar.com/news/computing/why-computers-suck-at-maths-644771/1
thanks for your work :)
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.
By using your example i added the following amount for a transfer:
'amount' => 19.99
In the XML output i get following output:
19.98
and:
19.98
I miss 0.01 Cent ;)
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.
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
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
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.
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();
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
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
Hi! I'm working with the 008.001.02 schema. It's posible to do a refund? multiply by -1 the amount? thanks!
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.
@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.
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 ๐
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
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.
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.
Hello,
very nice work !
But just a question :
in BaseDomBuilder.php , line 93,
you are using datetime->format() with a \Z at the end.
Why ?
This \Z appears in my XML and it's not accepted by our bank.
Where am I wrong ?
Thank you
Julien
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
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 :-/
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!
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?
Can I request a version bump, mostly for #8?
Thanks.
It is impossible to add PstlAdr for debit with format pain.008.001.02
in CustomerDirectDebitTransferDomBuilder L171 :
if (in_array($this->painFormat, array('pain.008.003.02'))) { $addPostalAddress = false; $postalAddress = $this->createElement('PstlAdr');
The PstlAdr is allowed in format 008.001.02 (check https://businessbanking.bankofireland.com/app/uploads/2016/07/SEPA-Direct-Debit-PAIN.008.001.02-XML-File-Structure-PDF.pdf)
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.