diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-09-08 19:54:23 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-09-08 19:54:30 +0530 |
commit | 043a5f89fe020bbb55170a9fc355c3d699ad8761 (patch) | |
tree | 1c033feecf6b276f8dc69e8ddb70ee260d675bb8 /packages/taler-wallet-core/src/operations/tip.ts | |
parent | b9e43e652e606706a81f39d4f888477580de79b0 (diff) | |
download | wallet-core-043a5f89fe020bbb55170a9fc355c3d699ad8761.tar.xz |
tipping transaction list entry, integration test and DB simplifications
Diffstat (limited to 'packages/taler-wallet-core/src/operations/tip.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/tip.ts | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts index 6ccd262b0..248ea2cd1 100644 --- a/packages/taler-wallet-core/src/operations/tip.ts +++ b/packages/taler-wallet-core/src/operations/tip.ts @@ -25,11 +25,8 @@ import { import * as Amounts from "../util/amounts"; import { Stores, - PlanchetRecord, - WithdrawalGroupRecord, initRetryInfo, updateRetryInfoTimeout, - WithdrawalSourceType, TipPlanchet, CoinRecord, CoinSourceType, @@ -38,7 +35,6 @@ import { import { getExchangeWithdrawalInfo, selectWithdrawalDenoms, - processWithdrawGroup, denomSelectionInfoToState, } from "./withdraw"; import { updateExchangeFromUrl } from "./exchanges"; @@ -102,15 +98,11 @@ export async function prepareTip( tipRecord = { walletTipId: walletTipId, acceptedTimestamp: undefined, - rejectedTimestamp: undefined, tipAmountRaw: amount, - deadline: tipPickupStatus.expiration, - exchangeUrl: tipPickupStatus.exchange_url, + tipExpiration: tipPickupStatus.expiration, + exchangeBaseUrl: tipPickupStatus.exchange_url, merchantBaseUrl: res.merchantBaseUrl, - nextUrl: undefined, - pickedUp: false, planchets: undefined, - response: undefined, createdTimestamp: getTimestampNow(), merchantTipId: res.merchantTipId, tipAmountEffective: Amounts.sub(amount, Amounts.add( @@ -120,6 +112,7 @@ export async function prepareTip( retryInfo: initRetryInfo(), lastError: undefined, denomsSel: denomSelectionInfoToState(selectedDenoms), + pickedUpTimestamp: undefined, }; await ws.db.put(Stores.tips, tipRecord); } @@ -197,7 +190,7 @@ async function processTipImpl( return; } - if (tipRecord.pickedUp) { + if (tipRecord.pickedUpTimestamp) { logger.warn("tip already picked up"); return; } @@ -302,7 +295,7 @@ async function processTipImpl( denomPub: planchet.denomPub, denomPubHash: planchet.denomPubHash, denomSig: denomSig, - exchangeBaseUrl: tipRecord.exchangeUrl, + exchangeBaseUrl: tipRecord.exchangeBaseUrl, status: CoinStatus.Fresh, suspended: false, }); @@ -315,10 +308,11 @@ async function processTipImpl( if (!tr) { return; } - if (tr.pickedUp) { + if (tr.pickedUpTimestamp) { return; } - tr.pickedUp = true; + tr.pickedUpTimestamp = getTimestampNow(); + tr.lastError = undefined; tr.retryInfo = initRetryInfo(false); await tx.put(Stores.tips, tr); for (const cr of newCoinRecords) { |