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/*" 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 d488c25..e34df1e 100644 --- a/modules/gateways/xendit/hooks.php +++ b/modules/gateways/xendit/hooks.php @@ -10,6 +10,10 @@ * @return void */ add_hook('InvoiceCreation', 1, function ($vars) { + if ($vars['status'] == 'Draft') { + return; + } + $xenditRecurring = new Recurring(); $invoice = $xenditRecurring->getInvoice($vars['invoiceid']); @@ -31,7 +35,7 @@ add_hook("ClientAreaPageCart", 1, function ($vars) { if ($vars['templatefile'] == 'viewcart') { $actionBase = new ActionBase(); - $activeCurrency = $vars['activeCurrency']->code; + $activeCurrency = $vars['currency']['code'] ?? $vars['activeCurrency']->code; if (!$actionBase->validateCompatibilityVersion() || !in_array($activeCurrency, ActionBase::ALLOW_CURRENCIES)) { unset($vars['gateways']["xendit"]); }