diff --git a/src/Gateway.php b/src/Gateway.php index 8e223ca..5756a37 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -46,11 +46,8 @@ public function getDefaultParameters(): array { return [ 'testMode' => FALSE, -<<<<<<< HEAD 'currency' => 'AED', 'language' => 'en', -======= ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 ]; } @@ -94,7 +91,6 @@ public function refund(array $options = []) return $this->createRequest(RefundRequest::class, $options); } -<<<<<<< HEAD public function setAccessCode($code) { return $this->setParameter('access_code', $code); @@ -156,8 +152,6 @@ public function setFortId($fort_id) return $this; } -======= ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 /** * @param string $requestPhrase * diff --git a/src/Message/Request/APSAbstractRequest.php b/src/Message/Request/APSAbstractRequest.php index ecdd4df..48ec351 100644 --- a/src/Message/Request/APSAbstractRequest.php +++ b/src/Message/Request/APSAbstractRequest.php @@ -21,29 +21,22 @@ public function sendData($data): ResponseInterface // Sort array by key ascending ksort($data); - $data['signature'] = $this->_createSignature($data); + echo $data['signature'] = $this->_createSignature($data); $httpResponse = $this->httpClient->request( 'POST', $this->getEndpoint(), [ -<<<<<<< HEAD -======= - 'Accept' => 'application/json', ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 'Content-type' => 'application/json', ], json_encode($data) ); -<<<<<<< HEAD if ($httpResponse->getStatusCode() != 200) { throw new \Exception($httpResponse->getReasonPhrase(), $httpResponse->getStatusCode()); } -======= ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 $json = $httpResponse->getBody()->getContents(); $data = !empty($json) ? json_decode($json, true) : []; @@ -77,7 +70,6 @@ protected function getEndpoint(): string */ private function _createSignature(array $data): string { -<<<<<<< HEAD unset($data['testMode']); unset($data['Mode']); @@ -91,22 +83,12 @@ private function _createSignature(array $data): string { if (empty($value)) continue; -======= - $shaType = $this->hasParameter('sha_type') ? $this->hasParameter('sha_type') : self::DEFAULT_SHA_TYPE; - - if ( ! $this->hasParameter('request_phrase')) - throw new RequestPhraseException('Request phrase is missing.'); - - foreach ($data as $key => $value) - { ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 $shaString .= "$key=$value"; } // "Glue" phrase to the both sides of the payload $shaString = $this->getParameter('request_phrase') . $shaString . $this->getParameter('request_phrase'); -<<<<<<< HEAD return hash_hmac($shaType, $shaString, $this->getParameter('request_phrase')); } @@ -178,8 +160,5 @@ public function setFortId($fort_id) protected function _is_json_response($string) { json_decode($string); return json_last_error() === JSON_ERROR_NONE; -======= - return hash($shaType, $shaString); ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 } } \ No newline at end of file diff --git a/src/Message/Request/AbstractCheckoutRequest.php b/src/Message/Request/AbstractCheckoutRequest.php index dfc66e3..c26f6fe 100644 --- a/src/Message/Request/AbstractCheckoutRequest.php +++ b/src/Message/Request/AbstractCheckoutRequest.php @@ -1,8 +1,7 @@ validate('access_code', 'merchant_identifier', 'merchant_reference', 'amount', 'currency', 'language', 'customer_email'); -======= - private $test_endpoint = 'https://sbcheckout.payfort.com/FortAPI/paymentPage'; - - private $live_endpoint = 'https://checkout.payfort.com/FortAPI/paymentPage'; - - public function validateData() - { - $this->validate('access_code', 'merchant_identifier', 'merchant_reference', 'amount', 'currency', 'language', 'customer_email', 'signature'); ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 } } \ No newline at end of file diff --git a/src/Message/Request/AuthorizationRequest.php b/src/Message/Request/AuthorizationRequest.php index ccf3f19..403e060 100644 --- a/src/Message/Request/AuthorizationRequest.php +++ b/src/Message/Request/AuthorizationRequest.php @@ -14,7 +14,6 @@ public function getData(): array $this->validateData(); return [ -<<<<<<< HEAD 'command' => self::COMMAND, 'testMode' => $this->getParameter('testMode'), 'access_code' => $this->getParameter('access_code'), @@ -25,9 +24,6 @@ public function getData(): array 'language' => $this->getParameter('language'), 'customer_email' => $this->getParameter('customer_email'), 'order_description' => $this->getParameter('order_description'), -======= - 'command' => self::COMMAND, ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 ]; } diff --git a/src/Message/Request/CaptureRequest.php b/src/Message/Request/CaptureRequest.php index ca5d2ae..8d48f70 100644 --- a/src/Message/Request/CaptureRequest.php +++ b/src/Message/Request/CaptureRequest.php @@ -7,15 +7,9 @@ class CaptureRequest extends APSAbstractRequest { const COMMAND = 'CAPTURE'; -<<<<<<< HEAD protected $test_endpoint = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi'; protected $live_endpoint = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; -======= - private $test_endpoint = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi'; - - private $live_endpoint = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 /** * @return mixed @@ -23,7 +17,6 @@ class CaptureRequest extends APSAbstractRequest */ public function getData(): array { -<<<<<<< HEAD $this->validate('access_code', 'merchant_identifier', 'merchant_reference', 'amount', 'currency', 'language'); return [ @@ -37,12 +30,6 @@ public function getData(): array 'language' => $this->getParameter('language'), 'order_description' => $this->getParameter('order_description'), 'fort_id' => $this->getParameter('fort_id'), -======= - $this->validate('access_code', 'merchant_identifier', 'merchant_reference', 'amount', 'currency', 'language', 'signature'); - - return [ - 'command' => self::COMMAND, ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 ]; } diff --git a/src/Message/Request/PurchaseRequest.php b/src/Message/Request/PurchaseRequest.php index 1470b92..5249b81 100644 --- a/src/Message/Request/PurchaseRequest.php +++ b/src/Message/Request/PurchaseRequest.php @@ -15,7 +15,6 @@ public function getData(): array return [ 'command' => self::COMMAND, -<<<<<<< HEAD 'testMode' => $this->getParameter('testMode'), 'access_code' => $this->getParameter('access_code'), 'merchant_identifier' => $this->getParameter('merchant_identifier'), @@ -25,17 +24,11 @@ public function getData(): array 'language' => $this->getParameter('language'), 'customer_email' => $this->getParameter('customer_email'), 'order_description' => $this->getParameter('order_description'), -======= ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 ]; } /** * @param array $data -<<<<<<< HEAD -======= - * ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 * @return PurchaseResponse * @throws \Omnipay\Common\Exception\InvalidResponseException */ @@ -43,8 +36,5 @@ protected function createResponse(array $data): PurchaseResponse { return new PurchaseResponse($this, $data); } -<<<<<<< HEAD -======= ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 } diff --git a/src/Message/Request/RefundRequest.php b/src/Message/Request/RefundRequest.php index 33573bb..11f25d8 100644 --- a/src/Message/Request/RefundRequest.php +++ b/src/Message/Request/RefundRequest.php @@ -7,15 +7,9 @@ class RefundRequest extends APSAbstractRequest { const COMMAND = 'REFUND'; -<<<<<<< HEAD protected $test_endpoint = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi'; protected $live_endpoint = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; -======= - private $test_endpoint = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi'; - - private $live_endpoint = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 /** * @return mixed @@ -24,7 +18,6 @@ class RefundRequest extends APSAbstractRequest */ public function getData(): array { -<<<<<<< HEAD $this->validate('access_code', 'merchant_identifier', 'merchant_reference', 'amount', 'currency', 'language'); return [ @@ -38,12 +31,6 @@ public function getData(): array 'language' => $this->getParameter('language'), 'order_description' => $this->getParameter('order_description'), 'fort_id' => $this->getParameter('fort_id'), -======= - $this->validate('access_code', 'merchant_identifier', 'merchant_reference', 'amount', 'currency', 'language', 'signature'); - - return [ - 'command' => self::COMMAND, ->>>>>>> 24428a5b7399bc46a68f08187fb62fe42a45d455 ]; }