pedidos
This commit is contained in:
@@ -184,4 +184,39 @@ export const api = {
|
||||
async syncFromWoo() {
|
||||
return fetch("/products/sync-from-woo", { method: "POST" }).then(r => r.json());
|
||||
},
|
||||
|
||||
// --- Testing ---
|
||||
async listRecentOrders({ limit = 20 } = {}) {
|
||||
const u = new URL("/test/orders", location.origin);
|
||||
u.searchParams.set("limit", String(limit));
|
||||
return fetch(u).then(r => r.json());
|
||||
},
|
||||
|
||||
async getProductsWithStock() {
|
||||
return fetch("/test/products-with-stock").then(r => r.json());
|
||||
},
|
||||
|
||||
async createTestOrder({ basket, address, wa_chat_id }) {
|
||||
return fetch("/test/order", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ basket, address, wa_chat_id }),
|
||||
}).then(r => r.json());
|
||||
},
|
||||
|
||||
async createPaymentLink({ woo_order_id, amount }) {
|
||||
return fetch("/test/payment-link", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ woo_order_id, amount }),
|
||||
}).then(r => r.json());
|
||||
},
|
||||
|
||||
async simulateMpWebhook({ woo_order_id, amount }) {
|
||||
return fetch("/test/simulate-webhook", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ woo_order_id, amount }),
|
||||
}).then(r => r.json());
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user