summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-06-14 19:37:35 +0200
committerFlorian Dold <florian@dold.me>2021-06-14 19:37:35 +0200
commitef636c022bb6f8017ef237a5e6468f5c449665ad (patch)
tree7c7f0fa083a4c02f8d3fb0711b2bd7781cd80879 /packages/taler-wallet-core/src/operations
parentb4f97f4592cbab6632aff4f1ea4bedccdbf00d3a (diff)
downloadwallet-core-ef636c022bb6f8017ef237a5e6468f5c449665ad.tar.gz
wallet-core-ef636c022bb6f8017ef237a5e6468f5c449665ad.tar.bz2
wallet-core-ef636c022bb6f8017ef237a5e6468f5c449665ad.zip
implement force-retrying transactions
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r--packages/taler-wallet-core/src/operations/transactions.ts45
1 files changed, 45 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts
index 3d9f1be41..1b2c8477f 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -38,6 +38,11 @@ import {
} from "@gnu-taler/taler-util";
import { getFundingPaytoUris } from "./reserves.js";
import { getExchangeDetails } from "./exchanges.js";
+import { processWithdrawGroup } from "./withdraw.js";
+import { processPurchasePay } from "./pay.js";
+import { processDepositGroup } from "./deposits.js";
+import { processTip } from "./tip.js";
+import { processRefreshGroup } from "./refresh.js";
/**
* Create an event ID from the type and the primary key for the event.
@@ -399,6 +404,46 @@ export enum TombstoneTag {
}
/**
+ * Immediately retry the underlying operation
+ * of a transaction.
+ */
+export async function retryTransaction(
+ ws: InternalWalletState,
+ transactionId: string,
+): Promise<void> {
+ const [type, ...rest] = transactionId.split(":");
+
+ switch (type) {
+ case TransactionType.Deposit:
+ const depositGroupId = rest[0];
+ processDepositGroup(ws, depositGroupId, true);
+ break;
+ case TransactionType.Withdrawal: {
+ const withdrawalGroupId = rest[0];
+ await processWithdrawGroup(ws, withdrawalGroupId, true);
+ break;
+ }
+ case TransactionType.Payment: {
+ const proposalId = rest[0]
+ await processPurchasePay(ws, proposalId, true);
+ break;
+ }
+ case TransactionType.Tip: {
+ const walletTipId = rest[0];
+ await processTip(ws, walletTipId, true);
+ break;
+ }
+ case TransactionType.Refresh: {
+ const refreshGroupId = rest[0];
+ await processRefreshGroup(ws, refreshGroupId, true);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/**
* Permanently delete a transaction based on the transaction ID.
*/
export async function deleteTransaction(