bhoomikajodhani 0 Newbie Poster

Hello,
I have implemented Gchechout in my website.
I am successfully able to go for payment at google.
I am facing problem will callback.

I have used "Notification Serial number" as Callback contents.

My call back code is as below:

Stream RequestStream = Request.InputStream;
            StreamReader RequestStreamReader = new StreamReader
      (RequestStream);
            RequestXml = RequestStreamReader.ReadToEnd();
            RequestStream.Close();
            // Act on the XML.
            switch (EncodeHelper.GetTopElement(RequestXml))
            {
                case "new-order-notification":
                    NewOrderNotification N1 = (NewOrderNotification)EncodeHelper.Deserialize(RequestXml, typeof(NewOrderNotification));
                    serialnum = N1.serialnumber;
                    string OrderNumber1 = N1.googleordernumber;
                    string ShipToName = N1.buyershippingaddress.contactname;
                    string ShipToAddress1 = N1.buyershippingaddress.address1;
                    string ShipToAddress2 = N1.buyershippingaddress.address2;
                    string ShipToCity = N1.buyershippingaddress.city;
                    string ShipToState = N1.buyershippingaddress.region;
                    string ShipToZip = N1.buyershippingaddress.postalcode;

                    string OID = "";
                    string Name = "";
                    int Quantity = 0;
                    decimal Price = 0;
                    foreach (Item ThisItem in N1.shoppingcart.items)
                    {
                        Name = ThisItem.itemname;
                        Quantity = ThisItem.quantity;
                        Price = ThisItem.unitprice.Value;
                        OID = ThisItem.merchantitemid;
                    }
                    if (N1.shoppingcart.merchantprivatedata != null && N1.shoppingcart.merchantprivatedata.Any != null && N1.shoppingcart.merchantprivatedata.Any.Length > 0)
                    {
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml(N1.shoppingcart.merchantprivatedata.Any[0].OuterXml);
                        XmlNodeList OrderIDVal = doc.GetElementsByTagName("Orderid");
                        MerasathiOrderID = OrderIDVal[0].InnerText;
                    }
                    SendGoogleAcknowledgement();
                 
                    break;

                case "risk-information-notification":
                    RiskInformationNotification N2 = (RiskInformationNotification)EncodeHelper.Deserialize(RequestXml, typeof(RiskInformationNotification));
                    // This notification tells us that Google has authorized theorder and it has passed the fraud check.
                    // Use the data below to determine if you want to accept theorder, then start processing it.
                    string OrderNumber2 = N2.googleordernumber;
                    string AVS = N2.riskinformation.avsresponse;
                    string CVN = N2.riskinformation.cvnresponse;
                    bool SellerProtection = N2.riskinformation.eligibleforprotection;
                 
                    break;
                case "order-state-change-notification":
                    OrderStateChangeNotification N3 = (OrderStateChangeNotification)EncodeHelper.Deserialize(RequestXml, typeof(OrderStateChangeNotification));
                    // The order has changed either financial or fulfillmentstate in Google's system.
                    string OrderNumber3 = N3.googleordernumber;
                    string NewFinanceState = N3.newfinancialorderstate.ToString();
                    string NewFulfillmentState = N3.newfulfillmentorderstate.ToString();
                    string PrevFinanceState = N3.previousfinancialorderstate.ToString();
                    string PrevFulfillmentState = N3.previousfulfillmentorderstate.ToString();
                    //Google.Insert(OrderNumber3, NewFinanceState,NewFulfillmentState, PrevFinanceState, PrevFulfillmentState);
                  
                    break;
                case "charge-amount-notification":
                    ChargeAmountNotification N4 = (ChargeAmountNotification)EncodeHelper.Deserialize(RequestXml, typeof(ChargeAmountNotification));
                    // Google has successfully charged the customer's creditcard.
                    string OrderNumber4 = N4.googleordernumber;
                    decimal ChargedAmount = N4.latestchargeamount.Value;
                    //GoogelNewOrder.UpdateChargedAmount(ChargedAmount,OrderNumber4);
                    //string OrderID =GoogelNewOrder.GetOIDByGoogleOrderNo(OrderNumber4).ToString();
                    //Orders.UpdatePaymentStatus("Payment Received fromGoogleCheckout", int.Parse(OrderID));
                   
                    break;
                case "refund-amount-notification":
                    RefundAmountNotification N5 = (RefundAmountNotification)EncodeHelper.Deserialize(RequestXml, typeof(RefundAmountNotification));
                    // Google has successfully refunded the customer's creditcard.
                    string OrderNumber5 = N5.googleordernumber;
                    decimal RefundedAmount = N5.latestrefundamount.Value;
                    //GoogelNewOrder.UpdateRefundAmt(RefundedAmount,OrderNumber5);
                  
                    break;
                case "chargeback-amount-notification":
                    ChargebackAmountNotification N6 = (ChargebackAmountNotification)EncodeHelper.Deserialize(RequestXml, typeof(ChargebackAmountNotification));
                    // A customer initiated a chargeback with his credit cardcompany to get her money back.
                    string OrderNumber6 = N6.googleordernumber;
                    decimal ChargebackAmount = N6.latestchargebackamount.Value;
                    //GoogelNewOrder.UpdateChargeBackAmt(ChargebackAmount,OrderNumber6);
                  
                    break;
                default:
                  
                    break;
            }
        }
        catch (Exception)
        {
            
        }

private void SendGoogleAcknowledgement()
    {
        StringBuilder responseXml = new StringBuilder();
        responseXml.Append("<?xml version='1.0' encoding='UTF-8'?>");
        responseXml.Append("<notifiation-acknowledgment xmlns=http://checkout.google.com/schema/2/ serial-number=");
        responseXml.Append(serialnum);
        responseXml.Append(">");
        HttpResponse response =
System.Web.HttpContext.Current.Response;
        response.StatusCode = 200;
        response.ContentType = "text/xml";
        response.Write(responseXml.ToString());
        response.End();
    }

Every time i getting RequestXml as "serial-number=505709817980874-00001-7", wheather it is new order place or merchant charge amount or cancel order or refund amount.

How do i recognize "order identity" and "Every order processing type" with "Notification Serial number" as Callback contents?

Do i need to use "Notification XML" for updating every order processing in my website?

Please reply .its very urgent.

Thanks.
Regards,
Bhoomika Jodhani

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.