AbcAeffchen / Sephpa

PHP class to create SEPA xml files for credit transfer and direct debit
GNU Lesser General Public License v3.0
71 stars 31 forks source link

IBAN only #2

Closed dennobaby closed 9 years ago

dennobaby commented 9 years ago

Hi,

it would be nice to have the ability to create a sepa-xml with the iban-only procedure. Is it possible now?

Thanks.

AbcAeffchen commented 9 years ago

This should be possible by using pain.001.003.03 (for credit transfer) or pain.008.003.02 (for direct debit). If it is not working with this SEPA versions, its a bug.

Notice: At the moment SEPA supports IBAN-only only for national payments, not international.

dennobaby commented 9 years ago

i tested with this code:

$creditTransferFile = new SephpaCreditTransfer('Some Ltd.', 'SEPANK-15-001',
                                               SephpaCreditTransfer::SEPA_PAIN_001_003_03);

// at least one in every SEPA file
$creditTransferCollection = $creditTransferFile->addCollection(array(
                    // needed information about the payer
                        'pmtInfId'      => 'SEPANK-15-001',    // ID of the payment collection
                        'dbtr'          => 'Some Ltd.',   // (max 70 characters)
                        'iban'          => 'DE72XXXXXXXXXXXXX',// IBAN of the Debtor
                        'bic'           => 'XXXXXXZZZ',       // BIC of the Debtor
                    // optional
                        'ccy'           => 'EUR',               // Currency. Default is 'EUR'
                        'btchBookg'     => 'true',              // BatchBooking, only 'true' or 'false'
                        //'ctgyPurp'      => ,                  // Do not use this if you do not know how. For further information read the SEPA documentation
                        'reqdExctnDt'   => '2015-01-29',        // Date: YYYY-MM-DD
                        'ultmtDebtr'    => 'Some Ltd.'   // just an information, this do not affect the payment (max 70 characters)
                    ));

        $creditTransferCollection->addPayment(array(
                    // needed information about the one who gets payed
                        'pmtId'     => 'TransferID-15515-23'     // ID of the payment (EndToEndId)
                        'instdAmt'  => 1000.00,                    // amount,
                        'iban'      => 'DE37XXXX00000XXXXXXXX',// IBAN of the Creditor
                    //    'bic'       => '',           // BIC of the Creditor
                        'cdtr'      => 'Name, Some',      // (max 70 characters)
                    // optional
                        'ultmtCdrt' => 'Name, Some',// just an information, this do not affect the payment (max 70 characters)
                        //'purp'      => ,                      // Do not use this if you do not know how. For further information read the SEPA documentation
                        'rmtInf'    => 'some thing' // unstructured information about the remittance (max 140 characters)
                    ));
//}

$creditTransferFile->storeSepaFile();

i commented out the determining of "bic". I get a xml thats semms to be valid... also the

<FinInstnId><Othr><Id>NOTPROVIDED</Id></Othr></FinInstnId>

seems to be valid, but the banking-institute says that the file is invalid :(

edit: the error-message is: "no declaration found for element 'Othr'

AbcAeffchen commented 9 years ago

I took a look at your code. The problem was, that <FinInstnId><Othr><Id>NOTPROVIDED</Id></Othr></FinInstnId> is not allowed in the payment information, but only in the debtor information.

I fixed the problem in 1.2.4. Please check if it is truly fixed.

dennobaby commented 9 years ago

thanks, but still the same :/ in the xml there is still

<FinInstnId><Othr><Id>NOTPROVIDED</Id></Othr></FinInstnId>
AbcAeffchen commented 9 years ago

Have you tried to validate it by your banking-institute?

The xml part you posted has to be there for the debtor information, but must not be in the CdtTrfTxInf block. I removed the code that generates the block from the pain.001.003.03 file, so this problem should be gone.

Did you updated to 1.2.4? If you use composer it could take a while until the new version is available.

dennobaby commented 9 years ago

Yes, it says:

unknown element "othr"
Element "Othr" is invalid in model (BIC)

yes, i updated the code directly

AbcAeffchen commented 9 years ago

Can you send me the xml file, so I can have a look? I'm not able to reproduce the error with the code you posted above.

dennobaby commented 9 years ago

i have send you an email

AbcAeffchen commented 9 years ago

Thank you. I took a look at your file.

As I see, this cannot be generated by the current version. The file \src\payment-collections\SepaCreditTransfer00100303.php does not contain the code to generate

<CdtrAgt>
    <FinInstnId>
      <Othr>
         <Id>NOTPROVIDED</Id>
      </Othr>
   </FinInstnId>
</CdtrAgt>

any more. Can you take a look into the file SepaCreditTransfer00100303.php and look for

->addChild('CdtrAgt')->addChild('FinInstnId')->addChild('Othr')

near by line 208. In an older version it looks like this.

dennobaby commented 9 years ago

god dammit, sorry, my fault. edited in one working-copy and tested in another. It runs now perfectly, thanks! :+1:

AbcAeffchen commented 9 years ago

No problem :) thank you for reporting the bug :-)

dennobaby commented 9 years ago

another question...does this affect also debits? Or, let me ask another way, it should also be possible to do debits without bic, right?

edit: forget it, i have to read better, you wrote that it is possible...

AbcAeffchen commented 9 years ago

It should work. If not, its another bug :laughing: