From dc8abaeab0d452321376b369a3618861f0d1a274 Mon Sep 17 00:00:00 2001 From: Alsharie Date: Tue, 16 May 2023 15:01:32 +0300 Subject: [PATCH] fixes --- README.md | 2 +- config/cashPay.php | 2 +- src/CashPay.php | 17 +++++++++++------ src/Guzzle.php | 6 +++--- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1285dfb..d362f11 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ return [ 'password' => env('CASHPAY_CERT_PASSWORD'), ], 'url' => [ - 'base' => env('CASHPAY_BASE_URL', 'https://www.tamkeen.com.ye:33291'), + 'base' => env('CASHPAY_BASE_URL', 'https://www.tamkeen.com.ye:33291/CashPG'), ] ]; ``` diff --git a/config/cashPay.php b/config/cashPay.php index b942fbd..8335bc7 100644 --- a/config/cashPay.php +++ b/config/cashPay.php @@ -11,6 +11,6 @@ 'password' => env('CASHPAY_CERT_PASSWORD'), ], 'url' => [ - 'base' => env('CASHPAY_BASE_URL', 'https://www.tamkeen.com.ye:33291'), + 'base' => env('CASHPAY_BASE_URL', 'https://www.tamkeen.com.ye:33291/CashPG'), ] ]; diff --git a/src/CashPay.php b/src/CashPay.php index a5949df..fb9b150 100644 --- a/src/CashPay.php +++ b/src/CashPay.php @@ -25,8 +25,8 @@ public function initPayment() $this->setEncPassword(); $this->generateMDToken(); - if(!isset($this->attributes['CurrencyId'])){ - $this->attributes['CurrencyId']=2;//rial Yemeni + if (!isset($this->attributes['CurrencyId'])) { + $this->attributes['CurrencyId'] = 2;//rial Yemeni } try { @@ -39,7 +39,9 @@ public function initPayment() return new CashPayInitPaymentResponse((string)$response->getBody()); } catch (\GuzzleHttp\Exception\RequestException $e) { - return new CashPayErrorResponse($e->getResponse()->getBody(),$e->getResponse()->getStatusCode()); + return new CashPayErrorResponse($e->getResponse()->getBody(), $e->getResponse()->getStatusCode()); + } catch (\Exception $e) { + return new CashPayErrorResponse($e->getMessage(), $e->getCode()); } } @@ -67,12 +69,13 @@ public function confirmPayment() return new CashPayConfirmPaymentResponse((string)$response->getBody()); } catch (\GuzzleHttp\Exception\RequestException $e) { - return new CashPayErrorResponse($e->getResponse()->getBody(),$e->getResponse()->getStatusCode()); + return new CashPayErrorResponse($e->getResponse()->getBody(), $e->getResponse()->getStatusCode()); + } catch (\Exception $e) { + return new CashPayErrorResponse($e->getMessage(), $e->getCode()); } } - /** * It is used to check the state of an operation ( It is useful in cases of time out). * @return CashPayOperationStatusResponse|CashPayErrorResponse @@ -96,7 +99,9 @@ public function operationStatus() return new CashPayOperationStatusResponse((string)$response->getBody()); } catch (\GuzzleHttp\Exception\RequestException $e) { - return new CashPayErrorResponse($e->getResponse()->getBody(),$e->getResponse()->getStatusCode()); + return new CashPayErrorResponse($e->getResponse()->getBody(), $e->getResponse()->getStatusCode()); + } catch (\Exception $e) { + return new CashPayErrorResponse($e->getMessage(), $e->getCode()); } } diff --git a/src/Guzzle.php b/src/Guzzle.php index 903eeed..4dce39c 100644 --- a/src/Guzzle.php +++ b/src/Guzzle.php @@ -71,19 +71,19 @@ protected function sendRequest($path, $attributes, $headers, $security = [], str protected function getInitPaymentPath(): string { - return $this->basePath . '/' . "CashPG/api/CashPay/InitPayment"; + return $this->basePath . '/' . "api/CashPay/InitPayment"; } protected function getConfirmPaymentPath(): string { - return $this->basePath . '/' . "CashPG/api/CashPay/ConfirmPayment"; + return $this->basePath . '/' . "api/CashPay/ConfirmPayment"; } protected function getOperationStatusPath(): string { - return $this->basePath . '/' . "CashPG/api/Operation/OperationStatus"; + return $this->basePath . '/' . "api/Operation/OperationStatus"; }