Well I am a small step further. I placed all the .jar files
in :ColdFusion8\runtime\jre\lib\ext to be configured as additional
java classes that Coldfusion has access to instead of using CFADMIN
which was not working for me at all. Now I get the following error:
Object Instantiation Exception.
An exception occurred while instantiating a Java object. The class
must not be an interface or an abstract class. If the class has a
constructor that accepts an argument, you must call the constructor
explicitly using the init(args) method. Error : ''
Here's the CFC i'm calling:
<cfcomponent displayname="PayPal" hint="PayPal Gateway">
<cfscript>
PPInitialize();
</cfscript>
<cffunction name="PPInitialize" returntype="void" output="no">
<cfset ppSignature = "myHardCodedSig">
<cfscript>
// Create CF caller object
pp_caller = CreateObject("java",
"com.paypal.sdk.services.CallerServices");
// Set API profile
pp_profile = CreateObject("java",
"com.paypal.sdk.profiles.SignatureAPIProfile");
pp_profile.setAPIUsername("myHardcodedusername");
pp_profile.setAPIPassword("myHardCodedPassword");
pp_profile.setSignature(ppSignature);
pp_profile.setEnvironment("sandbox"); //live
pp_caller.setAPIProfile(pp_profile);
</cfscript>
</cffunction>
<cffunction name="SetExpressCheckout" returntype="Struct"
output="no">
<cfargument name="returnURL" type="string" required="true">
<cfargument name="cancelURL" type="string" required="true">
<cfargument name="paymentAmount" type="string" required="true">
<cfargument name="maxAmount" type="string" required="true">
<cfscript>
// Create the request object
pp_request = CreateObject("java",
"com.paypal.soap.api.SetExpressCheckoutRequestType");
details = CreateObject("java",
"com.paypal.soap.api.SetExpressCheckoutRequestDetailsType");
details.setReturnURL(returnURL);
details.setCancelURL(CancelURL);
currencies = CreateObject("java",
"com.paypal.soap.api.CurrencyCodeType");
orderTotal = CreateObject("java",
"com.paypal.soap.api.BasicAmountType");
orderTotal.setCurrencyID(currencies.USD);
orderTotal.set_value(paymentAmount);
details.setOrderTotal(orderTotal);
maxAmountTotal = CreateObject("java",
"com.paypal.soap.api.BasicAmountType");
maxAmountTotal.setCurrencyID(currencies.USD);
maxAmountTotal.set_value(maxAmount);
details.setMaxAmount(maxAmountTotal);
paymentTypes = CreateObject("java",
"com.paypal.soap.api.PaymentActionCodeType");
details.setPaymentAction(paymentTypes.Sale);
pp_request.setSetExpressCheckoutRequestDetails(details);
</cfscript>
<cfset results = #pp_caller.call("SetExpressCheckout", pp_request)#>
<cfset responsestruct = structnew()>
<cfset responsestruct.Token = results.getToken()>
<cfreturn #responsestruct#>
</cffunction>
</cfcomponent>
Here is the Coldfusion test page calling the CFC function:
<center><h2>PayPal ExpressCheckout test 2</h2></center>
<CFSET variable.a = "">
<CFSET varible.b = "">
<cfinvoke component="globalShare.components.paypal"
method="SetExpressCheckout" returnvariable="variable.a">
<cfinvokeargument name="returnURL" value="http://localhost:8500/
taxpaymentsoftware"/>
<cfinvokeargument name="cancelURL" value="http://google.com"/>
<cfinvokeargument name="paymentAmount" value="100.00"/>
<cfinvokeargument name="maxAmount" value="1000.00"/>
</cfinvoke>
<CFDUMP var="#variable.a#"><BR><BR>