fix: transfor from backup proporsal status to purchase status and fix denom query
This commit is contained in:
parent
f4b92578b0
commit
892b3b500a
@ -588,8 +588,22 @@ export async function importBackup(
|
|||||||
case BackupProposalStatus.Paid:
|
case BackupProposalStatus.Paid:
|
||||||
proposalStatus = PurchaseStatus.Paid;
|
proposalStatus = PurchaseStatus.Paid;
|
||||||
break;
|
break;
|
||||||
default:
|
case BackupProposalStatus.Proposed:
|
||||||
throw Error();
|
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) {
|
if (!existingPurchase) {
|
||||||
const refunds: { [refundKey: string]: WalletRefundItem } = {};
|
const refunds: { [refundKey: string]: WalletRefundItem } = {};
|
||||||
@ -744,7 +758,10 @@ export async function importBackup(
|
|||||||
for (const oldCoin of backupRefreshGroup.old_coins) {
|
for (const oldCoin of backupRefreshGroup.old_coins) {
|
||||||
const c = await tx.coins.get(oldCoin.coin_pub);
|
const c = await tx.coins.get(oldCoin.coin_pub);
|
||||||
checkBackupInvariant(!!c);
|
checkBackupInvariant(!!c);
|
||||||
const d = await tx.denominations.get(c.denomPubHash);
|
const d = await tx.denominations.get([
|
||||||
|
c.exchangeBaseUrl,
|
||||||
|
c.denomPubHash,
|
||||||
|
]);
|
||||||
checkBackupInvariant(!!d);
|
checkBackupInvariant(!!d);
|
||||||
|
|
||||||
if (oldCoin.refresh_session) {
|
if (oldCoin.refresh_session) {
|
||||||
|
Loading…
Reference in New Issue
Block a user