From 4f8a0c54717b9c95e1b219dd68d4bb756835b2dc Mon Sep 17 00:00:00 2001 From: webdeveloper Date: Thu, 15 Feb 2024 20:42:37 +0800 Subject: [PATCH] introduced config.php - test mode, test email, data endpoint --- admin/add_vendor_action.php | 2 +- admin/config.php | 5 + admin/index.php | 2 +- admin/login.php | 2 +- admin/logout.php | 2 +- admin/order-history.php | 8 +- admin/product-add-action.bak.php | 2 +- admin/product-add-action.php | 2 +- admin/product-add.bak.php | 2 +- admin/product-delete-action.php | 3 +- admin/product-edit-action.php | 2 +- admin/product-edit.php | 8 +- admin/product-grid.php | 10 +- admin/update-token-session.php | 2 +- admin/upload_monitor.php | 5 +- admin/upload_monitor_user.php | 5 +- admin/user-card-action.php | 2 +- admin/user-card.php | 4 +- admin/vendor-card-2.php | 2 +- admin/vendor-card.php | 14 +-- admin/vendor-delete-action.php | 4 +- admin/vendor-list.php | 2 +- admin/vendor-product-grid.bak.php | 10 +- admin/vendor-product-grid.php | 4 +- admin/vendor-profile.php | 2 +- admin/vendor_list_action.php | 2 +- cart.php | 22 ++--- catalog-single-vendor.php | 2 +- check_session_variables.php | 46 ++------- checkout.php | 10 +- checkouttest.php | 10 +- contact-us-action.php | 2 +- forget_otp.php | 4 +- forget_otp_action.php | 2 +- forgot_password_action.php | 4 +- functions.php | 126 +++++++++++++----------- header.php | 16 +-- index.php | 2 +- info.php | 3 + login.php | 2 +- login_action.php | 2 +- offer.php | 2 +- product-left-sidebar.php | 18 ++-- register.php | 2 +- register_action.php | 2 +- register_customer.php | 2 +- register_customer_action.php | 2 +- register_otp.php | 2 +- register_otp_action.php | 2 +- register_vendor.php | 2 +- register_vendor_action.php | 4 +- same_day_delivery.php | 2 +- search_product_action.php | 4 +- selected_variation.php | 2 +- shop-left-sidebar-col-4.php | 2 +- shop-list-left-sidebar.php | 2 +- shop-list-left-sidebar2.php | 2 +- update-token-session.php | 2 +- user-history.php | 14 +-- user-profile.php | 18 ++-- user-refund-history.php | 2 +- vendor-all-product-list.php | 4 +- vendor-dashboard-orders-edit-action.php | 2 +- vendor-dashboard-orders-edit.php | 2 +- vendor-dashboard.php | 4 +- vendor-list.php | 2 +- vendor-profile.php | 2 +- vendor-refund-history.php | 8 +- vendor-settings.php | 24 ++--- vendor-uploads-add-product-action.php | 2 +- vendor-uploads-edit-product-action.php | 2 +- vendor-uploads.php | 8 +- wishlist.php | 4 +- 73 files changed, 252 insertions(+), 261 deletions(-) create mode 100644 admin/config.php create mode 100644 info.php diff --git a/admin/add_vendor_action.php b/admin/add_vendor_action.php index a54aa0d..d7066b5 100644 --- a/admin/add_vendor_action.php +++ b/admin/add_vendor_action.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index 14c69dd..65db273 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,6 +1,6 @@ "") { $_SESSION["isLoggedIn"] = true; diff --git a/admin/login.php b/admin/login.php index acccbda..a1883c5 100644 --- a/admin/login.php +++ b/admin/login.php @@ -1,6 +1,6 @@ "") { $_SESSION["isLoggedIn"] = true; @@ -959,7 +959,7 @@ $allorders = json_encode($orders, true); var password = ''; function login(username, password, callback) { - fetch("https://api.obanana.shop/api/v1/login", { + fetch("https:///api/v1/login", { method: "POST", headers: { "Content-Type": "application/json", @@ -1029,7 +1029,7 @@ $allorders = json_encode($orders, true); // Define your functions here function toReceiveFunction(orderId, reason, image, token) { // const token = ''; - fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, { + fetch(`https:///api/v1/orders/${orderId}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json', @@ -1057,7 +1057,7 @@ $allorders = json_encode($orders, true); } function refundCompleteFunction(orderId, reason, image, token) { - fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, { + fetch(`https:///api/v1/orders/${orderId}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json', diff --git a/admin/product-add-action.bak.php b/admin/product-add-action.bak.php index 6b5699e..f2610ff 100644 --- a/admin/product-add-action.bak.php +++ b/admin/product-add-action.bak.php @@ -1,6 +1,6 @@ '; $productName = $_POST['product_name']; diff --git a/admin/product-add.bak.php b/admin/product-add.bak.php index 9294bbc..a726648 100644 --- a/admin/product-add.bak.php +++ b/admin/product-add.bak.php @@ -1,6 +1,6 @@ diff --git a/admin/product-delete-action.php b/admin/product-delete-action.php index c80aec4..f3ede2a 100644 --- a/admin/product-delete-action.php +++ b/admin/product-delete-action.php @@ -1,7 +1,8 @@ 'https://api.obanana.shop/api/v1/products/656717579624f6181c49cdda', diff --git a/admin/product-edit-action.php b/admin/product-edit-action.php index 492717a..7c116e7 100644 --- a/admin/product-edit-action.php +++ b/admin/product-edit-action.php @@ -1,6 +1,6 @@ '; diff --git a/admin/product-edit.php b/admin/product-edit.php index 84f9fec..6968787 100644 --- a/admin/product-edit.php +++ b/admin/product-edit.php @@ -1,6 +1,6 @@ "") { @@ -1046,7 +1046,7 @@ $vendorId = $_SESSION["vendorId"]; formData.append('category', 'product'); formData.append('image', resizedFile); - fetch('https://api.obanana.shop/api/v1/upload_image', { + fetch('https:///api/v1/upload_image', { method: 'POST', body: formData }) @@ -1062,12 +1062,12 @@ $vendorId = $_SESSION["vendorId"]; const filename = result.filename; const payload = { - product_image: `https://api.obanana.shop/images/storage/product_uploads/${filename}`, + product_image: `https:///images/storage/product_uploads/${filename}`, }; console.log('Payload:', payload); const token = ''; - return fetch('https://api.obanana.shop/api/v1/products/' + productId, { + return fetch('https:///api/v1/products/' + productId, { method: 'PATCH', headers: { 'Content-Type': 'application/json', diff --git a/admin/product-grid.php b/admin/product-grid.php index 4c5e8ea..4634636 100644 --- a/admin/product-grid.php +++ b/admin/product-grid.php @@ -1,6 +1,6 @@ "") { $_SESSION["isLoggedIn"] = true; @@ -928,7 +928,7 @@ if($_SESSION["user_type"]!="admin"){ formData.append('category', 'product'); formData.append('image', file); - fetch('https://api.obanana.shop/api/v1/upload_image', { + fetch('https:///api/v1/upload_image', { method: 'POST', body: formData }) @@ -947,7 +947,7 @@ if($_SESSION["user_type"]!="admin"){ const filename = result.filename; const payload = { - product_image: `https://api.obanana.shop/images/storage/product_uploads/${filename}`, + product_image: `https:///images/storage/product_uploads/${filename}`, vendor_api_id: vendor, product_name: updatedName, stock: updatedStock, @@ -963,7 +963,7 @@ if($_SESSION["user_type"]!="admin"){ console.log('Payload:', payload); // Make another API request using the extracted filename - return fetch('https://api.obanana.shop/api/v1/products/' + productId, { + return fetch('https:///api/v1/products/' + productId, { method: 'PATCH', headers: { 'Content-Type': 'application/json' @@ -988,7 +988,7 @@ if($_SESSION["user_type"]!="admin"){ } else { // If no file selected, only update the email - fetch('https://api.obanana.shop/api/v1/products/' + productId, { + fetch('https:///api/v1/products/' + productId, { method: 'PATCH', headers: { 'Content-Type': 'application/json' diff --git a/admin/update-token-session.php b/admin/update-token-session.php index 652ac4d..3423690 100644 --- a/admin/update-token-session.php +++ b/admin/update-token-session.php @@ -1,5 +1,5 @@ @@ -169,7 +170,7 @@ function getAllProducts() $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/search?q=', + CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -194,7 +195,7 @@ function getAllUsers() $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => 'https://api.obanana.shop/api/v1/users', + CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/users", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, diff --git a/admin/upload_monitor_user.php b/admin/upload_monitor_user.php index d2ce03c..891402f 100644 --- a/admin/upload_monitor_user.php +++ b/admin/upload_monitor_user.php @@ -1,4 +1,5 @@ 'https://api.obanana.shop/api/v1/users', + CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/users", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -108,7 +109,7 @@ function getAllProducts() $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/search?q=', + CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, diff --git a/admin/user-card-action.php b/admin/user-card-action.php index c25141d..d7bb536 100644 --- a/admin/user-card-action.php +++ b/admin/user-card-action.php @@ -1,6 +1,6 @@ "") { $_SESSION["isLoggedIn"] = true; @@ -762,7 +762,7 @@ $users = getUsers(); } function login(username, password, sessionToken, callback) { - fetch("https://api.obanana.shop/api/v1/login", { + fetch("https:///api/v1/login", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/admin/vendor-card-2.php b/admin/vendor-card-2.php index 97e976f..f4111d0 100644 --- a/admin/vendor-card-2.php +++ b/admin/vendor-card-2.php @@ -1,6 +1,6 @@ "") { $_SESSION["isLoggedIn"] = true; diff --git a/admin/vendor-card.php b/admin/vendor-card.php index add84a8..111c49c 100644 --- a/admin/vendor-card.php +++ b/admin/vendor-card.php @@ -1,6 +1,6 @@ "") { $_SESSION["isLoggedIn"] = true; @@ -892,7 +892,7 @@ function deleteVendor(vendorId){ formData.append('category', 'vendor'); formData.append('image', file); - fetch('https://api.obanana.shop/api/v1/upload_image', { + fetch('https:///api/v1/upload_image', { method: 'POST', body: formData }) @@ -908,7 +908,7 @@ function deleteVendor(vendorId){ const filename = result.filename; const payload = { - vendor_image: `https://api.obanana.shop/images/storage/vendor_uploads/${filename}`, + vendor_image: `https:///images/storage/vendor_uploads/${filename}`, user_login: updatedUser, first_name: firstName, last_name: lastName, @@ -927,7 +927,7 @@ function deleteVendor(vendorId){ }; // Make another API request using the extracted filename - return fetch('https://api.obanana.shop/api/v1/vendors/' + vendorId, { + return fetch('https:///api/v1/vendors/' + vendorId, { method: 'PATCH', headers: { 'Content-Type': 'application/json' @@ -948,7 +948,7 @@ function deleteVendor(vendorId){ }); } else { // If no file selected, only update the email - fetch('https://api.obanana.shop/api/v1/vendors/' + vendorId, { + fetch('https:///api/v1/vendors/' + vendorId, { method: 'PATCH', headers: { 'Content-Type': 'application/json' @@ -992,7 +992,7 @@ function deleteVendor(vendorId){ var email = emailInput.value; if (email.trim() !== '') { - return fetch('https://api.obanana.shop/api/v1/vendors/search?q=' + email) + return fetch('https:///api/v1/vendors/search?q=' + email) .then(response => { if (response.ok) { return response.json(); @@ -1301,7 +1301,7 @@ function deleteVendor(vendorId){ if (email.trim() !== '') { var response; $.ajax({ - url: 'https://api.obanana.shop/api/v1/vendors/search?q=' + email, + url: 'https:///api/v1/vendors/search?q=' + email, method: 'GET', success: function(data) { response = data; diff --git a/admin/vendor-delete-action.php b/admin/vendor-delete-action.php index bb8abed..4afde7c 100644 --- a/admin/vendor-delete-action.php +++ b/admin/vendor-delete-action.php @@ -1,10 +1,10 @@ true, diff --git a/admin/vendor-list.php b/admin/vendor-list.php index b426fa7..98b8c67 100644 --- a/admin/vendor-list.php +++ b/admin/vendor-list.php @@ -1,6 +1,6 @@ "") { $_SESSION["isLoggedIn"] = true; diff --git a/admin/vendor-product-grid.bak.php b/admin/vendor-product-grid.bak.php index 0126d8e..c528093 100644 --- a/admin/vendor-product-grid.bak.php +++ b/admin/vendor-product-grid.bak.php @@ -1,6 +1,6 @@ @@ -1102,7 +1102,7 @@ $vendorId = $_SESSION["vendorId"]; formData.append('category', 'product'); formData.append('image', file); - fetch('https://api.obanana.shop/api/v1/upload_image', { + fetch('https:///api/v1/upload_image', { method: 'POST', body: formData }) @@ -1121,7 +1121,7 @@ $vendorId = $_SESSION["vendorId"]; const filename = result.filename; const payload = { - product_image: `https://api.obanana.shop/images/storage/product_uploads/${filename}`, + product_image: `https:///images/storage/product_uploads/${filename}`, vendor_api_id: vendor, product_name: updatedName, stock: updatedStock, @@ -1137,7 +1137,7 @@ $vendorId = $_SESSION["vendorId"]; console.log('Payload:', payload); // Make another API request using the extracted filename - return fetch('https://api.obanana.shop/api/v1/products/' + productId, { + return fetch('https:///api/v1/products/' + productId, { method: 'PATCH', headers: { 'Content-Type': 'application/json' @@ -1161,7 +1161,7 @@ $vendorId = $_SESSION["vendorId"]; }); } else { // If no file selected, only update the email - fetch('https://api.obanana.shop/api/v1/products/' + productId, { + fetch('https:///api/v1/products/' + productId, { method: 'PATCH', headers: { 'Content-Type': 'application/json' diff --git a/admin/vendor-product-grid.php b/admin/vendor-product-grid.php index 716b86b..f8f24c9 100644 --- a/admin/vendor-product-grid.php +++ b/admin/vendor-product-grid.php @@ -1,6 +1,6 @@ "") { @@ -777,7 +777,7 @@ if($_SESSION["user_type"]!="admin"){ } function login(username, password, callback) { - fetch("https://api.obanana.shop/api/v1/login", { + fetch("https:///api/v1/login", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/admin/vendor-profile.php b/admin/vendor-profile.php index 6d87715..2553644 100644 --- a/admin/vendor-profile.php +++ b/admin/vendor-profile.php @@ -1,6 +1,6 @@ "") { $_SESSION["isLoggedIn"] = true; @@ -255,7 +255,7 @@ if ($_SESSION["userId"] <> "") { function handleQtyInputCart(input, orderId, itemId, prodId) { var newQuantity = parseInt(input.value); // updateQuantityCart(orderId, itemId, newQuantity); - fetch(`https://api.obanana.shop/api/v1/products/${prodId}`, { + fetch(`https:///api/v1/products/${prodId}`, { method: 'GET' }) @@ -301,7 +301,7 @@ if ($_SESSION["userId"] <> "") { } function qtyIncrementCart(orderId, itemId, isFloat, prodId) { - fetch(`https://api.obanana.shop/api/v1/products/${prodId}`, { + fetch(`https:///api/v1/products/${prodId}`, { method: 'GET' }) @@ -352,7 +352,7 @@ if ($_SESSION["userId"] <> "") { function qtyDecrementCart(orderId, itemId, isFloat, prodId) { console.log('decrementing') - fetch(`https://api.obanana.shop/api/v1/products/${prodId}`, { + fetch(`https:///api/v1/products/${prodId}`, { method: 'GET' }) @@ -408,7 +408,7 @@ if ($_SESSION["userId"] <> "") { function updateQuantityCart(orderId, itemId, newQuantity, isFloat) { console.log(isFloat) const token = ''; - fetch(`https://api.obanana.shop/api/v1/orders/${orderId}/items/${itemId}`, { + fetch(`https:///api/v1/orders/${orderId}/items/${itemId}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', @@ -441,7 +441,7 @@ if ($_SESSION["userId"] <> "") { function updateFloatTotalAmountCart(orderId) { // Fetch the order data - fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`) + fetch(`https:///api/v1/orders/${orderId}`) .then(response => response.json()) .then(orderData => { console.log("This is the OrderData: " + JSON.stringify(orderData, null, 2)); @@ -457,7 +457,7 @@ if ($_SESSION["userId"] <> "") { // Perform the PATCH request to update the total amount in the API const token = ''; - fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, { + fetch(`https:///api/v1/orders/${orderId}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json', @@ -487,7 +487,7 @@ if ($_SESSION["userId"] <> "") { function updateTotalAmountCart(orderId) { // Fetch the order data - fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`) + fetch(`https:///api/v1/orders/${orderId}`) .then(response => response.json()) .then(orderData => { if (orderData && orderData !== "") { @@ -504,7 +504,7 @@ if ($_SESSION["userId"] <> "") { // Perform the PATCH request to update the total amount in the API const token = ''; - fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, { + fetch(`https:///api/v1/orders/${orderId}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json', @@ -534,7 +534,7 @@ if ($_SESSION["userId"] <> "") { function getLatestOrdersCart() { var customerId = '' // Fetch the order data - fetch(`https://api.obanana.shop/api/v1/orders/customer/${customerId}`) + fetch(`https:///api/v1/orders/customer/${customerId}`) .then(response => response.json()) .then(orderData => { if (orderData && orderData !== "") { @@ -563,7 +563,7 @@ if ($_SESSION["userId"] <> "") { function deleteOrderCart(orderId) { console.log('delete') - fetch('https://api.obanana.shop/api/v1/orders/' + orderId, { + fetch('https:///api/v1/orders/' + orderId, { method: 'DELETE' }) .then(response => response.json()) diff --git a/catalog-single-vendor.php b/catalog-single-vendor.php index a66b9a2..bc7a985 100644 --- a/catalog-single-vendor.php +++ b/catalog-single-vendor.php @@ -3,7 +3,7 @@ use Symfony\Component\VarDumper\VarDumper; include "functions.php"; -session_start(); + $_SESSION["url"] = $_SERVER['REQUEST_URI']; if ($_SESSION["userId"] <> "") { $_SESSION["isLoggedIn"] = true; diff --git a/check_session_variables.php b/check_session_variables.php index bdbebe3..04f3d39 100644 --- a/check_session_variables.php +++ b/check_session_variables.php @@ -1,37 +1,9 @@ -"; - echo "email : ".$_SESSION["email"]."
"; - echo "password : ".$_SESSION["password"]."
"; - echo "firstname : ".$_SESSION["firstname"]."
"; - echo "lastname : ".$_SESSION["lastname"]."
"; - echo "company : ".$_SESSION["company"]."
"; - echo "phone : ".$_SESSION["phone"]."
"; - if($_SESSION["isCustomer"]){ - echo "isCustomer : true
"; - } else { - echo "isCustomer : false
"; - } - echo "customerId : ".$_SESSION["customerId"]."
"; - if($_SESSION["isVendor"]){ - echo "isVendor : true
"; - } else { - echo "isVendor : false
"; - } - echo "vendorId : ".$_SESSION["vendorId"]."
"; - echo "otp : ".$_SESSION["otp"]."
"; - echo "token : ".$_SESSION["token"]."
"; - echo "userId : ".$_SESSION["userId"]."
"; - if($_SESSION["isLoggedIn"]){ - echo "isLoggedIn : true
"; - } else { - echo "isLoggedIn : false
"; - } - echo "url : ".$_SESSION["url"]."
"; - echo "cartitems : ".count($_SESSION["cart_items"])."
"; - echo "productId : ".$_SESSION["productId"]."
"; - if (isset($_SESSION["LoggedInVendorId"])) { - echo "LoggedInVendorId: " . $_SESSION["LoggedInVendorId"] . "
"; - } - -?> \ No newline at end of file +'; + var_dump($_SESSION); + echo ''; +}else{ + echo "

Alert! This only works in test mode.

"; +} diff --git a/checkout.php b/checkout.php index 305f227..a0d9dd4 100644 --- a/checkout.php +++ b/checkout.php @@ -1,6 +1,6 @@ "") { $_SESSION["isLoggedIn"] = true; @@ -489,7 +489,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] $('#submitBtn').on('click', function() { // Retrieve existing addresses from the API // fetch('https://api.obanana.shop/api/v1/customers/65482e8d209ff8d348bd30fd') - fetch('https://api.obanana.shop/api/v1/customers/' + customerId) + fetch('https:///api/v1/customers/' + customerId) .then(response => response.json()) .then(data => { // Get the existing addresses array @@ -524,7 +524,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] existingAddresses.push(newAddress); // Make a PATCH request to update the addresses array - return fetch('https://api.obanana.shop/api/v1/customers/' + customerId, { + return fetch('https:///api/v1/customers/' + customerId, { method: 'PATCH', headers: { 'Content-Type': 'application/json' @@ -892,7 +892,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] ordersToUpdate.forEach(async (orderId) => { // console.log(orderId) - const patchResponse = await fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, { + const patchResponse = await fetch(`https:///api/v1/orders/${orderId}`, { method: "PATCH", body: JSON.stringify({ // shipping_address:{ @@ -947,7 +947,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] ordersToUpdate.forEach(async (orderId) => { // console.log(orderId) - const patchResponse = await fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, { + const patchResponse = await fetch(`https:///api/v1/orders/${orderId}`, { method: "PATCH", body: JSON.stringify({ shipping_address: { diff --git a/checkouttest.php b/checkouttest.php index 5411e25..154742a 100644 --- a/checkouttest.php +++ b/checkouttest.php @@ -1,6 +1,6 @@ "") { $_SESSION["isLoggedIn"] = true; @@ -490,7 +490,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] $('#submitBtn').on('click', function() { // Retrieve existing addresses from the API // fetch('https://api.obanana.shop/api/v1/customers/65482e8d209ff8d348bd30fd') - fetch('https://api.obanana.shop/api/v1/customers/' + customerId) + fetch('https:///api/v1/customers/' + customerId) .then(response => response.json()) .then(data => { // Get the existing addresses array @@ -525,7 +525,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] existingAddresses.push(newAddress); // Make a PATCH request to update the addresses array - return fetch('https://api.obanana.shop/api/v1/customers/' + customerId, { + return fetch('https:///api/v1/customers/' + customerId, { method: 'PATCH', headers: { 'Content-Type': 'application/json' @@ -937,7 +937,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] console.log(orderId) const token = ''; const shippingfee = parseFloat(orderId.shipping_fee) - const patchResponse = await fetch(`https://api.obanana.shop/api/v1/orders/${orderId._id}`, { + const patchResponse = await fetch(`https:///api/v1/orders/${orderId._id}`, { method: "PATCH", body: JSON.stringify({ shipping_address: { @@ -1020,7 +1020,7 @@ if (isset($customer_data[0]["address"]) && is_array($customer_data[0]["address"] console.log(orderId) const token = ''; const shippingfee = parseFloat(orderId.shipping_fee) - const patchResponse = await fetch(`https://api.obanana.shop/api/v1/orders/${orderId._id}`, { + const patchResponse = await fetch(`https:///api/v1/orders/${orderId._id}`, { method: "PATCH", body: JSON.stringify({ shipping_address: { diff --git a/contact-us-action.php b/contact-us-action.php index f6a1164..3625a62 100644 --- a/contact-us-action.php +++ b/contact-us-action.php @@ -1,6 +1,6 @@ @@ -181,7 +181,7 @@ var pass2I = document.getElementById(`passInput2`); var email = '' if (otp && pass && pass2) { if (pass === pass2) { - fetch(`https://api.obanana.shop/api/v1/change-password`, { + fetch(`https:///api/v1/change-password`, { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/forget_otp_action.php b/forget_otp_action.php index 3fc8e4e..83ba3e1 100644 --- a/forget_otp_action.php +++ b/forget_otp_action.php @@ -1,6 +1,6 @@ 'https://api.obanana.shop/api/v1/products', + CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -30,7 +31,7 @@ function simpleProducts($category) // function searchProducts($query) // { // $query = str_replace(" ", "+", $query); -// $url = "https://api.obanana.shop/api/v1/products/search?q=$query"; +// $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=$query"; // $curl = curl_init(); // curl_setopt($curl, CURLOPT_URL, $url); // curl_setopt_array($curl, array( @@ -57,7 +58,7 @@ function simpleProducts($category) function searchProducts($query) { $query = str_replace(" ", "+", $query); - $url = "https://api.obanana.shop/api/v1/products/search?q=$query"; + $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=$query"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -108,11 +109,11 @@ $result = searchProducts($query); // function searchProducts($query) // { // $query = str_replace(" ", "+", $query); -// $url = "https://api.obanana.shop/api/v1/products/search?q=$query"; +// $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=$query"; // $curl = curl_init(); // curl_setopt($curl, CURLOPT_URL, $url); // curl_setopt_array($curl, array( -// //CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/search?q=phone', +// //CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=phone', // CURLOPT_RETURNTRANSFER => true, // CURLOPT_ENCODING => '', // CURLOPT_MAXREDIRS => 10, @@ -133,7 +134,7 @@ $result = searchProducts($query); function getProduct($product) { - $url = "https://api.obanana.shop/api/v1/products/$product"; + $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/$product"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -157,7 +158,7 @@ function productList() { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => 'https://api.obanana.shop/api/v1/products', + CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -179,10 +180,10 @@ function productList() function productListVendor($vendorId) { $curl = curl_init(); - $url = 'https://api.obanana.shop/api/v1/products/vendor/' . $vendorId; + $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/vendor/" . $vendorId; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( - //CURLOPT_URL => 'https://api.obanana.shop/api/v1/products/vendor/6527b593f79b5deac5ad6cb8', + //CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/vendor/6527b593f79b5deac5ad6cb8', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -209,7 +210,7 @@ function getProductVariations($parent_id) { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => 'https://api.obanana.shop/api/v1/products', + CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -245,7 +246,7 @@ function register($username, $password) $json = json_encode($array); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt_array($curl, array( - CURLOPT_URL => 'https://api.obanana.shop/api/v1/register', + CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/register", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -273,7 +274,7 @@ function login($username, $password) $json = json_encode($array); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt_array($curl, array( - CURLOPT_URL => 'https://api.obanana.shop/api/v1/login', + CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/login", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -293,6 +294,9 @@ function login($username, $password) } function forgot_password($email) { + if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + $email = $_SESSION["test_email_rcpt"]; + } $curl = curl_init(); $array = array( "username" => $email @@ -300,7 +304,7 @@ function forgot_password($email) $json = json_encode($array); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt_array($curl, array( - CURLOPT_URL => 'https://api.obanana.shop/api/v1/forgot-password', + CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/forgot-password", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -320,7 +324,7 @@ function forgot_password($email) function getCustomerbyLoginId($id) { $curl = curl_init(); - $url = "https://api.obanana.shop/api/v1/customers/login_id/$id"; + $url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/login_id/$id"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -344,7 +348,7 @@ function getCustomerbyLoginId($id) function getCustomer($id) { $curl = curl_init(); - $url = "https://api.obanana.shop/api/v1/customers/$id"; + $url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/$id"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -368,7 +372,7 @@ function getCustomer($id) function getVendorbyLoginId($id) { $curl = curl_init(); - $url = "https://api.obanana.shop/api/v1/vendors/login_id/$id"; + $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/login_id/$id"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -392,7 +396,7 @@ function getVendorbyLoginId($id) function customerExists($email) { $curl = curl_init(); - $url = "https://api.obanana.shop/api/v1/customers/search?q=$email"; + $url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/search?q=$email"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => true, @@ -420,7 +424,7 @@ function customerExists($email) function vendorExists($email) { $curl = curl_init(); - $url = "https://api.obanana.shop/api/v1/vendors/search?q=$email"; + $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/search?q=$email"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => true, @@ -449,7 +453,9 @@ function vendorExists($email) function sendEmail($fName, $lName, $email, $phone, $message) { - $email2 = "stacyjoycemapano@gmail.com"; + if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + $email = $_SESSION["test_email_rcpt"]; + } $message2 = "

Greetings from Obanana!