From 2a3f5d41d45e01fdaecc67cdb6827efae2865124 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 19 Apr 2022 02:04:28 +0000 Subject: [PATCH 1/2] Re-format the source code using php codeSniffer --- modules/gateways/callback/xendit.php | 11 +-- modules/gateways/xendit.php | 31 ++++---- modules/gateways/xendit/autoload.php | 11 ++- modules/gateways/xendit/handler/updatecc.php | 6 +- modules/gateways/xendit/hooks.php | 3 +- modules/gateways/xendit/lib/ActionBase.php | 3 +- modules/gateways/xendit/lib/CreditCard.php | 9 ++- modules/gateways/xendit/lib/Link.php | 9 +-- modules/gateways/xendit/lib/Recurring.php | 35 ++++----- modules/gateways/xendit/lib/XenditRequest.php | 73 +++++++++++-------- .../gateways/xendit/tests/WHMCSModuleTest.php | 3 + 11 files changed, 103 insertions(+), 91 deletions(-) diff --git a/modules/gateways/callback/xendit.php b/modules/gateways/callback/xendit.php index 4b9020c..7aaca1b 100644 --- a/modules/gateways/callback/xendit.php +++ b/modules/gateways/callback/xendit.php @@ -41,7 +41,7 @@ $payMethodId = isset($_REQUEST['custom_reference']) ? (int)$_REQUEST['custom_reference'] : 0; // validate hash - if ($creditCard->compareHash($params, $verificationHash)) { + if ($creditCard->compareHash($verificationHash, $params)) { logTransaction($gatewayParams['paymentmethod'], $_REQUEST, "Invalid Hash"); die('Invalid hash.'); } @@ -60,7 +60,6 @@ ); exit; } catch (Exception $e) { - // Log to gateway log as unsuccessful. logTransaction($gatewayParams['paymentmethod'], $_REQUEST, $e->getMessage()); @@ -89,18 +88,14 @@ } else { // use for callback $arrRequestInput = json_decode(file_get_contents("php://input"), true); - if ( - !empty($arrRequestInput) - && isset($arrRequestInput['external_id']) - && !empty($arrRequestInput['external_id']) - ) { + if (!empty($arrRequestInput) && isset($arrRequestInput['external_id']) && !empty($arrRequestInput['external_id'])) { $invoiceId = $callback->getInvoiceIdFromExternalId($arrRequestInput['external_id']); $transactions = $callback->getTransactionFromInvoiceId($invoiceId); try { // Get invoice from Xendit $xenditInvoice = $xenditRequest->getInvoiceById($arrRequestInput['id']); - if(isset($arrRequestInput['credit_card_token'])){ + if (isset($arrRequestInput['credit_card_token'])) { $xenditInvoice['credit_card_token'] = $arrRequestInput['credit_card_token']; } $result = $callback->confirmInvoice( diff --git a/modules/gateways/xendit.php b/modules/gateways/xendit.php index 0803ac8..a61e1dd 100644 --- a/modules/gateways/xendit.php +++ b/modules/gateways/xendit.php @@ -45,14 +45,14 @@ function xendit_config() */ function xendit_deactivate() { - try{ + try { (new \Xendit\Lib\Migrate())->removeTransactionTable(); return [ // Supported values here include: success, error or info 'status' => 'success', 'description' => 'Drop Xendit data success.' ]; - }catch (\Exception $e){ + } catch (\Exception $e) { return [ // Supported values here include: success, error or info "status" => "error", @@ -126,7 +126,6 @@ function xendit_capture($params) } if (!empty($response) && isset($response['status']) && $response['status'] == "CAPTURED") { - // Save transaction status $xenditRecurring = new Recurring(); $transactions = $xenditRecurring->getTransactionFromInvoiceId($params["invoiceid"]); @@ -258,7 +257,7 @@ function xendit_remoteinput($params) */ function xendit_remoteupdate($params) { - if (strpos($_REQUEST["rp"], "/admin/") !== FALSE) { + if (strpos($_REQUEST["rp"], "/admin/") !== false) { return << Updating your card/bank is not possible. Please create a new Pay Method to make changes. @@ -354,9 +353,9 @@ function xendit_adminstatusmsg($params) * * @param array $params Payment Gateway Module Parameters * + * @return array Transaction response status * @see https://developers.whmcs.com/payment-gateways/refunds/ * - * @return array Transaction response status */ function xendit_refund($params) { @@ -369,32 +368,32 @@ function xendit_refund($params) // perform API call to initiate refund and interpret result $xenditRequest = new \Xendit\Lib\XenditRequest(); - try{ + try { $invoiceResponse = $xenditRequest->getInvoiceById($transactionIdToRefund); $chargeId = $invoiceResponse['credit_card_charge_id']; - }catch (Exception $e){ - if(str_contains($e->getMessage(), "INVOICE_NOT_FOUND_ERROR")){ + } catch (Exception $e) { + if (str_contains($e->getMessage(), "INVOICE_NOT_FOUND_ERROR")) { // The invoice created via CLI & chargeID saved to transaction $chargeId = $transactionIdToRefund; } } - if(empty($chargeId)) { + if (empty($chargeId)) { return array( - 'status' => 'error', - 'rawdata' => 'Can not refund the payment because because it is not credit card transaction' + 'status' => 'error', + 'rawdata' => 'Can not refund the payment because because it is not credit card transaction' ); } $body = array( - 'store_name' => $companyName, - 'external_id' => 'whmcs-refund-' . uniqid(), - 'amount' => $refundAmount + 'store_name' => $companyName, + 'external_id' => 'whmcs-refund-' . uniqid(), + 'amount' => $refundAmount ); - try{ + try { $refundResponse = $xenditRequest->createRefund($chargeId, $body); - }catch (Exception $e){ + } catch (Exception $e) { return array( 'status' => 'declined', 'rawdata' => $e->getMessage(), diff --git a/modules/gateways/xendit/autoload.php b/modules/gateways/xendit/autoload.php index 75eea62..154e24c 100644 --- a/modules/gateways/xendit/autoload.php +++ b/modules/gateways/xendit/autoload.php @@ -9,18 +9,17 @@ spl_autoload_register(function ($className) { if (strpos($className, 'Xendit') !== false) { - $classPath = explode("\\", $className); unset($classPath[0]); - try{ - $filePath = __DIR__ . DIRECTORY_SEPARATOR . implode("/", array_map(function ($path){ + try { + $filePath = __DIR__ . DIRECTORY_SEPARATOR . implode("/", array_map(function ($path) { return $path == "Lib" ? strtolower($path) : $path; - }, $classPath)) . ".php"; - if(file_exists($filePath)){ + }, $classPath)) . ".php"; + if (file_exists($filePath)) { require $filePath; } - }catch (Exception $e){ + } catch (Exception $e) { } } }); diff --git a/modules/gateways/xendit/handler/updatecc.php b/modules/gateways/xendit/handler/updatecc.php index 2a30bae..485d2bd 100644 --- a/modules/gateways/xendit/handler/updatecc.php +++ b/modules/gateways/xendit/handler/updatecc.php @@ -28,17 +28,17 @@ $verificationHash = $_POST['verification_hash'] ?? ''; $comparisonHash = sha1( - implode('|', [ + implode('|', [ $publicKey, $customerId, $invoiceId, $amount, $currencyCode, $secretKey - ]) + ]) ); if ($verificationHash !== $comparisonHash) { - die('Invalid hash.'); + die('Invalid hash.'); } if ($action === 'payment') { diff --git a/modules/gateways/xendit/hooks.php b/modules/gateways/xendit/hooks.php index 318daf4..37062c7 100644 --- a/modules/gateways/xendit/hooks.php +++ b/modules/gateways/xendit/hooks.php @@ -8,8 +8,7 @@ * @param $vars * @return void */ -add_hook('InvoiceCreation', 1, function ($vars) -{ +add_hook('InvoiceCreation', 1, function ($vars) { $xenditRecurring = new Recurring(); $invoice = $xenditRecurring->getInvoice($vars['invoiceid']); diff --git a/modules/gateways/xendit/lib/ActionBase.php b/modules/gateways/xendit/lib/ActionBase.php index d723062..73f2f17 100644 --- a/modules/gateways/xendit/lib/ActionBase.php +++ b/modules/gateways/xendit/lib/ActionBase.php @@ -239,7 +239,8 @@ public function confirmInvoice(int $invoiceId, array $xenditInvoiceData, bool $s // Save payment method $transactions = $this->getTransactionFromInvoiceId($invoiceId); if (!empty($transactions)) { - $this->updateTransactions($transactions, + $this->updateTransactions( + $transactions, [ "status" => XenditTransaction::STATUS_PAID, "payment_method" => $xenditInvoiceData["payment_method"] diff --git a/modules/gateways/xendit/lib/CreditCard.php b/modules/gateways/xendit/lib/CreditCard.php index a4611ea..9dc6475 100644 --- a/modules/gateways/xendit/lib/CreditCard.php +++ b/modules/gateways/xendit/lib/CreditCard.php @@ -60,8 +60,9 @@ public function extractItems($invoice): array public function generateCCPaymentRequest(array $params = [], int $auth_id = null, int $cvn = null): array { $invoice = $this->getInvoice($params["invoiceid"]); - if (empty($invoice)) + if (empty($invoice)) { throw new \Exception("Invoice does not exist"); + } $payload = [ "amount" => $params["amount"], @@ -97,11 +98,11 @@ public function getCardSetting() } /** - * @param array $params * @param string $verificationHash - * @return void + * @param array $params + * @return false|void */ - public function compareHash(array $params = [], string $verificationHash) + public function compareHash(string $verificationHash, array $params = []) { $comparisonHash = sha1( implode('|', [ diff --git a/modules/gateways/xendit/lib/Link.php b/modules/gateways/xendit/lib/Link.php index b9c6a84..38032db 100644 --- a/modules/gateways/xendit/lib/Link.php +++ b/modules/gateways/xendit/lib/Link.php @@ -80,9 +80,9 @@ protected function invoiceUrl($invoiceId, string $systemurl): string */ protected function isRefererUrlFromCart(): bool { - if(isset($_SERVER["HTTP_REFERER"]) && ltrim($_SERVER["SCRIPT_NAME"], "/") == "viewinvoice.php"){ + if (isset($_SERVER["HTTP_REFERER"]) && ltrim($_SERVER["SCRIPT_NAME"], "/") == "viewinvoice.php") { $uri = parse_url($_SERVER['HTTP_REFERER']); - if(ltrim($uri["path"], "/") == "cart.php"){ + if (ltrim($uri["path"], "/") == "cart.php") { return true; } } @@ -96,8 +96,8 @@ protected function isRefererUrlFromCart(): bool */ protected function generateFormParam(array $params, string $invoiceUrl = "") { - if($this->isRefererUrlFromCart()){ - header("Location: " . $invoiceUrl ); + if ($this->isRefererUrlFromCart()) { + header("Location: " . $invoiceUrl); exit(); } @@ -149,7 +149,6 @@ public function generatePaymentLink(array $params, bool $force = false): string // If force create new invoice if ($force) { - $payload = $this->generateInvoicePayload($params, true); $createInvoice = $this->xenditRequest->createInvoice($payload); $url = $createInvoice['invoice_url']; diff --git a/modules/gateways/xendit/lib/Recurring.php b/modules/gateways/xendit/lib/Recurring.php index c6778aa..aed7536 100644 --- a/modules/gateways/xendit/lib/Recurring.php +++ b/modules/gateways/xendit/lib/Recurring.php @@ -1,6 +1,7 @@ where("invoiceid", "!=", $invoiceId) ->whereIn("relid", $relationIds) @@ -37,7 +37,7 @@ protected function getPreviousTransaction( ->orderBy('created_at', 'desc') ->first(); - if(!empty($xenditTransaction)){ + if (!empty($xenditTransaction)) { return $xenditTransaction; } return false; @@ -50,24 +50,25 @@ protected function getPreviousTransaction( public function getPreviousInvoice(int $invoiceId) { $invoice = $this->getInvoice($invoiceId); - if(empty($invoice)) + if (empty($invoice)) { throw \Exception("Invoice does not exists!"); + } $orderIds = []; $items = []; - foreach ($invoice->items()->get() as $item){ + foreach ($invoice->items()->get() as $item) { $items[$item->relid] = $item->type; - foreach (self::WHMCS_PRODUCTS as $product){ - foreach ($item->$product()->get() as $service){ + foreach (self::WHMCS_PRODUCTS as $product) { + foreach ($item->$product()->get() as $service) { $orderIds[] = $service->orderid; } } } // If invoice does not have order OR invoice created for multi Order then IGNORE - if(empty($orderIds) || count($orderIds) > 1){ + if (empty($orderIds) || count($orderIds) > 1) { return false; } @@ -78,7 +79,7 @@ public function getPreviousInvoice(int $invoiceId) array_keys($items), array_values($items) ); - if(empty($xenditTransaction)){ + if (empty($xenditTransaction)) { return false; } @@ -92,7 +93,7 @@ public function getPreviousInvoice(int $invoiceId) public function isRecurring(int $invoiceId): bool { $recurringData = $this->getRecurringBillingInfo($invoiceId); - if(!isset($recurringData["firstpaymentamount"]) && !isset($recurringData['firstcycleperiod'])){ + if (!isset($recurringData["firstpaymentamount"]) && !isset($recurringData['firstcycleperiod'])) { return true; } return false; @@ -104,14 +105,14 @@ public function isRecurring(int $invoiceId): bool public function storeTransactions(int $invoiceid) { $invoice = $this->getInvoice($invoiceid); - if(empty($invoice)) + if (empty($invoice)) { throw \Exception("Invoice does not exists!"); + } $transactions = []; - foreach ($invoice->items()->get() as $item){ - + foreach ($invoice->items()->get() as $item) { // Custom item - if($item->type == ""){ + if ($item->type == "") { $transactions[] = $this->storeTransaction( [ "invoiceid" => $invoiceid, @@ -119,10 +120,10 @@ public function storeTransactions(int $invoiceid) "external_id" => $this->generateExternalId($invoiceid) ] ); - }else{ + } else { // Products - foreach (self::WHMCS_PRODUCTS as $product){ - foreach ($item->$product()->get() as $p){ + foreach (self::WHMCS_PRODUCTS as $product) { + foreach ($item->$product()->get() as $p) { $transactions[] = $this->storeTransaction( [ "invoiceid" => $invoiceid, diff --git a/modules/gateways/xendit/lib/XenditRequest.php b/modules/gateways/xendit/lib/XenditRequest.php index e5c7670..f9b638b 100644 --- a/modules/gateways/xendit/lib/XenditRequest.php +++ b/modules/gateways/xendit/lib/XenditRequest.php @@ -4,7 +4,7 @@ class XenditRequest { - protected $tpi_server_domain = "https://tpi.xendit.co"; + protected $tpi_server_domain = "https://tpi.xendit.co"; /** * @return mixed @@ -42,12 +42,12 @@ public function getSecretKey() } /** - * @param string $method * @param string $endpoint * @param array $param + * @param string $method * @return bool|string */ - protected function request(string $method = 'GET', string $endpoint, array $param = []) + protected function request(string $endpoint, array $param = [], string $method = 'GET') { $curl = curl_init(); @@ -81,7 +81,7 @@ protected function defaultHeader(string $version = ''): array 'x-plugin-name: WHMCS', 'x-plugin-version: 1.0.1' ); - $default_header[] = 'Authorization: Basic '.base64_encode(sprintf("%s:", $this->getSecretKey())); + $default_header[] = 'Authorization: Basic ' . base64_encode(sprintf("%s:", $this->getSecretKey())); if (!empty($version)) { $default_header[] = 'x-api-version: ' . $version; } @@ -112,10 +112,11 @@ public function getInvoiceById(string $invoice_id) { try { $response = $this->request( - "GET", - '/payment/xendit/invoice/' . $invoice_id, [ - 'headers' => $this->defaultHeader() - ]); + '/payment/xendit/invoice/' . $invoice_id, + [ + 'headers' => $this->defaultHeader() + ] + ); return $this->processResponse($response); } catch (\Exception $e) { throw new \Exception($e->getMessage()); @@ -130,15 +131,17 @@ public function getInvoiceById(string $invoice_id) */ public function createRefund(string $chargeId, array $payload = []) { - try{ + try { $response = $this->request( - "POST", - '/payment/xendit/credit-card/charges/' . $chargeId . '/refund', [ - 'headers' => $this->defaultHeader(), - 'body' => json_encode($payload) - ]); + '/payment/xendit/credit-card/charges/' . $chargeId . '/refund', + [ + 'headers' => $this->defaultHeader(), + 'body' => json_encode($payload) + ], + "POST" + ); return $this->processResponse($response); - }catch (\Exception $e){ + } catch (\Exception $e) { throw new \Exception($e->getMessage()); } } @@ -151,10 +154,14 @@ public function createRefund(string $chargeId, array $payload = []) public function createInvoice(array $param = []) { try { - $response = $this->request("POST", '/payment/xendit/invoice', [ - 'headers' => $this->defaultHeader(), - 'body' => json_encode($param) - ]); + $response = $this->request( + '/payment/xendit/invoice', + [ + 'headers' => $this->defaultHeader(), + 'body' => json_encode($param) + ], + "POST" + ); return $this->processResponse($response); } catch (\Exception $e) { throw new \Exception($e->getMessage()); @@ -169,10 +176,14 @@ public function createInvoice(array $param = []) public function createHost3DS(array $param = []) { try { - $response = $this->request("POST", '/payment/xendit/credit-card/hosted-3ds', [ - 'headers' => $this->defaultHeader('2020-02-14'), - 'body' => json_encode($param) - ]); + $response = $this->request( + '/payment/xendit/credit-card/hosted-3ds', + [ + 'headers' => $this->defaultHeader('2020-02-14'), + 'body' => json_encode($param) + ], + "POST" + ); return $this->processResponse($response); } catch (\Exception $e) { throw new \Exception($e->getMessage()); @@ -187,10 +198,14 @@ public function createHost3DS(array $param = []) public function createCharge($payload) { try { - $response = $this->request("POST", '/payment/xendit/credit-card/charges', [ - 'headers' => $this->defaultHeader(), - 'body' => json_encode($payload) - ]); + $response = $this->request( + '/payment/xendit/credit-card/charges', + [ + 'headers' => $this->defaultHeader(), + 'body' => json_encode($payload) + ], + "POST" + ); return $this->processResponse($response); } catch (\Exception $e) { throw new \Exception($e->getMessage()); @@ -205,7 +220,7 @@ public function createCharge($payload) public function getCardInfo(string $card_charge_id) { try { - $response = $this->request("GET", '/payment/xendit/credit-card/charges/' . $card_charge_id, [ + $response = $this->request('/payment/xendit/credit-card/charges/' . $card_charge_id, [ 'headers' => $this->defaultHeader() ]); return $this->processResponse($response); @@ -222,7 +237,7 @@ public function getCardInfo(string $card_charge_id) public function getCardTokenInfo(string $card_token) { try { - $response = $this->request("GET", '/payment/xendit/credit-card/token/' . $card_token, [ + $response = $this->request('/payment/xendit/credit-card/token/' . $card_token, [ 'headers' => $this->defaultHeader() ]); return $this->processResponse($response); diff --git a/modules/gateways/xendit/tests/WHMCSModuleTest.php b/modules/gateways/xendit/tests/WHMCSModuleTest.php index da1f8cd..3631a13 100644 --- a/modules/gateways/xendit/tests/WHMCSModuleTest.php +++ b/modules/gateways/xendit/tests/WHMCSModuleTest.php @@ -1,4 +1,6 @@ Date: Wed, 20 Apr 2022 02:22:00 +0000 Subject: [PATCH 2/2] Fix some validation --- modules/gateways/xendit/assets/js/xendit.js | 35 +++++++-------------- modules/gateways/xendit/hooks.php | 17 ++++++++++ modules/gateways/xendit/lib/ActionBase.php | 2 ++ modules/gateways/xendit/lib/Link.php | 2 +- 4 files changed, 32 insertions(+), 24 deletions(-) diff --git a/modules/gateways/xendit/assets/js/xendit.js b/modules/gateways/xendit/assets/js/xendit.js index 53a28e2..7b9d39b 100644 --- a/modules/gateways/xendit/assets/js/xendit.js +++ b/modules/gateways/xendit/assets/js/xendit.js @@ -87,7 +87,7 @@ jQuery(function ($) { }, block: function () { - if(cc_xendit_form.btnSaveCC.find('.loading-icon').length == 0){ + if (cc_xendit_form.btnSaveCC.find('.loading-icon').length == 0) { cc_xendit_form.btnSaveCC.append('
'); } cc_xendit_form.btnSaveCC.prop('disabled', true); @@ -111,20 +111,8 @@ jQuery(function ($) { return true; }, - toggleInputError: function (erred, input) { - input.parent('.form-group').toggleClass('has-error', erred); - return input; - }, - - extractMonth: function (date) { - var expiryArray = date.split("/"); - return String(expiryArray[0]).length === 1 ? '0' + String(expiryArray[0]) : String(expiryArray[0]); - }, - - extractYear: function (date) { - var expiryArray = date.split("/"); - var fullYear = new Date().getFullYear(); - return String(String(fullYear).substr(0, 2) + expiryArray[1]); + extractMonth: function (month) { + return month.toString().length < 2 ? '0' + month.toString() : month.toString(); }, onSubmit: function (e) { @@ -140,7 +128,7 @@ jQuery(function ($) { success: function (response) { if (!response.error) { var message = cc_xendit_form.isAddNewCC() ? "Payment method added successfully" : "Payment method updated successfully" - cc_xendit_form.form.append('

