From 29544213df18e45427c2de7cd1216005f40d08f2 Mon Sep 17 00:00:00 2001 From: Sabrina Buchegger Date: Tue, 23 Nov 2021 09:11:03 +0100 Subject: [PATCH] add country code to wallet data --- src/Data/PaymentData/WalletData.php | 18 ++++++++++++++++++ src/Data/Result/WalletData.php | 24 ++++++++++++++++++++++++ src/Json/JsonGenerator.php | 4 ++++ src/Json/JsonParser.php | 1 + src/Xml/Parser.php | 3 +++ 5 files changed, 50 insertions(+) diff --git a/src/Data/PaymentData/WalletData.php b/src/Data/PaymentData/WalletData.php index 36708da..ef272c0 100644 --- a/src/Data/PaymentData/WalletData.php +++ b/src/Data/PaymentData/WalletData.php @@ -21,6 +21,8 @@ class WalletData extends PaymentData { protected $walletOwnerFirstName; /** @var string */ protected $walletOwnerLastName; + /** @var string */ + protected $walletOwnerCountryCode; /** * @return string @@ -111,4 +113,20 @@ public function setWalletOwnerLastName($walletOwnerLastName) $this->walletOwnerLastName = $walletOwnerLastName; } + /** + * @return string + */ + public function getWalletOwnerCountryCode() + { + return $this->walletOwnerCountryCode; + } + + /** + * @param string $walletOwnerCountryCode + */ + public function setWalletOwnerCountryCode($walletOwnerCountryCode) + { + $this->walletOwnerCountryCode = $walletOwnerCountryCode; + } + } diff --git a/src/Data/Result/WalletData.php b/src/Data/Result/WalletData.php index 4cd1522..b4f2c52 100644 --- a/src/Data/Result/WalletData.php +++ b/src/Data/Result/WalletData.php @@ -35,6 +35,11 @@ class WalletData extends ResultData { */ protected $walletOwnerLastName; + /** + * @var string + */ + protected $walletOwnerCountryCode; + /** * @return string */ @@ -113,6 +118,21 @@ public function setWalletOwnerLastName($walletOwnerLastName) $this->walletOwnerLastName = $walletOwnerLastName; } + /** + * @return string + */ + public function getWalletOwnerCountryCode() + { + return $this->walletOwnerCountryCode; + } + + /** + * @param string $walletOwnerCountryCode + */ + public function setWalletOwnerCountryCode($walletOwnerCountryCode) + { + $this->walletOwnerCountryCode = $walletOwnerCountryCode; + } /** * @return array @@ -132,6 +152,10 @@ public function toArray() { $result['walletOwnerLastName'] = $this->walletOwnerLastName; } + if (!empty($this->walletOwnerCountryCode)) { + $result['walletOwnerCountryCode'] = $this->walletOwnerCountryCode; + } + return $result; } diff --git a/src/Json/JsonGenerator.php b/src/Json/JsonGenerator.php index 28fb604..9c93ee0 100644 --- a/src/Json/JsonGenerator.php +++ b/src/Json/JsonGenerator.php @@ -474,6 +474,10 @@ protected function createPaymentData($paymentData){ if (!empty($paymentData->getWalletOwnerLastName())) { $data['walletData']['walletOwnerLastName'] = $paymentData->getWalletOwnerLastName(); } + + if (!empty($paymentData->getWalletOwnerCountryCode())) { + $data['walletData']['walletOwnerCountryCode'] = $paymentData->getWalletOwnerCountryCode(); + } } return $data; diff --git a/src/Json/JsonParser.php b/src/Json/JsonParser.php index b9f8c17..4b413fb 100644 --- a/src/Json/JsonParser.php +++ b/src/Json/JsonParser.php @@ -348,6 +348,7 @@ protected function parseReturnData($returnData) { $walletData->setWalletType($this->arrGet($returnData, 'walletType')); $walletData->setWalletOwnerFirstName($this->arrGet($returnData, 'walletOwnerFirstName')); $walletData->setWalletOwnerLastName($this->arrGet($returnData, 'walletOwnerLastName')); + $walletData->setWalletOwnerCountryCode($this->arrGet($returnData, 'walletOwnerCountryCode')); return $walletData; diff --git a/src/Xml/Parser.php b/src/Xml/Parser.php index 1de9024..7915ee9 100644 --- a/src/Xml/Parser.php +++ b/src/Xml/Parser.php @@ -576,6 +576,9 @@ protected function parseReturnData(\DOMNode $node) { case 'walletOwnerLastName': $walletData->setWalletOwnerLastName($child->nodeValue); break; + case 'walletOwnerCountryCode': + $walletData->setWalletOwnerCountryCode($child->nodeValue); + break; default: break; }