return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingPayPalPaymentGatewayConfigCannotFind", locale));
}
NVPEncoder encoder = new NVPEncoder();
// Set Express Checkout Request Parameters
encoder.add("METHOD", "SetExpressCheckout");
String token = (String) cart.getAttribute("payPalCheckoutToken");
if (UtilValidate.isNotEmpty(token)) {
encoder.add("TOKEN", token);
}
encoder.add("RETURNURL", payPalConfig.getString("returnUrl"));
encoder.add("CANCELURL", payPalConfig.getString("cancelReturnUrl"));
if (!cart.shippingApplies()) {
encoder.add("NOSHIPPING", "1");
} else {
encoder.add("CALLBACK", payPalConfig.getString("shippingCallbackUrl"));
encoder.add("CALLBACKTIMEOUT", "6");
// Default to no
String reqConfirmShipping = "Y".equals(payPalConfig.getString("requireConfirmedShipping")) ? "1" : "0";
encoder.add("REQCONFIRMSHIPPING", reqConfirmShipping);
// Default shipment method
encoder.add("L_SHIPPINGOPTIONISDEFAULT0", "true");
encoder.add("L_SHIPPINGOPTIONNAME0", "Calculated Offline");
encoder.add("L_SHIPPINGOPTIONAMOUNT0", "0.00");
}
encoder.add("ALLOWNOTE", "1");
encoder.add("INSURANCEOPTIONOFFERED", "false");
if (UtilValidate.isNotEmpty(payPalConfig.getString("imageUrl")));
encoder.add("PAYMENTACTION", "Order");
// Cart information
try {
addCartDetails(encoder, cart);
} catch (GenericEntityException e) {