我正在使用colfusion paypal SDK进行直接支付,链接在这里:https://github.com/paypal/nvp-coldfusion-sdk
我已经粘贴了下面的application.cfc文件。我的问题是,每次我转到samples --> dodirectpayment.cfm并提交测试表单时,它都会显示“错误:无法找到ColdFusion组件或接口CallerService”。我认为这与引用callerservice.cfc文件有关,但不知道出了什么问题。任何帮助都是非常感谢的。application.cfc就在这里。
<cfscript>
/**
@dateCreated "July 18, 2011"
@hint "You implement methods in Application.cfc to handle ColdFusion application events and set variables in the CFC to configure application characteristics."
*/
component output="false" {
/* **************************** APPLICATION VARIABLES **************************** */
THIS.name = "NVPSample";
THIS.applicationTimeout = createTimeSpan(0, 2, 0, 0);
customtagpaths = "{#getDirectoryFromPath(ExpandPath('../lib/'))#,#getDirectoryFromPath(ExpandPath('../lib/services/'))#}";
THIS.customTagPaths = customtagpaths;
THIS.serverSideFormValidation = true;
THIS.sessionManagement = true;
THIS.sessionTimeout = createTimeSpan(0, 0, 30, 0);
THIS.setClientCookies = true;
THIS.setDomainCookies = false;
THIS.scriptProtect = true;
THIS.secureJSON = false;
THIS.secureJSONPrefix = "";
THIS.enablerobustexception = true;
/* **************************** APPLICATION METHODS **************************** */
public void function onApplicationEnd(struct ApplicationScope=structNew()) {
return;
}
public boolean function onApplicationStart() {
return true;
}
public void function onCFCRequest(required string cfcname, required string method, required string args) {
return;
}
public void function onRequestEnd() {
return;
}
public boolean function onRequestStart(required string TargetPage) {
request.serverURL = "https://api-3t.sandbox.paypal.com/nvp";
/* SUBJECT to be uncommented for UNIPAY all the other credentials like API username,
password,signature can be commented for UNIPAY
To enable Payments for Third Party Email whcih will be passed along with Partner's 3token credentials
uncomment both subject and 3 token credentials.
*/
request.SUBJECT="sales-facilitator@totalsportsadvantage.com";
APIuserName = "sales-facilitator_api1.totalsportsadvantage.com";
APIPassword = "1387466817";
APISignature = "An5ns1Kso7MWUdW4ErQKJJJ4qi4-AMJWATXVSChE1ExjnH8FyoZD8U5Q";
/*
request.SUBJECT="clip_1309031681_biz@paypal.com";
APIuserName = "clip_1309031681_biz_api1.paypal.com";
APIPassword = "1309031732";
APISignature = "AFcWxV21C7fd0v3bYYYRCpSSRl31An2lFbilAjH412uQjiC0OEJh45pL";
*/
//condition to check if it is UNIPAY
if (isdefined("SUBJECT") && (isdefined("APIuserName") eq "false" && isdefined("APIPassword") eq "false" && isdefined("APISignature") eq "false") )
{
request.UNIPAYSUBJECT="#SUBJECT#";
request.USER = "";
request.PWD = "";
request.SIGNATURE = "";
}
//condition to check if it is Payments for Third Party Email
if (isdefined("SUBJECT") && isdefined("APIuserName") && isdefined("APIPassword") && isdefined("APISignature"))
{
request.UNIPAYSUBJECT="#SUBJECT#";
request.USER = "#APIuserName#";
request.PWD = "#APIPassword#";
request.SIGNATURE = "#APISignature#";
}
//condition to check if it is 3 token credentials
if (isdefined("SUBJECT") eq "false" && isdefined("APIuserName") && isdefined("APIPassword") && isdefined("APISignature") )
{
request.UNIPAYSUBJECT="";
request.USER = "#APIuserName#";
request.PWD = "#APIPassword#";
request.SIGNATURE = "#APISignature#";
}
request.PayPalURL = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=";
request.version = "65.1";
/*
By default the API requests doesn't go through proxy. To route the requests through a proxy server
set "useProxy" value as "true" and set values for proxyName and proxyPort. Set proxyName with
the Host Name or the IP address of the proxy server. proxyPort should be a valid port number.
eg:
useProxy = "true";
proxyName = "127.0.0.1";
proxyPort = "8081";
*/
request.useProxy = "false";
request.proxyName = "";
request.proxyPort = "";
return true;
}
public void function onSessionEnd(required struct SessionScope, struct ApplicationScope=structNew()) {
return;
}
public void function onSessionStart() {
return;
}
}
</cfscript>发布于 2014-01-05 07:11:48
getDirectoryFromPath确实引用了这些文件的实际位置,但由于某些原因,应用程序在该位置找不到它们。最终的解决方案是将文件复制到与application.cfc文件相同的文件夹中,一切都按预期进行。谢谢你的帮助。
https://stackoverflow.com/questions/20922739
复制相似问题