【发布时间】:2018-10-25 09:11:44
【问题描述】:
我已经下载并安装了 .Net sagepay 集成工具包到项目中,并且正在尝试实现服务器集成。
直到用户转移到 sagepay 之前一切正常,您可以成功付款,但是当 sagepay POST 到我的 Notification.aspx 页面时,我没有收到任何数据。
POST 肯定是在服务器日志看到它进入时进行的,redirectURL 被传回,以便 Sagepay 将用户重定向回我的站点,但我找不到任何 POST 数据来处理并知道我是什么事务处理。
套件中应处理此问题的代码是:
public partial class Server_Notification : System.Web.UI.Page
{
private const string OK = "OK";
private const string INVALID = "INVALID";
protected void Page_Load(object sender, EventArgs e)
{
IServerNotificationRequest serverNotificationRequest = new SagePayServerIntegration().GetServerNotificationRequest();
try
{
OrderDataService.handleNotification(serverNotificationRequest);
if (Request.QueryString["uid"] != null && !string.IsNullOrEmpty(Request.QueryString["uid"]))
{
new CardDB().Add(Convert.ToInt32(Request.QueryString["uid"]), serverNotificationRequest.Token, serverNotificationRequest.Last4Digits);
}
if (serverNotificationRequest.Status == SagePay.IntegrationKit.ResponseStatus.OK)
{
ShoppingCart.Current().Clean();
}
}
catch (Exception ex)
{
Debug.WriteLine("ERROR: " + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
}
Response.Clear();
Response.ContentType = "text/plain";
Response.Write(string.Format("Status={0}\n", serverNotificationRequest.Status == ResponseStatus.ERROR ? INVALID : OK));
Response.Write(string.Format("RedirectURL={0}server/Result.aspx?Status={1}&VendorTxCode={2}", SagePaySettings.SiteFqdn, serverNotificationRequest.Status, serverNotificationRequest.VendorTxCode));
}
}
失败的特定行是IServerNotificationRequest serverNotificationRequest = new SagePayServerIntegration().GetServerNotificationRequest();
这将返回一个没有交易数据的空对象。
我添加了一些日志记录并尝试手动提取任何 POST 数据,但使用 Request.InputStream、Request.Form.AllKeys 或 Request.QueryString 找不到任何内容(除了我自己传递的客户 UID)。
我曾尝试向 sagepay 寻求帮助,但他们“......无法为套件提供直接开发支持,因为它们是示例”。
我没有想法,想知道是否有其他人可以帮助解释一下?
干杯
西蒙
【问题讨论】: