summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/pay.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-12 16:32:07 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-12 16:32:07 +0530
commit11fa3397053c16cfcbf594c1389a75eaad94a40e (patch)
tree2a464ac389576b8a81021d92ee4ec3d2d6e8f56b /packages/taler-wallet-core/src/operations/pay.ts
parent8d7b171d02e0ab4d5da7dc81eaea6c27106dbc57 (diff)
downloadwallet-core-11fa3397053c16cfcbf594c1389a75eaad94a40e.tar.gz
wallet-core-11fa3397053c16cfcbf594c1389a75eaad94a40e.tar.bz2
wallet-core-11fa3397053c16cfcbf594c1389a75eaad94a40e.zip
fix preparePay bug and add integration test for it
Diffstat (limited to 'packages/taler-wallet-core/src/operations/pay.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/pay.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts
index db5a56d18..0576f7eab 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -980,17 +980,17 @@ export async function preparePayForUri(
amountRaw: Amounts.stringify(purchase.contractData.amount),
amountEffective: Amounts.stringify(purchase.payCostInfo.totalCost),
};
- } else if (purchase.paymentSubmitPending) {
+ } else {
+ const paid = !purchase.paymentSubmitPending;
return {
status: PreparePayResultType.AlreadyConfirmed,
contractTerms: JSON.parse(purchase.contractTermsRaw),
- paid: false,
+ paid,
amountRaw: Amounts.stringify(purchase.contractData.amount),
amountEffective: Amounts.stringify(purchase.payCostInfo.totalCost),
+ ...(paid ? { nextUrl: purchase.contractData.orderId } : {}),
};
}
- // FIXME: we don't handle aborted payments correctly here.
- throw Error("BUG: invariant violation (purchase status)");
}
/**