Skip to content

Commit

Permalink
updated Configuration.java and samples with modified method names
Browse files Browse the repository at this point in the history
  • Loading branch information
lvairamani committed Aug 12, 2013
1 parent 9e090b8 commit 736b47e
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@

public class IPNListenerServlet extends HttpServlet {

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

/*
* receiver for PayPal ipn call back.
*/
Expand All @@ -23,7 +28,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.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 @@ -145,7 +145,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
35 changes: 17 additions & 18 deletions merchantsample/src/main/java/com/sample/merchant/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
*/
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");
Expand All @@ -24,26 +21,28 @@ public static final Map<String,String> getSignatureConfig(){
// 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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,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 @@ -10,8 +10,6 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import urn.ebay.api.PayPalAPI.PayPalAPIInterfaceServiceService;

import com.paypal.exception.ClientActionRequiredException;
import com.paypal.exception.HttpErrorException;
import com.paypal.exception.InvalidCredentialException;
Expand Down Expand Up @@ -48,7 +46,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 @@ -121,7 +121,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 @@ -93,7 +93,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 @@ -12,8 +12,6 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import urn.ebay.api.PayPalAPI.PayPalAPIInterfaceServiceService;

import com.paypal.exception.ClientActionRequiredException;
import com.paypal.exception.HttpErrorException;
import com.paypal.exception.InvalidCredentialException;
Expand Down Expand Up @@ -82,10 +80,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 @@ -24,7 +24,6 @@
import urn.ebay.apis.eBLBaseComponents.CurrencyCodeType;
import urn.ebay.apis.eBLBaseComponents.ReceiverInfoCodeType;

import com.paypal.core.credential.ICredential;
import com.paypal.core.credential.SignatureCredential;
import com.paypal.core.credential.ThirdPartyAuthorization;
import com.paypal.core.credential.TokenAuthorization;
Expand Down Expand Up @@ -136,7 +135,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 @@ -192,7 +192,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 @@ -302,7 +302,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 @@ -929,6 +929,8 @@ else if (request.getParameter("creditCardNumber") != "") {
case MASTERCARD:
cc.setCreditCardType(CreditCardTypeType.MASTERCARD);
break;
default:
break;
}

reqDetails.setCreditCard(cc);
Expand Down Expand Up @@ -1149,6 +1151,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 @@ -86,7 +86,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 @@ -151,7 +151,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

0 comments on commit 736b47e

Please sign in to comment.