[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] 01/03: wallet-core: handle missing purchase status c
From: |
gnunet |
Subject: |
[taler-wallet-core] 01/03: wallet-core: handle missing purchase status cases |
Date: |
Wed, 12 Oct 2022 22:27:54 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
commit 8bfa77200e711718e24c72ee84a28fa443c61786
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Oct 12 20:06:45 2022 +0200
wallet-core: handle missing purchase status cases
---
packages/taler-wallet-core/src/db.ts | 38 ++++++++++++----------
.../src/operations/pay-merchant.ts | 6 +++-
2 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/packages/taler-wallet-core/src/db.ts
b/packages/taler-wallet-core/src/db.ts
index 125e777b8..539a925c1 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -103,6 +103,8 @@ export const WALLET_DB_MINOR_VERSION = 2;
export enum OperationStatusRange {
ACTIVE_START = 10,
ACTIVE_END = 29,
+ USER_ATTENTION_START = 30,
+ USER_ATTENTION_END = 49,
DORMANT_START = 50,
DORMANT_END = 69,
}
@@ -114,36 +116,36 @@ export enum WithdrawalGroupStatus {
/**
* Reserve must be registered with the bank.
*/
- RegisteringBank = OperationStatusRange.ACTIVE_START,
+ RegisteringBank = 10,
/**
* We've registered reserve's information with the bank
* and are now waiting for the user to confirm the withdraw
* with the bank (typically 2nd factor auth).
*/
- WaitConfirmBank = OperationStatusRange.ACTIVE_START + 1,
+ WaitConfirmBank = 11,
/**
* Querying reserve status with the exchange.
*/
- QueryingStatus = OperationStatusRange.ACTIVE_START + 2,
+ QueryingStatus = 12,
/**
* Ready for withdrawal.
*/
- Ready = OperationStatusRange.ACTIVE_START + 3,
+ Ready = 13,
/**
* The corresponding withdraw record has been created.
* No further processing is done, unless explicitly requested
* by the user.
*/
- Finished = OperationStatusRange.DORMANT_START,
+ Finished = 50,
/**
* The bank aborted the withdrawal.
*/
- BankAborted = OperationStatusRange.DORMANT_START + 1,
+ BankAborted = 51,
}
/**
@@ -1036,59 +1038,59 @@ export enum PurchaseStatus {
/**
* Not downloaded yet.
*/
- DownloadingProposal = OperationStatusRange.ACTIVE_START,
+ DownloadingProposal = 10,
/**
* The user has accepted the proposal.
*/
- Paying = OperationStatusRange.ACTIVE_START + 1,
+ Paying = 11,
- AbortingWithRefund = OperationStatusRange.ACTIVE_START + 2,
+ AbortingWithRefund = 12,
/**
* Paying a second time, likely with different session ID
*/
- PayingReplay = OperationStatusRange.ACTIVE_START + 3,
+ PayingReplay = 13,
/**
* Query for refunds (until query succeeds).
*/
- QueryingRefund = OperationStatusRange.ACTIVE_START + 4,
+ QueryingRefund = 14,
/**
* Query for refund (until auto-refund deadline is reached).
*/
- QueryingAutoRefund = OperationStatusRange.ACTIVE_START + 5,
+ QueryingAutoRefund = 15,
/**
* Proposal downloaded, but the user needs to accept/reject it.
*/
- Proposed = OperationStatusRange.DORMANT_START,
+ Proposed = 30,
/**
* The user has rejected the proposal.
*/
- ProposalRefused = OperationStatusRange.DORMANT_START + 1,
+ ProposalRefused = 50,
/**
* Downloading or processing the proposal has failed permanently.
*/
- ProposalDownloadFailed = OperationStatusRange.DORMANT_START + 2,
+ ProposalDownloadFailed = 51,
/**
* Downloaded proposal was detected as a re-purchase.
*/
- RepurchaseDetected = OperationStatusRange.DORMANT_START + 3,
+ RepurchaseDetected = 52,
/**
* The payment has been aborted.
*/
- PaymentAbortFinished = OperationStatusRange.DORMANT_START + 4,
+ PaymentAbortFinished = 53,
/**
* Payment was successful.
*/
- Paid = OperationStatusRange.DORMANT_START + 5,
+ Paid = 54,
}
/**
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts
b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index 750b3b9a6..d45a93056 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -1797,12 +1797,16 @@ export async function processPurchase(
case PurchaseStatus.ProposalDownloadFailed:
case PurchaseStatus.Paid:
case PurchaseStatus.RepurchaseDetected:
+ case PurchaseStatus.Proposed:
+ case PurchaseStatus.ProposalRefused:
+ case PurchaseStatus.PaymentAbortFinished:
return {
type: OperationAttemptResultType.Finished,
result: undefined,
};
default:
- throw Error(`unexpected purchase status (${purchase.purchaseStatus})`);
+ assertUnreachable(purchase.purchaseStatus);
+ // throw Error(`unexpected purchase status (${purchase.purchaseStatus})`);
}
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.