From fdad95358b5b69da7b6e1f5b1883be289948b69d Mon Sep 17 00:00:00 2001 From: Erwin Galang Date: Wed, 21 Feb 2024 09:09:50 +0800 Subject: [PATCH] added payment gateway switch in config.php --- admin/config.php | 9 +++++++-- checkout.php | 2 +- checkouttest.php | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/admin/config.php b/admin/config.php index 6103bed..9b40b50 100644 --- a/admin/config.php +++ b/admin/config.php @@ -3,6 +3,11 @@ $_SESSION["is_test"]=true; $_SESSION["test_email_rcpt"]=""; $_SESSION["sales_email"]=""; $_SESSION["data_endpoint"]="api.obanana.shop"; -$_SESSION["obpay"]=""; -$_SESSION["obpay_gate"]=""; +if ($_SESSION["is_test"]){ + $_SESSION["obpay"]="web.obpay.online/test"; + $_SESSION["obpay_gate"]="gate.obpay.online/api"; +} else { + $_SESSION["obpay"]="web.obpay.online"; + $_SESSION["obpay_gate"]="gate.obpay.online/api/v1"; +} ?> \ No newline at end of file diff --git a/checkout.php b/checkout.php index a0d9dd4..9c31b2f 100644 --- a/checkout.php +++ b/checkout.php @@ -848,7 +848,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] } else if (pay2RadioButton.checked) { try { const base64Credentialss = btoa(`${username}:${password}`); - const response = await fetch('https://gate.obpay.online/api/payment/links', { + const response = await fetch('https:///payment/links', { method: "POST", body: JSON.stringify({ amount: totalAmount * 100, diff --git a/checkouttest.php b/checkouttest.php index 154742a..a356165 100644 --- a/checkouttest.php +++ b/checkouttest.php @@ -856,7 +856,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] try { const base64Credentialss = btoa(`${username}:${password}`); - const response = await fetch('https://gate.obpay.online/api/v1/payment/links', { + const response = await fetch('https:///payment/links', { method: "POST", body: JSON.stringify({ amount: totalAmount * 100,