in service/src/main/java/org/apache/fineract/cn/interoperation/service/internal/service/InteropService.java [589:609]
private AccountWrapper validateAndGetAccount(@NotNull InteropRequestData request) {
//TODO: error handling
String accountId = request.getAccountId();
Account account = accountingService.findAccount(accountId);
validateAccount(request, account);
ProductInstance product = depositService.findProductInstance(accountId);
ProductDefinition productDefinition = depositService.findProductDefinition(product.getProductIdentifier());
Currency currency = productDefinition.getCurrency();
if (!currency.getCode().equals(request.getAmount().getCurrency()))
throw new UnsupportedOperationException();
request.normalizeAmounts(currency);
Double withdrawableBalance = getWithdrawableBalance(account, productDefinition);
if (request.getTransactionRole().isWithdraw() && withdrawableBalance < request.getAmount().getAmount().doubleValue())
throw new UnsupportedOperationException();
return new AccountWrapper(account, product, productDefinition, withdrawableBalance);
}