}
boolean requestPhone = "Y".equalsIgnoreCase(requestPhoneStr) ? true : false;
req.setRequestBuyerPhoneNumber(requestPhone);
// send the request
CheckoutResponse resp = null;
try {
Debug.logInfo("Sending XML to Google:\n\n" + req.getXmlPretty() + "\n\n", module);
resp = req.send();
} catch (CheckoutException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
if (resp == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "GoogleCheckoutResponseIsNull", locale));
}
if (!resp.isValidRequest()) {
Debug.logError("Error returned from Google: " + resp.getErrorMessage(), module);
return ServiceUtil.returnError(resp.getErrorMessage());
}
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("redirect", resp.getRedirectUrl());
return result;
}