diff options
author | Florian Dold <florian@dold.me> | 2023-06-28 11:10:35 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-06-28 11:10:35 +0200 |
commit | 5bbf41ce1c01497d3efe6db63fba1c3d4688c1a8 (patch) | |
tree | 6af3baf2dd9adb1b0ce97d1e383a8987c6898e54 /packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts | |
parent | 4e3e17edd15e584c28982b67a3c22f1ac117ba18 (diff) | |
download | wallet-core-5bbf41ce1c01497d3efe6db63fba1c3d4688c1a8.tar.xz |
wallet-core: handle 'never' timestamp in purse status
Diffstat (limited to 'packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts b/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts index a070eea50..424715efa 100644 --- a/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts +++ b/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts @@ -29,6 +29,7 @@ import { TalerError, TalerErrorCode, TalerPreciseTimestamp, + TalerProtocolTimestamp, TalerProtocolViolationError, TalerUriAction, TransactionAction, @@ -479,8 +480,11 @@ async function processPeerPushDebitReady( resp, codecForExchangePurseStatus(), ); + const mergeTimestamp = purseStatus.merge_timestamp; logger.info(`got purse status ${purseStatus}`); - if (purseStatus.merge_timestamp) { + if (!mergeTimestamp || TalerProtocolTimestamp.isNever(mergeTimestamp)) { + return { ready: false }; + } else { await transitionPeerPushDebitTransaction( ws, peerPushInitiation.pursePub, @@ -505,10 +509,12 @@ async function processPeerPushDebitReady( return { ready: true, }; + } else { + logger.warn(`unexpected HTTP status for purse: ${resp.status}`); + return { + ready: false, + }; } - return { - ready: false, - }; }); logger.trace( "returning early from peer-push-debit for long-polling in background", |