From 732cc1930155f5e7390dff6e7a1c9657e657049a Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 27 Apr 2022 08:06:38 +0000 Subject: [PATCH 1/4] Fix admin create invoice error --- modules/gateways/xendit/hooks.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/gateways/xendit/hooks.php b/modules/gateways/xendit/hooks.php index 35349af..b025ed1 100644 --- a/modules/gateways/xendit/hooks.php +++ b/modules/gateways/xendit/hooks.php @@ -10,6 +10,9 @@ * @return void */ add_hook('InvoiceCreation', 1, function ($vars) { + if($vars['status'] == 'Draft') + return; + $xenditRecurring = new Recurring(); $invoice = $xenditRecurring->getInvoice($vars['invoiceid']); From 91e430a513ce41fe5c6e72e5a2010ccbbcd7eb36 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 27 Apr 2022 08:08:31 +0000 Subject: [PATCH 2/4] Fix PHP format --- modules/gateways/xendit/hooks.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/gateways/xendit/hooks.php b/modules/gateways/xendit/hooks.php index b025ed1..30157df 100644 --- a/modules/gateways/xendit/hooks.php +++ b/modules/gateways/xendit/hooks.php @@ -10,8 +10,9 @@ * @return void */ add_hook('InvoiceCreation', 1, function ($vars) { - if($vars['status'] == 'Draft') + if ($vars['status'] == 'Draft') { return; + } $xenditRecurring = new Recurring(); $invoice = $xenditRecurring->getInvoice($vars['invoiceid']); From b0650b078ab74459fd1105d0526b42c8141b9a3f Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 27 Apr 2022 08:10:16 +0000 Subject: [PATCH 3/4] Update yml --- .buddy/phpcodesniffer.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.buddy/phpcodesniffer.yml b/.buddy/phpcodesniffer.yml index 807bae5..119bcf5 100644 --- a/.buddy/phpcodesniffer.yml +++ b/.buddy/phpcodesniffer.yml @@ -4,6 +4,7 @@ - type: "PUSH" refs: - "refs/heads/master" + - "refs/pull/*" - type: "CREATE_REF" refs: - "refs/pull/*" From 546b612a91f1761eb8728673288c716fc86783a9 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 27 Apr 2022 14:21:33 +0000 Subject: [PATCH 4/4] Fix issues on WHMCS 7.9.2 --- modules/gateways/xendit.php | 4 ++-- modules/gateways/xendit/hooks.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/gateways/xendit.php b/modules/gateways/xendit.php index a61e1dd..a3c4581 100644 --- a/modules/gateways/xendit.php +++ b/modules/gateways/xendit.php @@ -186,7 +186,7 @@ function xendit_remoteinput($params) $secretKey = $params['xenditTestMode'] == 'on' ? $params['xenditTestSecretKey'] : $params['xenditSecretKey']; // Client Parameters - $clientId = $params["clientdetails"]["id"]; + $clientId = $params["clientdetails"]["id"] ?? $params['userid']; // System Parameters $systemUrl = $params['systemurl']; @@ -273,7 +273,7 @@ function xendit_remoteupdate($params) $remoteStorageToken = $params['gatewayid']; // Client Parameters - $clientId = $params['client_id']; + $clientId = $params['client_id'] ?? $params['userid']; $payMethodId = $params['paymethodid']; $card_expired_date = (new DateTime($params['payMethod']->payment->expiry_date)); $currencyData = getCurrency($clientId); diff --git a/modules/gateways/xendit/hooks.php b/modules/gateways/xendit/hooks.php index 30157df..a6c1de3 100644 --- a/modules/gateways/xendit/hooks.php +++ b/modules/gateways/xendit/hooks.php @@ -34,7 +34,7 @@ */ add_hook("ClientAreaPageCart", 1, function ($vars) { if ($vars['templatefile'] == 'viewcart') { - $activeCurrency = $vars['activeCurrency']->code; + $activeCurrency = $vars['currency']['code'] ?? $vars['activeCurrency']->code; if (!in_array($activeCurrency, ActionBase::ALLOW_CURRENCIES)) { unset($vars['gateways']["xendit"]); }