簡體   English   中英

SEPA SDD XML Generator中的directDebitTransaction聚合

[英]directDebitTransaction aggregation in SEPA SDD XML Generator

我正在使用SEPA SDD XML Generator( https://github.com/dmitrirussu/php-sepa-xml-generator )為SEPA直接借記創建XML文件。

為了添加“ addDirectDebitTransaction”,首先我創建了一個包含所有事務的對象:

$a = 1;
$xmlFile2 = SEPA\Factory\XMLGeneratorFactory::createXMLPaymentInfo();
foreach($transactions as $t)
{
    $xmlFile2->addDirectDebitTransaction(
                    SEPA\Factory\XmlGeneratorFactory::createXMLDirectDebitTransaction()
                        ->setInstructionIdentification(++$a)
                        ->setEndToEndIdentification(++$a)
                        ->setInstructedAmount(100.5)
                        ->setDebtorName('DVORAK')
                        ->setDebitIBAN('FR14 2004 1010 0505 0001 3M02 606')
                        ->setDebitBIC('AABAFI22')
                        ->setMandateIdentification('SDD000000016PFX071'.$a) 
                        ->setDateOfSignature('2013-08-03')
                        ->setDirectDebitInvoice(++$a));

}

之后,我創建了XML文件:

$xmlFile = SEPA\Factory\XMLGeneratorFactory::createXmlGeneratorObject(\SEPA\XMLGenerator::PAIN_008_001_02)->addXmlMessage(
            SEPA\Factory\XMLGeneratorFactory::createXMLMessage()->setMessageGroupHeader(
                SEPA\Factory\XMLGeneratorFactory::createXMLGroupHeader()
                    ->setMessageIdentification($identificacionFichero)
                    ->setInitiatingPartyName($datos['nombreCliente'])
                    ->setPrivateIdentification($identificador))
                ->addMessagePaymentInfo(
                    SEPA\Factory\XMLGeneratorFactory::createXMLPaymentInfo()
                        ->setPaymentInformationIdentification(6222)
                        ->setSequenceType('RCUR')
                        ->setCreditorAccountIBAN('MD24 AG00 0225 1000 1310 4168')
                        ->setCreditorAccountBIC('AABAFI42')->setCreditorName('Amazing SRL')
                        ->setCreditorSchemeIdentification('FR07ZZZ519993')
                        ->setRequestedCollectionDate('2013-08-06'))->save($fileExist = 'sepa_test.xml');

問題是:如何將$ xmlFile2(事務)添加到$ xmlFile(XML文件)中?

謝謝。

$paymentInfo = SEPA\Factory\XMLGeneratorFactory::createXMLPaymentInfo();

    $transactions = array(1, 2, 3, 4, 5);
    $a = 0;
    //add payment info transactions
    foreach($transactions as $t)
    {
        $paymentInfo->addDirectDebitTransaction(
            SEPA\Factory\XmlGeneratorFactory::createXMLDirectDebitTransaction()
                ->setInstructionIdentification(++$a)
                ->setEndToEndIdentification(++$a)
                ->setInstructedAmount(100.5)
                ->setDebtorName('DVORAK')
                ->setDebitIBAN('FR14 2004 1010 0505 0001 3M02 606')
                ->setDebitBIC('AABAFI22')
                ->setMandateIdentification('SDD000000016PFX071'.$a)
                ->setDateOfSignature('2013-08-03')
                ->setDirectDebitInvoice(++$a));

    }

    //set The payment info
    $paymentInfo->setPaymentInformationIdentification(6222)
        ->setSequenceType('RCUR')
        ->setCreditorAccountIBAN('MD24 AG00 0225 1000 1310 4168')
        ->setCreditorAccountBIC('AABAFI42')->setCreditorName('Amazing SRL')
        ->setCreditorSchemeIdentification('FR07ZZZ519993')
        ->setRequestedCollectionDate('2013-08-06');

  //create SEPA file
  \SEPA\Factory\XMLGeneratorFactory::createXmlGeneratorObject(\SEPA\XMLGenerator::PAIN_008_001_02)
      ->addXmlMessage(
      SEPA\Factory\XMLGeneratorFactory::createXMLMessage()->setMessageGroupHeader(

          SEPA\Factory\XMLGeneratorFactory::createXMLGroupHeader()
              ->setMessageIdentification($identificacionFichero = 1)
              ->setInitiatingPartyName($datos['nombreCliente'] = 'test')
              ->setPrivateIdentification($identificador=123)
      )->addMessagePaymentInfo($paymentInfo)

    )->save($fileExist = realpath(__DIR__) . '/xml_files/sepa_demo.xml');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM