I am trying to implement GoCardless subscriptions in ColdFusion using their Java library (as per the documentation here https://gocardless.com/docs/java/merchant_client_guide#installation-and-setup). I am quite new to using Java with ColdFusion and I am getting the following error:
The newSubscriptionUrl method was not found - Either there are no methods with the specified method name and argument types or the newSubscriptionUrl method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity.
The code which is producing the error is as follows:
<cfset GoCardless = createobject("java","gocardless.GoCardless")>
<cfset GoCardless.environment = GoCardless.Environment.SANDBOX>
<cfset GoCardless.accountDetails.setAppId("My app ID")>
<cfset GoCardless.accountDetails.setAppSecret("My app secret")>
<cfset GoCardless.accountDetails.setAccessToken("My access token")>
<cfset GoCardless.accountDetails.setMerchantId("My merchant ID")>
<cfset monthlyAmount = 35>
<cfset subscription = createobject("java","gocardless.connect.Subscription").init(
GoCardless.accountDetails.getMerchantId(),
javacast("bigdecimal",monthlyAmount),
1,
"month"
)>
<cfset GoCardless.connect.newSubscriptionUrl(subscription)>
My first thought was that the subscription object was not of the correct type for the newSubscriptionUrl method but I don't think this is the case because when I dump GoCardless.connect it shows the following:
This shows that the first argument passed to the newSubscriptionUrl method should be of the class gocardless.connect.Subscription.
When I dump the subscription object it shows that this is indeed the case:
Like I say I am new to using Java with ColdFusion so I don't really know what might be causing this issue and whether the code I have so far written is even correct. Any help would be greatly appreciated.
Thanks, Michael.