gpt4 book ai didi

java - 未找到方法 - 将 GoCardless Java 库与 ColdFusion 结合使用

转载 作者:行者123 更新时间:2023-11-30 11:30:43 25 4
gpt4 key购买 nike

我正在尝试使用他们的 Java 库在 ColdFusion 中实现 GoCardless 订阅(根据此处的文档 https://gocardless.com/docs/java/merchant_client_guide#installation-and-setup)。我对将 Java 与 ColdFusion 结合使用还很陌生,但出现以下错误:

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.

产生错误的代码如下:

<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)>

我的第一个想法是订阅对象不是 newSubscriptionUrl 方法的正确类型,但我不认为是这种情况,因为当我转储 GoCardless.connect 时它显示以下内容:

Dump of GoCardless.connect

这表明传递给 newSubscriptionUrl 方法的第一个参数应该属于 gocardless.connect.Subscription 类。

当我转储订阅对象时,它表明情况确实如此:

Dump of GoCardless.connect

就像我说的那样,我是将 Java 与 ColdFusion 结合使用的新手,所以我真的不知道是什么导致了这个问题,也不知道我目前编写的代码是否正确。任何帮助将不胜感激。

谢谢,迈克尔。

最佳答案

方法的签名是这样的:

newSubscriptionUrl(Subscription, String, String, String)

无论您如何调用它:

newSubscriptionUrl(Subscription)

因此出现错误消息。您需要确保按预期调用该方法。

关于java - 未找到方法 - 将 GoCardless Java 库与 ColdFusion 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17652124/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com