From 53a11b5d80d59bf30657a4e5bd4d8a21c2ee6d97 Mon Sep 17 00:00:00 2001 From: Gerd Katzenbeisser Date: Sun, 3 Dec 2017 10:09:24 +0100 Subject: [PATCH] Add tests for OrderingCustomer* --- src/BankConfirmationDetails.php | 18 +++---- .../BankConfirmationDetailsTest.php | 22 +++++++++ ...aymentInitiatorDetailsWithoutSignature.xml | 47 +++++++++++++++++++ 3 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 tests/unit/at/externet/eps_bank_transfer/EpsData/BankConfirmationDetailsWithPaymentInitiatorDetailsWithoutSignature.xml diff --git a/src/BankConfirmationDetails.php b/src/BankConfirmationDetails.php index 1fe7c3a..dba5a00 100644 --- a/src/BankConfirmationDetails.php +++ b/src/BankConfirmationDetails.php @@ -11,7 +11,7 @@ class BankConfirmationDetails private $remittanceIdentifier; private $paymentReferenceIdentifier; private $referenceIdentifier; - private $orderingCustomerName; + private $orderingCustomerNameAddress; private $orderingCustomerIdentifier; private $orderingCustomerBIC; private $sessionId; @@ -68,15 +68,15 @@ private function init($simpleXml) //The following 3 data elements could be used e.g. for routing information within additional business scenarios (e.g. EBPP). //These are optional data elements - if(isset($t5->OrderingCustomerNameAddressText) && !empty($t5->OrderingCustomerNameAddressText)){ - $this->SetOrderingCustomerName($t5->OrderingCustomerNameAddressText); + if(isset($t5->OrderingCustomerNameAddressText)){ + $this->SetOrderingCustomerNameAddressText($t5->OrderingCustomerNameAddressText); } - if(isset($t5->OrderingCustomerIdentifier) && !empty($t5->OrderingCustomerIdentifier)){ + if(isset($t5->OrderingCustomerIdentifier)){ $this->SetOrderingCustomerIdentifier($t5->OrderingCustomerIdentifier); } - if(isset($t5->OrderingCustomerOfiIdentifier) && !empty($t5->OrderingCustomerOfiIdentifier)){ + if(isset($t5->OrderingCustomerOfiIdentifier)){ $this->SetOrderingCustomerBIC($t5->OrderingCustomerOfiIdentifier); } } @@ -128,18 +128,18 @@ public function GetReferenceIdentifier() * Set the identification of ordering customer (name and/or address of the buyer) in non-coded form * @param $customerName */ - public function SetOrderingCustomerName($customerName) + public function SetOrderingCustomerNameAddressText($customerName) { - $this->orderingCustomerName = (string) $customerName; + $this->orderingCustomerNameAddress = (string) $customerName; } /** * Get the identification of ordering customer (name and/or address of the buyer) in non-coded form * @return mixed */ - public function GetOrderingCustomerName() + public function GetOrderingCustomerNameAddress() { - return $this->orderingCustomerName; + return $this->orderingCustomerNameAddress; } diff --git a/tests/unit/at/externet/eps_bank_transfer/BankConfirmationDetailsTest.php b/tests/unit/at/externet/eps_bank_transfer/BankConfirmationDetailsTest.php index 0c2fdb2..3545854 100644 --- a/tests/unit/at/externet/eps_bank_transfer/BankConfirmationDetailsTest.php +++ b/tests/unit/at/externet/eps_bank_transfer/BankConfirmationDetailsTest.php @@ -17,6 +17,7 @@ public function setUp() $this->simpleXmls['UnstructuredWithoutSignature'] = new \SimpleXMLElement($this->GetEpsData('BankConfirmationDetailsWithoutSignatureUnstructuredRemittanceIdentifier.xml')); $this->simpleXmls['WithoutSignature'] = new \SimpleXMLElement($this->GetEpsData('BankConfirmationDetailsWithoutSignature.xml')); $this->simpleXmls['UnstructuredWithSignature'] = new \SimpleXMLElement($this->GetEpsData('BankConfirmationDetailsWithSignatureUnstructuredRemittanceIdentifier.xml')); + $this->simpleXmls['WithPaymentInititatorDetails'] = new \SimpleXMLElement($this->GetEpsData('BankConfirmationDetailsWithPaymentInitiatorDetailsWithoutSignature.xml')); } public function testGetRemittanceIdentifier() @@ -75,4 +76,25 @@ public function testGetReferenceIdentifier() $actual = $t->GetReferenceIdentifier(); $this->assertEquals('1234567890ABCDEFG', $actual); } + + public function testGetOrderingCustomerNameAddress() + { + $t = new BankConfirmationDetails($this->simpleXmls['WithPaymentInititatorDetails']); + $actual = $t->GetOrderingCustomerNameAddress(); + $this->assertEquals('Customer Name', $actual); + } + + public function testGetOrderingCustomerIdentifier() + { + $t = new BankConfirmationDetails($this->simpleXmls['WithPaymentInititatorDetails']); + $actual = $t->GetOrderingCustomerIdentifier(); + $this->assertEquals('DE0815', $actual); + } + + public function testGetOrderingCustomerBIC() + { + $t = new BankConfirmationDetails($this->simpleXmls['WithPaymentInititatorDetails']); + $actual = $t->GetOrderingCustomerBIC(); + $this->assertEquals('GERMAN2A', $actual); + } } \ No newline at end of file diff --git a/tests/unit/at/externet/eps_bank_transfer/EpsData/BankConfirmationDetailsWithPaymentInitiatorDetailsWithoutSignature.xml b/tests/unit/at/externet/eps_bank_transfer/EpsData/BankConfirmationDetailsWithPaymentInitiatorDetailsWithoutSignature.xml new file mode 100644 index 0000000..0c23335 --- /dev/null +++ b/tests/unit/at/externet/eps_bank_transfer/EpsData/BankConfirmationDetailsWithPaymentInitiatorDetailsWithoutSignature.xml @@ -0,0 +1,47 @@ + + + + 13212452dea + + + + + 2013-02-28 + 1234567890ABCDEFG + GERMAN2A + DE0815 + Customer Name + + + + GAWIATW1XXX + + + Max Mustermann + AT611904300234573201 + + + + AT1234567890XYZ + 150.00 + SHA + + 2013-02-28 + 11:00:00-05:00 + + + + + SIG + 2013-02-28T09:30:47Z + + + + AAAAAAAAAAA + + 2007-03-19T11:11:00-05:00 + 120000302122320812201106461 + OK + + + \ No newline at end of file