From ac3d28584335d785b02df57dfc6833657c4a00ba Mon Sep 17 00:00:00 2001 From: ngorbacs Date: Tue, 3 Oct 2023 16:10:16 +0200 Subject: [PATCH 1/2] add schemeTransactionIdentifier to Resul/StatusResult --- src/Data/Result/CreditcardData.php | 22 ++++++++++++++++++++++ src/Json/JsonParser.php | 10 ++++++++++ src/StatusApi/StatusResult.php | 25 ++++++++++++++++++++++++- src/Transaction/Result.php | 25 ++++++++++++++++++++++++- src/Xml/Parser.php | 1 + 5 files changed, 81 insertions(+), 2 deletions(-) diff --git a/src/Data/Result/CreditcardData.php b/src/Data/Result/CreditcardData.php index 39ee008..9df8d31 100644 --- a/src/Data/Result/CreditcardData.php +++ b/src/Data/Result/CreditcardData.php @@ -112,6 +112,11 @@ class CreditcardData extends ResultData { */ protected $eci; + /** + * @var string + */ + protected $schemeTransactionIdentifier; + /** * @return string */ @@ -423,6 +428,23 @@ public function setEci($eci) return $this; } + /** + * @return string + */ + public function getSchemeTransactionIdentifier() + { + return $this->schemeTransactionIdentifier; + } + + /** + * @param string $schemeTransactionIdentifier + * @return $this + */ + public function setSchemeTransactionIdentifier($schemeTransactionIdentifier) + { + $this->schemeTransactionIdentifier = $schemeTransactionIdentifier; + return $this; + } /** * @return array diff --git a/src/Json/JsonParser.php b/src/Json/JsonParser.php index d23ac68..db50878 100644 --- a/src/Json/JsonParser.php +++ b/src/Json/JsonParser.php @@ -7,6 +7,7 @@ use Ixopay\Client\Data\ChargebackReversalData; use Ixopay\Client\Data\Customer; use Ixopay\Client\Data\CustomerProfileData; +use Ixopay\Client\Data\Result\CreditcardData; use Ixopay\Client\Data\Result\CreditcardData as ReturnCardData; use Ixopay\Client\Data\Result\IbanData as ReturnIbanData; use Ixopay\Client\Data\Result\PhoneData as ReturnPhoneData; @@ -75,6 +76,10 @@ public function parseTransactionResult($jsonString) { if (isset($json['returnData'])) { $returnData = $this->parseReturnData($json['returnData']); $result->setReturnData($returnData); + + if ($returnData instanceof CreditcardData && !empty($returnData->getSchemeTransactionIdentifier())) { + $result->setSchemeTransactionIdentifier($returnData->getSchemeTransactionIdentifier()); + } } if (isset($json['scheduleData'])) { @@ -161,6 +166,10 @@ public function parseStatusResult($jsonString) { if(isset($json['returnData'])) { $returnData = $this->parseReturnData($json['returnData']); $result->setReturnData($returnData); + + if ($returnData instanceof CreditcardData && !empty($returnData->getSchemeTransactionIdentifier())) { + $result->setSchemeTransactionIdentifier($returnData->getSchemeTransactionIdentifier()); + } } if(isset($json['customer'])) { @@ -326,6 +335,7 @@ protected function parseReturnData($returnData) { $creditcardData->setBinCountry($this->arrGet($returnData, 'binCountry')); $creditcardData->setThreeDSecure($this->arrGet($returnData, 'threeDSecure')); $creditcardData->setEci($this->arrGet($returnData, 'eci')); + $creditcardData->setSchemeTransactionIdentifier($this->arrGet($returnData, 'schemeTransactionIdentifier')); if($this->arrGet($returnData, 'binDigits')){ $binDigits = $this->arrGet($returnData, 'binDigits'); diff --git a/src/StatusApi/StatusResult.php b/src/StatusApi/StatusResult.php index b8f1a45..d70c266 100644 --- a/src/StatusApi/StatusResult.php +++ b/src/StatusApi/StatusResult.php @@ -176,6 +176,11 @@ class StatusResult { */ protected $transactionSplits = []; + /** + * @var string + */ + protected $schemeTransactionIdentifier = null; + /** * @return bool */ @@ -307,7 +312,7 @@ public function setIncomingSettlementState($incomingSettlementState) { $this->incomingSettlementState = $incomingSettlementState; return $this; } - + /** * set transaction errors * @@ -637,6 +642,24 @@ public function setTransactionSplits($transactionSplits) $this->transactionSplits = $transactionSplits; } + /** + * @return string|null + */ + public function getSchemeTransactionIdentifier() + { + return $this->schemeTransactionIdentifier; + } + + /** + * @param $schemeTransactionIdentifier + * @return $this + */ + public function setSchemeTransactionIdentifier($schemeTransactionIdentifier) + { + $this->schemeTransactionIdentifier = $schemeTransactionIdentifier; + return $this; + } + /** * @return array */ diff --git a/src/Transaction/Result.php b/src/Transaction/Result.php index f75d6aa..98ef9a0 100644 --- a/src/Transaction/Result.php +++ b/src/Transaction/Result.php @@ -107,6 +107,11 @@ class Result { */ protected $paymentDescriptor = null; + /** + * @var string + */ + protected $schemeTransactionIdentifier = null; + /** * identifier of the payment method for this transaction * @@ -433,6 +438,24 @@ public function setPaymentDescriptor($paymentDescriptor) { return $this; } + /** + * @return string + */ + public function getSchemeTransactionIdentifier() + { + return $this->schemeTransactionIdentifier; + } + + /** + * @param $schemeTransactionIdentifier + * @return $this + */ + public function setSchemeTransactionIdentifier($schemeTransactionIdentifier) + { + $this->schemeTransactionIdentifier = $schemeTransactionIdentifier; + return $this; + } + /** * @return null|string */ @@ -622,4 +645,4 @@ public function setCustomer($customer) $this->customer = $customer; } -} \ No newline at end of file +} diff --git a/src/Xml/Parser.php b/src/Xml/Parser.php index 7915ee9..9727994 100644 --- a/src/Xml/Parser.php +++ b/src/Xml/Parser.php @@ -470,6 +470,7 @@ protected function parseReturnData(\DOMNode $node) { case 'binCountry': case 'threeDSecure': case 'eci': + case 'schemeTransactionIdentifier': if (method_exists($cc, 'set'.ucfirst($child->localName))) { $cc->{'set' . ucfirst($child->localName)}($child->nodeValue); } From c5a2c6c2a2bcec426405ed532976e1d3761d4e3e Mon Sep 17 00:00:00 2001 From: ngorbacs Date: Thu, 5 Oct 2023 11:29:09 +0200 Subject: [PATCH 2/2] code cleanup --- src/Json/JsonParser.php | 9 --------- src/StatusApi/StatusResult.php | 23 ----------------------- src/Transaction/Result.php | 23 ----------------------- src/Xml/Parser.php | 1 - 4 files changed, 56 deletions(-) diff --git a/src/Json/JsonParser.php b/src/Json/JsonParser.php index db50878..6e94b21 100644 --- a/src/Json/JsonParser.php +++ b/src/Json/JsonParser.php @@ -7,7 +7,6 @@ use Ixopay\Client\Data\ChargebackReversalData; use Ixopay\Client\Data\Customer; use Ixopay\Client\Data\CustomerProfileData; -use Ixopay\Client\Data\Result\CreditcardData; use Ixopay\Client\Data\Result\CreditcardData as ReturnCardData; use Ixopay\Client\Data\Result\IbanData as ReturnIbanData; use Ixopay\Client\Data\Result\PhoneData as ReturnPhoneData; @@ -76,10 +75,6 @@ public function parseTransactionResult($jsonString) { if (isset($json['returnData'])) { $returnData = $this->parseReturnData($json['returnData']); $result->setReturnData($returnData); - - if ($returnData instanceof CreditcardData && !empty($returnData->getSchemeTransactionIdentifier())) { - $result->setSchemeTransactionIdentifier($returnData->getSchemeTransactionIdentifier()); - } } if (isset($json['scheduleData'])) { @@ -166,10 +161,6 @@ public function parseStatusResult($jsonString) { if(isset($json['returnData'])) { $returnData = $this->parseReturnData($json['returnData']); $result->setReturnData($returnData); - - if ($returnData instanceof CreditcardData && !empty($returnData->getSchemeTransactionIdentifier())) { - $result->setSchemeTransactionIdentifier($returnData->getSchemeTransactionIdentifier()); - } } if(isset($json['customer'])) { diff --git a/src/StatusApi/StatusResult.php b/src/StatusApi/StatusResult.php index d70c266..6aae834 100644 --- a/src/StatusApi/StatusResult.php +++ b/src/StatusApi/StatusResult.php @@ -176,11 +176,6 @@ class StatusResult { */ protected $transactionSplits = []; - /** - * @var string - */ - protected $schemeTransactionIdentifier = null; - /** * @return bool */ @@ -642,24 +637,6 @@ public function setTransactionSplits($transactionSplits) $this->transactionSplits = $transactionSplits; } - /** - * @return string|null - */ - public function getSchemeTransactionIdentifier() - { - return $this->schemeTransactionIdentifier; - } - - /** - * @param $schemeTransactionIdentifier - * @return $this - */ - public function setSchemeTransactionIdentifier($schemeTransactionIdentifier) - { - $this->schemeTransactionIdentifier = $schemeTransactionIdentifier; - return $this; - } - /** * @return array */ diff --git a/src/Transaction/Result.php b/src/Transaction/Result.php index 98ef9a0..e545a78 100644 --- a/src/Transaction/Result.php +++ b/src/Transaction/Result.php @@ -107,11 +107,6 @@ class Result { */ protected $paymentDescriptor = null; - /** - * @var string - */ - protected $schemeTransactionIdentifier = null; - /** * identifier of the payment method for this transaction * @@ -438,24 +433,6 @@ public function setPaymentDescriptor($paymentDescriptor) { return $this; } - /** - * @return string - */ - public function getSchemeTransactionIdentifier() - { - return $this->schemeTransactionIdentifier; - } - - /** - * @param $schemeTransactionIdentifier - * @return $this - */ - public function setSchemeTransactionIdentifier($schemeTransactionIdentifier) - { - $this->schemeTransactionIdentifier = $schemeTransactionIdentifier; - return $this; - } - /** * @return null|string */ diff --git a/src/Xml/Parser.php b/src/Xml/Parser.php index 9727994..7915ee9 100644 --- a/src/Xml/Parser.php +++ b/src/Xml/Parser.php @@ -470,7 +470,6 @@ protected function parseReturnData(\DOMNode $node) { case 'binCountry': case 'threeDSecure': case 'eci': - case 'schemeTransactionIdentifier': if (method_exists($cc, 'set'.ucfirst($child->localName))) { $cc->{'set' . ucfirst($child->localName)}($child->nodeValue); }