From 1406e4bd24a00002c7f7309ff000e4a70dd1b58b Mon Sep 17 00:00:00 2001 From: wixarm Date: Sun, 1 Feb 2026 08:41:16 +0330 Subject: [PATCH] add: gui sep requests --- index.js | 144 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 74 insertions(+), 70 deletions(-) diff --git a/index.js b/index.js index 3a7305b..88b7a8c 100644 --- a/index.js +++ b/index.js @@ -927,26 +927,6 @@ app.post("/sepverify", async (req, res) => { if (response.data.ResultCode === 0) { let redirectUrl = `https://rasadyar.net/payment?finalAmount=${Amount}&cardHolderPan=${SecurePan}&date=${new Date()}&saleReferenceId=${TraceNo}`; - // Update DB with verify result for manual submit in GUI - try { - const coll = await getSepPayCollection(); - await coll.updateOne( - { token: Token }, - { - $set: { - verified: true, - refNum: RefNum, - traceNo: TraceNo, - securePan: SecurePan, - verifyAmount: Amount, - updatedAt: new Date(), - }, - }, - ); - } catch (dbErr) { - console.error("sepverify: failed to update DB", dbErr); - } - if (isLink) { await taavonSendDataZarinPalLink(province, { authority: Token, @@ -990,6 +970,31 @@ app.get("/sep-pay-requests/gui", async (req, res) => { const submitPathPrefix = basePath ? basePath + "/sep-pay-request/" : "/sep-pay-request/"; + + let list = []; + try { + const coll = await getSepPayCollection(); + const raw = await coll + .find({}) + .sort({ createdAt: -1 }) + .limit(500) + .toArray(); + list = raw.map((doc) => ({ + ...doc, + _id: doc._id ? doc._id.toString() : doc._id, + })); + } catch (err) { + console.error("sep-pay-requests gui list error", err); + } + + const listJson = JSON.stringify(list) + .replace(/\u2028/g, "\\u2028") + .replace(/\u2029/g, "\\u2029") + .replace(//g, "\\u003e") + .replace(/\\/g, "\\\\") + .replace(/"/g, '\\"'); + const html = ` @@ -1001,71 +1006,70 @@ app.get("/sep-pay-requests/gui", async (req, res) => { body { font-family: Tahoma, Arial, sans-serif; margin: 0; padding: 16px; background: #f5f5f5; } h1 { color: #333; margin-bottom: 16px; } .card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 16px; margin-bottom: 12px; } - .row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; } - .label { font-weight: bold; color: #555; min-width: 100px; } + .row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; align-items: center; } + .label { font-weight: bold; color: #555; min-width: 90px; } .value { color: #333; } - .verified { color: #2e7d32; } - .unverified { color: #c62828; } - button { background: #1976d2; color: #fff; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; } + button { background: #1976d2; color: #fff; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; margin-top: 8px; } button:hover { background: #1565c0; } - button:disabled { background: #9e9e9e; cursor: not-allowed; } - .msg { margin-top: 12px; padding: 8px; border-radius: 6px; } + .msg { margin-top: 8px; padding: 8px; border-radius: 6px; font-size: 14px; } .msg.success { background: #e8f5e9; color: #2e7d32; } .msg.error { background: #ffebee; color: #c62828; } + input { padding: 6px 8px; border: 1px solid #ccc; border-radius: 4px; width: 180px; } #list { margin-top: 16px; }

درخواست‌های پرداخت SEP

API لیست (JSON)

-
در حال بارگذاری...
+
`;