谷歌Checkout的通知确认(C#ASP.NET MVC) [英] Google Checkout Notification Acknowledgement (C# ASP.NET MVC)

查看:175
本文介绍了谷歌Checkout的通知确认(C#ASP.NET MVC)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图发送谷歌Checkout的一个通知确认一次我收到一个序列号,所以会知道,我已经处理了这个序列号,并保存到我的数据库。不过,我不断收到以下错误在集成控制台:

I'm trying to send Google Checkout a Notification Acknowledgement once I receive a serial number so it would know that I've already handled this serial number and saved it to my database. But I keep getting the following error in the integration console:

我们遇到了一个错误处理
  您的通知确认。该
  我们得到的错误是:错误分析
  通知确认。

We encountered an error processing your notification acknowledgment. The error we got is: Error parsing notification acknowledgment.

当我检查值发送到服务器上,一切似乎看起来没什么问题:

When I check the value being sent to the server, everything seems to look fine to me:

<notification-acknowledgement xmlns="http://checkout.google.com/schema/2" serial-number="357304636821412-00001-7" />

下面是我的code:

    [HttpPost]
    public EmptyResult Notify()
    {
        var serial = Request["serial-number"];
        var data =
            "<notification-history-request xmlns=\"http://checkout.google.com/schema/2\"><serial-number>" + serial + "</serial-number></notification-history-request>";
        var serverResponse = _checkoutService.Post(data, GoogleCheckoutConstants.ReportsUri);

        //Send me email to checkout the response
        dynamic email = new Email("CheckoutLog");
        email.Response = serverResponse;
        email.Send();

        var acknowldgement =
            "<notification-acknowledgement xmlns=\"http://checkout.google.com/schema/2\" serial-number=\"" + serial +
            "\" />";

        HttpResponse response = System.Web.HttpContext.Current.Response;
         response.StatusCode = 200;
         response.ContentType = "text/xml";
        response.Write(acknowldgement);
        return null;
    }

此外,为什么我不断收到新订单通知只?什么是对我来说更重要的是授权金额通知,但它从来没有把它发送虽然在的文档第2节,步骤2.1 它说,一段时间后,就应该给我发此通知。我失去了一些东西在这里?

Moreover, why do I keep receiving new-order-notification only? What's more important to me is the authorization-amount-notification, but it never sends it although in the Documentation Section 2, Step 2.1 it says that after some time it should send me this notification. Am I missing something here?

推荐答案

好像你缺少XML声明(?)

Seems you are missing xml declaration(?)

**<?xml version="1.0" encoding="utf-8"?>**
<notification-acknowledgment serial-number="the-serial-no" xmlns="http://checkout.google.com/schema/2" />

其他的事情,也可能会影响到它(猜只基于以上):

Other things that could also affect it (guess based only on the above):


  • 在您的来电_checkoutService.Post异常

  • 在您的来电email.Send异常()

这可能会更好,如果你第一次存储的序列号(所以你总是有它),然后你需要做其他(即发送通知的历史请求,解析,发送电子邮件等)。

It might be better if you first store the serial # (so you "always" have it), and then do whatever else you need to do (i.e. send the notification history request, parse, send email, etc.).

确认的想法是让你确认成功的收到的序列号的的。一旦你的序列号,只要你需要,你可以执行通知要求的历史(S)(即,如果您有分析你总是可以重新发送一遍又一遍,直到你可以成功解析问题)。

The idea of the acknowledgement is for you to acknowledge successful receipt of the serial number. Once you have the serial number you can perform notification history request(s) whenever you need to (i.e. if you have issues parsing you can always resend over and over until you can parse successfully).

希望这有助于....

Hope this helps....

这篇关于谷歌Checkout的通知确认(C#ASP.NET MVC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