Get Code
Download the most recent patch titled googleCheckout.patch from OFBIZ-71
Apply the patch to your development deployment. This will create several folders and files under hot-deploy/googleCheckout
SSL
Since we will be consuming services from Google over secure socket layer (SSL) we will need to add two certificates from google to our trusted key store, otherwise our call to Google will fail with the following error:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Obtain and Compile InstallCert.java
Andreas Sterbenz created a small program that will obtain the ssl certificate from a website and place it into keystore in the current directory. There is probably an easier way of doing this. This is just the first answer I came across that worked.
- Download the program from Andreas's Blog.
- Compile% javac InstallCert.java
Obtain SSL Certificates
- Obtain the SSL certificate for sandbox.google.com% java InstallCert sandbox.google.com
- Obtain the SSL certificatate for checkout.google.com% java InstallCert checkout.google.com
Export Certificates to file
- Export the certificate for sandbox.google.com from the keystore created by InstallCert % keytool -export -file sandbox.cer -alias sandbox.google.com-1 -keystore jssecacerts -storepass changeit
- Export the certificate for checkout.google.com from the keystore created by InstallCert % keytool -export -file checkout.cer -alias checkout.google.com-1 -keystore jssecacerts -storepass changeit
- Copy both certificates to framework/base/config/% copy *.cer %OFBIZ_HOME%/framework/base/config
- Change into the correct directory % cd %OFBIZ_HOME%/framework/base/config
Import Certificates into OFBiz Trust Store
- Import the certificate for sandbox.google.com into ofbiztrust.jks% keytool -import -alias sandbox.google.com-1 -file sandbox.cer -keypass changeit -storetype jks -keystore ofbiztrust.jks -storepass changeit
- Import the certificate for checkout.google.com into ofbiztrust.jks% keytool -import -alias sandbox.google.com-1 -file sandbox.cer -keypass changeit -storetype jks -keystore ofbiztrust.jks -storepass changeit