Do single trade currency check in api generated payment acct

This commit is contained in:
ghubstan 2021-09-06 12:21:29 -03:00
parent e00cc86fea
commit 19e9c78f51
No known key found for this signature in database
GPG key ID: E35592D6800A861E

View file

@ -138,9 +138,12 @@ class CorePaymentAccountsService {
} }
private void verifyPaymentAccountHasRequiredFields(PaymentAccount paymentAccount) { private void verifyPaymentAccountHasRequiredFields(PaymentAccount paymentAccount) {
// Do checks here to make sure required fields are populated. if (paymentAccount.canSupportMultipleCurrencies() && paymentAccount.getTradeCurrencies().isEmpty())
if (paymentAccount.isTransferwiseAccount() && paymentAccount.getTradeCurrencies().isEmpty())
throw new IllegalArgumentException(format("no trade currencies defined for %s payment account", throw new IllegalArgumentException(format("no trade currencies defined for %s payment account",
paymentAccount.getPaymentMethod().getDisplayString().toLowerCase())); paymentAccount.getPaymentMethod().getDisplayString().toLowerCase()));
if (!paymentAccount.canSupportMultipleCurrencies() && paymentAccount.getSingleTradeCurrency() == null)
throw new IllegalArgumentException(format("no trade currency defined for %s payment account",
paymentAccount.getPaymentMethod().getDisplayString().toLowerCase()));
} }
} }