Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.base.ipn;
  
  import java.net.URL;
  import java.util.HashMap;
  import java.util.Map;
  
 
 
 
 public class IPNMessage {
 
 	private static final Logger log = LogManager.getLogger(IPNMessage.class);
 	
 	private static final long serialVersionUID = -7187275404183441828L;
 	private static final String ENCODING = "windows-1252";
 
 	private Map<StringStringipnMap = new HashMap<StringString>();
 	private Map<StringStringconfigurationMap = null;
 	private HttpConfiguration httpConfiguration = null;
 	private boolean isIpnVerified = false;
 	private StringBuffer payload;

Populates HttpConfiguration with connection specifics parameters
 
 	private void initialize() {
 	}

Constructs IPNMessage using the given javax.servlet.http.HttpServletRequest to retrieve the name and value java.util.Map.

Parameters:
request javax.servlet.http.HttpServletRequest object received from PayPal IPN call back.
 
 	public IPNMessage(HttpServletRequest request) {
 		this(request.getParameterMap());
 	}

Constructs IPNMessage using the given java.util.Map for name and values.

Parameters:
ipnMap java.util.Map representing IPN name/value pair
 
 	public IPNMessage(Map<StringString[]> ipnMap) {
 		this(ipnMap, ConfigManager.getInstance().getConfigurationMap());
 	}

Constructs IPNMessage using the given javax.servlet.http.HttpServletRequest to retrieve the name and value java.util.Map and a custom configuration java.util.Map

Parameters:
request javax.servlet.http.HttpServletRequest object received from PayPal IPN call back.
configurationMap custom configuration java.util.Map
 
 	public IPNMessage(HttpServletRequest request,
 			Map<StringStringconfigurationMap) {
 		this(request.getParameterMap(), configurationMap);
 	}

Constructs IPNMessage using the given java.util.Map for name and values and a custom configuration java.util.Map

Parameters:
ipnMap java.util.Map representing IPN name/value pair
configurationMap
	public IPNMessage(Map<StringString[]> ipnMap,
			Map<StringStringconfigurationMap) {
		this. = SDKUtil.combineDefaultMap(configurationMap);
		 = new StringBuffer("cmd=_notify-validate");
		if (ipnMap != null) {
			String[] encodingParam = ipnMap.get("charset");
			String encoding = encodingParam != null && encodingParam.length > 0 ?
				 encodingParam[0] : ;
			for (Map.Entry<StringString[]> entry : ipnMap.entrySet()) {
				String name = entry.getKey();
				String[] value = entry.getValue();
				try {
					this..put(name,
							 URLDecoder.decode(value[0], encoding));
					.append("&").append(name).append("=")
							.append(URLEncoder.encode(value[0], encoding));
catch (Exception e) {
				}
			}
		}
	}

This method post back ipn payload to PayPal system for verification
	public boolean validate() {
		Map<StringStringheaderMap = new HashMap<StringString>();
		URL url = null;
		HttpConnection connection = ConnectionManager.getInstance()
		try {
			url = new URL(this.);
			headerMap.put("Host"url.getHost());
			if (!this.) {
				res = connection.execute(null.toString(), headerMap);
			}
catch (Exception e) {
		}
		// check notification validation
		if (res.equals("VERIFIED")) {
			 = true;
		}
	}

Returns:
Map of IPN name/value parameters
	public Map<StringStringgetIpnMap() {
		return ;
	}

Parameters:
ipnName
Returns:
IPN value for corresponding IpnName
	public String getIpnValue(String ipnName) {
		return this..get(ipnName);
	}

Returns:
Transaction Type (eg: express_checkout, cart, web_accept)
		return this..containsKey("txn_type") ? this.
				.get("txn_type") : this..get("transaction_type");
	}
	private String getIPNEndpoint() {
		String ipnEPoint = null;
		if (ipnEPoint == null) {
			if (mode != null
else if (mode != null
			}
		}
		return ipnEPoint;
	}
New to GrepCode? Check out our FAQ X