'+message+'

') + cc_xendit_form.form.append('

' + message + '

') } else { cc_xendit_form.form.append('

' + response.message + '

') } @@ -154,7 +142,8 @@ jQuery(function ($) { var card = cc_xendit_form.inputCardNumber.val().replace(/\s/g, ''); var cvn = cc_xendit_form.inputCardCVV.val().replace(/ /g, ''); - var expiry = cc_xendit_form.inputCardExpiry.val().replace(/ /g, ''); + var card_type = $.payment.cardType(card); + var expiry = cc_xendit_form.inputCardExpiry.payment('cardExpiryVal'); // check if all card details are not empty if (!card || !cvn || !expiry) { @@ -173,7 +162,7 @@ jQuery(function ($) { } // validate card number - if (!Xendit.card.validateCardNumber(card)) { + if (!$.payment.validateCardNumber(card)) { var err = { message: 'Incorrect number' } @@ -181,7 +170,7 @@ jQuery(function ($) { } // validate expiry format MM/YY - if (expiry.length != 5) { + if (!$.payment.validateCardExpiry(expiry.month, expiry.year)) { var err = { message: 'Invalid expire' } @@ -189,7 +178,7 @@ jQuery(function ($) { } // validate cvc - if (cvn.length < 3) { + if (!$.payment.validateCardCVC(cvn, card_type)) { var err = { message: 'Invalid cvn' } @@ -198,8 +187,8 @@ jQuery(function ($) { var data = { "card_number": card, - "card_exp_month": cc_xendit_form.extractMonth(expiry), - "card_exp_year": cc_xendit_form.extractYear(expiry), + "card_exp_month": cc_xendit_form.extractMonth(expiry.month), + "card_exp_year": expiry.year.toString(), "card_cvn": cvn, "is_multiple_use": true, "on_behalf_of": "", @@ -288,7 +277,7 @@ jQuery(function ($) { return 'unknown'; }, - backToPaymentMethod: function (e){ + backToPaymentMethod: function (e) { parent.location.href = cc_xendit_form.btnCancel.data("href"); } }; diff --git a/modules/gateways/xendit/hooks.php b/modules/gateways/xendit/hooks.php index 37062c7..35349af 100644 --- a/modules/gateways/xendit/hooks.php +++ b/modules/gateways/xendit/hooks.php @@ -1,5 +1,6 @@ storeTransactions($vars['invoiceid']); }); + +/** + * Hook to show Xendit payment gateway based on currency + * + * @param $vars + * @return array|void + */ +add_hook("ClientAreaPageCart", 1, function ($vars) { + if ($vars['templatefile'] == 'viewcart') { + $activeCurrency = $vars['activeCurrency']->code; + if (!in_array($activeCurrency, ActionBase::ALLOW_CURRENCIES)) { + unset($vars['gateways']["xendit"]); + } + } + return $vars; +}); diff --git a/modules/gateways/xendit/lib/ActionBase.php b/modules/gateways/xendit/lib/ActionBase.php index 73f2f17..caf7002 100644 --- a/modules/gateways/xendit/lib/ActionBase.php +++ b/modules/gateways/xendit/lib/ActionBase.php @@ -12,6 +12,8 @@ class ActionBase { + const ALLOW_CURRENCIES = ['IDR', 'PHP', 'USD']; + protected $moduleDomain = 'xendit'; protected $xenditRequest; protected $xenditTransaction; diff --git a/modules/gateways/xendit/lib/Link.php b/modules/gateways/xendit/lib/Link.php index 38032db..aa08871 100644 --- a/modules/gateways/xendit/lib/Link.php +++ b/modules/gateways/xendit/lib/Link.php @@ -94,7 +94,7 @@ protected function isRefererUrlFromCart(): bool * @param string $invoiceUrl * @return string */ - protected function generateFormParam(array $params, string $invoiceUrl = "") + protected function generateFormParam(array $params, string $invoiceUrl) { if ($this->isRefererUrlFromCart()) { header("Location: " . $invoiceUrl);