Skip to content

Commit

Permalink
Add tests for OrderingCustomer*
Browse files Browse the repository at this point in the history
  • Loading branch information
hakito committed Dec 3, 2017
1 parent 90afeed commit 53a11b5
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/BankConfirmationDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BankConfirmationDetails
private $remittanceIdentifier;
private $paymentReferenceIdentifier;
private $referenceIdentifier;
private $orderingCustomerName;
private $orderingCustomerNameAddress;
private $orderingCustomerIdentifier;
private $orderingCustomerBIC;
private $sessionId;
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<epsp:EpsProtocolDetails SessionLanguage="DE" xsi:schemaLocation="http://www.stuzza.at/namespaces/eps/protocol/2013/02 EPSProtocol-V25.xsd" xmlns:atrul="http://www.stuzza.at/namespaces/eps/austrianrules/2013/02" xmlns:epi="http://www.stuzza.at/namespaces/eps/epi/2013/02" xmlns:eps="http://www.stuzza.at/namespaces/eps/payment/2013/02" xmlns:epsp="http://www.stuzza.at/namespaces/eps/protocol/2013/02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<epsp:BankConfirmationDetails>
<epsp:SessionId>13212452dea</epsp:SessionId>
<eps:PaymentConfirmationDetails>
<eps:PaymentInitiatorDetails>
<epi:EpiDetails>
<epi:IdentificationDetails>
<epi:Date>2013-02-28</epi:Date>
<epi:ReferenceIdentifier>1234567890ABCDEFG</epi:ReferenceIdentifier>
<epi:OrderingCustomerOfiIdentifier>GERMAN2A</epi:OrderingCustomerOfiIdentifier>
<epi:OrderingCustomerIdentifier>DE0815</epi:OrderingCustomerIdentifier>
<epi:OrderingCustomerNameAddressText>Customer Name</epi:OrderingCustomerNameAddressText>
</epi:IdentificationDetails>
<epi:PartyDetails>
<epi:BfiPartyDetails>
<epi:BfiBicIdentifier>GAWIATW1XXX</epi:BfiBicIdentifier>
</epi:BfiPartyDetails>
<epi:BeneficiaryPartyDetails>
<epi:BeneficiaryNameAddressText>Max Mustermann</epi:BeneficiaryNameAddressText>
<epi:BeneficiaryAccountIdentifier>AT611904300234573201</epi:BeneficiaryAccountIdentifier>
</epi:BeneficiaryPartyDetails>
</epi:PartyDetails>
<epi:PaymentInstructionDetails>
<epi:RemittanceIdentifier>AT1234567890XYZ</epi:RemittanceIdentifier>
<epi:InstructedAmount AmountCurrencyIdentifier="EUR">150.00</epi:InstructedAmount>
<epi:ChargeCode>SHA</epi:ChargeCode>
<epi:DateOptionDetails DateSpecificationCode="CRD">
<epi:OptionDate>2013-02-28</epi:OptionDate>
<epi:OptionTime>11:00:00-05:00</epi:OptionTime>
</epi:DateOptionDetails>
</epi:PaymentInstructionDetails>
</epi:EpiDetails>
<atrul:AustrianRulesDetails>
<atrul:DigSig>SIG</atrul:DigSig>
<atrul:ExpirationTime>2013-02-28T09:30:47Z</atrul:ExpirationTime>
</atrul:AustrianRulesDetails>
</eps:PaymentInitiatorDetails>
<eps:PayConApprovingUnitDetails>
<eps:ApprovingUnitBankIdentifier>AAAAAAAAAAA</eps:ApprovingUnitBankIdentifier>
</eps:PayConApprovingUnitDetails>
<eps:PayConApprovalTime>2007-03-19T11:11:00-05:00</eps:PayConApprovalTime>
<eps:PaymentReferenceIdentifier>120000302122320812201106461</eps:PaymentReferenceIdentifier>
<eps:StatusCode>OK</eps:StatusCode>
</eps:PaymentConfirmationDetails>
</epsp:BankConfirmationDetails>
</epsp:EpsProtocolDetails>

0 comments on commit 53a11b5

Please sign in to comment.