Skip to content

Commit

Permalink
some small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
andykim committed Aug 24, 2022
1 parent baacaed commit f5e6206
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion modules/gateways/xendit.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

require __DIR__ . '/xendit/autoload.php';

// defines
// Module version
const XENDIT_PAYMENT_GATEWAY_VERSION = '1.1.0';

use WHMCS\Billing\Invoice;
Expand Down
2 changes: 1 addition & 1 deletion modules/gateways/xendit/lib/PaymentLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 7 additions & 7 deletions modules/gateways/xendit/lib/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand All @@ -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']
);
}
Expand All @@ -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']
]
);
}
Expand Down

0 comments on commit f5e6206

Please sign in to comment.