fix: do not count coins with other currency

This commit is contained in:
Sebastian 2023-01-19 13:37:42 -03:00
parent 928fe2d019
commit e263fe3508
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1

View File

@ -379,6 +379,9 @@ export async function getMerchantPaymentBalanceDetails(
])
.runReadOnly(async (tx) => {
await tx.coinAvailability.iter().forEach((ca) => {
if (ca.currency != req.currency) {
return;
}
const singleCoinAmount: AmountJson = {
currency: ca.currency,
fraction: ca.amountFrac,
@ -413,6 +416,9 @@ export async function getMerchantPaymentBalanceDetails(
});
await tx.refreshGroups.iter().forEach((r) => {
if (r.currency != req.currency) {
return;
}
d.balanceAvailable = Amounts.add(
d.balanceAvailable,
computeRefreshGroupAvailableAmount(r),