From f5e6206166a2f9904c9c283642f3e0234eb85431 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 24 Aug 2022 13:40:05 +0700 Subject: [PATCH] some small changes --- modules/gateways/xendit.php | 2 +- modules/gateways/xendit/lib/PaymentLink.php | 2 +- modules/gateways/xendit/lib/Webhook.php | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/gateways/xendit.php b/modules/gateways/xendit.php index 826e821..966a82b 100644 --- a/modules/gateways/xendit.php +++ b/modules/gateways/xendit.php @@ -9,7 +9,7 @@ require __DIR__ . '/xendit/autoload.php'; -// defines +// Module version const XENDIT_PAYMENT_GATEWAY_VERSION = '1.1.0'; use WHMCS\Billing\Invoice; diff --git a/modules/gateways/xendit/lib/PaymentLink.php b/modules/gateways/xendit/lib/PaymentLink.php index 8ccafb1..dbb281f 100644 --- a/modules/gateways/xendit/lib/PaymentLink.php +++ b/modules/gateways/xendit/lib/PaymentLink.php @@ -234,7 +234,7 @@ public function generatePaymentLink(array $params, bool $force = false): string return $this->updateInvoiceStatus($params, $xenditInvoice, $transactions); } - // If Xendit invoice not exist then create a new Xendit invoice + // If Xendit invoice does not exist, create a new Xendit invoice $xenditInvoice = $this->createXenditInvoice($params, $transactions); return $this->generateFormParam($params, $xenditInvoice['invoice_url']); } catch (\Exception $e) { diff --git a/modules/gateways/xendit/lib/Webhook.php b/modules/gateways/xendit/lib/Webhook.php index 04a0736..4a09830 100644 --- a/modules/gateways/xendit/lib/Webhook.php +++ b/modules/gateways/xendit/lib/Webhook.php @@ -11,7 +11,7 @@ class Webhook extends ActionBase */ public function getInvoiceIdFromExternalId(string $external_id) { - $externalArray = array_map("trim", explode("-", $external_id)); + $externalArray = array_map('trim', explode('-', $external_id)); return end($externalArray); } @@ -42,7 +42,7 @@ public function confirmInvoice(int $invoiceId, array $xenditInvoiceData, bool $s $transactionId = $xenditInvoiceData['id']; $paymentAmount = $this->extractPaidAmount($xenditInvoiceData['paid_amount'], $invoice->total); - $paymentFee = $xenditInvoiceData['fees'][0]["value"]; + $paymentFee = $xenditInvoiceData['fees'][0]['value']; $transactionStatus = 'Success'; // Save credit card token @@ -51,12 +51,12 @@ public function confirmInvoice(int $invoiceId, array $xenditInvoiceData, bool $s $cardExpired = $this->xenditRequest->getCardTokenInfo($xenditInvoiceData['credit_card_token']); if (!empty($cardInfo) && !empty($cardExpired)) { - $lastDigit = substr($cardInfo["masked_card_number"], -4); + $lastDigit = substr($cardInfo['masked_card_number'], -4); invoiceSaveRemoteCard( $invoiceId, $lastDigit, - $cardInfo["card_brand"], - sprintf("%s/%s", $cardExpired["card_expiration_month"], $cardExpired["card_expiration_year"]), + $cardInfo['card_brand'], + sprintf('%s/%s', $cardExpired['card_expiration_month'], $cardExpired['card_expiration_year']), $xenditInvoiceData['credit_card_token'] ); } @@ -79,8 +79,8 @@ public function confirmInvoice(int $invoiceId, array $xenditInvoiceData, bool $s $this->updateTransactions( $transactions, [ - "status" => XenditTransaction::STATUS_PAID, - "payment_method" => $xenditInvoiceData["payment_method"] + 'status' => XenditTransaction::STATUS_PAID, + 'payment_method' => $xenditInvoiceData['payment_method'] ] ); }