From a32b4f56ccba972bbfb754fd5edff646d6a51301 Mon Sep 17 00:00:00 2001 From: monofone Date: Fri, 27 Dec 2013 13:30:02 +0100 Subject: [PATCH 1/2] Requested in #23 the painFormat should be overwritable as the XML seems the same for different PAINFormats. As this is likely not to be, this is just an Idea to solve this temporarily. A better solution would be to build DomBuilder for each PAINFormat but I think this is a pain too. --- .../Sepa/DomBuilder/BaseDomBuilder.php | 1 - .../CustomerCreditTransferDomBuilder.php | 4 +- .../CustomerDirectDebitTransferDomBuilder.php | 4 +- .../CustomerCreditTransferFile.php | 1 - .../CustomerDirectDebitTransferFile.php | 1 - ...rDirectDebitValidationPain00800102Test.php | 85 ++ tests/pain.008.001.02.xml | 135 +++ tests/pain.008.001.02.xsd | 879 ++++++++++++++++++ 8 files changed, 1103 insertions(+), 7 deletions(-) create mode 100644 tests/CustomerDirectDebitValidationPain00800102Test.php create mode 100644 tests/pain.008.001.02.xml create mode 100644 tests/pain.008.001.02.xsd diff --git a/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php b/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php index 42d7fa9..d050483 100644 --- a/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php +++ b/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php @@ -27,7 +27,6 @@ abstract class BaseDomBuilder implements DomBuilderInterface { - const INITIAL_STRING = ''; protected $doc; diff --git a/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php b/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php index 84c69b0..b29a35c 100644 --- a/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php +++ b/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php @@ -31,8 +31,8 @@ class CustomerCreditTransferDomBuilder extends BaseDomBuilder { - function __construct() { - parent::__construct(CustomerCreditTransferFile::PAIN_FORMAT); + function __construct($painFormat = 'pain.001.002.03') { + parent::__construct($painFormat); } diff --git a/lib/Digitick/Sepa/DomBuilder/CustomerDirectDebitTransferDomBuilder.php b/lib/Digitick/Sepa/DomBuilder/CustomerDirectDebitTransferDomBuilder.php index aa3d529..d642a90 100644 --- a/lib/Digitick/Sepa/DomBuilder/CustomerDirectDebitTransferDomBuilder.php +++ b/lib/Digitick/Sepa/DomBuilder/CustomerDirectDebitTransferDomBuilder.php @@ -33,8 +33,8 @@ class CustomerDirectDebitTransferDomBuilder extends BaseDomBuilder { - public function __construct() { - parent::__construct(CustomerDirectDebitTransferFile::PAIN_FORMAT); + public function __construct($painFormat = 'pain.008.002.02') { + parent::__construct($painFormat); } /** diff --git a/lib/Digitick/Sepa/TransferFile/CustomerCreditTransferFile.php b/lib/Digitick/Sepa/TransferFile/CustomerCreditTransferFile.php index a9c455f..c683a43 100644 --- a/lib/Digitick/Sepa/TransferFile/CustomerCreditTransferFile.php +++ b/lib/Digitick/Sepa/TransferFile/CustomerCreditTransferFile.php @@ -29,7 +29,6 @@ class CustomerCreditTransferFile extends BaseTransferFile { - const PAIN_FORMAT = 'pain.001.002.03'; /** * @param PaymentInformation $paymentInformation diff --git a/lib/Digitick/Sepa/TransferFile/CustomerDirectDebitTransferFile.php b/lib/Digitick/Sepa/TransferFile/CustomerDirectDebitTransferFile.php index b7dc7ce..7f3b8a5 100644 --- a/lib/Digitick/Sepa/TransferFile/CustomerDirectDebitTransferFile.php +++ b/lib/Digitick/Sepa/TransferFile/CustomerDirectDebitTransferFile.php @@ -29,7 +29,6 @@ class CustomerDirectDebitTransferFile extends BaseTransferFile { - const PAIN_FORMAT = 'pain.008.002.02'; /** * @param PaymentInformation $paymentInformation diff --git a/tests/CustomerDirectDebitValidationPain00800102Test.php b/tests/CustomerDirectDebitValidationPain00800102Test.php new file mode 100644 index 0000000..519e4d9 --- /dev/null +++ b/tests/CustomerDirectDebitValidationPain00800102Test.php @@ -0,0 +1,85 @@ + 2012-2013 + * @copyright © Blage 2013 + * @license GNU Lesser General Public License v3.0 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Lesser Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +namespace Tests; + +use Digitick\Sepa\DomBuilder\CustomerDirectDebitTransferDomBuilder; +use Digitick\Sepa\Exception\InvalidTransferFileConfiguration; +use Digitick\Sepa\GroupHeader; +use Digitick\Sepa\PaymentInformation; +use Digitick\Sepa\TransferFile\CustomerDirectDebitTransferFile; +use Digitick\Sepa\TransferInformation\CustomerDirectDebitTransferInformation; + + +class CustomerDirectDebitValidationPain00800102Test extends \PHPUnit_Framework_TestCase { + protected $schema; + + /** + * @var \DOMDocument + */ + protected $dom; + + protected function setUp() { + $this->schema = __DIR__ . "/pain.008.001.02.xsd"; + $this->dom = new \DOMDocument('1.0', 'UTF-8'); + } + + /** + * Sanity check: test reference file with XSD. + */ + public function testSanity() { + $this->dom->load(__DIR__ . '/pain.008.001.02.xml'); + $validated = $this->dom->schemaValidate($this->schema); + $this->assertTrue($validated); + } + + /** + * Test a transfer file with one payment and one transaction. + */ + public function testDomBuilderAcceptsPainFormatAsConstructor() + { + $groupHeader = new GroupHeader('transferID', 'Me'); + $sepaFile = new CustomerDirectDebitTransferFile($groupHeader); + + $transfer = new CustomerDirectDebitTransferInformation('0.02', 'FI1350001540000056', 'Their Corp'); + $transfer->setBic('OKOYFIHH'); + $transfer->setMandateSignDate(new \DateTime('16.08.2013')); + $transfer->setMandateId('ABCDE'); + $transfer->setRemittanceInformation('Transaction Description'); + + $payment = new PaymentInformation('Payment Info ID', 'FR1420041010050500013M02606', 'PSSTFRPPMON', 'My Corp'); + $payment->setSequenceType(PaymentInformation::S_ONEOFF); + $payment->setDueDate(new \DateTime('22.08.2013')); + $payment->setCreditorId('DE21WVM1234567890'); + $payment->addTransfer($transfer); + + $sepaFile->addPaymentInformation($payment); + + $domBuilder = new CustomerDirectDebitTransferDomBuilder('pain.008.001.02'); + $sepaFile->accept($domBuilder); + $xml = $domBuilder->asXml(); + $this->dom->loadXML($xml); + + $validated = $this->dom->schemaValidate($this->schema); + $this->assertTrue($validated); + } +} diff --git a/tests/pain.008.001.02.xml b/tests/pain.008.001.02.xml new file mode 100644 index 0000000..58878c8 --- /dev/null +++ b/tests/pain.008.001.02.xml @@ -0,0 +1,135 @@ + + + + + Message-ID + 2010-11-21T09:30:47.000Z + 2 + + Initiator Name + + + + Payment-ID + DD + 2 + 6655.86 + + + SEPA + + + CORE + + RCUR + + 2010-12-03 + + Creditor Name + + + + DE87200500001234567890 + + + + + BANKDEFFXXX + + + SLEV + + + + + DE00ZZZ00099999999 + + SEPA + + + + + + + + OriginatorID1234 + + 6543.14 + + + Mandate-Id + 2010-11-20 + true + + + Original Creditor Name + + + + AA00ZZZOriginalCreditorID + + SEPA + + + + + + + + + + + SPUEDE2UXXX + + + + Debtor Name + + + + DE21500500009876543210 + + + + Ultimate Debtor Name + + + Unstructured Remittance Information + + + + + OriginatorID1235 + + 112.72 + + + Other0Mandate0Id + 2010-11-20 + false + + + + + SPUEDE2UXXX + + + + Other Debtor Name + + + + DE21500500001234567897 + + + + Ultimate Debtor Name + + + Unstructured Remittance Information + + + + + \ No newline at end of file diff --git a/tests/pain.008.001.02.xsd b/tests/pain.008.001.02.xsd new file mode 100644 index 0000000..394b804 --- /dev/null +++ b/tests/pain.008.001.02.xsd @@ -0,0 +1,879 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From fb3948a55a73f33286f776c8c0f703217677b24a Mon Sep 17 00:00:00 2001 From: monofone Date: Fri, 27 Dec 2013 23:56:03 +0100 Subject: [PATCH 2/2] Code reformatting to a single coding style (Symfony2) --- composer.json | 4 +- .../Sepa/DomBuilder/BaseDomBuilder.php | 37 ++++--- .../CustomerCreditTransferDomBuilder.php | 29 ++++-- .../CustomerDirectDebitTransferDomBuilder.php | 41 +++++--- .../Sepa/DomBuilder/DomBuilderFactory.php | 8 +- lib/Digitick/Sepa/Exception/Exception.php | 3 +- .../Exception/InvalidArgumentException.php | 3 +- .../InvalidPaymentMethodException.php | 3 +- .../InvalidTransferFileConfiguration.php | 3 +- .../InvalidTransferTypeException.php | 3 +- lib/Digitick/Sepa/GroupHeader.php | 45 ++++++--- lib/Digitick/Sepa/PaymentInformation.php | 98 +++++++++++++------ .../Sepa/TransferFile/BaseTransferFile.php | 22 +++-- .../CustomerCreditTransferFile.php | 18 ++-- .../CustomerDirectDebitTransferFile.php | 20 ++-- .../Facade/BaseCustomerTransferFileFacade.php | 9 +- .../Facade/CustomerDirectDebitFacade.php | 29 +++--- .../Factory/TransferFileFacadeFactory.php | 8 +- .../BaseTransferInformation.php | 47 ++++++--- .../CustomerCreditTransferInformation.php | 6 +- ...CustomerDirectDebitTransferInformation.php | 24 +++-- lib/Digitick/Sepa/Util/StringHelper.php | 5 +- tests/CustomerCreditValidationTest.php | 95 +++++++++--------- tests/CustomerDirectDebitFacadeTest.php | 49 ++++++---- ...rDirectDebitValidationPain00800102Test.php | 9 +- tests/CustomerDirectDebitValidationTest.php | 18 ++-- tests/Unit/DomBuilderFactoryTest.php | 9 +- tests/bootstrap.php | 2 +- 28 files changed, 413 insertions(+), 234 deletions(-) diff --git a/composer.json b/composer.json index a9baf50..7c476fa 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,9 @@ } ], "autoload": { - "psr-0": { "Digitick\\Sepa": "lib/" } + "psr-0": { + "Digitick\\Sepa": "lib/" + } }, "require": { "php": ">=5.3.2" diff --git a/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php b/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php index d050483..c5f6bc1 100644 --- a/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php +++ b/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php @@ -42,12 +42,13 @@ abstract class BaseDomBuilder implements DomBuilderInterface */ protected $currentPayment = null; - function __construct($painFormat) { + function __construct($painFormat) + { $this->doc = new \DOMDocument('1.0', 'UTF-8'); $this->doc->formatOutput = true; $this->root = $this->doc->createElement('Document'); $this->root->setAttribute('xmlns', sprintf("urn:iso:std:iso:20022:tech:xsd:%s", $painFormat)); - $this->root->setAttribute('xmlns:xsi',"http://www.w3.org/2001/XMLSchema-instance"); + $this->root->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); $this->doc->appendChild($this->root); } @@ -56,10 +57,12 @@ function __construct($painFormat) { * @param null $value * @return \DOMElement */ - protected function createElement($name, $value = null) { - if($value){ + protected function createElement($name, $value = null) + { + if ($value) { $elm = $this->doc->createElement($name); $elm->appendChild($this->doc->createTextNode($value)); + return $elm; } else { return $this->doc->createElement($name); @@ -69,7 +72,8 @@ protected function createElement($name, $value = null) { /** * @return string */ - public function asXml(){ + public function asXml() + { return $this->doc->saveXML(); } @@ -87,16 +91,22 @@ protected function intToCurrency($amount) * @param GroupHeader $groupHeader * @return mixed */ - public function visitGroupHeader(GroupHeader $groupHeader) { + public function visitGroupHeader(GroupHeader $groupHeader) + { $groupHeaderTag = $this->doc->createElement('GrpHdr'); $messageId = $this->createElement('MsgId', $groupHeader->getMessageIdentification()); $groupHeaderTag->appendChild($messageId); - $creationDateTime = $this->createElement('CreDtTm', $groupHeader->getCreationDateTime()->format('Y-m-d\TH:i:s\Z')); + $creationDateTime = $this->createElement( + 'CreDtTm', + $groupHeader->getCreationDateTime()->format('Y-m-d\TH:i:s\Z') + ); $groupHeaderTag->appendChild($creationDateTime); $groupHeaderTag->appendChild($this->createElement('NbOfTxs', $groupHeader->getNumberOfTransactions())); - $groupHeaderTag->appendChild($this->createElement('CtrlSum', $this->intToCurrency($groupHeader->getControlSumCents()))); + $groupHeaderTag->appendChild( + $this->createElement('CtrlSum', $this->intToCurrency($groupHeader->getControlSumCents())) + ); $initiatingParty = $this->createElement('InitgPty'); - $initiatingPartyName = $this->createElement('Nm', $groupHeader->getInitiatingPartyName()); + $initiatingPartyName = $this->createElement('Nm', $groupHeader->getInitiatingPartyName()); $initiatingParty->appendChild($initiatingPartyName); if ($groupHeader->getInitiatingPartyId() !== null) { $id = $this->createElement('Id', $groupHeader->getInitiatingPartyId()); @@ -111,7 +121,8 @@ public function visitGroupHeader(GroupHeader $groupHeader) { * @param string $bic * @return \DOMElement */ - protected function getFinancialInstitutionElement($bic) { + protected function getFinancialInstitutionElement($bic) + { $finInstitution = $this->createElement('FinInstnId'); $finInstitution->appendChild($this->createElement('BIC', $bic)); @@ -123,7 +134,8 @@ protected function getFinancialInstitutionElement($bic) { * @param string $iban * @return \DOMElement */ - public function getIbanElement($iban) { + public function getIbanElement($iban) + { $id = $this->createElement('Id'); $id->appendChild($this->createElement('IBAN', $iban)); @@ -135,7 +147,8 @@ public function getIbanElement($iban) { * @param string $remittenceInformation * @return \DOMElement */ - public function getRemittenceElement($remittenceInformation) { + public function getRemittenceElement($remittenceInformation) + { $remittanceInformation = $this->createElement('RmtInf'); $remittanceInformation->appendChild($this->createElement('Ustrd', $remittenceInformation)); diff --git a/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php b/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php index b29a35c..d1b91ed 100644 --- a/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php +++ b/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php @@ -31,7 +31,8 @@ class CustomerCreditTransferDomBuilder extends BaseDomBuilder { - function __construct($painFormat = 'pain.001.002.03') { + function __construct($painFormat = 'pain.001.002.03') + { parent::__construct($painFormat); } @@ -42,7 +43,8 @@ function __construct($painFormat = 'pain.001.002.03') { * @param TransferFileInterface $transferFile * @return mixed */ - public function visitTransferFile(TransferFileInterface $transferFile) { + public function visitTransferFile(TransferFileInterface $transferFile) + { $this->currentTransfer = $this->doc->createElement('CstmrCdtTrfInitn'); $this->root->appendChild($this->currentTransfer); } @@ -53,7 +55,8 @@ public function visitTransferFile(TransferFileInterface $transferFile) { * @param PaymentInformation $paymentInformation * @return mixed */ - public function visitPaymentInformation(PaymentInformation $paymentInformation) { + public function visitPaymentInformation(PaymentInformation $paymentInformation) + { $this->currentPayment = $this->createElement('PmtInf'); $this->currentPayment->appendChild($this->createElement('PmtInfId', $paymentInformation->getId())); if ($paymentInformation->getCategoryPurposeCode()) { @@ -62,9 +65,13 @@ public function visitPaymentInformation(PaymentInformation $paymentInformation) $this->currentPayment->appendChild($categoryPurpose); } $this->currentPayment->appendChild($this->createElement('PmtMtd', $paymentInformation->getPaymentMethod())); - $this->currentPayment->appendChild($this->createElement('NbOfTxs', $paymentInformation->getNumberOfTransactions())); + $this->currentPayment->appendChild( + $this->createElement('NbOfTxs', $paymentInformation->getNumberOfTransactions()) + ); - $this->currentPayment->appendChild($this->createElement('CtrlSum', $this->intToCurrency($paymentInformation->getControlSumCents()))); + $this->currentPayment->appendChild( + $this->createElement('CtrlSum', $this->intToCurrency($paymentInformation->getControlSumCents())) + ); $paymentTypeInformation = $this->createElement('PmtTpInf'); $serviceLevel = $this->createElement('SvcLvl'); @@ -86,7 +93,7 @@ public function visitPaymentInformation(PaymentInformation $paymentInformation) $id = $this->createElement('Id'); $id->appendChild($this->createElement('IBAN', $paymentInformation->getOriginAccountIBAN())); $debtorAccount->appendChild($id); - if($paymentInformation->getOriginAccountCurrency()) { + if ($paymentInformation->getOriginAccountCurrency()) { $debtorAccount->appendChild($this->createElement('Ccy', $paymentInformation->getOriginAccountCurrency())); } $this->currentPayment->appendChild($debtorAccount); @@ -97,7 +104,7 @@ public function visitPaymentInformation(PaymentInformation $paymentInformation) $debtorAgent->appendChild($financialInstitutionId); $this->currentPayment->appendChild($debtorAgent); - $this->currentPayment->appendChild($this->createElement('ChrgBr','SLEV')); + $this->currentPayment->appendChild($this->createElement('ChrgBr', 'SLEV')); $this->currentTransfer->appendChild($this->currentPayment); } @@ -107,7 +114,8 @@ public function visitPaymentInformation(PaymentInformation $paymentInformation) * @param TransferInformationInterface $transactionInformation * @return mixed */ - public function visitTransferInformation(TransferInformationInterface $transactionInformation) { + public function visitTransferInformation(TransferInformationInterface $transactionInformation) + { /** @var $transactionInformation CustomerCreditTransferInformation */ $CdtTrfTxInf = $this->createElement('CdtTrfTxInf'); @@ -118,7 +126,10 @@ public function visitTransferInformation(TransferInformationInterface $transacti // Amount 2.42 $amount = $this->createElement('Amt'); - $instructedAmount = $this->createElement('InstdAmt', $this->intToCurrency($transactionInformation->getTransferAmount())); + $instructedAmount = $this->createElement( + 'InstdAmt', + $this->intToCurrency($transactionInformation->getTransferAmount()) + ); $instructedAmount->setAttribute('Ccy', $transactionInformation->getCurrency()); $amount->appendChild($instructedAmount); $CdtTrfTxInf->appendChild($amount); diff --git a/lib/Digitick/Sepa/DomBuilder/CustomerDirectDebitTransferDomBuilder.php b/lib/Digitick/Sepa/DomBuilder/CustomerDirectDebitTransferDomBuilder.php index d642a90..95b51f0 100644 --- a/lib/Digitick/Sepa/DomBuilder/CustomerDirectDebitTransferDomBuilder.php +++ b/lib/Digitick/Sepa/DomBuilder/CustomerDirectDebitTransferDomBuilder.php @@ -33,7 +33,8 @@ class CustomerDirectDebitTransferDomBuilder extends BaseDomBuilder { - public function __construct($painFormat = 'pain.008.002.02') { + public function __construct($painFormat = 'pain.008.002.02') + { parent::__construct($painFormat); } @@ -43,7 +44,8 @@ public function __construct($painFormat = 'pain.008.002.02') { * @param TransferFileInterface $transferFile * @return mixed */ - public function visitTransferFile(TransferFileInterface $transferFile) { + public function visitTransferFile(TransferFileInterface $transferFile) + { $this->currentTransfer = $this->doc->createElement('CstmrDrctDbtInitn'); $this->root->appendChild($this->currentTransfer); } @@ -54,13 +56,18 @@ public function visitTransferFile(TransferFileInterface $transferFile) { * @param PaymentInformation $paymentInformation * @return mixed */ - public function visitPaymentInformation(PaymentInformation $paymentInformation) { + public function visitPaymentInformation(PaymentInformation $paymentInformation) + { $this->currentPayment = $this->createElement('PmtInf'); $this->currentPayment->appendChild($this->createElement('PmtInfId', $paymentInformation->getId())); $this->currentPayment->appendChild($this->createElement('PmtMtd', $paymentInformation->getPaymentMethod())); - $this->currentPayment->appendChild($this->createElement('NbOfTxs', $paymentInformation->getNumberOfTransactions())); + $this->currentPayment->appendChild( + $this->createElement('NbOfTxs', $paymentInformation->getNumberOfTransactions()) + ); - $this->currentPayment->appendChild($this->createElement('CtrlSum', $this->intToCurrency($paymentInformation->getControlSumCents()))); + $this->currentPayment->appendChild( + $this->createElement('CtrlSum', $this->intToCurrency($paymentInformation->getControlSumCents())) + ); $paymentTypeInformation = $this->createElement('PmtTpInf'); $serviceLevel = $this->createElement('SvcLvl'); @@ -117,23 +124,33 @@ public function visitPaymentInformation(PaymentInformation $paymentInformation) * @param TransferInformationInterface $transactionInformation * @return mixed */ - public function visitTransferInformation(TransferInformationInterface $transactionInformation) { + public function visitTransferInformation(TransferInformationInterface $transactionInformation) + { /** @var $transactionInformation CustomerDirectDebitTransferInformation */ $directDebitTransactionInformation = $this->createElement('DrctDbtTxInf'); $paymentId = $this->createElement('PmtId'); - $paymentId->appendChild($this->createElement('EndToEndId', $transactionInformation->getEndToEndIdentification())); + $paymentId->appendChild( + $this->createElement('EndToEndId', $transactionInformation->getEndToEndIdentification()) + ); $directDebitTransactionInformation->appendChild($paymentId); - $instructedAmount = $this->createElement('InstdAmt', $this->intToCurrency($transactionInformation->getTransferAmount())); + $instructedAmount = $this->createElement( + 'InstdAmt', + $this->intToCurrency($transactionInformation->getTransferAmount()) + ); $instructedAmount->setAttribute('Ccy', $transactionInformation->getCurrency()); $directDebitTransactionInformation->appendChild($instructedAmount); $directDebitTransaction = $this->createElement('DrctDbtTx'); $mandateRelatedInformation = $this->createElement('MndtRltdInf'); $directDebitTransaction->appendChild($mandateRelatedInformation); - $mandateRelatedInformation->appendChild($this->createElement('MndtId', $transactionInformation->getMandateId())); - $mandateRelatedInformation->appendChild($this->createElement('DtOfSgntr', $transactionInformation->getMandateSignDate()->format('Y-m-d'))); + $mandateRelatedInformation->appendChild( + $this->createElement('MndtId', $transactionInformation->getMandateId()) + ); + $mandateRelatedInformation->appendChild( + $this->createElement('DtOfSgntr', $transactionInformation->getMandateSignDate()->format('Y-m-d')) + ); $directDebitTransactionInformation->appendChild($directDebitTransaction); // TODO add the possibility to add CreditorSchemeId on transfer level @@ -150,7 +167,9 @@ public function visitTransferInformation(TransferInformationInterface $transacti $debtorAccount->appendChild($this->getIbanElement($transactionInformation->getIban())); $directDebitTransactionInformation->appendChild($debtorAccount); - $directDebitTransactionInformation->appendChild($this->getRemittenceElement($transactionInformation->getRemittanceInformation())); + $directDebitTransactionInformation->appendChild( + $this->getRemittenceElement($transactionInformation->getRemittanceInformation()) + ); $this->currentPayment->appendChild($directDebitTransactionInformation); } diff --git a/lib/Digitick/Sepa/DomBuilder/DomBuilderFactory.php b/lib/Digitick/Sepa/DomBuilder/DomBuilderFactory.php index ff18e85..20978f8 100644 --- a/lib/Digitick/Sepa/DomBuilder/DomBuilderFactory.php +++ b/lib/Digitick/Sepa/DomBuilder/DomBuilderFactory.php @@ -25,11 +25,13 @@ use Digitick\Sepa\Exception\InvalidArgumentException; use Digitick\Sepa\TransferFile\TransferFileInterface; -class DomBuilderFactory { +class DomBuilderFactory +{ - public static function createDomBuilder(TransferFileInterface $transferFile) { + public static function createDomBuilder(TransferFileInterface $transferFile) + { $transferFileClass = get_class($transferFile); - switch($transferFileClass) { + switch ($transferFileClass) { case 'Digitick\Sepa\TransferFile\CustomerCreditTransferFile': $domBuilder = new CustomerCreditTransferDomBuilder(); $transferFile->accept($domBuilder); diff --git a/lib/Digitick/Sepa/Exception/Exception.php b/lib/Digitick/Sepa/Exception/Exception.php index 71d64c7..8479fb3 100644 --- a/lib/Digitick/Sepa/Exception/Exception.php +++ b/lib/Digitick/Sepa/Exception/Exception.php @@ -22,6 +22,7 @@ * along with this program. If not, see . */ -class Exception extends \Exception { +class Exception extends \Exception +{ } \ No newline at end of file diff --git a/lib/Digitick/Sepa/Exception/InvalidArgumentException.php b/lib/Digitick/Sepa/Exception/InvalidArgumentException.php index 467d8f0..a767f28 100644 --- a/lib/Digitick/Sepa/Exception/InvalidArgumentException.php +++ b/lib/Digitick/Sepa/Exception/InvalidArgumentException.php @@ -22,6 +22,7 @@ * along with this program. If not, see . */ -class InvalidArgumentException extends Exception{ +class InvalidArgumentException extends Exception +{ } \ No newline at end of file diff --git a/lib/Digitick/Sepa/Exception/InvalidPaymentMethodException.php b/lib/Digitick/Sepa/Exception/InvalidPaymentMethodException.php index bbe123d..0ab967f 100644 --- a/lib/Digitick/Sepa/Exception/InvalidPaymentMethodException.php +++ b/lib/Digitick/Sepa/Exception/InvalidPaymentMethodException.php @@ -22,6 +22,7 @@ * along with this program. If not, see . */ -class InvalidPaymentMethodException extends Exception { +class InvalidPaymentMethodException extends Exception +{ } \ No newline at end of file diff --git a/lib/Digitick/Sepa/Exception/InvalidTransferFileConfiguration.php b/lib/Digitick/Sepa/Exception/InvalidTransferFileConfiguration.php index bef102e..bce6f92 100644 --- a/lib/Digitick/Sepa/Exception/InvalidTransferFileConfiguration.php +++ b/lib/Digitick/Sepa/Exception/InvalidTransferFileConfiguration.php @@ -22,6 +22,7 @@ * along with this program. If not, see . */ -class InvalidTransferFileConfiguration extends Exception { +class InvalidTransferFileConfiguration extends Exception +{ } \ No newline at end of file diff --git a/lib/Digitick/Sepa/Exception/InvalidTransferTypeException.php b/lib/Digitick/Sepa/Exception/InvalidTransferTypeException.php index 9cd53cb..0167f95 100644 --- a/lib/Digitick/Sepa/Exception/InvalidTransferTypeException.php +++ b/lib/Digitick/Sepa/Exception/InvalidTransferTypeException.php @@ -22,6 +22,7 @@ * along with this program. If not, see . */ -class InvalidTransferTypeException extends Exception { +class InvalidTransferTypeException extends Exception +{ } \ No newline at end of file diff --git a/lib/Digitick/Sepa/GroupHeader.php b/lib/Digitick/Sepa/GroupHeader.php index 49d7691..2260d14 100644 --- a/lib/Digitick/Sepa/GroupHeader.php +++ b/lib/Digitick/Sepa/GroupHeader.php @@ -71,105 +71,120 @@ class GroupHeader * @param $isTest * @param $initiatingPartyName */ - function __construct($messageIdentification, $initiatingPartyName, $isTest = false) { + function __construct($messageIdentification, $initiatingPartyName, $isTest = false) + { $this->messageIdentification = $messageIdentification; $this->isTest = $isTest; $this->initiatingPartyName = StringHelper::sanitizeString($initiatingPartyName); $this->creationDateTime = new \DateTime(); } - public function accept(DomBuilderInterface $domBuilder) { + public function accept(DomBuilderInterface $domBuilder) + { $domBuilder->visitGroupHeader($this); } /** * @param int $controlSumCents */ - public function setControlSumCents($controlSumCents) { + public function setControlSumCents($controlSumCents) + { $this->controlSumCents = $controlSumCents; } /** * @return int */ - public function getControlSumCents() { + public function getControlSumCents() + { return $this->controlSumCents; } /** * @param string $initiatingPartyId */ - public function setInitiatingPartyId($initiatingPartyId) { + public function setInitiatingPartyId($initiatingPartyId) + { $this->initiatingPartyId = $initiatingPartyId; } /** * @return string */ - public function getInitiatingPartyId() { + public function getInitiatingPartyId() + { return $this->initiatingPartyId; } /** * @param string $initiatingPartyName */ - public function setInitiatingPartyName($initiatingPartyName) { + public function setInitiatingPartyName($initiatingPartyName) + { $this->initiatingPartyName = StringHelper::sanitizeString($initiatingPartyName); } /** * @return string */ - public function getInitiatingPartyName() { + public function getInitiatingPartyName() + { return $this->initiatingPartyName; } /** * @param boolean $isTest */ - public function setIsTest($isTest) { + public function setIsTest($isTest) + { $this->isTest = $isTest; } /** * @return boolean */ - public function getIsTest() { + public function getIsTest() + { return $this->isTest; } /** * @param string $messageIdentification */ - public function setMessageIdentification($messageIdentification) { + public function setMessageIdentification($messageIdentification) + { $this->messageIdentification = $messageIdentification; } /** * @return string */ - public function getMessageIdentification() { + public function getMessageIdentification() + { return $this->messageIdentification; } /** * @param int $numberOfTransactions */ - public function setNumberOfTransactions($numberOfTransactions) { + public function setNumberOfTransactions($numberOfTransactions) + { $this->numberOfTransactions = $numberOfTransactions; } /** * @return int */ - public function getNumberOfTransactions() { + public function getNumberOfTransactions() + { return $this->numberOfTransactions; } /** * @return \DateTime */ - public function getCreationDateTime() { + public function getCreationDateTime() + { return $this->creationDateTime; } diff --git a/lib/Digitick/Sepa/PaymentInformation.php b/lib/Digitick/Sepa/PaymentInformation.php index 78616f9..046c5aa 100644 --- a/lib/Digitick/Sepa/PaymentInformation.php +++ b/lib/Digitick/Sepa/PaymentInformation.php @@ -120,7 +120,8 @@ class PaymentInformation * @param string $originName This is your Name * @param string $originAccountCurrency */ - function __construct($id, $originAccountIBAN, $originAgentBIC, $originName, $originAccountCurrency = 'EUR') { + function __construct($id, $originAccountIBAN, $originAgentBIC, $originName, $originAccountCurrency = 'EUR') + { $this->id = $id; $this->originAccountIBAN = $originAccountIBAN; $this->originAgentBIC = $originAgentBIC; @@ -133,7 +134,8 @@ function __construct($id, $originAccountIBAN, $originAgentBIC, $originName, $ori /** * @param TransferInformationInterface $transfer */ - public function addTransfer(TransferInformationInterface $transfer) { + public function addTransfer(TransferInformationInterface $transfer) + { $this->transfers[] = $transfer; $this->numberOfTransactions++; $this->controlSumCents += $transfer->getTransferAmount(); @@ -142,7 +144,8 @@ public function addTransfer(TransferInformationInterface $transfer) { /** * @return array */ - public function getTransfers() { + public function getTransfers() + { return $this->transfers; } @@ -151,7 +154,8 @@ public function getTransfers() { * * @param DomBuilderInterface $domBuilder */ - public function accept(DomBuilderInterface $domBuilder) { + public function accept(DomBuilderInterface $domBuilder) + { $domBuilder->visitPaymentInformation($this); /** @var $transfer TransferInformationInterface */ foreach ($this->getTransfers() as $transfer) { @@ -164,10 +168,14 @@ public function accept(DomBuilderInterface $domBuilder) { * @param string $method * @throws InvalidArgumentException */ - public function setPaymentMethod($method) { + public function setPaymentMethod($method) + { $method = strtoupper($method); if (!in_array($method, $this->validPaymentMethods)) { - throw new InvalidArgumentException("Invalid Payment Method: $method, must be one of " . implode(',', $this->validPaymentMethods)); + throw new InvalidArgumentException("Invalid Payment Method: $method, must be one of " . implode( + ',', + $this->validPaymentMethods + )); } $this->paymentMethod = $method; } @@ -176,7 +184,8 @@ public function setPaymentMethod($method) { * @param string $localInstrumentCode * @throws InvalidArgumentException */ - public function setLocalInstrumentCode($localInstrumentCode) { + public function setLocalInstrumentCode($localInstrumentCode) + { $localInstrumentCode = strtoupper($localInstrumentCode); if (!in_array($localInstrumentCode, array('B2B', 'CORE', 'COR1'))) { throw new InvalidArgumentException("Invalid Local Instrument Code: $localInstrumentCode"); @@ -187,175 +196,200 @@ public function setLocalInstrumentCode($localInstrumentCode) { /** * @param mixed $validPaymentMethods */ - public function setValidPaymentMethods($validPaymentMethods) { + public function setValidPaymentMethods($validPaymentMethods) + { $this->validPaymentMethods = $validPaymentMethods; } /** * @param string $categoryPurposeCode */ - public function setCategoryPurposeCode($categoryPurposeCode) { + public function setCategoryPurposeCode($categoryPurposeCode) + { $this->categoryPurposeCode = $categoryPurposeCode; } /** * @return string */ - public function getCategoryPurposeCode() { + public function getCategoryPurposeCode() + { return $this->categoryPurposeCode; } /** * @param \DateTime $dueDate */ - public function setDueDate($dueDate) { + public function setDueDate($dueDate) + { $this->dueDate = $dueDate; } /** * @return \DateTime */ - public function getDueDate() { + public function getDueDate() + { return $this->dueDate->format('Y-m-d'); } /** * @param \DateTime $mandateSignDate */ - public function setMandateSignDate($mandateSignDate) { + public function setMandateSignDate($mandateSignDate) + { $this->mandateSignDate = $mandateSignDate; } /** * @return \DateTime */ - public function getMandateSignDate() { + public function getMandateSignDate() + { return $this->mandateSignDate; } /** * @param string $originName */ - public function setOriginName($originName) { + public function setOriginName($originName) + { $this->originName = StringHelper::sanitizeString($originName); } /** * @return string */ - public function getOriginName() { + public function getOriginName() + { return $this->originName; } /** * @param string $originAgentBIC */ - public function setOriginAgentBIC($originAgentBIC) { + public function setOriginAgentBIC($originAgentBIC) + { $this->originAgentBIC = $originAgentBIC; } /** * @return string */ - public function getOriginAgentBIC() { + public function getOriginAgentBIC() + { return $this->originAgentBIC; } /** * @param string $originAccountIBAN */ - public function setOriginAccountIBAN($originAccountIBAN) { + public function setOriginAccountIBAN($originAccountIBAN) + { $this->originAccountIBAN = $originAccountIBAN; } /** * @return string */ - public function getOriginAccountIBAN() { + public function getOriginAccountIBAN() + { return $this->originAccountIBAN; } /** * @param string $originAccountCurrency */ - public function setOriginAccountCurrency($originAccountCurrency) { + public function setOriginAccountCurrency($originAccountCurrency) + { $this->originAccountCurrency = $originAccountCurrency; } /** * @return string */ - public function getOriginAccountCurrency() { + public function getOriginAccountCurrency() + { return $this->originAccountCurrency; } /** * @param string $id */ - public function setId($id) { + public function setId($id) + { $this->id = $id; } /** * @return string */ - public function getId() { + public function getId() + { return $this->id; } /** * @return int */ - public function getControlSumCents() { + public function getControlSumCents() + { return $this->controlSumCents; } /** * @return string */ - public function getLocalInstrumentCode() { + public function getLocalInstrumentCode() + { return $this->localInstrumentCode; } /** * @return int */ - public function getNumberOfTransactions() { + public function getNumberOfTransactions() + { return $this->numberOfTransactions; } /** * @return string */ - public function getPaymentMethod() { + public function getPaymentMethod() + { return $this->paymentMethod; } /** * @param string $creditorSchemeId */ - public function setCreditorId($creditorSchemeId) { + public function setCreditorId($creditorSchemeId) + { $this->creditorId = StringHelper::sanitizeString($creditorSchemeId); } /** * @return string */ - public function getCreditorId() { + public function getCreditorId() + { return $this->creditorId; } /** * @param mixed $sequenceType */ - public function setSequenceType($sequenceType) { + public function setSequenceType($sequenceType) + { $this->sequenceType = $sequenceType; } /** * @return mixed */ - public function getSequenceType() { + public function getSequenceType() + { return $this->sequenceType; } diff --git a/lib/Digitick/Sepa/TransferFile/BaseTransferFile.php b/lib/Digitick/Sepa/TransferFile/BaseTransferFile.php index 5ba569a..70ca512 100644 --- a/lib/Digitick/Sepa/TransferFile/BaseTransferFile.php +++ b/lib/Digitick/Sepa/TransferFile/BaseTransferFile.php @@ -42,22 +42,26 @@ abstract class BaseTransferFile implements TransferFileInterface /** * @param GroupHeader $groupHeader */ - public function __construct(GroupHeader $groupHeader) { + public function __construct(GroupHeader $groupHeader) + { $this->groupHeader = $groupHeader; } /** * @return GroupHeader */ - public function getGroupHeader() { + public function getGroupHeader() + { return $this->groupHeader; } /** * @param PaymentInformation $paymentInformation */ - public function addPaymentInformation(PaymentInformation $paymentInformation) { - $numberOfTransactions = $this->getGroupHeader()->getNumberOfTransactions() + $paymentInformation->getNumberOfTransactions(); + public function addPaymentInformation(PaymentInformation $paymentInformation) + { + $numberOfTransactions = $this->getGroupHeader()->getNumberOfTransactions( + ) + $paymentInformation->getNumberOfTransactions(); $transactionTotal = $this->getGroupHeader()->getControlSumCents() + $paymentInformation->getControlSumCents(); $this->groupHeader->setNumberOfTransactions($numberOfTransactions); $this->groupHeader->setControlSumCents($transactionTotal); @@ -67,12 +71,13 @@ public function addPaymentInformation(PaymentInformation $paymentInformation) { /** * @param DomBuilderInterface $domBuilder */ - public function accept(DomBuilderInterface $domBuilder) { + public function accept(DomBuilderInterface $domBuilder) + { $this->validate(); $domBuilder->visitTransferFile($this); $this->groupHeader->accept($domBuilder); /** @var $paymentInformation PaymentInformation */ - foreach($this->paymentInformations as $paymentInformation) { + foreach ($this->paymentInformations as $paymentInformation) { $paymentInformation->accept($domBuilder); } } @@ -81,8 +86,9 @@ public function accept(DomBuilderInterface $domBuilder) { * update the group header with transaction informations collected * by paymentinformation */ - public function validate() { - if(count($this->paymentInformations) === 0) { + public function validate() + { + if (count($this->paymentInformations) === 0) { throw new InvalidTransferFileConfiguration('No paymentinformations available, add paymentInformation via addPaymentInformation()'); } } diff --git a/lib/Digitick/Sepa/TransferFile/CustomerCreditTransferFile.php b/lib/Digitick/Sepa/TransferFile/CustomerCreditTransferFile.php index c683a43..ce8dd22 100644 --- a/lib/Digitick/Sepa/TransferFile/CustomerCreditTransferFile.php +++ b/lib/Digitick/Sepa/TransferFile/CustomerCreditTransferFile.php @@ -33,7 +33,8 @@ class CustomerCreditTransferFile extends BaseTransferFile /** * @param PaymentInformation $paymentInformation */ - public function addPaymentInformation(PaymentInformation $paymentInformation) { + public function addPaymentInformation(PaymentInformation $paymentInformation) + { $paymentInformation->setValidPaymentMethods(array('TRF')); $paymentInformation->setPaymentMethod('TRF'); parent::addPaymentInformation($paymentInformation); @@ -44,16 +45,19 @@ public function addPaymentInformation(PaymentInformation $paymentInformation) { * * @throws \Digitick\Sepa\Exception\InvalidTransferTypeException */ - public function validate() { + public function validate() + { parent::validate(); /** @var $payment PaymentInformation */ - foreach($this->paymentInformations as $payment) { - if(count($payment->getTransfers()) === 0) { + foreach ($this->paymentInformations as $payment) { + if (count($payment->getTransfers()) === 0) { throw new InvalidTransferFileConfiguration('PaymentInformation must at least contain one payment'); } - foreach($payment->getTransfers() as $transfer) { - if(!$transfer instanceof CustomerCreditTransferInformation) { - throw new InvalidTransferTypeException('Transfers must be of type CustomerCreditTransferInformation instead of: ' . get_class($transfer)); + foreach ($payment->getTransfers() as $transfer) { + if (!$transfer instanceof CustomerCreditTransferInformation) { + throw new InvalidTransferTypeException('Transfers must be of type CustomerCreditTransferInformation instead of: ' . get_class( + $transfer + )); } } } diff --git a/lib/Digitick/Sepa/TransferFile/CustomerDirectDebitTransferFile.php b/lib/Digitick/Sepa/TransferFile/CustomerDirectDebitTransferFile.php index 7f3b8a5..d292a55 100644 --- a/lib/Digitick/Sepa/TransferFile/CustomerDirectDebitTransferFile.php +++ b/lib/Digitick/Sepa/TransferFile/CustomerDirectDebitTransferFile.php @@ -33,7 +33,8 @@ class CustomerDirectDebitTransferFile extends BaseTransferFile /** * @param PaymentInformation $paymentInformation */ - public function addPaymentInformation(PaymentInformation $paymentInformation) { + public function addPaymentInformation(PaymentInformation $paymentInformation) + { $paymentInformation->setValidPaymentMethods(array('DD')); $paymentInformation->setPaymentMethod('DD'); parent::addPaymentInformation($paymentInformation); @@ -44,19 +45,22 @@ public function addPaymentInformation(PaymentInformation $paymentInformation) { * * @throws \Digitick\Sepa\Exception\InvalidTransferTypeException */ - public function validate() { + public function validate() + { parent::validate(); /** @var $payment PaymentInformation */ - foreach($this->paymentInformations as $payment) { - if((string)$payment->getSequenceType() === '') { + foreach ($this->paymentInformations as $payment) { + if ((string)$payment->getSequenceType() === '') { throw new InvalidTransferFileConfiguration('Payment must contain a SequenceType'); } - if((string)$payment->getCreditorId() === '') { + if ((string)$payment->getCreditorId() === '') { throw new InvalidTransferFileConfiguration('Payment must contain a CreditorSchemeId'); } - foreach($payment->getTransfers() as $transfer) { - if(!$transfer instanceof CustomerDirectDebitTransferInformation) { - throw new InvalidTransferTypeException('Transfers must be of type \Digitick\Sepa\TransferInformation\CustomerDirectDebitTransferInformation instead of: ' . get_class($transfer)); + foreach ($payment->getTransfers() as $transfer) { + if (!$transfer instanceof CustomerDirectDebitTransferInformation) { + throw new InvalidTransferTypeException('Transfers must be of type \Digitick\Sepa\TransferInformation\CustomerDirectDebitTransferInformation instead of: ' . get_class( + $transfer + )); } } } diff --git a/lib/Digitick/Sepa/TransferFile/Facade/BaseCustomerTransferFileFacade.php b/lib/Digitick/Sepa/TransferFile/Facade/BaseCustomerTransferFileFacade.php index 94d9c7e..b42b84a 100644 --- a/lib/Digitick/Sepa/TransferFile/Facade/BaseCustomerTransferFileFacade.php +++ b/lib/Digitick/Sepa/TransferFile/Facade/BaseCustomerTransferFileFacade.php @@ -46,7 +46,8 @@ abstract class BaseCustomerTransferFileFacade implements CustomerTransferFileFac * @param TransferFileInterface $transferFile * @param BaseDomBuilder $domBuilder */ - public function __construct(TransferFileInterface $transferFile, BaseDomBuilder $domBuilder) { + public function __construct(TransferFileInterface $transferFile, BaseDomBuilder $domBuilder) + { $this->transferFile = $transferFile; $this->domBuilder = $domBuilder; } @@ -54,11 +55,13 @@ public function __construct(TransferFileInterface $transferFile, BaseDomBuilder /** * @return string */ - public function asXML() { - foreach($this->payments as $payment) { + public function asXML() + { + foreach ($this->payments as $payment) { $this->transferFile->addPaymentInformation($payment); } $this->transferFile->accept($this->domBuilder); + return $this->domBuilder->asXml(); } diff --git a/lib/Digitick/Sepa/TransferFile/Facade/CustomerDirectDebitFacade.php b/lib/Digitick/Sepa/TransferFile/Facade/CustomerDirectDebitFacade.php index 1117cc1..39ee1c4 100644 --- a/lib/Digitick/Sepa/TransferFile/Facade/CustomerDirectDebitFacade.php +++ b/lib/Digitick/Sepa/TransferFile/Facade/CustomerDirectDebitFacade.php @@ -43,8 +43,9 @@ class CustomerDirectDebitFacade extends BaseCustomerTransferFileFacade * @return mixed * */ - public function addPaymentInfo($paymentName, array $paymentInformation) { - if(isset($this->payments[$paymentName])) { + public function addPaymentInfo($paymentName, array $paymentInformation) + { + if (isset($this->payments[$paymentName])) { throw new InvalidArgumentException(sprintf('Payment with the name %s already exists', $paymentName)); } $payment = new PaymentInformation( @@ -58,14 +59,14 @@ public function addPaymentInfo($paymentName, array $paymentInformation) { if (isset($paymentInformation['localInstrumentCode'])) { $payment->setLocalInstrumentCode($paymentInformation['localInstrumentCode']); } - if(isset($paymentInformation['dueDate'])) { - if($paymentInformation['dueDate'] instanceof \DateTime) { + if (isset($paymentInformation['dueDate'])) { + if ($paymentInformation['dueDate'] instanceof \DateTime) { $payment->setDueDate($paymentInformation['dueDate']); } else { $payment->setDueDate(new \DateTime($paymentInformation['dueDate'])); } } else { - $payment->setDueDate(new \DateTime(date('Y-m-d',strtotime('now + 5 days')))); + $payment->setDueDate(new \DateTime(date('Y-m-d', strtotime('now + 5 days')))); } $this->payments[$paymentName] = $payment; @@ -86,9 +87,13 @@ public function addPaymentInfo($paymentName, array $paymentInformation) { * @throws \Digitick\Sepa\Exception\InvalidArgumentException * @return mixed */ - public function addTransfer($paymentName, array $transferInformation) { - if(!isset($this->payments[$paymentName])) { - throw new InvalidArgumentException(sprintf('Payment with the name %s does not exists, create one first with addPaymentInfo', $paymentName)); + public function addTransfer($paymentName, array $transferInformation) + { + if (!isset($this->payments[$paymentName])) { + throw new InvalidArgumentException(sprintf( + 'Payment with the name %s does not exists, create one first with addPaymentInfo', + $paymentName + )); } $transfer = new CustomerDirectDebitTransferInformation( $transferInformation['amount'], @@ -97,16 +102,18 @@ public function addTransfer($paymentName, array $transferInformation) { ); $transfer->setBic($transferInformation['debtorBic']); $transfer->setMandateId($transferInformation['debtorMandate']); - if($transferInformation['debtorMandateSignDate'] instanceof \DateTime) { + if ($transferInformation['debtorMandateSignDate'] instanceof \DateTime) { $transfer->setMandateSignDate($transferInformation['debtorMandateSignDate']); } else { $transfer->setMandateSignDate(new \DateTime($transferInformation['debtorMandateSignDate'])); } $transfer->setRemittanceInformation($transferInformation['remittanceInformation']); - if(isset($transferInformation['endToEndId'])) { + if (isset($transferInformation['endToEndId'])) { $transfer->setEndToEndIdentification($transferInformation['endToEndId']); } else { - $transfer->setEndToEndIdentification($this->payments[$paymentName]->getId() . count($this->payments[$paymentName]->getTransfers())); + $transfer->setEndToEndIdentification( + $this->payments[$paymentName]->getId() . count($this->payments[$paymentName]->getTransfers()) + ); } $this->payments[$paymentName]->addTransfer($transfer); diff --git a/lib/Digitick/Sepa/TransferFile/Factory/TransferFileFacadeFactory.php b/lib/Digitick/Sepa/TransferFile/Factory/TransferFileFacadeFactory.php index cc2fd90..9ed83e7 100644 --- a/lib/Digitick/Sepa/TransferFile/Factory/TransferFileFacadeFactory.php +++ b/lib/Digitick/Sepa/TransferFile/Factory/TransferFileFacadeFactory.php @@ -37,10 +37,12 @@ class TransferFileFacadeFactory * * @return CustomerDirectDebitFacade */ - public static function createDirectDebit($uniqueMessageIdentification, $initiatingPartyName) { + public static function createDirectDebit($uniqueMessageIdentification, $initiatingPartyName) + { $groupHeader = new GroupHeader($uniqueMessageIdentification, $initiatingPartyName); $directDebitTransferFile = new CustomerDirectDebitTransferFile($groupHeader); $domBuilder = new CustomerDirectDebitTransferDomBuilder(); + return new CustomerDirectDebitFacade($directDebitTransferFile, $domBuilder); } @@ -50,10 +52,12 @@ public static function createDirectDebit($uniqueMessageIdentification, $initiati * * @return CustomerCreditFacade */ - public static function createCustomerCredit($uniqueMessageIdentification, $initiatingPartyName) { + public static function createCustomerCredit($uniqueMessageIdentification, $initiatingPartyName) + { $groupHeader = new GroupHeader($uniqueMessageIdentification, $initiatingPartyName); $directDebitTransferFile = new CustomerCreditTransferFile($groupHeader); $domBuilder = new CustomerCreditTransferDomBuilder(); + return new CustomerCreditFacade($directDebitTransferFile, $domBuilder); } } \ No newline at end of file diff --git a/lib/Digitick/Sepa/TransferInformation/BaseTransferInformation.php b/lib/Digitick/Sepa/TransferInformation/BaseTransferInformation.php index edce412..2b82df8 100644 --- a/lib/Digitick/Sepa/TransferInformation/BaseTransferInformation.php +++ b/lib/Digitick/Sepa/TransferInformation/BaseTransferInformation.php @@ -80,10 +80,11 @@ class BaseTransferInformation implements TransferInformationInterface * @param string $iban * @param string $name */ - public function __construct($amount, $iban, $name) { + public function __construct($amount, $iban, $name) + { $amount += 0; if (is_float($amount)) { - $amount = (integer) ($amount * 100); + $amount = (integer)($amount * 100); } $this->transferAmount = $amount; $this->iban = $iban; @@ -93,56 +94,64 @@ public function __construct($amount, $iban, $name) { /** * @param DomBuilderInterface $domBuilder */ - public function accept(DomBuilderInterface $domBuilder) { + public function accept(DomBuilderInterface $domBuilder) + { $domBuilder->visitTransferInformation($this); } /** * @return mixed */ - public function getTransferAmount() { + public function getTransferAmount() + { return $this->transferAmount; } /** * @param mixed $currency */ - public function setCurrency($currency) { + public function setCurrency($currency) + { $this->currency = $currency; } /** * @return mixed */ - public function getCurrency() { + public function getCurrency() + { return $this->currency; } /** * @param string $EndToEndIdentification */ - public function setEndToEndIdentification($EndToEndIdentification) { + public function setEndToEndIdentification($EndToEndIdentification) + { $this->EndToEndIdentification = $EndToEndIdentification; } /** * @return string */ - public function getEndToEndIdentification() { + public function getEndToEndIdentification() + { return $this->EndToEndIdentification; } /** * @param string $instructionId */ - public function setInstructionId($instructionId) { + public function setInstructionId($instructionId) + { $this->instructionId = $instructionId; } /** * @return string */ - public function getInstructionId() { + public function getInstructionId() + { return $this->instructionId; } @@ -150,42 +159,48 @@ public function getInstructionId() { /** * @param string $iban */ - public function setIban($iban) { + public function setIban($iban) + { $this->iban = $iban; } /** * @return string */ - public function getIban() { + public function getIban() + { return $this->iban; } /** * @param string $bic */ - public function setBic($bic) { + public function setBic($bic) + { $this->bic = $bic; } /** * @return string */ - public function getBic() { + public function getBic() + { return $this->bic; } /** * @param string $remittanceInformation */ - public function setRemittanceInformation($remittanceInformation) { + public function setRemittanceInformation($remittanceInformation) + { $this->remittanceInformation = StringHelper::sanitizeString($remittanceInformation); } /** * @return string */ - public function getRemittanceInformation() { + public function getRemittanceInformation() + { return $this->remittanceInformation; } diff --git a/lib/Digitick/Sepa/TransferInformation/CustomerCreditTransferInformation.php b/lib/Digitick/Sepa/TransferInformation/CustomerCreditTransferInformation.php index 22da000..7e76b48 100644 --- a/lib/Digitick/Sepa/TransferInformation/CustomerCreditTransferInformation.php +++ b/lib/Digitick/Sepa/TransferInformation/CustomerCreditTransferInformation.php @@ -29,7 +29,8 @@ class CustomerCreditTransferInformation extends BaseTransferInformation * @param string $iban * @param string $name */ - function __construct($amount, $iban, $name) { + function __construct($amount, $iban, $name) + { parent::__construct($amount, $iban, $name); // FIXME broken implementation find suitable IDs $this->EndToEndIdentification = $name; @@ -38,7 +39,8 @@ function __construct($amount, $iban, $name) { /** * @return string */ - public function getCreditorName() { + public function getCreditorName() + { return $this->name; } diff --git a/lib/Digitick/Sepa/TransferInformation/CustomerDirectDebitTransferInformation.php b/lib/Digitick/Sepa/TransferInformation/CustomerDirectDebitTransferInformation.php index d9401aa..6b79091 100644 --- a/lib/Digitick/Sepa/TransferInformation/CustomerDirectDebitTransferInformation.php +++ b/lib/Digitick/Sepa/TransferInformation/CustomerDirectDebitTransferInformation.php @@ -46,7 +46,8 @@ class CustomerDirectDebitTransferInformation extends BaseTransferInformation * @param string $iban * @param string $name */ - function __construct($amount, $iban, $name) { + function __construct($amount, $iban, $name) + { parent::__construct($amount, $iban, $name); // FIXME broken implementation find suitable IDs $this->EndToEndIdentification = StringHelper::sanitizeString($name); @@ -55,49 +56,56 @@ function __construct($amount, $iban, $name) { /** * @param \DateTime $finalCollectionDate */ - public function setFinalCollectionDate($finalCollectionDate) { + public function setFinalCollectionDate($finalCollectionDate) + { $this->finalCollectionDate = $finalCollectionDate; } /** * @return \DateTime */ - public function getFinalCollectionDate() { + public function getFinalCollectionDate() + { return $this->finalCollectionDate; } /** * @param string $mandateId */ - public function setMandateId($mandateId) { + public function setMandateId($mandateId) + { $this->mandateId = StringHelper::sanitizeString($mandateId); } /** * @return string */ - public function getMandateId() { + public function getMandateId() + { return $this->mandateId; } /** * @param \DateTime $mandateSignDate */ - public function setMandateSignDate($mandateSignDate) { + public function setMandateSignDate($mandateSignDate) + { $this->mandateSignDate = $mandateSignDate; } /** * @return \DateTime */ - public function getMandateSignDate() { + public function getMandateSignDate() + { return $this->mandateSignDate; } /** * @return string */ - public function getDebitorName() { + public function getDebitorName() + { return $this->name; } diff --git a/lib/Digitick/Sepa/Util/StringHelper.php b/lib/Digitick/Sepa/Util/StringHelper.php index e79d0cf..8a9fbf1 100644 --- a/lib/Digitick/Sepa/Util/StringHelper.php +++ b/lib/Digitick/Sepa/Util/StringHelper.php @@ -28,8 +28,9 @@ class StringHelper * @param string $inputString * @return string */ - public static function sanitizeString($inputString) { - $searches = array('Ä', 'Ö', 'Ü', 'ä', 'ö', 'ü', 'ß'); + public static function sanitizeString($inputString) + { + $searches = array('Ä', 'Ö', 'Ü', 'ä', 'ö', 'ü', 'ß'); $replacements = array('Ae', 'Oe', 'Ue', 'ae', 'oe', 'ue', 'ss'); return str_replace($searches, $replacements, $inputString); diff --git a/tests/CustomerCreditValidationTest.php b/tests/CustomerCreditValidationTest.php index 7149c52..daf7076 100644 --- a/tests/CustomerCreditValidationTest.php +++ b/tests/CustomerCreditValidationTest.php @@ -33,34 +33,34 @@ */ class CustomerCreditValidationTest extends \PHPUnit_Framework_TestCase { - protected $schema; + protected $schema; /** * @var \DOMDocument */ protected $dom; - protected function setUp() - { - $this->schema = __DIR__ . "/pain.001.002.03.xsd"; - $this->dom = new \DOMDocument('1.0', 'UTF-8'); - } - - /** - * Sanity check: test reference file with XSD. - */ - public function testSanity() - { - $this->dom->load(__DIR__ . '/pain.001.002.03.xml'); - $validated = $this->dom->schemaValidate($this->schema); - $this->assertTrue($validated); - } - - /** - * Test a transfer file with one payment and one transaction. - */ - public function testSinglePaymentSingleTrans() - { + protected function setUp() + { + $this->schema = __DIR__ . "/pain.001.002.03.xsd"; + $this->dom = new \DOMDocument('1.0', 'UTF-8'); + } + + /** + * Sanity check: test reference file with XSD. + */ + public function testSanity() + { + $this->dom->load(__DIR__ . '/pain.001.002.03.xml'); + $validated = $this->dom->schemaValidate($this->schema); + $this->assertTrue($validated); + } + + /** + * Test a transfer file with one payment and one transaction. + */ + public function testSinglePaymentSingleTrans() + { $groupHeader = new GroupHeader('transferID', 'Me'); $sepaFile = new CustomerCreditTransferFile($groupHeader); @@ -70,24 +70,24 @@ public function testSinglePaymentSingleTrans() $transfer->setRemittanceInformation('Transaction Description'); $payment = new PaymentInformation('Payment Info ID', 'FR1420041010050500013M02606', 'PSSTFRPPMON', 'My Corp'); - $payment->addTransfer($transfer); + $payment->addTransfer($transfer); $sepaFile->addPaymentInformation($payment); $domBuilder = new CustomerCreditTransferDomBuilder(); $sepaFile->accept($domBuilder); $xml = $domBuilder->asXml(); - $this->dom->loadXML($xml); + $this->dom->loadXML($xml); - $validated = $this->dom->schemaValidate($this->schema); - $this->assertTrue($validated); - } + $validated = $this->dom->schemaValidate($this->schema); + $this->assertTrue($validated); + } - /** - * Test a transfer file with one payment and several transactions. - */ - public function testSinglePaymentMultiTrans() - { + /** + * Test a transfer file with one payment and several transactions. + */ + public function testSinglePaymentMultiTrans() + { $groupHeader = new GroupHeader('transferID', 'Me'); $sepaFile = new CustomerCreditTransferFile($groupHeader); $payment = new PaymentInformation('Payment Info ID', 'FR1420041010050500013M02606', 'PSSTFRPPMON', 'My Corp'); @@ -110,14 +110,15 @@ public function testSinglePaymentMultiTrans() $this->dom->loadXML($xml); $validated = $this->dom->schemaValidate($this->schema); - $this->assertTrue($validated); - } + $this->assertTrue($validated); + } /** * Test that a transferfile without Payments throws understandable exception * @expectedException \Digitick\Sepa\Exception\InvalidTransferFileConfiguration */ - public function testInvalidTransferFileThrowsException() { + public function testInvalidTransferFileThrowsException() + { $groupHeader = new GroupHeader('transferID', 'Me'); $sepaFile = new CustomerCreditTransferFile($groupHeader); @@ -129,7 +130,8 @@ public function testInvalidTransferFileThrowsException() { /** * Test correct calulation of controlsum and transaction count */ - public function testControlSumAndTransactionCount() { + public function testControlSumAndTransactionCount() + { $groupHeader = new GroupHeader('transferID', 'Me'); $sepaFile = new CustomerCreditTransferFile($groupHeader); $payment = new PaymentInformation('Payment Info ID', 'FR1420041010050500013M02606', 'PSSTFRPPMON', 'My Corp'); @@ -163,7 +165,8 @@ public function testControlSumAndTransactionCount() { /** * Test the payment informations in the xml */ - public function testPaymentMetaData() { + public function testPaymentMetaData() + { $groupHeader = new GroupHeader('transferID', 'Me'); $sepaFile = new CustomerCreditTransferFile($groupHeader); $payment = new PaymentInformation('Payment Info ID', 'FR1420041010050500013M02606', 'PSSTFRPPMON', 'My Corp'); @@ -201,11 +204,11 @@ public function testPaymentMetaData() { $this->assertEquals('My Corp', $originName->item(0)->textContent); } - /** - * Test a transfer file with several payments, several transactions each. - */ - public function testMultiPaymentMultiTrans() - { + /** + * Test a transfer file with several payments, several transactions each. + */ + public function testMultiPaymentMultiTrans() + { $groupHeader = new GroupHeader('transferID', 'Me'); $sepaFile = new CustomerCreditTransferFile($groupHeader); @@ -241,10 +244,10 @@ public function testMultiPaymentMultiTrans() $sepaFile->accept($domBuilder); $xml = $domBuilder->asXml(); - $this->dom->loadXML($xml); + $this->dom->loadXML($xml); - $validated = $this->dom->schemaValidate($this->schema); - $this->assertTrue($validated); + $validated = $this->dom->schemaValidate($this->schema); + $this->assertTrue($validated); $xpathDoc = new \DOMXPath($this->dom); $xpathDoc->registerNamespace('sepa', 'urn:iso:std:iso:20022:tech:xsd:pain.001.002.03'); @@ -255,5 +258,5 @@ public function testMultiPaymentMultiTrans() $ctrlSum = $xpathDoc->query('//sepa:CtrlSum'); $this->assertEquals('10000.04', $ctrlSum->item(0)->textContent); - } + } } diff --git a/tests/CustomerDirectDebitFacadeTest.php b/tests/CustomerDirectDebitFacadeTest.php index f052284..42896c1 100644 --- a/tests/CustomerDirectDebitFacadeTest.php +++ b/tests/CustomerDirectDebitFacadeTest.php @@ -26,7 +26,8 @@ use Digitick\Sepa\PaymentInformation; use Digitick\Sepa\TransferFile\Factory\TransferFileFacadeFactory; -class CustomerDirectDebitFacadeTest extends \PHPUnit_Framework_TestCase { +class CustomerDirectDebitFacadeTest extends \PHPUnit_Framework_TestCase +{ protected $schema; /** @@ -34,7 +35,8 @@ class CustomerDirectDebitFacadeTest extends \PHPUnit_Framework_TestCase { */ protected $dom; - protected function setUp() { + protected function setUp() + { $this->schema = __DIR__ . "/pain.008.002.02.xsd"; $this->dom = new \DOMDocument('1.0', 'UTF-8'); } @@ -42,25 +44,32 @@ protected function setUp() { /** * Test creation of file via Factory and Facade */ - public function testValidFileCreationWithFacade() { + public function testValidFileCreationWithFacade() + { $directDebit = TransferFileFacadeFactory::createDirectDebit('test123', 'Me'); - $directDebit->addPaymentInfo('firstPayment', array( - 'id' => 'firstPayment', - 'creditorName' => 'My Company', - 'creditorAccountIBAN' => 'FI1350001540000056', - 'creditorAgentBIC' => 'PSSTFRPPMON', - 'seqType' => PaymentInformation::S_ONEOFF, - 'creditorId' => 'DE21WVM1234567890' - )); - $directDebit->addTransfer('firstPayment', array( - 'amount' => '500', - 'debtorIban' => 'FI1350001540000056', - 'debtorBic' => 'OKOYFIHH', - 'debtorName' => 'Their Company', - 'debtorMandate' => 'AB12345', - 'debtorMandateSignDate' => '13.10.2012', - 'remittanceInformation' => 'Purpose of this direct debit' - )); + $directDebit->addPaymentInfo( + 'firstPayment', + array( + 'id' => 'firstPayment', + 'creditorName' => 'My Company', + 'creditorAccountIBAN' => 'FI1350001540000056', + 'creditorAgentBIC' => 'PSSTFRPPMON', + 'seqType' => PaymentInformation::S_ONEOFF, + 'creditorId' => 'DE21WVM1234567890' + ) + ); + $directDebit->addTransfer( + 'firstPayment', + array( + 'amount' => '500', + 'debtorIban' => 'FI1350001540000056', + 'debtorBic' => 'OKOYFIHH', + 'debtorName' => 'Their Company', + 'debtorMandate' => 'AB12345', + 'debtorMandateSignDate' => '13.10.2012', + 'remittanceInformation' => 'Purpose of this direct debit' + ) + ); $this->dom->loadXML($directDebit->asXML()); $this->assertTrue($this->dom->schemaValidate($this->schema)); diff --git a/tests/CustomerDirectDebitValidationPain00800102Test.php b/tests/CustomerDirectDebitValidationPain00800102Test.php index 519e4d9..0b2e94f 100644 --- a/tests/CustomerDirectDebitValidationPain00800102Test.php +++ b/tests/CustomerDirectDebitValidationPain00800102Test.php @@ -30,7 +30,8 @@ use Digitick\Sepa\TransferInformation\CustomerDirectDebitTransferInformation; -class CustomerDirectDebitValidationPain00800102Test extends \PHPUnit_Framework_TestCase { +class CustomerDirectDebitValidationPain00800102Test extends \PHPUnit_Framework_TestCase +{ protected $schema; /** @@ -38,7 +39,8 @@ class CustomerDirectDebitValidationPain00800102Test extends \PHPUnit_Framework_T */ protected $dom; - protected function setUp() { + protected function setUp() + { $this->schema = __DIR__ . "/pain.008.001.02.xsd"; $this->dom = new \DOMDocument('1.0', 'UTF-8'); } @@ -46,7 +48,8 @@ protected function setUp() { /** * Sanity check: test reference file with XSD. */ - public function testSanity() { + public function testSanity() + { $this->dom->load(__DIR__ . '/pain.008.001.02.xml'); $validated = $this->dom->schemaValidate($this->schema); $this->assertTrue($validated); diff --git a/tests/CustomerDirectDebitValidationTest.php b/tests/CustomerDirectDebitValidationTest.php index 9f4e085..5763bf0 100644 --- a/tests/CustomerDirectDebitValidationTest.php +++ b/tests/CustomerDirectDebitValidationTest.php @@ -31,7 +31,8 @@ use Digitick\Sepa\TransferInformation\CustomerDirectDebitTransferInformation; -class CustomerDirectDebitValidationTest extends \PHPUnit_Framework_TestCase { +class CustomerDirectDebitValidationTest extends \PHPUnit_Framework_TestCase +{ protected $schema; /** @@ -39,7 +40,8 @@ class CustomerDirectDebitValidationTest extends \PHPUnit_Framework_TestCase { */ protected $dom; - protected function setUp() { + protected function setUp() + { $this->schema = __DIR__ . "/pain.008.002.02.xsd"; $this->dom = new \DOMDocument('1.0', 'UTF-8'); } @@ -47,7 +49,8 @@ protected function setUp() { /** * Sanity check: test reference file with XSD. */ - public function testSanity() { + public function testSanity() + { $this->dom->load(__DIR__ . '/pain.008.002.02.xml'); $validated = $this->dom->schemaValidate($this->schema); $this->assertTrue($validated); @@ -88,7 +91,8 @@ public function testSinglePaymentSingleTrans() * @expectedException \Digitick\Sepa\Exception\InvalidTransferFileConfiguration * @expectedExceptionMessage Payment must contain a SequenceType */ - public function testValidationFailureSeqType() { + public function testValidationFailureSeqType() + { $groupHeader = new GroupHeader('transferID', 'Me'); $sepaFile = new CustomerDirectDebitTransferFile($groupHeader); @@ -107,7 +111,8 @@ public function testValidationFailureSeqType() { * @expectedException \Digitick\Sepa\Exception\InvalidTransferFileConfiguration * @expectedExceptionMessage Payment must contain a CreditorSchemeId */ - public function testValidationFailureCreditorId() { + public function testValidationFailureCreditorId() + { $groupHeader = new GroupHeader('transferID', 'Me'); $sepaFile = new CustomerDirectDebitTransferFile($groupHeader); @@ -126,7 +131,8 @@ public function testValidationFailureCreditorId() { /** * Test the payment informations in the xml */ - public function testUmlautConversion() { + public function testUmlautConversion() + { $groupHeader = new GroupHeader('transferID', 'Only A-Z without äöüßÄÖÜ initiatingPartyName'); $sepaFile = new CustomerDirectDebitTransferFile($groupHeader); $payment = new PaymentInformation('Payment Info ID', 'FR1420041010050500013M02606', 'PSSTFRPPMON', 'Only A-Z without äöüßÄÖÜ creditorName'); diff --git a/tests/Unit/DomBuilderFactoryTest.php b/tests/Unit/DomBuilderFactoryTest.php index d7c4034..06fb771 100644 --- a/tests/Unit/DomBuilderFactoryTest.php +++ b/tests/Unit/DomBuilderFactoryTest.php @@ -31,12 +31,14 @@ use Digitick\Sepa\TransferInformation\CustomerCreditTransferInformation; use Digitick\Sepa\TransferInformation\CustomerDirectDebitTransferInformation; -class DomBuilderFactoryTest extends \PHPUnit_Framework_TestCase { +class DomBuilderFactoryTest extends \PHPUnit_Framework_TestCase +{ /** * @test */ - public function createReturnsCustomerCreditDomBuilderForCustomerCreditTransfer() { + public function createReturnsCustomerCreditDomBuilderForCustomerCreditTransfer() + { $groupHeader = new GroupHeader('123456788', 'Initiating Company'); $paymentInformation = new PaymentInformation('12345', 'DE2112345678910111213141516', 'NOLANDEKI', 'Origin Company'); $sepaFile = new CustomerCreditTransferFile($groupHeader); @@ -51,7 +53,8 @@ public function createReturnsCustomerCreditDomBuilderForCustomerCreditTransfer() /** * @test */ - public function createReturnsCustomerDebitDomBuilderForCustomerDebitTransfer() { + public function createReturnsCustomerDebitDomBuilderForCustomerDebitTransfer() + { $groupHeader = new GroupHeader('123456788', 'Initiating Company'); $paymentInformation = new PaymentInformation('12345', 'DE2112345678910111213141516', 'NOLANDEKI', 'Origin Company'); $paymentInformation->setSequenceType(PaymentInformation::S_ONEOFF); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 2c85365..36b897f 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,6 +1,6 @@