diff options
author | Florian Dold <florian@dold.me> | 2023-05-05 19:03:44 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-05-07 21:51:02 +0200 |
commit | 7f0edb6a783d9a50f94f65c815c1280baecaac89 (patch) | |
tree | b4f3bc24fece1f651e8c2f69fc0fcf52e1d6f330 /packages/taler-wallet-core/src/operations/backup/export.ts | |
parent | a0bf83fbb5db026389cc7d203adcff050d5a1b28 (diff) | |
download | wallet-core-7f0edb6a783d9a50f94f65c815c1280baecaac89.tar.xz |
wallet-core: refund DD37 refactoring
Diffstat (limited to 'packages/taler-wallet-core/src/operations/backup/export.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/backup/export.ts | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/packages/taler-wallet-core/src/operations/backup/export.ts b/packages/taler-wallet-core/src/operations/backup/export.ts index 68f8beb93..7b245a4eb 100644 --- a/packages/taler-wallet-core/src/operations/backup/export.ts +++ b/packages/taler-wallet-core/src/operations/backup/export.ts @@ -69,7 +69,6 @@ import { DenominationRecord, PurchaseStatus, RefreshCoinStatus, - RefundState, WithdrawalGroupStatus, WithdrawalRecordType, } from "../../db.js"; @@ -384,34 +383,34 @@ export async function exportBackup( await tx.purchases.iter().forEachAsync(async (purch) => { const refunds: BackupRefundItem[] = []; purchaseProposalIdSet.add(purch.proposalId); - for (const refundKey of Object.keys(purch.refunds)) { - const ri = purch.refunds[refundKey]; - const common = { - coin_pub: ri.coinPub, - execution_time: ri.executionTime, - obtained_time: ri.obtainedTime, - refund_amount: Amounts.stringify(ri.refundAmount), - rtransaction_id: ri.rtransactionId, - total_refresh_cost_bound: Amounts.stringify( - ri.totalRefreshCostBound, - ), - }; - switch (ri.type) { - case RefundState.Applied: - refunds.push({ type: BackupRefundState.Applied, ...common }); - break; - case RefundState.Failed: - refunds.push({ type: BackupRefundState.Failed, ...common }); - break; - case RefundState.Pending: - refunds.push({ type: BackupRefundState.Pending, ...common }); - break; - } - } + // for (const refundKey of Object.keys(purch.refunds)) { + // const ri = purch.refunds[refundKey]; + // const common = { + // coin_pub: ri.coinPub, + // execution_time: ri.executionTime, + // obtained_time: ri.obtainedTime, + // refund_amount: Amounts.stringify(ri.refundAmount), + // rtransaction_id: ri.rtransactionId, + // total_refresh_cost_bound: Amounts.stringify( + // ri.totalRefreshCostBound, + // ), + // }; + // switch (ri.type) { + // case RefundState.Applied: + // refunds.push({ type: BackupRefundState.Applied, ...common }); + // break; + // case RefundState.Failed: + // refunds.push({ type: BackupRefundState.Failed, ...common }); + // break; + // case RefundState.Pending: + // refunds.push({ type: BackupRefundState.Pending, ...common }); + // break; + // } + // } let propStatus: BackupProposalStatus; switch (purch.purchaseStatus) { - case PurchaseStatus.Paid: + case PurchaseStatus.Done: case PurchaseStatus.QueryingAutoRefund: case PurchaseStatus.QueryingRefund: propStatus = BackupProposalStatus.Paid; @@ -422,19 +421,19 @@ export async function exportBackup( case PurchaseStatus.Paying: propStatus = BackupProposalStatus.Proposed; break; - case PurchaseStatus.ProposalDownloadFailed: - case PurchaseStatus.PaymentAbortFinished: + case PurchaseStatus.FailedClaim: + case PurchaseStatus.AbortedIncompletePayment: propStatus = BackupProposalStatus.PermanentlyFailed; break; case PurchaseStatus.AbortingWithRefund: - case PurchaseStatus.ProposalRefused: + case PurchaseStatus.AbortedProposalRefused: propStatus = BackupProposalStatus.Refused; break; case PurchaseStatus.RepurchaseDetected: propStatus = BackupProposalStatus.Repurchase; break; default: { - const error: never = purch.purchaseStatus; + const error = purch.purchaseStatus; throw Error(`purchase status ${error} is not handled`); } } |