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,14 +366,16 @@ async function gatherPurchasePending(
now, now,
pr.payRetryInfo.nextRetry, pr.payRetryInfo.nextRetry,
); );
resp.pendingOperations.push({ if (!onlyDue || pr.payRetryInfo.nextRetry.t_ms <= now.t_ms) {
type: "pay", resp.pendingOperations.push({
givesLifeness: true, type: "pay",
isReplay: false, givesLifeness: true,
proposalId: pr.proposalId, isReplay: false,
retryInfo: pr.payRetryInfo, proposalId: pr.proposalId,
lastError: pr.lastPayError, retryInfo: pr.payRetryInfo,
}); lastError: pr.lastPayError,
});
}
} }
if (pr.refundStatusRequested) { if (pr.refundStatusRequested) {
resp.nextRetryDelay = updateRetryDelay( resp.nextRetryDelay = updateRetryDelay(
@ -381,13 +383,15 @@ async function gatherPurchasePending(
now, now,
pr.refundStatusRetryInfo.nextRetry, pr.refundStatusRetryInfo.nextRetry,
); );
resp.pendingOperations.push({ if (!onlyDue || pr.refundStatusRetryInfo.nextRetry.t_ms <= now.t_ms) {
type: "refund-query", resp.pendingOperations.push({
givesLifeness: true, type: "refund-query",
proposalId: pr.proposalId, givesLifeness: true,
retryInfo: pr.refundStatusRetryInfo, proposalId: pr.proposalId,
lastError: pr.lastRefundStatusError, retryInfo: pr.refundStatusRetryInfo,
}); lastError: pr.lastRefundStatusError,
});
}
} }
const numRefundsPending = Object.keys(pr.refundsPending).length; const numRefundsPending = Object.keys(pr.refundsPending).length;
if (numRefundsPending > 0) { if (numRefundsPending > 0) {
@ -397,15 +401,17 @@ async function gatherPurchasePending(
now, now,
pr.refundApplyRetryInfo.nextRetry, pr.refundApplyRetryInfo.nextRetry,
); );
resp.pendingOperations.push({ if (!onlyDue || pr.refundApplyRetryInfo.nextRetry.t_ms <= now.t_ms) {
type: "refund-apply", resp.pendingOperations.push({
numRefundsDone, type: "refund-apply",
numRefundsPending, numRefundsDone,
givesLifeness: true, numRefundsPending,
proposalId: pr.proposalId, givesLifeness: true,
retryInfo: pr.refundApplyRetryInfo, proposalId: pr.proposalId,
lastError: pr.lastRefundApplyError, retryInfo: pr.refundApplyRetryInfo,
}); lastError: pr.lastRefundApplyError,
});
}
} }
}); });
} }