Skip to content

Commit

Permalink
Merge branch 'master' into dev-usecaseSample
Browse files Browse the repository at this point in the history
  • Loading branch information
lvairamani committed Aug 13, 2013
2 parents 5aa537a + dd7debc commit 572109c
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 38 deletions.
10 changes: 5 additions & 5 deletions merchantsample/IPN-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ IPN configuration :
// Endpoints are varied depending on whether sandbox OR live is chosen for mode
configMap.put("mode", "sandbox");

//Connection Information
configMap.put("http.ConnectionTimeOut", "5000");
configMap.put("http.Retry", "2");
configMap.put("http.ReadTimeOut", "30000");
configMap.put("http.MaxConnection", "100");
// Connection Information. These values are defaulted in SDK. If you want to override default values, uncomment it and add your value.
// configMap.put("http.ConnectionTimeOut", "5000");
// configMap.put("http.Retry", "2");
// configMap.put("http.ReadTimeOut", "30000");
// configMap.put("http.MaxConnection", "100");

IPNMessage ipnlistener = new IPNMessage(request,configMap);
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@

public class IPNListenerServlet extends HttpServlet {

/**
*
*/
private static final long serialVersionUID = 1L;

/*
* receiver for PayPal ipn call back.
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {

// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer at
// (https://github.com/paypal/merchant-sdk-java/wiki/SDK-Configuration-Parameters)
Map<String,String> configurationMap = Configuration.getSignatureConfig();
Map<String,String> configurationMap = Configuration.getConfig();
IPNMessage ipnlistener = new IPNMessage(request,configurationMap);
boolean isIpnVerified = ipnlistener.validate();
String transactionType = ipnlistener.getTransactionType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ protected void doPost(HttpServletRequest request,
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer at
// [https://github.com/paypal/merchant-sdk-java/wiki/SDK-Configuration-Parameters]
Map<String,String> configurationMap = Configuration.getSignatureConfig();
Map<String,String> configurationMap = Configuration.getAcctAndConfig();

// Creating service wrapper object to make an API call by loading configuration map.
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res)
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer at
// [https://github.com/paypal/merchant-sdk-java/wiki/SDK-Configuration-Parameters]
Map<String,String> configurationMap = Configuration.getSignatureConfig();
Map<String,String> configurationMap = Configuration.getAcctAndConfig();

// Creating service wrapper object to make an API call by loading configuration map.
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void doPost(HttpServletRequest request,
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer at
// [https://github.com/paypal/permissions-sdk-java/wiki/SDK-Configuration-Parameters]
Map<String,String> configurationMap = Configuration.getSignatureConfig();
Map<String,String> configurationMap = Configuration.getAcctAndConfig();

// Creating service wrapper object to make an API call by loading configuration map.
PermissionsService service = new PermissionsService(configurationMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected void doPost(HttpServletRequest request,
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer at
// [https://github.com/paypal/merchant-sdk-java/wiki/SDK-Configuration-Parameters]
Map<String,String> configurationMap = Configuration.getSignatureConfig();
Map<String,String> configurationMap = Configuration.getAcctAndConfig();

// Creating service wrapper object to make an API call by loading configuration map.
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected void doPost(HttpServletRequest request,
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer at
// [https://github.com/paypal/merchant-sdk-java/wiki/SDK-Configuration-Parameters]
Map<String,String> configurationMap = Configuration.getSignatureConfig();
Map<String,String> configurationMap = Configuration.getAcctAndConfig();

// Creating service wrapper object to make an API call by loading configuration map.
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ protected void doPost(HttpServletRequest request,
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer at
// [https://github.com/paypal/permissions-sdk-java/wiki/SDK-Configuration-Parameters]
Map<String,String> configurationMap = Configuration.getSignatureConfig();
Map<String,String> configurationMap = Configuration.getAcctAndConfig();

// Creating service wrapper object to make an API call by loading configuration map.
PermissionsService perm = new PermissionsService(Configuration.getSignatureConfig());
PermissionsService perm = new PermissionsService(configurationMap);

RequestPermissionsResponse resp = perm
.requestPermissions(permRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected void doPost(HttpServletRequest request,
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer at
// [https://github.com/paypal/merchant-sdk-java/wiki/SDK-Configuration-Parameters]
Map<String,String> configurationMap = Configuration.getSignatureConfig();
Map<String,String> configurationMap = Configuration.getAcctAndConfig();

// Creating service wrapper object to make an API call by loading configuration map.
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ protected void doPost(HttpServletRequest request,
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer at
// [https://github.com/paypal/merchant-sdk-java/wiki/SDK-Configuration-Parameters]
Map<String,String> configurationMap = Configuration.getSignatureConfig();
Map<String,String> configurationMap = Configuration.getAcctAndConfig();

// Creating service wrapper object to make an API call by loading configuration map.
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
Expand Down Expand Up @@ -303,7 +303,7 @@ protected void doPost(HttpServletRequest request,
* to identify transactions.
Character length and limitations: 32 single-byte alphanumeric characters
*/
paymentDetails.setButtonSource("Java_SDK_JSP");
paymentDetails.setButtonSource("PayPal_SDK");
// The total cost of the transaction to the buyer. If shipping cost and
// tax charges are known, include them in this value. If not, this value
// should be the current subtotal of the order.
Expand Down Expand Up @@ -930,6 +930,8 @@ else if (request.getParameter("creditCardNumber") != "") {
case MASTERCARD:
cc.setCreditCardType(CreditCardTypeType.MASTERCARD);
break;
default:
break;
}

reqDetails.setCreditCard(cc);
Expand Down Expand Up @@ -1150,6 +1152,8 @@ else if (request.getParameter("creditCardNumber") != "") {
case MASTERCARD:
cc.setCreditCardType(CreditCardTypeType.MASTERCARD);
break;
default:
break;
}
reqDetails.setCreditCard(cc);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected void doPost(HttpServletRequest request,
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer at
// [https://github.com/paypal/merchant-sdk-java/wiki/SDK-Configuration-Parameters]
Map<String,String> configurationMap = Configuration.getSignatureConfig();
Map<String,String> configurationMap = Configuration.getAcctAndConfig();

// Creating service wrapper object to make an API call by loading configuration map.
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected void doPost(HttpServletRequest request,
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer at
// [https://github.com/paypal/merchant-sdk-java/wiki/SDK-Configuration-Parameters]
Map<String,String> configurationMap = Configuration.getSignatureConfig();
Map<String,String> configurationMap = Configuration.getAcctAndConfig();

// Creating service wrapper object to make an API call by loading configuration map.
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
Expand Down
36 changes: 17 additions & 19 deletions merchantsample/src/main/java/com/sample/util/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,40 @@
*/
public class Configuration {

// Creates a configuration map containing signature credentials and other required configuration parameters.
public static final Map<String,String> getSignatureConfig(){

// Creates a configuration map containing credentials and other required configuration parameters.
public static final Map<String,String> getAcctAndConfig(){
Map<String,String> configMap = new HashMap<String,String>();

// Endpoints are varied depending on whether sandbox OR live is chosen for mode
configMap.put("mode", "sandbox");
configMap.putAll(getConfig());

// Account Credential
configMap.put("acct1.UserName", "jb-us-seller_api1.paypal.com");
configMap.put("acct1.Password", "WX4WTU3S8MY44S7F");
configMap.put("acct1.Signature", "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy");
configMap.put("acct1.AppId", "APP-80W284485P519543T");
// Subject is optional, only required in case of third party permission
//configMap.put("acct1.Subject", "");

// Sample Certificate credential
// configMap.put("acct2.UserName", "certuser_biz_api1.paypal.com");
// configMap.put("acct2.Password", "D6JNKKULHN3G5B8A");
// configMap.put("acct2.CertKey", "password");
// configMap.put("acct2.CertPath", "resource/sdk-cert.p12");
// configMap.put("acct2.AppId", "APP-80W284485P519543T");

return configMap;
}

//Creates a configuration map containing certificate credentials and other required configuration parameters.
public static final Map<String,String> getCertificateConfig(){

public static final Map<String,String> getConfig(){
Map<String,String> configMap = new HashMap<String,String>();

// Endpoints are varied depending on whether sandbox OR live is chosen for mode
configMap.put("mode", "sandbox");

//Account Credential
configMap.put("acct2.UserName", "certuser_biz_api1.paypal.com");
configMap.put("acct2.Password", "D6JNKKULHN3G5B8A");
configMap.put("acct2.CertKey", "password");
configMap.put("acct2.CertPath", "resource/sdk-cert.p12");
configMap.put("acct2.AppId", "APP-80W284485P519543T");
// Subject is optional, only required in case of third party permission
//configMap.put("acct2.Subject", "");


// These values are defaulted in SDK. If you want to override default values, uncomment it and add your value.
// configMap.put("http.ConnectionTimeOut", "5000");
// configMap.put("http.Retry", "2");
// configMap.put("http.ReadTimeOut", "30000");
// configMap.put("http.MaxConnection", "100");
return configMap;
}
}

0 comments on commit 572109c

Please sign in to comment.