Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
BigDecimal processAmount = paymentPref.getBigDecimal("maxAmount");
NVPEncoder encoder = new NVPEncoder();
encoder.add("METHOD", "DoExpressCheckoutPayment");
encoder.add("TOKEN", payPalPaymentMethod.getString("expressCheckoutToken"));
encoder.add("PAYMENTACTION", "Order");
encoder.add("PAYERID", payPalPaymentMethod.getString("payerId"));
// set the amount
encoder.add("AMT", processAmount.setScale(2).toPlainString());
encoder.add("CURRENCYCODE", orh.getCurrency());
BigDecimal grandTotal = orh.getOrderGrandTotal();
BigDecimal shippingTotal = orh.getShippingTotal().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal taxTotal = orh.getTaxTotal().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal subTotal = grandTotal.subtract(shippingTotal).subtract(taxTotal).setScale(2, BigDecimal.ROUND_HALF_UP);
encoder.add("ITEMAMT", subTotal.toPlainString());
encoder.add("SHIPPINGAMT", shippingTotal.toPlainString());
encoder.add("TAXAMT", taxTotal.toPlainString());
NVPDecoder decoder = null;
try {
decoder = sendNVPRequest(payPalPaymentSetting, encoder);
} catch (PayPalException e) {