String isoCode = transactionRequest.getCurrency().getCurrencyCode(); if(isoCode.equals("USD")) currencyCode = "840"; else {
try { if(!transactionRequest.getCurrency().getCurrencyCode().equals("USD")) throw new ErrorCodeException(TransactionResult.ErrorCode.INVALID_CURRENCY_CODE, "TransactionResult.ErrorCode.INVALID_CURRENCY_CODE");
Currency currency = transactionRequest.getCurrency(); int currencyDigits = currency.getDefaultFractionDigits(); if(currencyDigits < 0) throw new AssertionError("currencyDigits < 0: " + currencyDigits);
BigDecimal dutyAmount = transactionRequest.getDutyAmount(); if(dutyAmount!=null) amount = amount.add(dutyAmount); invoice.setAmt(new Currency(amount.doubleValue(), transactionRequest.getCurrency().getCurrencyCode())); if(taxAmount!=null) invoice.setTaxAmt(new Currency(taxAmount.doubleValue(), transactionRequest.getCurrency().getCurrencyCode())); invoice.setTaxExempt(transactionRequest.getTaxExempt() ? "Y" : "N"); if(shippingAmount!=null) invoice.setFreightAmt(new Currency(shippingAmount.doubleValue(), transactionRequest.getCurrency().getCurrencyCode())); if(dutyAmount!=null) invoice.setDutyAmt(new Currency(dutyAmount.doubleValue(), transactionRequest.getCurrency().getCurrencyCode()));
private AuthorizationResult saleOrAuthorize(TransactionRequest transactionRequest, CreditCard creditCard, boolean capture) { if(!transactionRequest.getCurrency().getCurrencyCode().equals("USD")) {