aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-06-12 12:38:28 -0300
committerSebastian <sebasjm@gmail.com>2024-06-12 12:38:28 -0300
commitf9d4ff5b43e48a07ac81d7e7ef800ddb12f5f90a (patch)
tree066d37ecc36ab9085e59411f6b69a75c43cd5577 /packages
parent366b2e6d8bdaab0995ce43e8f56edb3600ab7c01 (diff)
downloadwallet-core-f9d4ff5b43e48a07ac81d7e7ef800ddb12f5f90a.tar.xz
do not throw error when asking withdrawal info for instructed amount 0
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-core/src/pay-peer-pull-credit.ts10
-rw-r--r--packages/taler-wallet-core/src/pay-peer-push-credit.ts6
-rw-r--r--packages/taler-wallet-core/src/withdraw.ts8
3 files changed, 16 insertions, 8 deletions
diff --git a/packages/taler-wallet-core/src/pay-peer-pull-credit.ts b/packages/taler-wallet-core/src/pay-peer-pull-credit.ts
index d3c4f0d7f..3e7fdd36b 100644
--- a/packages/taler-wallet-core/src/pay-peer-pull-credit.ts
+++ b/packages/taler-wallet-core/src/pay-peer-pull-credit.ts
@@ -934,6 +934,11 @@ export async function checkPeerPullPaymentInitiation(
Amounts.parseOrThrow(req.amount),
undefined,
);
+ if (wi.selectedDenoms.selectedDenoms.length === 0) {
+ throw Error(
+ `unable to check pull payment from ${exchangeUrl}, can't select denominations for instructed amount (${req.amount}`,
+ );
+ }
logger.trace(`got withdrawal info`);
@@ -1054,6 +1059,11 @@ export async function initiatePeerPullPayment(
Amounts.parseOrThrow(req.partialContractTerms.amount),
undefined,
);
+ if (wi.selectedDenoms.selectedDenoms.length === 0) {
+ throw Error(
+ `unable to initiate pull payment from ${exchangeBaseUrl}, can't select denominations for instructed amount (${req.partialContractTerms.amount}`,
+ );
+ }
const mergeTimestamp = TalerPreciseTimestamp.now();
diff --git a/packages/taler-wallet-core/src/pay-peer-push-credit.ts b/packages/taler-wallet-core/src/pay-peer-push-credit.ts
index ae2372eeb..5a1bfbdbd 100644
--- a/packages/taler-wallet-core/src/pay-peer-push-credit.ts
+++ b/packages/taler-wallet-core/src/pay-peer-push-credit.ts
@@ -461,6 +461,12 @@ export async function preparePeerPushCredit(
undefined,
);
+ if (wi.selectedDenoms.selectedDenoms.length === 0) {
+ throw Error(
+ `unable to prepare push credit from ${exchangeBaseUrl}, can't select denominations for instructed amount (${purseStatus.balance}`,
+ );
+ }
+
const transitionInfo = await wex.db.runReadWriteTx(
{ storeNames: ["contractTerms", "peerPushCredit"] },
async (tx) => {
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts
index d7a1c6d24..8bc4aafd1 100644
--- a/packages/taler-wallet-core/src/withdraw.ts
+++ b/packages/taler-wallet-core/src/withdraw.ts
@@ -2267,14 +2267,6 @@ export async function getExchangeWithdrawalInfo(
logger.trace("selection done");
- if (selectedDenoms.selectedDenoms.length === 0) {
- throw Error(
- `unable to withdraw from ${exchangeBaseUrl}, can't select denominations for instructed amount (${Amounts.stringify(
- instructedAmount,
- )}`,
- );
- }
-
const exchangeWireAccounts: string[] = [];
for (const account of exchange.wireInfo.accounts) {