From 888d665a9c4798ce7aca1ce8b36553f171e53505 Mon Sep 17 00:00:00 2001 From: rorymac69 Date: Sun, 4 Jul 2021 03:16:58 +0200 Subject: [PATCH 1/2] fix irregular response name for processRefund method --- src/FixSoftware/WebpayWS/Response.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/FixSoftware/WebpayWS/Response.php b/src/FixSoftware/WebpayWS/Response.php index 52f3766..c2d7142 100644 --- a/src/FixSoftware/WebpayWS/Response.php +++ b/src/FixSoftware/WebpayWS/Response.php @@ -30,7 +30,9 @@ class Response { private $soapWrapperName; /** @var array */ - private $soapWrapperNameIrregulars = []; + private $soapWrapperNameIrregulars = [ + 'processRefund' => 'refundRequest', + ]; /** @var array */ private $soapData; @@ -46,7 +48,7 @@ class Response { public function __construct($method, $messageId, $soapData, $soapWrapperNameIrregulars = []) { - $this->soapWrapperNameIrregulars = $soapWrapperNameIrregulars; + $this->soapWrapperNameIrregulars = array_merge($soapWrapperNameIrregulars, $this->soapWrapperNameIrregulars); $this->method = $method; $this->messageId = $messageId; From 917349dcb4f2f77d6402e1a0f89fe828fe7aca3c Mon Sep 17 00:00:00 2001 From: rorymac69 Date: Thu, 30 Sep 2021 02:09:18 +0200 Subject: [PATCH 2/2] add irregular request/response names for all methods --- src/FixSoftware/WebpayWS/Api.php | 16 +++++++++++++--- src/FixSoftware/WebpayWS/Request.php | 4 ++-- src/FixSoftware/WebpayWS/Response.php | 8 +++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/FixSoftware/WebpayWS/Api.php b/src/FixSoftware/WebpayWS/Api.php index 7a7df8a..b9cf72e 100644 --- a/src/FixSoftware/WebpayWS/Api.php +++ b/src/FixSoftware/WebpayWS/Api.php @@ -6,8 +6,18 @@ class Api { /** @var array */ private $soapWrapperNameIrregulars = [ - 'processMasterPaymentRevoke' => 'masterPaymentStatus' - // TODO: add other irregularities + 'processMasterPaymentRevoke' => [ + 'request' => 'masterPaymentStatusRequest', + 'response' => 'masterPaymentStatusResponse', + ], + 'processBatchClose' => [ + 'request' => 'batchClose', + 'response' => 'batchCloseResponse', + ], + 'processRefund' => [ + 'request' => 'refundRequest', + 'response' => 'refundRequestResponse', + ], ]; /** @var Config */ @@ -83,4 +93,4 @@ public function getResponse() { } -} \ No newline at end of file +} diff --git a/src/FixSoftware/WebpayWS/Request.php b/src/FixSoftware/WebpayWS/Request.php index 69cb42f..d04bac7 100644 --- a/src/FixSoftware/WebpayWS/Request.php +++ b/src/FixSoftware/WebpayWS/Request.php @@ -81,7 +81,7 @@ public function getSoapMethod() { public function getSoapWrapperName() { if(isset($this->soapWrapperNameIrregulars[$this->method])) - return $this->soapWrapperNameIrregulars[$this->method] . 'Request'; + return $this->soapWrapperNameIrregulars[$this->method]['request']; return lcfirst(substr($this->method, $this->ucpos($this->method))) . 'Request'; @@ -92,4 +92,4 @@ private function ucpos($subject) { return $n ? $matches[0][1] : false; } -} \ No newline at end of file +} diff --git a/src/FixSoftware/WebpayWS/Response.php b/src/FixSoftware/WebpayWS/Response.php index c2d7142..bf17ec1 100644 --- a/src/FixSoftware/WebpayWS/Response.php +++ b/src/FixSoftware/WebpayWS/Response.php @@ -30,9 +30,7 @@ class Response { private $soapWrapperName; /** @var array */ - private $soapWrapperNameIrregulars = [ - 'processRefund' => 'refundRequest', - ]; + private $soapWrapperNameIrregulars = []; /** @var array */ private $soapData; @@ -48,7 +46,7 @@ class Response { public function __construct($method, $messageId, $soapData, $soapWrapperNameIrregulars = []) { - $this->soapWrapperNameIrregulars = array_merge($soapWrapperNameIrregulars, $this->soapWrapperNameIrregulars); + $this->soapWrapperNameIrregulars = $soapWrapperNameIrregulars; $this->method = $method; $this->messageId = $messageId; @@ -120,7 +118,7 @@ public function getError() { public function getSoapWrapperName() { if(isset($this->soapWrapperNameIrregulars[$this->method])) - return $this->soapWrapperNameIrregulars[$this->method] . 'Response'; + return $this->soapWrapperNameIrregulars[$this->method]['response']; return lcfirst(substr($this->method, $this->ucpos($this->method))) . 'Response';