Beispiel #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="GCheckoutResponse"/> class.
        /// </summary>
        /// <param name="ResponseXml">The XML returned from Google.</param>
        public GCheckoutResponse(string ResponseXml)
        {
            _Xml = ResponseXml;

            //to cut down on the number or exceptions, we are going to try to
            //predetermine the type of message being returned this will allow for
            //a greater experience on the dev side. If you are not using debug
            //symbols, it is very difficult to determine if the error is real
            //or not if you are breaking on all thrown exceptions.
            bool parsed = false;

            try {
                if (ResponseXml.IndexOf("<checkout-redirect") > -1)
                {
                    _CheckoutRedirectResponse = (AutoGen.CheckoutRedirect)
                                                EncodeHelper.Deserialize(ResponseXml,
                                                                         typeof(AutoGen.CheckoutRedirect));
                    parsed = true;
                }
                else if (ResponseXml.IndexOf("<request-received") > -1)
                {
                    _GoodResponse = (AutoGen.RequestReceivedResponse)
                                    EncodeHelper.Deserialize(ResponseXml,
                                                             typeof(AutoGen.RequestReceivedResponse));
                    parsed = true;
                }
                else if (ResponseXml.IndexOf("<error") > -1)
                {
                    _ErrorResponse = (AutoGen.ErrorResponse)
                                     EncodeHelper.Deserialize(ResponseXml,
                                                              typeof(AutoGen.ErrorResponse));
                    parsed = true;
                }
            }
            catch {
                //let it continue
            }


            if (!parsed)
            {
                try {
                    _GoodResponse = (AutoGen.RequestReceivedResponse)
                                    EncodeHelper.Deserialize(ResponseXml,
                                                             typeof(AutoGen.RequestReceivedResponse));
                }
                catch {
                    try {
                        _ErrorResponse = (AutoGen.ErrorResponse)
                                         EncodeHelper.Deserialize(ResponseXml,
                                                                  typeof(AutoGen.ErrorResponse));
                    }
                    catch {
                        _CheckoutRedirectResponse = (AutoGen.CheckoutRedirect)
                                                    EncodeHelper.Deserialize(ResponseXml,
                                                                             typeof(AutoGen.CheckoutRedirect));
                    }
                }
            }
        }
 /// <summary>
 /// Creates a new instance of the <see cref="GCheckoutResponse"/> class.
 /// </summary>
 /// <param name="ResponseXml">The XML returned from Google.</param>
 public GCheckoutResponse(string ResponseXml) {
   _Xml = ResponseXml;
   try {
     _GoodResponse = (AutoGen.RequestReceivedResponse) 
       EncodeHelper.Deserialize(ResponseXml, 
       typeof(AutoGen.RequestReceivedResponse));
   }
   catch {
     try {
       _ErrorResponse = (AutoGen.ErrorResponse) 
         EncodeHelper.Deserialize(ResponseXml, 
         typeof(AutoGen.ErrorResponse));
     }
     catch {
       _CheckoutRedirectResponse = (AutoGen.CheckoutRedirect) 
         EncodeHelper.Deserialize(ResponseXml, 
         typeof(AutoGen.CheckoutRedirect));
     }
   }
 }
 /// <summary>
 /// Creates a new instance of the <see cref="GCheckoutResponse"/> class.
 /// </summary>
 /// <param name="ResponseXml">The XML returned from Google.</param>
 public GCheckoutResponse(string ResponseXml)
 {
     _Xml = ResponseXml;
     try {
         _GoodResponse = (AutoGen.RequestReceivedResponse)
                         EncodeHelper.Deserialize(ResponseXml,
                                                  typeof(AutoGen.RequestReceivedResponse));
     }
     catch {
         try {
             _ErrorResponse = (AutoGen.ErrorResponse)
                              EncodeHelper.Deserialize(ResponseXml,
                                                       typeof(AutoGen.ErrorResponse));
         }
         catch {
             _CheckoutRedirectResponse = (AutoGen.CheckoutRedirect)
                                         EncodeHelper.Deserialize(ResponseXml,
                                                                  typeof(AutoGen.CheckoutRedirect));
         }
     }
 }
Beispiel #4
0
        /// <summary>
        /// Parse the message for a checkout-redirect
        /// </summary>
        /// <returns></returns>
        protected override bool ParseMessage()
        {
            //to cut down on the number or exceptions, we are going to try to
            //predetermine the type of message being returned this will allow for
            //a greater experience on the dev side. If you are not using debug
            //symbols, it is very difficult to determine if the error is real
            //or not if you are breaking on all thrown exceptions.

            try {
                if (ResponseXml.IndexOf("<checkout-redirect") > -1)
                {
                    _CheckoutRedirectResponse = (AutoGen.CheckoutRedirect)
                                                EncodeHelper.Deserialize(ResponseXml,
                                                                         typeof(AutoGen.CheckoutRedirect));
                    Log.Xml(_CheckoutRedirectResponse.serialnumber, ResponseXml);
                    return(true);
                }
            }
            catch (Exception ex) {
                Log.Err("GCheckoutShoppingCartResponse ParseResponse:" + ex.Message);
            }

            return(false);
        }
        /// <summary>
        /// Parse the message for a checkout-redirect
        /// </summary>
        /// <returns></returns>
        protected override bool ParseMessage()
        {
            //to cut down on the number or exceptions, we are going to try to
              //predetermine the type of message being returned this will allow for
              //a greater experience on the dev side. If you are not using debug
              //symbols, it is very difficult to determine if the error is real
              //or not if you are breaking on all thrown exceptions.

              try {
            if (ResponseXml.IndexOf("<checkout-redirect") > -1) {
              _CheckoutRedirectResponse = (AutoGen.CheckoutRedirect)
            EncodeHelper.Deserialize(ResponseXml,
            typeof(AutoGen.CheckoutRedirect));
              Log.Xml(_CheckoutRedirectResponse.serialnumber , ResponseXml);
              return true;
            }
              }
              catch (Exception ex) {
            Log.Err("GCheckoutShoppingCartResponse ParseResponse:" + ex.Message);
              }

              return false;
        }