fix: order will stay in queryRefund state forever

This commit is contained in:
Sebastian 2023-01-19 14:25:02 -03:00
parent e263fe3508
commit 4f376297dc
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1

View File

@ -2685,6 +2685,15 @@ export async function processPurchaseQueryRefund(
waitForAutoRefund, waitForAutoRefund,
); );
if (Amounts.isZero(awaitingAmount)) { if (Amounts.isZero(awaitingAmount)) {
// Maybe the user wanted to check for refund to find out
// that there is no refund pending from merchant
await ws.db
.mktx((x) => [x.purchases])
.runReadWrite(async (tx) => {
purchase.purchaseStatus = PurchaseStatus.Paid;
await tx.purchases.put(purchase);
});
return OperationAttemptResult.finishedEmpty(); return OperationAttemptResult.finishedEmpty();
} }
} }