Exemple #1
0
<?php

/*
 * This is just an example. Please read the documentation
 * of the SEPA file format to learn more about using SEPA files.
 */
use AbcAeffchen\Sephpa\SephpaCreditTransfer;
use AbcAeffchen\SepaUtilities\SepaUtilities;
use AbcAeffchen\Sephpa\SephpaDirectDebit;
require_once '../src/Sephpa.php';
// generate a SepaCreditTransfer object (pain.001.002.03).
$creditTransferFile = new SephpaCreditTransfer('Initiator Name', 'MessageID-1234', SephpaCreditTransfer::SEPA_PAIN_001_003_03);
// at least one in every SEPA file
$creditTransferCollection = $creditTransferFile->addCollection(array('pmtInfId' => 'PaymentID-1234', 'dbtr' => 'Name of Debtor2', 'iban' => 'DE21500500001234567897', 'bic' => 'BELADEBEXXX', 'ccy' => 'EUR', 'btchBookg' => 'true', 'reqdExctnDt' => '2013-11-25', 'ultmtDebtr' => 'Ultimate Debtor Name'));
// at least one in every CreditTransferCollection
$creditTransferCollection->addPayment(array('pmtId' => 'TransferID-1234-1', 'instdAmt' => 1.14, 'iban' => 'DE21500500009876543210', 'bic' => 'SPUEDE2UXXX', 'cdtr' => 'Name of Creditor', 'ultmtCdrt' => 'Ultimate Creditor Name', 'rmtInf' => 'Remittance Information'));
$creditTransferFile->storeSepaFile();
// generate a SepaDirectDebit object (pain.008.002.02).
$directDebitFile = new SephpaDirectDebit('Initiator Name', 'MessageID-1235', SephpaDirectDebit::SEPA_PAIN_008_003_02);
// at least one in every SEPA file. No limit.
$directDebitCollection = $directDebitFile->addCollection(array('pmtInfId' => 'PaymentID-1235', 'lclInstrm' => SepaUtilities::LOCAL_INSTRUMENT_CORE_DIRECT_DEBIT, 'seqTp' => SepaUtilities::SEQUENCE_TYPE_RECURRING, 'cdtr' => 'Name of Creditor', 'iban' => 'DE87200500001234567890', 'bic' => 'BELADEBEXXX', 'ci' => 'DE98ZZZ09999999999', 'ccy' => 'EUR', 'btchBookg' => 'true', 'ultmtCdtr' => 'Ultimate Creditor Name', 'reqdColltnDt' => '2013-11-25'));
// at least one in every DirectDebitCollection. No limit.
$directDebitCollection->addPayment(array('pmtId' => 'TransferID-1235-1', 'instdAmt' => 2.34, 'mndtId' => 'Mandate-Id', 'dtOfSgntr' => '2010-04-12', 'bic' => 'BELADEBEXXX', 'dbtr' => 'Name of Debtor', 'iban' => 'DE87200500001234567890', 'amdmntInd' => 'false', 'ultmtDbtr' => 'Ultimate Debtor Name', 'rmtInf' => 'Remittance Information', 'orgnlMndtId' => 'Original-Mandat-ID', 'orgnlCdtrSchmeId_nm' => 'Creditor-Identifier Name', 'orgnlCdtrSchmeId_id' => 'DE98AAA09999999999', 'orgnlDbtrAcct_iban' => 'DE87200500001234567890', 'orgnlDbtrAgt' => 'SMNDA'));
$directDebitFile->storeSepaFile();