Skip to content

Commit

Permalink
Merge pull request #20 from xendit/TPI-7326/whmcs-no-payment-cta
Browse files Browse the repository at this point in the history
Fix redirect to xendit invoice
  • Loading branch information
andykim authored Jun 16, 2022
2 parents 3c0de24 + f37a9ed commit 65dfbcd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/gateways/xendit/lib/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function isRefererUrlFromCart(): bool
{
if (isset($_SERVER["HTTP_REFERER"]) && $this->isViewInvoicePage()) {
$uri = parse_url($_SERVER['HTTP_REFERER']);
if (ltrim($uri["path"], "/") == "cart.php") {
if (in_array("cart.php", explode("/", $uri["path"]))) {
return true;
}
}
Expand All @@ -94,7 +94,7 @@ protected function isRefererUrlFromCart(): bool
*/
protected function isViewInvoicePage(): bool
{
return ltrim($_SERVER["SCRIPT_NAME"], "/") == "viewinvoice.php";
return in_array("viewinvoice.php", explode("/", $_SERVER["SCRIPT_NAME"] ?? ""));
}

/**
Expand Down Expand Up @@ -165,7 +165,7 @@ protected function generateFormParam(array $params, string $invoiceUrl): string
public function generatePaymentLink(array $params, bool $force = false): string
{
try {
if ($this->isRecurring($params["invoiceid"]) && !$this->isViewInvoicePage()) {
if (!$this->isViewInvoicePage()) {
return false;
}

Expand Down

0 comments on commit 65dfbcd

Please sign in to comment.