diff options
author | Florian Dold <florian@dold.me> | 2023-05-30 09:33:32 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-05-30 09:33:38 +0200 |
commit | 0323067c0757262084e16a9bba9d58bcd773fc23 (patch) | |
tree | 667a0e03825e40189b7ec9d84eb7a8b99ccad997 /packages/taler-wallet-core/src/db.ts | |
parent | 246f914ca62906b463dfe98e834b5ade379a97e0 (diff) | |
download | wallet-core-0323067c0757262084e16a9bba9d58bcd773fc23.tar.xz |
wallet-core: add missing resume/suspend implementations
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 0e35fe27c..3edaf8af5 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -863,11 +863,22 @@ export interface TipRecord { * The url to be redirected after the tip is accepted. */ next_url: string | undefined; + /** * Timestamp for when the wallet finished picking up the tip * from the merchant. */ pickedUpTimestamp: TalerPreciseTimestamp | undefined; + + status: TipRecordStatus; +} + +export enum TipRecordStatus { + PendingPickup = 10, + + SuspendidPickup = 21, + + Done = 50, } export enum RefreshCoinStatus { @@ -1078,12 +1089,12 @@ export enum PurchaseStatus { /** * Not downloaded yet. */ - DownloadingProposal = 10, + PendingDownloadingProposal = 10, /** * The user has accepted the proposal. */ - Paying = 11, + PendingPaying = 11, /** * Currently in the process of aborting with a refund. @@ -1093,17 +1104,17 @@ export enum PurchaseStatus { /** * Paying a second time, likely with different session ID */ - PayingReplay = 13, + PendingPayingReplay = 13, /** * Query for refunds (until query succeeds). */ - QueryingRefund = 14, + PendingQueryingRefund = 14, /** * Query for refund (until auto-refund deadline is reached). */ - QueryingAutoRefund = 15, + PendingQueryingAutoRefund = 15, PendingAcceptRefund = 16, @@ -1902,7 +1913,7 @@ export interface PeerPullPaymentInitiationRecord { export enum PeerPushPaymentIncomingStatus { PendingMerge = 10 /* ACTIVE_START */, - MergeKycRequired = 11 /* ACTIVE_START + 1 */, + PendingMergeKycRequired = 11 /* ACTIVE_START + 1 */, /** * Merge was successful and withdrawal group has been created, now * everything is in the hand of the withdrawal group. @@ -2829,6 +2840,22 @@ export const walletDbFixups: FixupDescription[] = [ }); }, }, + { + name: "TipRecordRecord_status_add", + async fn(tx): Promise<void> { + await tx.tips.iter().forEachAsync(async (r) => { + // Remove legacy transactions that don't have the totalCost field yet. + if (r.status == null) { + if (r.pickedUpTimestamp) { + r.status = TipRecordStatus.Done; + } else { + r.status = TipRecordStatus.PendingPickup; + } + await tx.tips.put(r); + } + }); + }, + }, ]; const logger = new Logger("db.ts"); |