From f7c97f73bb0a3fca48e2e1c65950c3b73dd265c0 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Thu, 23 Feb 2023 12:31:52 -0300
Subject: fix: check amount request when no enough balance

---
 .../src/components/PaymentButtons.tsx                          | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/components/PaymentButtons.tsx')

diff --git a/packages/taler-wallet-webextension/src/components/PaymentButtons.tsx b/packages/taler-wallet-webextension/src/components/PaymentButtons.tsx
index f8983b995..67aaccf53 100644
--- a/packages/taler-wallet-webextension/src/components/PaymentButtons.tsx
+++ b/packages/taler-wallet-webextension/src/components/PaymentButtons.tsx
@@ -203,19 +203,19 @@ type NoEnoughBalanceReason =
 function getReason(
   info: PayMerchantInsufficientBalanceDetails,
 ): NoEnoughBalanceReason {
-  if (Amounts.cmp(info.amountRequested, info.balanceAvailable)) {
+  if (Amounts.cmp(info.amountRequested, info.balanceAvailable) > 0) {
     return "available";
   }
-  if (Amounts.cmp(info.amountRequested, info.balanceMaterial)) {
+  if (Amounts.cmp(info.amountRequested, info.balanceMaterial) > 0) {
     return "material";
   }
-  if (Amounts.cmp(info.amountRequested, info.balanceAgeAcceptable)) {
+  if (Amounts.cmp(info.amountRequested, info.balanceAgeAcceptable) > 0) {
     return "age-acceptable";
   }
-  if (Amounts.cmp(info.amountRequested, info.balanceMerchantAcceptable)) {
+  if (Amounts.cmp(info.amountRequested, info.balanceMerchantAcceptable) > 0) {
     return "merchant-acceptable";
   }
-  if (Amounts.cmp(info.amountRequested, info.balanceMerchantDepositable)) {
+  if (Amounts.cmp(info.amountRequested, info.balanceMerchantDepositable) > 0) {
     return "merchant-depositable";
   }
   return "fee-gap";
-- 
cgit v1.2.3

