From 072e969f723ff930f041713b23cfb0e670a1477f Mon Sep 17 00:00:00 2001 From: g0dReVeN Date: Wed, 20 May 2020 15:05:45 +0200 Subject: [PATCH 1/2] Updated repeatedPayment request's payload --- src/Api/Factory/PaymentScheme.php | 4 ++-- src/Api/PaymentMethods/CopyAndPay.php | 4 +++- src/Api/PaymentMethods/ServerToServer.php | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Api/Factory/PaymentScheme.php b/src/Api/Factory/PaymentScheme.php index 92fd147..4bc3d6a 100644 --- a/src/Api/Factory/PaymentScheme.php +++ b/src/Api/Factory/PaymentScheme.php @@ -24,7 +24,7 @@ abstract class PaymentScheme public function __construct(Setting $settings) { - + $this->settings = $settings; $this->client = new Client([ 'base_uri' => $this->getApiUri(), @@ -40,7 +40,7 @@ public function __construct(Setting $settings) //abstract protected function registerCardDuringPayment(CardBuilder $card); - abstract protected function repeatedPayment(PaymentCard $card, object $owner, int $amount, string $type); + abstract protected function repeatedPayment(PaymentCard $card, object $owner, int $amount, string $customerName, $invoiceId, string $type); abstract protected function oneClickPayment(PaymentCard $card, int $amount); diff --git a/src/Api/PaymentMethods/CopyAndPay.php b/src/Api/PaymentMethods/CopyAndPay.php index 96c1359..01e9de7 100644 --- a/src/Api/PaymentMethods/CopyAndPay.php +++ b/src/Api/PaymentMethods/CopyAndPay.php @@ -151,11 +151,13 @@ public function registerCardDuringPayment(int $amount, $preAuth = false) * @param PaymentCard $card * @param $owner * @param int $amount + * @param string $customerName + * @param string $invoiceId * @param string $type * * @return mixed|\Psr\Http\Message\ResponseInterface */ - public function repeatedPayment(PaymentCard $card, $owner, int $amount, string $type = PaymentScheme::REPEATED_PAYMENT) + public function repeatedPayment(PaymentCard $card, $owner, int $amount, string $customerName = null, $invoiceId = null, string $type = PaymentScheme::REPEATED_PAYMENT) { try { return $this->client->request( diff --git a/src/Api/PaymentMethods/ServerToServer.php b/src/Api/PaymentMethods/ServerToServer.php index f2806b8..f02e266 100644 --- a/src/Api/PaymentMethods/ServerToServer.php +++ b/src/Api/PaymentMethods/ServerToServer.php @@ -89,10 +89,12 @@ public function registerCardDuringPayment(CardBuilder $card, int $amount) * @param $owner * @param int $amount * @param string $type + * @param string $customerName + * @param string $invoiceId * * @return mixed|\Psr\Http\Message\ResponseInterface */ - public function repeatedPayment(PaymentCard $card, $owner, int $amount, string $type = PaymentScheme::REPEATED_PAYMENT) + public function repeatedPayment(PaymentCard $card, $owner, int $amount, string $customerName = null, $invoiceId = null, string $type = PaymentScheme::REPEATED_PAYMENT) { try { $response = $this->client->request( @@ -106,6 +108,8 @@ public function repeatedPayment(PaymentCard $card, $owner, int $amount, string $ 'paymentType' => self::DEBIT, 'recurringType' => $type, 'merchantTransactionId' => class_basename($owner) . '-' . $owner->id, + 'customer.givenName' => $customerName, + 'merchantInvoiceId' => $invoiceId, ], ] )->getBody()->getContents(); From 0911aed0f0c89fade3634fcc25d1f5c431af7ebc Mon Sep 17 00:00:00 2001 From: Jordan Govender <42699212+g0dReVeN@users.noreply.github.com> Date: Wed, 20 May 2020 16:00:13 +0200 Subject: [PATCH 2/2] Update ServerToServer.php --- src/Api/PaymentMethods/ServerToServer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Api/PaymentMethods/ServerToServer.php b/src/Api/PaymentMethods/ServerToServer.php index f02e266..b6e4370 100644 --- a/src/Api/PaymentMethods/ServerToServer.php +++ b/src/Api/PaymentMethods/ServerToServer.php @@ -109,7 +109,7 @@ public function repeatedPayment(PaymentCard $card, $owner, int $amount, string $ 'recurringType' => $type, 'merchantTransactionId' => class_basename($owner) . '-' . $owner->id, 'customer.givenName' => $customerName, - 'merchantInvoiceId' => $invoiceId, + 'merchantInvoiceId' => $invoiceId ], ] )->getBody()->getContents();