mapping missing purchase state with backup state

This commit is contained in:
Sebastian 2022-10-21 11:04:36 -03:00
parent e63f202e36
commit 4dac65e557
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1

View File

@ -413,23 +413,31 @@ export async function exportBackup(
let propStatus: BackupProposalStatus; let propStatus: BackupProposalStatus;
switch (purch.purchaseStatus) { switch (purch.purchaseStatus) {
case PurchaseStatus.Paid: case PurchaseStatus.Paid:
case PurchaseStatus.QueryingAutoRefund:
case PurchaseStatus.QueryingRefund:
propStatus = BackupProposalStatus.Paid; propStatus = BackupProposalStatus.Paid;
return; break;
case PurchaseStatus.PayingReplay:
case PurchaseStatus.DownloadingProposal: case PurchaseStatus.DownloadingProposal:
case PurchaseStatus.Proposed: case PurchaseStatus.Proposed:
case PurchaseStatus.Paying:
propStatus = BackupProposalStatus.Proposed; propStatus = BackupProposalStatus.Proposed;
break; break;
case PurchaseStatus.ProposalDownloadFailed: case PurchaseStatus.ProposalDownloadFailed:
case PurchaseStatus.PaymentAbortFinished:
propStatus = BackupProposalStatus.PermanentlyFailed; propStatus = BackupProposalStatus.PermanentlyFailed;
break; break;
case PurchaseStatus.AbortingWithRefund:
case PurchaseStatus.ProposalRefused: case PurchaseStatus.ProposalRefused:
propStatus = BackupProposalStatus.Refused; propStatus = BackupProposalStatus.Refused;
break; break;
case PurchaseStatus.RepurchaseDetected: case PurchaseStatus.RepurchaseDetected:
propStatus = BackupProposalStatus.Repurchase; propStatus = BackupProposalStatus.Repurchase;
break; break;
default: default: {
throw Error(); const error: never = purch.purchaseStatus;
throw Error(`purchase status ${error} is not handled`);
}
} }
const payInfo = purch.payInfo; const payInfo = purch.payInfo;