Exemple #1
0
 public function testDirectDebit00800302()
 {
     // 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'));
     $this->assertXmlStringEqualsXmlFile(__DIR__ . '/directDebitValid00800302.xsd', $directDebitFile->generateXml('2014-10-19T00:38:44'));
 }
Exemple #2
0
 /**
  * @param int $version  Use SephpaDirectDebit::SEPA_PAIN_008_* constants
  * @param bool $addBIC
  * @param bool $addOptionalData
  * @param bool $checkAndSanitize
  * @return DOMDocument
  */
 private function getDirectDebitFile($version, $addBIC, $addOptionalData, $checkAndSanitize)
 {
     $collectionData = array('pmtInfId' => 'PaymentID-1235', 'lclInstrm' => SepaUtilities::LOCAL_INSTRUMENT_CORE_DIRECT_DEBIT, 'seqTp' => SepaUtilities::SEQUENCE_TYPE_FIRST, 'cdtr' => 'Name of Creditor', 'iban' => 'DE87200500001234567890', 'ci' => 'DE98ZZZ09999999999');
     if ($addBIC) {
         $collectionData['bic'] = 'BELADEBEXXX';
     }
     if ($addOptionalData) {
         $collectionData['ccy'] = 'EUR';
         // Currency. Default is 'EUR'
         $collectionData['btchBookg'] = 'true';
         // BatchBooking, only 'true' or 'false'
         $collectionData['ultmtCdtr'] = 'Ultimate Creditor Name';
         // just an information, this do not affect the payment (max 70 characters)
         $collectionData['reqdColltnDt'] = '2013-11-25';
         // Date: YYYY-MM-DD
     }
     $paymentData = array('pmtId' => 'TransferID-1235-1', 'instdAmt' => 2.34, 'mndtId' => 'Mandate-Id', 'dtOfSgntr' => '2010-04-12', 'dbtr' => 'Name of Debtor', 'iban' => 'DE87200500001234567890');
     if ($addBIC) {
         $paymentData['bic'] = 'BELADEBEXXX';
     }
     if ($addOptionalData) {
         $paymentData['amdmntInd'] = 'true';
         // Did the mandate change
         $paymentData['ultmtDbtr'] = 'Ultimate Debtor Name';
         // just an information, this do not affect the payment (max 70 characters)
         $paymentData['rmtInf'] = 'Remittance Information';
         // unstructured information about the remittance (max 140 characters)
         // only use this if 'amdmntInd' is 'true'. at least one must be used
         $paymentData['orgnlMndtId'] = 'Original-Mandat-ID';
         $paymentData['orgnlCdtrSchmeId_nm'] = 'Creditor-Identifier Name';
         $paymentData['orgnlCdtrSchmeId_id'] = 'DE98AAA09999999999';
         $paymentData['orgnlDbtrAcct_iban'] = 'DE87200500001234567890';
         // Original Debtor Account
         $paymentData['orgnlDbtrAgt'] = 'SMNDA';
         // only 'SMNDA' allowed if used
     }
     // generate a SepaDirectDebit object (pain.008.002.02).
     $directDebitFile = new SephpaDirectDebit('Initiator Name', 'MessageID-1235', $version, $checkAndSanitize);
     $directDebitCollection = $directDebitFile->addCollection($collectionData);
     $directDebitCollection->addPayment($paymentData);
     $domDoc = new DOMDocument();
     $domDoc->loadXML($directDebitFile->generateXml('2014-10-19T00:38:44'));
     return $domDoc;
 }