aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/pay-merchant.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/operations/pay-merchant.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/pay-merchant.ts30
1 files changed, 27 insertions, 3 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index 496641fe7..2419d32a2 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -168,6 +168,7 @@ export async function getTotalPaymentCost(
allDenoms,
DenominationRecord.toDenomInfo(denom),
amountLeft,
+ ws.config.testing.denomselAllowLate,
);
costs.push(Amounts.parseOrThrow(pcs.coinContributions[i]));
costs.push(refreshCost);
@@ -1659,6 +1660,7 @@ async function applySuccessfulRefund(
p: PurchaseRecord,
refreshCoinsMap: Record<string, CoinRefreshRequest>,
r: MerchantCoinRefundSuccessStatus,
+ denomselAllowLate: boolean,
): Promise<void> {
// FIXME: check signature before storing it as valid!
@@ -1688,6 +1690,7 @@ async function applySuccessfulRefund(
allDenoms,
DenominationRecord.toDenomInfo(denom),
amountLeft,
+ denomselAllowLate,
);
refreshCoinsMap[coin.coinPub] = {
@@ -1714,6 +1717,7 @@ async function storePendingRefund(
}>,
p: PurchaseRecord,
r: MerchantCoinRefundFailureStatus,
+ denomselAllowLate: boolean,
): Promise<void> {
const refundKey = getRefundKey(r);
@@ -1745,6 +1749,7 @@ async function storePendingRefund(
allDenoms,
DenominationRecord.toDenomInfo(denom),
amountLeft,
+ denomselAllowLate,
);
p.refunds[refundKey] = {
@@ -1767,6 +1772,7 @@ async function storeFailedRefund(
p: PurchaseRecord,
refreshCoinsMap: Record<string, CoinRefreshRequest>,
r: MerchantCoinRefundFailureStatus,
+ denomselAllowLate: boolean,
): Promise<void> {
const refundKey = getRefundKey(r);
@@ -1797,6 +1803,7 @@ async function storeFailedRefund(
allDenoms,
DenominationRecord.toDenomInfo(denom),
amountLeft,
+ denomselAllowLate,
);
p.refunds[refundKey] = {
@@ -1905,11 +1912,28 @@ async function acceptRefunds(
// Invariant: (!existingRefundInfo) || (existingRefundInfo === Pending)
if (refundStatus.type === "success") {
- await applySuccessfulRefund(tx, p, refreshCoinsMap, refundStatus);
+ await applySuccessfulRefund(
+ tx,
+ p,
+ refreshCoinsMap,
+ refundStatus,
+ ws.config.testing.denomselAllowLate,
+ );
} else if (isPermanentFailure) {
- await storeFailedRefund(tx, p, refreshCoinsMap, refundStatus);
+ await storeFailedRefund(
+ tx,
+ p,
+ refreshCoinsMap,
+ refundStatus,
+ ws.config.testing.denomselAllowLate,
+ );
} else {
- await storePendingRefund(tx, p, refundStatus);
+ await storePendingRefund(
+ tx,
+ p,
+ refundStatus,
+ ws.config.testing.denomselAllowLate,
+ );
}
}