From e4ea2019430fb3c4b788f67427fbd743f604b7e5 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 14 May 2022 18:09:33 -0300 Subject: feat: awaiting refund --- packages/taler-wallet-core/src/operations/pay.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/pay.ts') diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts index db157257a..325d07bd1 100644 --- a/packages/taler-wallet-core/src/operations/pay.ts +++ b/packages/taler-wallet-core/src/operations/pay.ts @@ -443,6 +443,7 @@ async function recordConfirmPay( refundQueryRequested: false, timestampFirstSuccessfulPay: undefined, autoRefundDeadline: undefined, + refundAwaiting: undefined, paymentSubmitPending: true, refunds: {}, merchantPaySig: undefined, @@ -987,18 +988,16 @@ async function storeFirstPaySuccess( purchase.lastSessionId = sessionId; purchase.payRetryInfo = resetRetryInfo(); purchase.merchantPaySig = paySig; - if (isFirst) { - const protoAr = purchase.download.contractData.autoRefund; - if (protoAr) { - const ar = Duration.fromTalerProtocolDuration(protoAr); - logger.info("auto_refund present"); - purchase.refundQueryRequested = true; - purchase.refundStatusRetryInfo = resetRetryInfo(); - purchase.lastRefundStatusError = undefined; - purchase.autoRefundDeadline = AbsoluteTime.toTimestamp( - AbsoluteTime.addDuration(AbsoluteTime.now(), ar), - ); - } + const protoAr = purchase.download.contractData.autoRefund; + if (protoAr) { + const ar = Duration.fromTalerProtocolDuration(protoAr); + logger.info("auto_refund present"); + purchase.refundQueryRequested = true; + purchase.refundStatusRetryInfo = resetRetryInfo(); + purchase.lastRefundStatusError = undefined; + purchase.autoRefundDeadline = AbsoluteTime.toTimestamp( + AbsoluteTime.addDuration(AbsoluteTime.now(), ar), + ); } await tx.purchases.put(purchase); }); -- cgit v1.2.3