} else {
isSandboxMode = false;
}
String returnString = ppIPNRequest.contentString() + "&cmd=_notify-validate";
WOHTTPConnection ppEchoConnection = new WOHTTPConnection(paypalSite, 80); // our echo to PayPal
if (isSandboxMode) {
ppEchoConnection = new WOHTTPConnection(sandboxSite, 80); // our echo to PayPal
}
// assemble User-Agent header
StringBuilder ua = new StringBuilder();
ua.append("WebObjects/ " + ERXProperties.webObjectsVersion() + " (");
ua.append(System.getProperty("os.arch"));
ua.append("; ");
ua.append(System.getProperty("os.name"));
ua.append(' ');
ua.append(System.getProperty("os.version"));
ua.append(')');
NSMutableDictionary headers = new NSMutableDictionary();
headers.setObjectForKey("en", "Accept-Language");
headers.setObjectForKey("iso-8859-1,*,utf-8", "Accept-Charset");
headers.setObjectForKey("image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*", "Accept");
headers.setObjectForKey(ua.toString(),"User-Agent");
// the response back to PayPal
WORequest paypalEchoRequest;
paypalEchoRequest = new WORequest("POST", paypalCgi, "HTTP/1.1", headers, null, null);
paypalEchoRequest.setContent(returnString);
ppEchoConnection.setReceiveTimeout(90 * 1000); // 90 second timeout -- this might be too long!?!
connectionSuccess = ppEchoConnection.sendRequest(paypalEchoRequest);
if (connectionSuccess) {
ppValidationResponse = ppEchoConnection.readResponse(); // read PayPal's validation
}
ppValidationResponseString = ppValidationResponse.contentString();
if (connectionSuccess) {