fix pending operation query for refunds

This commit is contained in:
Florian Dold 2019-12-07 20:35:47 +01:00
parent 165486a112
commit 27e42111e7
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -366,6 +366,7 @@ async function gatherPurchasePending(
now,
pr.payRetryInfo.nextRetry,
);
if (!onlyDue || pr.payRetryInfo.nextRetry.t_ms <= now.t_ms) {
resp.pendingOperations.push({
type: "pay",
givesLifeness: true,
@ -375,12 +376,14 @@ async function gatherPurchasePending(
lastError: pr.lastPayError,
});
}
}
if (pr.refundStatusRequested) {
resp.nextRetryDelay = updateRetryDelay(
resp.nextRetryDelay,
now,
pr.refundStatusRetryInfo.nextRetry,
);
if (!onlyDue || pr.refundStatusRetryInfo.nextRetry.t_ms <= now.t_ms) {
resp.pendingOperations.push({
type: "refund-query",
givesLifeness: true,
@ -389,6 +392,7 @@ async function gatherPurchasePending(
lastError: pr.lastRefundStatusError,
});
}
}
const numRefundsPending = Object.keys(pr.refundsPending).length;
if (numRefundsPending > 0) {
const numRefundsDone = Object.keys(pr.refundsDone).length;
@ -397,6 +401,7 @@ async function gatherPurchasePending(
now,
pr.refundApplyRetryInfo.nextRetry,
);
if (!onlyDue || pr.refundApplyRetryInfo.nextRetry.t_ms <= now.t_ms) {
resp.pendingOperations.push({
type: "refund-apply",
numRefundsDone,
@ -407,6 +412,7 @@ async function gatherPurchasePending(
lastError: pr.lastRefundApplyError,
});
}
}
});
}