diff --git a/src/Adapter/AdapterInterface.php b/src/Adapter/AdapterInterface.php index a5686aa..520829e 100755 --- a/src/Adapter/AdapterInterface.php +++ b/src/Adapter/AdapterInterface.php @@ -15,6 +15,11 @@ public function setParameters(array $parameters = []): AdapterInterface; */ public function form(): string; + /** + * @return array + */ + public function formParams(): array; + /** * @return bool */ diff --git a/src/Adapter/Mellat.php b/src/Adapter/Mellat.php index 77f3b74..d098b85 100755 --- a/src/Adapter/Mellat.php +++ b/src/Adapter/Mellat.php @@ -96,6 +96,20 @@ protected function generateForm() ]); } + /** + * @return array + * @throws Exception + */ + public function formParams(): array + { + $refId = $this->requestToken(); + + return [ + 'endPoint' => $this->getEndPoint(), + 'refId' => $refId, + ]; + } + /** * @return bool * @throws Exception diff --git a/src/Adapter/Parsian.php b/src/Adapter/Parsian.php index dd48582..a601274 100755 --- a/src/Adapter/Parsian.php +++ b/src/Adapter/Parsian.php @@ -107,6 +107,21 @@ protected function generateForm(): string ]); } + /** + * @return array + * @throws Exception + * @throws \Tartan\Larapay\Adapter\Exception + */ + public function fromParams(): array + { + $authority = $this->requestToken(); + + return [ + 'endPoint' => $this->getEndPoint(), + 'refId' => $authority, + ]; + } + /** * @return bool * @throws Exception diff --git a/src/Adapter/Pasargad.php b/src/Adapter/Pasargad.php index 7f38ea6..6a3f7aa 100644 --- a/src/Adapter/Pasargad.php +++ b/src/Adapter/Pasargad.php @@ -67,6 +67,49 @@ protected function generateForm(): string )); } + /** + * @return array + * @throws Exception + */ + public function formParams(): array + { + $this->checkRequiredParameters([ + 'amount', + 'order_id', + 'redirect_url' + ]); + + $processor = new RSAProcessor(config('larapay.pasargad.certificate_path'), RSAKeyType::XMLFile); + + $url = $this->getEndPoint(); + $redirectUrl = $this->redirect_url; + $invoiceNumber = $this->order_id; + $amount = $this->amount; + $terminalCode = config('larapay.pasargad.terminalId'); + $merchantCode = config('larapay.pasargad.merchantId'); + $timeStamp = date("Y/m/d H:i:s"); + $invoiceDate = date("Y/m/d H:i:s"); + $action = 1003; // sell code + + $data = "#" . $merchantCode . "#" . $terminalCode . "#" . $invoiceNumber . "#" . $invoiceDate . "#" . $amount . "#" . $redirectUrl . "#" . $action . "#" . $timeStamp . "#"; + $data = sha1($data, true); + $data = $processor->sign($data); // امضاي ديجيتال + $sign = base64_encode($data); // base64_encode + + return [ + 'url' => $url, + 'redirectUrl' => $redirectUrl, + 'invoiceNumber' => $invoiceNumber, + 'invoiceDate' => $invoiceDate, + 'amount' => $amount, + 'terminalCode' => $terminalCode, + 'merchantCode' => $merchantCode, + 'timeStamp' => $timeStamp, + 'action' => $action, + 'sign' => $sign, + ]; + } + // public function inquiryTransaction () // { // diff --git a/src/Adapter/Payir.php b/src/Adapter/Payir.php index 009af12..f4b67a9 100755 --- a/src/Adapter/Payir.php +++ b/src/Adapter/Payir.php @@ -89,6 +89,20 @@ protected function generateForm(): string ]); } + /** + * @return array + * @throws Exception + * @throws \Tartan\Larapay\Adapter\Exception + */ + public function formParams(): array + { + $authority = $this->requestToken(); + + return [ + 'endPoint' => $this->endPointForm . $authority, + ]; + } + /** * @return bool * @throws Exception diff --git a/src/Adapter/Saderat.php b/src/Adapter/Saderat.php index 5d46bc7..c1ac0df 100755 --- a/src/Adapter/Saderat.php +++ b/src/Adapter/Saderat.php @@ -1,4 +1,5 @@ public_key_path)) { - throw new Exception('larapay::larapay.saderat.errors.public_key_file_not_found'); - } - - if (!file_exists($this->private_key_path)) { - throw new Exception('larapay::larapay.saderat.errors.private_key_file_not_found'); - } - - $this->public_key = trim(file_get_contents($this->public_key_path)); - $this->private_key = trim(file_get_contents($this->private_key_path)); - - Log::debug('public key: ' . $this->public_key_path . ' --- ' . substr($this->public_key, 0, 64)); - Log::debug('private key: ' . $this->private_key_path . ' --- ' . substr($this->private_key, 0, 64)); - } - - /** - * @return array - * @throws Exception - */ - protected function requestToken (): array - { - if ($this->getTransaction()->checkForRequestToken() == false) { - throw new Exception('larapay::larapay.could_not_request_payment'); - } - - $this->checkRequiredParameters([ - 'MID', - 'TID', - 'public_key', - 'private_key', - 'amount', - 'order_id', - 'redirect_url', - ]); - - $sendParams = [ - "Token_param" => [ - "AMOUNT" => $this->encryptText($this->amount), - "CRN" => $this->encryptText($this->order_id), - "MID" => $this->encryptText($this->MID), - "REFERALADRESS" => $this->encryptText($this->redirect_url), - "SIGNATURE" => $this->makeSignature('token'), - "TID" => $this->encryptText($this->TID), - "Payload" => $this->getTransaction()->description - ] - ]; - - try { - Log::debug('reservation call', $sendParams); + protected $WSDL = 'https://mabna.shaparak.ir/PayloadTokenService?wsdl'; + protected $endPoint = 'https://mabna.shaparak.ir'; + protected $verifyWSDL = 'https://mabna.shaparak.ir/TransactionReference/TransactionReference?wsdl'; + + protected $testWSDL = 'http://mabna.shaparak.ir/PayloadTokenService?wsdl'; + protected $testEndPoint = 'http://mabna.shaparak.ir'; + protected $testVerifyWSDL = 'http://mabna.shaparak.ir/TransactionReference/TransactionReference?wsdl'; + + protected $reverseSupport = false; + + public function init() + { + if (!file_exists($this->public_key_path)) { + throw new Exception('larapay::larapay.saderat.errors.public_key_file_not_found'); + } + + if (!file_exists($this->private_key_path)) { + throw new Exception('larapay::larapay.saderat.errors.private_key_file_not_found'); + } + + $this->public_key = trim(file_get_contents($this->public_key_path)); + $this->private_key = trim(file_get_contents($this->private_key_path)); + + Log::debug('public key: ' . $this->public_key_path . ' --- ' . substr($this->public_key, 0, 64)); + Log::debug('private key: ' . $this->private_key_path . ' --- ' . substr($this->private_key, 0, 64)); + } + + /** + * @return array + * @throws Exception + */ + protected function requestToken(): array + { + if ($this->getTransaction()->checkForRequestToken() == false) { + throw new Exception('larapay::larapay.could_not_request_payment'); + } + + $this->checkRequiredParameters([ + 'MID', + 'TID', + 'public_key', + 'private_key', + 'amount', + 'order_id', + 'redirect_url', + ]); + + $sendParams = [ + "Token_param" => [ + "AMOUNT" => $this->encryptText($this->amount), + "CRN" => $this->encryptText($this->order_id), + "MID" => $this->encryptText($this->MID), + "REFERALADRESS" => $this->encryptText($this->redirect_url), + "SIGNATURE" => $this->makeSignature('token'), + "TID" => $this->encryptText($this->TID), + "Payload" => $this->getTransaction()->description + ] + ]; + + try { + Log::debug('reservation call', $sendParams); $soapClient = $this->getSoapClient(); - $response = $soapClient->reservation($sendParams); - - if (is_object($response)) { - $response = $this->obj2array($response); - } - Log::info('reservation response', $response); - - if (isset($response['return'])) { - - if ($response['return']['result'] != 0) { - throw new Exception($response["return"]["token"], $response['return']['result']); - } - - if (isset($response['return']['signature'])) { - - /** - * Final signature is created - */ - $signature = base64_decode($response['return']['signature']); - - /** - * State whether signature is okay or not - */ - $keyResource = openssl_get_publickey($this->public_key); - $verifyResult = openssl_verify($response["return"]["token"], $signature, $keyResource); - - if ($verifyResult == 1) { - $this->getTransaction()->setReferenceId($response["return"]["token"]); // update transaction reference id - return $response["return"]["token"]; - } - else { - throw new Exception('larapay::larapay.saderat.errors.invalid_verify_result'); - } - } - else { - throw new Exception('larapay::larapay.invalid_response'); - } - } - else { - throw new Exception('larapay::larapay.invalid_response'); - } - } catch (SoapFault $e) { - throw new Exception('SoapFault: ' . $e->getMessage() . ' #' . $e->getCode(), $e->getCode()); - } - } + $response = $soapClient->reservation($sendParams); + + if (is_object($response)) { + $response = $this->obj2array($response); + } + Log::info('reservation response', $response); + + if (isset($response['return'])) { + + if ($response['return']['result'] != 0) { + throw new Exception($response["return"]["token"], $response['return']['result']); + } + + if (isset($response['return']['signature'])) { + + /** + * Final signature is created + */ + $signature = base64_decode($response['return']['signature']); + + /** + * State whether signature is okay or not + */ + $keyResource = openssl_get_publickey($this->public_key); + $verifyResult = openssl_verify($response["return"]["token"], $signature, $keyResource); + + if ($verifyResult == 1) { + $this->getTransaction()->setReferenceId($response["return"]["token"]); // update transaction reference id + return $response["return"]["token"]; + } else { + throw new Exception('larapay::larapay.saderat.errors.invalid_verify_result'); + } + } else { + throw new Exception('larapay::larapay.invalid_response'); + } + } else { + throw new Exception('larapay::larapay.invalid_response'); + } + } catch (SoapFault $e) { + throw new Exception('SoapFault: ' . $e->getMessage() . ' #' . $e->getCode(), $e->getCode()); + } + } /** * @return mixed * @throws Exception */ - protected function generateForm () - { - $token = $this->requestToken(); - - return view('larapay::saderat-form', [ - 'endPoint' => $this->getEndPoint(), - 'token' => $token, - 'submitLabel' => !empty($this->submit_label) ? $this->submit_label : trans("larapay::larapay.goto_gate"), - 'autoSubmit' => boolval($this->auto_submit) - ]); - } + protected function generateForm() + { + $token = $this->requestToken(); + + return view('larapay::saderat-form', [ + 'endPoint' => $this->getEndPoint(), + 'token' => $token, + 'submitLabel' => !empty($this->submit_label) ? $this->submit_label : trans("larapay::larapay.goto_gate"), + 'autoSubmit' => boolval($this->auto_submit) + ]); + } + + /** + * @return array + * @throws Exception + */ + public function formParams(): array + { + $token = $this->requestToken(); + + return [ + 'endPoint' => $this->getEndPoint(), + 'token' => $token, + ]; + } /** * @return bool * @throws Exception * @throws \Tartan\Larapay\Adapter\Exception */ - protected function verifyTransaction (): bool - { - if ($this->getTransaction()->checkForVerify() == false) { - throw new Exception('larapay::larapay.could_not_verify_payment'); - } - - $this->checkRequiredParameters([ - 'MID', - 'TID', - 'public_key', - 'private_key', - 'RESCODE', - 'TRN', - 'CRN', - 'AMOUNT', - 'SIGNATURE' //callback signature - ]); - - $sendParams = [ - "SaleConf_req" => [ - "MID" => $this->encryptText($this->MID), - "CRN" => $this->encryptText($this->CRN), - "TRN" => $this->encryptText($this->TRN), - "SIGNATURE" => $this->makeSignature('verify'), - ] - ]; - - try { - Log::debug('sendConfirmation call', $sendParams); - - $soapClient = new SoapClient($this->getVerifyWSDL(), $this->getSoapOptions()); - - $response = $soapClient->sendConfirmation($sendParams); - - if (is_object($response)) { - $response = $this->obj2array($response); - } - Log::info('sendConfirmation response', $response); - - if (isset($response['return'], $response['return']['RESCODE'])) { - if (($response['return']['RESCODE'] == '00') && ($response['return']['successful'] == true)) { - /** - * Final signature is created - */ - $signature = base64_decode($response['return']['SIGNATURE']); - - $data = $response["return"]["RESCODE"] . - $response["return"]["REPETETIVE"] . - $response["return"]["AMOUNT"] . - $response["return"]["DATE"] . - $response["return"]["TIME"] . - $response["return"]["TRN"] . - $response["return"]["STAN"]; - - /** - * State whether signature is okay or not - */ - $keyResource = openssl_get_publickey($this->public_key); - $verifyResult = openssl_verify($data, $signature, $keyResource); - - if ($verifyResult == 1) { - // success - // update server description - if ($response['return']['description'] != "") { - $this->getTransaction()->setExtra('description', $response['return']['description'], false); - } - $this->getTransaction()->setExtra('stan', $response['return']['STAN'], false); - $this->getTransaction()->setExtra('repeat', $response['return']['REPETETIVE'], false); - //update server side transaction time - $this->getTransaction()->setExtra('server_paid_at', date("Y") . $response["return"]["DATE"] . ' ' . $response['return']['TIME']); - $this->getTransaction()->setReferenceId($response['return']['TRN'], $save = false) ; - - $this->getTransaction()->setVerified(); // calls SAVE too - - return true; // successful verify - - } - else { - throw new Exception('larapay::larapay.saderat.errors.invalid_verify_result'); - } - } - else if ($response['return']['RESCODE'] == 101) { - return true; - } - else if ($response['return']['RESCODE'] > 0) { - throw new Exception($response['return']['RESCODE']); - } - else if ($response['return']['RESCODE'] < 0) { - throw new Exception(900 + abs($response['return']['RESCODE'])); - } - else { - throw new Exception('larapay::larapay.invalid_response'); - } - } - else { - throw new Exception('larapay::larapay.invalid_response'); - } - } catch (SoapFault $e) { - throw new Exception('SoapFault: ' . $e->getMessage() . ' #' . $e->getCode(), $e->getCode()); - } - } + protected function verifyTransaction(): bool + { + if ($this->getTransaction()->checkForVerify() == false) { + throw new Exception('larapay::larapay.could_not_verify_payment'); + } + + $this->checkRequiredParameters([ + 'MID', + 'TID', + 'public_key', + 'private_key', + 'RESCODE', + 'TRN', + 'CRN', + 'AMOUNT', + 'SIGNATURE' //callback signature + ]); + + $sendParams = [ + "SaleConf_req" => [ + "MID" => $this->encryptText($this->MID), + "CRN" => $this->encryptText($this->CRN), + "TRN" => $this->encryptText($this->TRN), + "SIGNATURE" => $this->makeSignature('verify'), + ] + ]; + + try { + Log::debug('sendConfirmation call', $sendParams); + + $soapClient = new SoapClient($this->getVerifyWSDL(), $this->getSoapOptions()); + + $response = $soapClient->sendConfirmation($sendParams); + + if (is_object($response)) { + $response = $this->obj2array($response); + } + Log::info('sendConfirmation response', $response); + + if (isset($response['return'], $response['return']['RESCODE'])) { + if (($response['return']['RESCODE'] == '00') && ($response['return']['successful'] == true)) { + /** + * Final signature is created + */ + $signature = base64_decode($response['return']['SIGNATURE']); + + $data = $response["return"]["RESCODE"] . + $response["return"]["REPETETIVE"] . + $response["return"]["AMOUNT"] . + $response["return"]["DATE"] . + $response["return"]["TIME"] . + $response["return"]["TRN"] . + $response["return"]["STAN"]; + + /** + * State whether signature is okay or not + */ + $keyResource = openssl_get_publickey($this->public_key); + $verifyResult = openssl_verify($data, $signature, $keyResource); + + if ($verifyResult == 1) { + // success + // update server description + if ($response['return']['description'] != "") { + $this->getTransaction()->setExtra('description', $response['return']['description'], false); + } + $this->getTransaction()->setExtra('stan', $response['return']['STAN'], false); + $this->getTransaction()->setExtra('repeat', $response['return']['REPETETIVE'], false); + //update server side transaction time + $this->getTransaction()->setExtra('server_paid_at', date("Y") . $response["return"]["DATE"] . ' ' . $response['return']['TIME']); + $this->getTransaction()->setReferenceId($response['return']['TRN'], $save = false); + + $this->getTransaction()->setVerified(); // calls SAVE too + + return true; // successful verify + + } else { + throw new Exception('larapay::larapay.saderat.errors.invalid_verify_result'); + } + } else if ($response['return']['RESCODE'] == 101) { + return true; + } else if ($response['return']['RESCODE'] > 0) { + throw new Exception($response['return']['RESCODE']); + } else if ($response['return']['RESCODE'] < 0) { + throw new Exception(900 + abs($response['return']['RESCODE'])); + } else { + throw new Exception('larapay::larapay.invalid_response'); + } + } else { + throw new Exception('larapay::larapay.invalid_response'); + } + } catch (SoapFault $e) { + throw new Exception('SoapFault: ' . $e->getMessage() . ' #' . $e->getCode(), $e->getCode()); + } + } /** * @param $text @@ -251,20 +257,20 @@ protected function verifyTransaction (): bool * @return string * @throws Exception */ - private function encryptText ($text): string - { - /** - * get key resource to start based on public key - */ - $keyResource = openssl_get_publickey($this->public_key); - if (!$keyResource) { - throw new Exception('larapay::larapay.could_not_get_public_key'); - } + private function encryptText($text): string + { + /** + * get key resource to start based on public key + */ + $keyResource = openssl_get_publickey($this->public_key); + if (!$keyResource) { + throw new Exception('larapay::larapay.could_not_get_public_key'); + } - openssl_public_encrypt($text, $encryptedText, $keyResource); + openssl_public_encrypt($text, $encryptedText, $keyResource); - return base64_encode($encryptedText); - } + return base64_encode($encryptedText); + } /** * @param $action @@ -272,27 +278,27 @@ private function encryptText ($text): string * @return string * @throws Exception */ - private function makeSignature ($action): string - { - /** - * Make a signature temporary - * Note: each paid has it's own specific signature - */ - $source = $this->getSignSource($action); + private function makeSignature($action): string + { + /** + * Make a signature temporary + * Note: each paid has it's own specific signature + */ + $source = $this->getSignSource($action); - /** - * Sign data and make final signature - */ - $signature = ''; + /** + * Sign data and make final signature + */ + $signature = ''; - $privateKey = openssl_pkey_get_private($this->private_key); + $privateKey = openssl_pkey_get_private($this->private_key); - if (!openssl_sign($source, $signature, $privateKey, OPENSSL_ALGO_SHA1)) { - throw new Exception('larapay::larapay.saderat.errors.making_openssl_sign_error'); - } + if (!openssl_sign($source, $signature, $privateKey, OPENSSL_ALGO_SHA1)) { + throw new Exception('larapay::larapay.saderat.errors.making_openssl_sign_error'); + } - return base64_encode($signature); - } + return base64_encode($signature); + } /** * @param $action @@ -300,57 +306,59 @@ private function makeSignature ($action): string * @return string * @throws Exception */ - public function getSignSource (string $action): string - { - switch (strtoupper($action)) { - case 'TOKEN' : { - return $this->amount . $this->order_id . $this->MID . $this->redirect_url . $this->TID; - break; - } - - case 'VERIFY' : { - return $this->MID . $this->TRN . $this->CRN; - break; - } - - default : { - throw new Exception('undefined sign source'); - break; - } - } - } - - /** - * @return string - */ - private function getVerifyWSDL (): string - { - if (config('larapay.mode') == 'production') { - return $this->verifyWSDL; - } - else { - return $this->testVerifyWSDL; - } - } - - /** - * @return bool - */ - public function canContinueWithCallbackParameters (): bool - { - if ($this->RESCODE == "00") { - return true; - } - - return false; - } - - public function getGatewayReferenceId (): string - { - $this->checkRequiredParameters([ - 'TRN', - ]); - - return $this->TRN; - } + public function getSignSource(string $action): string + { + switch (strtoupper($action)) { + case 'TOKEN' : + { + return $this->amount . $this->order_id . $this->MID . $this->redirect_url . $this->TID; + break; + } + + case 'VERIFY' : + { + return $this->MID . $this->TRN . $this->CRN; + break; + } + + default : + { + throw new Exception('undefined sign source'); + break; + } + } + } + + /** + * @return string + */ + private function getVerifyWSDL(): string + { + if (config('larapay.mode') == 'production') { + return $this->verifyWSDL; + } else { + return $this->testVerifyWSDL; + } + } + + /** + * @return bool + */ + public function canContinueWithCallbackParameters(): bool + { + if ($this->RESCODE == "00") { + return true; + } + + return false; + } + + public function getGatewayReferenceId(): string + { + $this->checkRequiredParameters([ + 'TRN', + ]); + + return $this->TRN; + } } diff --git a/src/Adapter/Saman.php b/src/Adapter/Saman.php index 795c0d1..7a52fd8 100755 --- a/src/Adapter/Saman.php +++ b/src/Adapter/Saman.php @@ -85,6 +85,15 @@ public function generateForm(): string } } + public function formParams(): array + { + if ($this->with_token) { + return $this->formParamsWithToken(); + } else { + return $this->formParamsWithoutToken(); // default + } + } + protected function generateFormWithoutToken(): string { Log::debug(__METHOD__, $this->getParameters()); @@ -107,6 +116,26 @@ protected function generateFormWithoutToken(): string ]); } + protected function formParamsWithoutToken(): array + { + Log::debug(__METHOD__, $this->getParameters()); + + $this->checkRequiredParameters([ + 'merchant_id', + 'amount', + 'order_id', + 'redirect_url', + ]); + + return [ + 'endPoint' => $this->getEndPoint(), + 'amount' => intval($this->amount), + 'merchantId' => $this->merchant_id, + 'orderId' => $this->order_id, + 'redirectUrl' => $this->redirect_url, + ]; + } + protected function generateFormWithToken(): string { Log::debug(__METHOD__, $this->getParameters()); @@ -133,6 +162,30 @@ protected function generateFormWithToken(): string ]); } + protected function formParamsWithToken(): array + { + Log::debug(__METHOD__, $this->getParameters()); + $this->checkRequiredParameters([ + 'merchant_id', + 'order_id', + 'amount', + 'redirect_url', + ]); + + $token = $this->requestToken(); + + Log::info(__METHOD__, ['fetchedToken' => $token]); + + return [ + 'endPoint' => $this->getEndPoint(), + 'amount' => '',// just because of view + 'merchantId' => '', // just because of view + 'orderId' => '', // just because of view + 'token' => $token, + 'redirectUrl' => $this->redirect_url, + ]; + } + /** * @return bool * @throws Exception diff --git a/src/Adapter/Zarinpal.php b/src/Adapter/Zarinpal.php index 5460fe3..162a382 100755 --- a/src/Adapter/Zarinpal.php +++ b/src/Adapter/Zarinpal.php @@ -94,6 +94,20 @@ protected function generateForm(): string ]); } + /** + * @return array + * @throws Exception + * @throws \Tartan\Larapay\Adapter\Exception + */ + public function formParams(): array + { + $authority = $this->requestToken(); + + return [ + 'endPoint' => strtr($this->getEndPoint(), ['{authority}' => $authority]), + ]; + } + /** * @return bool * @throws Exception diff --git a/src/Models/LarapayTransaction.php b/src/Models/LarapayTransaction.php index efcc339..94a709a 100644 --- a/src/Models/LarapayTransaction.php +++ b/src/Models/LarapayTransaction.php @@ -140,9 +140,41 @@ public function generateForm($autoSubmit = false, $callback = null, $adapterConf } } + public function formParams($callback = null, $adapterConfig = []): array + { + + $paymentGatewayHandler = $this->gatewayHandler($adapterConfig); + + $callbackRoute = route(config("larapay.payment_callback"), [ + 'gateway' => $this->gate_name, + 'transaction-id' => $this->id, + ]); + + if ($callback != null) { + $callbackRoute = route($callback, [ + 'gateway' => $this->gate_name, + 'transaction-id' => $this->id, + ]); + } + + $paymentParams = [ + 'order_id' => $this->getBankOrderId(), + 'redirect_url' => $callbackRoute, + 'amount' => $this->amount, + 'submit_label' => trans('larapay::larapay.goto_gate'), + ]; + + try { + return $paymentGatewayHandler->formParams($paymentParams); + } catch (Exception $e) { + Log::emergency($this->gate_name . ' #' . $e->getCode() . '-' . $e->getMessage()); + return false; + } + } + public function gatewayHandler($adapterConfig = []) { - return Larapay::make($this->gate_name, $this, json_decode($adapterConfig, true)); + return Larapay::make($this->gate_name, $this, $adapterConfig); } } \ No newline at end of file diff --git a/src/Payable.php b/src/Payable.php index 5eb4653..6588d69 100644 --- a/src/Payable.php +++ b/src/Payable.php @@ -68,10 +68,7 @@ public function createTransaction( $transactionData['payment_method'] = 'ONLINE'; $transactionData['additional_data'] = json_encode($additionalData, JSON_UNESCAPED_UNICODE); - $transaction = $this->transactions()->create($transactionData); - - return $transaction; - + return $this->transactions()->create($transactionData); } public function getAmount()