From 3be6f59f3550c8ceba2b731090cf780dc0defe2a Mon Sep 17 00:00:00 2001 From: PRABU KUPPUSAMY Date: Sun, 2 Apr 2023 17:38:05 +0530 Subject: [PATCH] pos terminal payment update --- src/Client.php | 6 +++++- src/Request/CreatePayment.php | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index adc0b68..764ceb5 100755 --- a/src/Client.php +++ b/src/Client.php @@ -38,7 +38,11 @@ class Client extends Request */ public function createPayment(CreatePayment $request) { - $result = $this->request('POST', '/payment-requests', (array)$request); + $requestArray = (array)$request; + if (!(isset($requestArray['wifi_terminal_id']) && !empty($requestArray['wifi_terminal_id']))) { + unset($requestArray['wifi_terminal_id']); + } + $result = $this->request('POST', '/payment-requests', $requestArray); return new CreatePaymentResponse($result); } diff --git a/src/Request/CreatePayment.php b/src/Request/CreatePayment.php index 3105a0c..c76549c 100644 --- a/src/Request/CreatePayment.php +++ b/src/Request/CreatePayment.php @@ -346,4 +346,26 @@ public function setChannel($channel) return $this; } + + /** + * @param string $payment_method + * @return CreatePayment + */ + public function setPaymentMethod($payment_method) + { + $this->payment_methods[] = $payment_method; + + return $this; + } + + /** + * @param string $wifi_terminal_id + * @return CreatePayment + */ + public function setWifiTerminalId($wifi_terminal_id) + { + $this->wifi_terminal_id = $wifi_terminal_id; + + return $this; + } } \ No newline at end of file