From f37a9ed4754eaedc6080ccc359136b5d180da063 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 16 Jun 2022 03:23:51 +0000 Subject: [PATCH] Fix redirect to xendit invoice --- modules/gateways/xendit/lib/Link.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/gateways/xendit/lib/Link.php b/modules/gateways/xendit/lib/Link.php index 85abaf0..0fab754 100644 --- a/modules/gateways/xendit/lib/Link.php +++ b/modules/gateways/xendit/lib/Link.php @@ -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; } } @@ -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"] ?? "")); } /** @@ -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; }