fix final rate calculation for the National Bank of Kazakhstan (#565)

This commit is contained in:
vigdail
2026-04-29 05:06:22 +05:00
committed by GitHub
parent 416e7cece1
commit da2f1ef410
2 changed files with 3 additions and 3 deletions
@@ -116,7 +116,7 @@ func (e *NationalBankOfKazakhstanExchangeRate) ToLatestExchangeRate(c core.Conte
return nil
}
finalRate := rate / unit
finalRate := unit / rate
if math.IsInf(finalRate, 0) {
log.Warnf(c, "[national_bank_of_kazakhstan_datasource.ToLatestExchangeRate] final exchange rate calculation failed, currency is %s, unit is %s, rate is %s", e.Currency, e.Unit, e.Rate)
return nil
@@ -55,12 +55,12 @@ func TestNationalBankOfKazakhstanDataSource_StandardDataExtractExchangeRates(t *
assert.Contains(t, resp.ExchangeRates, &models.LatestExchangeRate{
Currency: "USD",
Rate: "450.5",
Rate: "0.0022197558268590455",
})
assert.Contains(t, resp.ExchangeRates, &models.LatestExchangeRate{
Currency: "VND",
Rate: "0.0018",
Rate: "555.5555555555555",
})
}