diff --git a/merchantsample/src/main/java/com/sample/ipn/IPNListenerServlet.java b/merchantsample/src/main/java/com/sample/ipn/IPNListenerServlet.java index 7bd4dc6..63d4991 100644 --- a/merchantsample/src/main/java/com/sample/ipn/IPNListenerServlet.java +++ b/merchantsample/src/main/java/com/sample/ipn/IPNListenerServlet.java @@ -14,6 +14,11 @@ public class IPNListenerServlet extends HttpServlet { + /** + * + */ + private static final long serialVersionUID = 1L; + /* * receiver for PayPal ipn call back. */ @@ -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 configurationMap = Configuration.getSignatureConfig(); + Map configurationMap = Configuration.getConfig(); IPNMessage ipnlistener = new IPNMessage(request,configurationMap); boolean isIpnVerified = ipnlistener.validate(); String transactionType = ipnlistener.getTransactionType(); diff --git a/merchantsample/src/main/java/com/sample/merchant/CheckoutServlet.java b/merchantsample/src/main/java/com/sample/merchant/CheckoutServlet.java index b624e3f..8207ea5 100644 --- a/merchantsample/src/main/java/com/sample/merchant/CheckoutServlet.java +++ b/merchantsample/src/main/java/com/sample/merchant/CheckoutServlet.java @@ -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 configurationMap = Configuration.getSignatureConfig(); + Map configurationMap = Configuration.getAcctAndConfig(); // Creating service wrapper object to make an API call by loading configuration map. PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap); diff --git a/merchantsample/src/main/java/com/sample/merchant/Configuration.java b/merchantsample/src/main/java/com/sample/merchant/Configuration.java index e5a9936..c6b745b 100644 --- a/merchantsample/src/main/java/com/sample/merchant/Configuration.java +++ b/merchantsample/src/main/java/com/sample/merchant/Configuration.java @@ -8,13 +8,10 @@ */ public class Configuration { - // Creates a configuration map containing signature credentials and other required configuration parameters. - public static final Map getSignatureConfig(){ - + // Creates a configuration map containing credentials and other required configuration parameters. + public static final Map getAcctAndConfig(){ Map configMap = new HashMap(); - - // 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"); @@ -24,26 +21,28 @@ public static final Map 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 getCertificateConfig(){ - + public static final Map getConfig(){ Map configMap = new HashMap(); // 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; } + } diff --git a/merchantsample/src/main/java/com/sample/merchant/DoDirectPaymentServlet.java b/merchantsample/src/main/java/com/sample/merchant/DoDirectPaymentServlet.java index 83c88d7..0989301 100644 --- a/merchantsample/src/main/java/com/sample/merchant/DoDirectPaymentServlet.java +++ b/merchantsample/src/main/java/com/sample/merchant/DoDirectPaymentServlet.java @@ -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 configurationMap = Configuration.getSignatureConfig(); + Map configurationMap = Configuration.getAcctAndConfig(); // Creating service wrapper object to make an API call by loading configuration map. PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap); diff --git a/merchantsample/src/main/java/com/sample/merchant/GenerateAccessTokenServlet.java b/merchantsample/src/main/java/com/sample/merchant/GenerateAccessTokenServlet.java index 27da689..296ae4c 100644 --- a/merchantsample/src/main/java/com/sample/merchant/GenerateAccessTokenServlet.java +++ b/merchantsample/src/main/java/com/sample/merchant/GenerateAccessTokenServlet.java @@ -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; @@ -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 configurationMap = Configuration.getSignatureConfig(); + Map configurationMap = Configuration.getAcctAndConfig(); // Creating service wrapper object to make an API call by loading configuration map. PermissionsService service = new PermissionsService(configurationMap); diff --git a/merchantsample/src/main/java/com/sample/merchant/MassPayServlet.java b/merchantsample/src/main/java/com/sample/merchant/MassPayServlet.java index 96a291b..b2d431c 100644 --- a/merchantsample/src/main/java/com/sample/merchant/MassPayServlet.java +++ b/merchantsample/src/main/java/com/sample/merchant/MassPayServlet.java @@ -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 configurationMap = Configuration.getSignatureConfig(); + Map configurationMap = Configuration.getAcctAndConfig(); // Creating service wrapper object to make an API call by loading configuration map. PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap); diff --git a/merchantsample/src/main/java/com/sample/merchant/OnboardingServlet.java b/merchantsample/src/main/java/com/sample/merchant/OnboardingServlet.java index d1d0524..fbaf33b 100644 --- a/merchantsample/src/main/java/com/sample/merchant/OnboardingServlet.java +++ b/merchantsample/src/main/java/com/sample/merchant/OnboardingServlet.java @@ -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 configurationMap = Configuration.getSignatureConfig(); + Map configurationMap = Configuration.getAcctAndConfig(); // Creating service wrapper object to make an API call by loading configuration map. PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap); diff --git a/merchantsample/src/main/java/com/sample/merchant/PermissionServlet.java b/merchantsample/src/main/java/com/sample/merchant/PermissionServlet.java index d4ddc35..cb45bce 100644 --- a/merchantsample/src/main/java/com/sample/merchant/PermissionServlet.java +++ b/merchantsample/src/main/java/com/sample/merchant/PermissionServlet.java @@ -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; @@ -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 configurationMap = Configuration.getSignatureConfig(); + Map 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); diff --git a/merchantsample/src/main/java/com/sample/merchant/PermissionsMassPayServlet.java b/merchantsample/src/main/java/com/sample/merchant/PermissionsMassPayServlet.java index f6245dc..7fd8103 100644 --- a/merchantsample/src/main/java/com/sample/merchant/PermissionsMassPayServlet.java +++ b/merchantsample/src/main/java/com/sample/merchant/PermissionsMassPayServlet.java @@ -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; @@ -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 configurationMap = Configuration.getSignatureConfig(); + Map configurationMap = Configuration.getAcctAndConfig(); // Creating service wrapper object to make an API call by loading configuration map. PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap); diff --git a/merchantsample/src/main/java/com/sample/merchant/RecurringPaymentsServlet.java b/merchantsample/src/main/java/com/sample/merchant/RecurringPaymentsServlet.java index dfec3af..6447ffb 100644 --- a/merchantsample/src/main/java/com/sample/merchant/RecurringPaymentsServlet.java +++ b/merchantsample/src/main/java/com/sample/merchant/RecurringPaymentsServlet.java @@ -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 configurationMap = Configuration.getSignatureConfig(); + Map configurationMap = Configuration.getAcctAndConfig(); // Creating service wrapper object to make an API call by loading configuration map. PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap); @@ -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. @@ -929,6 +929,8 @@ else if (request.getParameter("creditCardNumber") != "") { case MASTERCARD: cc.setCreditCardType(CreditCardTypeType.MASTERCARD); break; + default: + break; } reqDetails.setCreditCard(cc); @@ -1149,6 +1151,8 @@ else if (request.getParameter("creditCardNumber") != "") { case MASTERCARD: cc.setCreditCardType(CreditCardTypeType.MASTERCARD); break; + default: + break; } reqDetails.setCreditCard(cc); } diff --git a/merchantsample/src/main/java/com/sample/merchant/ReportingServlet.java b/merchantsample/src/main/java/com/sample/merchant/ReportingServlet.java index b103583..ba9da77 100644 --- a/merchantsample/src/main/java/com/sample/merchant/ReportingServlet.java +++ b/merchantsample/src/main/java/com/sample/merchant/ReportingServlet.java @@ -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 configurationMap = Configuration.getSignatureConfig(); + Map configurationMap = Configuration.getAcctAndConfig(); // Creating service wrapper object to make an API call by loading configuration map. PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap); diff --git a/merchantsample/src/main/java/com/sample/merchant/SettlementServlet.java b/merchantsample/src/main/java/com/sample/merchant/SettlementServlet.java index 1aefbbe..a6b8b86 100644 --- a/merchantsample/src/main/java/com/sample/merchant/SettlementServlet.java +++ b/merchantsample/src/main/java/com/sample/merchant/SettlementServlet.java @@ -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 configurationMap = Configuration.getSignatureConfig(); + Map configurationMap = Configuration.getAcctAndConfig(); // Creating service wrapper object to make an API call by loading configuration map. PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);