aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-10-21 12:24:23 -0300
committerSebastian <sebasjm@gmail.com>2022-10-21 12:24:23 -0300
commit892b3b500a4884dd6a4db6a777d829b7eec529cd (patch)
tree1eaf9245eeea39ebd665ea90dd2204c42178f377
parentf4b92578b0dd08ccd0b7a31b9da318ba661ae3ec (diff)
fix: transfor from backup proporsal status to purchase status and fix denom query
-rw-r--r--packages/taler-wallet-core/src/operations/backup/import.ts23
1 files changed, 20 insertions, 3 deletions
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts
index 6ec541edc..ad3676ef8 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -588,8 +588,22 @@ export async function importBackup(
case BackupProposalStatus.Paid:
proposalStatus = PurchaseStatus.Paid;
break;
- default:
- throw Error();
+ case BackupProposalStatus.Proposed:
+ proposalStatus = PurchaseStatus.Proposed;
+ break;
+ case BackupProposalStatus.PermanentlyFailed:
+ proposalStatus = PurchaseStatus.PaymentAbortFinished;
+ break;
+ case BackupProposalStatus.Refused:
+ proposalStatus = PurchaseStatus.ProposalRefused;
+ break;
+ case BackupProposalStatus.Repurchase:
+ proposalStatus = PurchaseStatus.RepurchaseDetected;
+ break;
+ default: {
+ const error: never = backupPurchase.proposal_status;
+ throw Error(`backup status ${error} is not handled`);
+ }
}
if (!existingPurchase) {
const refunds: { [refundKey: string]: WalletRefundItem } = {};
@@ -744,7 +758,10 @@ export async function importBackup(
for (const oldCoin of backupRefreshGroup.old_coins) {
const c = await tx.coins.get(oldCoin.coin_pub);
checkBackupInvariant(!!c);
- const d = await tx.denominations.get(c.denomPubHash);
+ const d = await tx.denominations.get([
+ c.exchangeBaseUrl,
+ c.denomPubHash,
+ ]);
checkBackupInvariant(!!d);
if (oldCoin.refresh_session) {