updating credit amount functionality

This commit is contained in:
2026-07-05 00:01:19 +02:00
parent 6d48472425
commit a4d210393e
2 changed files with 12 additions and 3 deletions

View File

@@ -130,10 +130,12 @@ class TransactionServiceTest {
when(currencyService.findCurrencyByIsoCode("USD")).thenReturn(currencyUsd);
when(currencyService.findCurrencyByIsoCode("ZWL")).thenReturn(currencyZwl);
BigDecimal creditAmount = transactionService.calculateCurrencyExchangeValue(transaction);
BigDecimal creditAmount = transactionService.calculateCurrencyExchangeValue(
transaction.getDebitCurrency(),
transaction.getCreditCurrency(),
transaction.getAmount());
assertEquals(new BigDecimal("1500.0000"), creditAmount);
assertEquals(new BigDecimal("1500.0000"), transaction.getCreditAmount());
}
@Test
@@ -141,7 +143,10 @@ class TransactionServiceTest {
void shouldReturnZeroWhenCreditCurrencyNull() {
transaction.setCreditCurrency(null);
BigDecimal result = transactionService.calculateCurrencyExchangeValue(transaction);
BigDecimal result = transactionService.calculateCurrencyExchangeValue(
transaction.getDebitCurrency(),
transaction.getCreditCurrency(),
transaction.getAmount());
assertEquals(BigDecimal.ZERO, result);
}