From 6454c18071b60b8011843354108863ed22a0c29f Mon Sep 17 00:00:00 2001 From: parsa aghaei Date: Sat, 22 Aug 2026 17:18:24 +0330 Subject: [PATCH] feat(checkout): improve wallet top-up flow with auto deficit pre-fill on insufficient funds --- .../application/components/CheckoutPage.tsx | 9 +- .../application/components/TopUpModal.tsx | 11 +- graphify-out/.graphify_labels.json | 6 +- graphify-out/.graphify_labels.json.sig | 2 +- graphify-out/2026-08-22/.graphify_labels.json | 4 +- graphify-out/2026-08-22/GRAPH_REPORT.md | 10 +- graphify-out/2026-08-22/graph.json | 506 ++++---- graphify-out/2026-08-22/manifest.json | 1146 ++++++++--------- graphify-out/GRAPH_REPORT.md | 36 +- graphify-out/cache/stat-index.json | 2 +- graphify-out/graph.html | 4 +- graphify-out/graph.json | 658 +++++----- graphify-out/manifest.json | 1132 ++++++++-------- 13 files changed, 1769 insertions(+), 1757 deletions(-) diff --git a/frontend/application/components/CheckoutPage.tsx b/frontend/application/components/CheckoutPage.tsx index 1da724f..ac957d3 100644 --- a/frontend/application/components/CheckoutPage.tsx +++ b/frontend/application/components/CheckoutPage.tsx @@ -118,7 +118,11 @@ export default function CheckoutPage() { // 2. Validate wallet balance if payment method is wallet if (paymentMethod === 'wallet' && (profile.walletBalance || 0) < totalAmount) { - toast.error(`موجودی کیف پول شما (${(profile.walletBalance || 0).toLocaleString('fa-IR')} تومان) کمتر از مبلغ نهایی سفارش (${totalAmount.toLocaleString('fa-IR')} تومان) است. لطفاً ابتدا کیف پول خود را شارژ کنید.`); + const neededAmount = totalAmount - (profile.walletBalance || 0); + toast.error( + `موجودی کیف پول شما (${(profile.walletBalance || 0).toLocaleString('fa-IR')} تومان) کمتر از مبلغ سفارش (${totalAmount.toLocaleString('fa-IR')} تومان) است. کادر افزایش موجودی (${neededAmount.toLocaleString('fa-IR')} تومان) باز شد.`, + ); + setShowTopUpModal(true); return; } @@ -560,7 +564,7 @@ export default function CheckoutPage() {

{pay.desc}

- {pay.id === 'wallet' && pay.enabled && (profile.walletBalance || 0) === 0 && ( + {pay.id === 'wallet' && pay.enabled && (