public override void HandleAuthorizationAmountNotification(
            string requestXml,
            AuthorizationAmountNotification notification)
        {
            GoogleCheckoutLog gLog = new GoogleCheckoutLog();

            gLog.ProviderName     = "WebStoreGCheckoutNotificationHandlerProvider";
            gLog.NotificationType = "AuthorizationAmountNotification";
            gLog.RawResponse      = requestXml;
            gLog.SerialNumber     = notification.serialnumber;
            gLog.OrderNumber      = notification.googleordernumber;
            gLog.GTimestamp       = notification.timestamp;
            gLog.AuthAmt          = notification.authorizationamount.Value;
            gLog.AuthExpDate      = notification.authorizationexpirationdate;
            gLog.CvnResponse      = notification.cvnresponse;
            gLog.AvsResponse      = notification.avsresponse;

            gLog.Save();

            Guid orderGuid = GoogleCheckoutLog.GetCartGuidFromOrderNumber(notification.googleordernumber);

            if (orderGuid == Guid.Empty)
            {
                return;
            }

            Order order = new Order(orderGuid);

            if (order.OrderGuid != orderGuid)
            {
                return;
            }

            Store store = new Store(order.StoreGuid);

            if (store.Guid != order.StoreGuid)
            {
                return;
            }

            gLog.SiteGuid  = store.SiteGuid;
            gLog.UserGuid  = order.UserGuid;
            gLog.CartGuid  = order.OrderGuid;
            gLog.StoreGuid = order.StoreGuid;
            gLog.Save();
        }
Beispiel #2
0
        private void HandleAuthorizationAmountNotification(AuthorizationAmountNotification notification)
        {
            NotificationSerialNumber = notification.serialnumber;

            string providerName = GoogleCheckoutLog.GetProviderNameFromOrderNumber(notification.googleordernumber);

            if (providerName.Length > 0)
            {
                GCheckoutNotificationHandlerProvider provider
                    = GCheckoutNotificationManager.Providers[providerName];

                if (provider != null)
                {
                    provider.HandleAuthorizationAmountNotification(RequestXml, notification);

                    return;
                }
            }

            // if no provider found just log it
            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            GoogleCheckoutLog gLog = new GoogleCheckoutLog();

            gLog.SiteGuid         = siteSettings.SiteGuid;
            gLog.NotificationType = "AuthorizationAmountNotification";
            gLog.RawResponse      = RequestXml;
            gLog.SerialNumber     = notification.serialnumber;
            gLog.OrderNumber      = notification.googleordernumber;
            gLog.GTimestamp       = notification.timestamp;
            gLog.AuthAmt          = notification.authorizationamount.Value;
            gLog.AuthExpDate      = notification.authorizationexpirationdate;
            gLog.CvnResponse      = notification.cvnresponse;
            gLog.AvsResponse      = notification.avsresponse;

            gLog.Save();
        }
Beispiel #3
0
        private void HandleNotification()
        {
            if (requestContext == null)
            {
                return;
            }

            Stream       RequestStream       = requestContext.Request.InputStream;
            StreamReader RequestStreamReader = new StreamReader(RequestStream);

            RequestXml = RequestStreamReader.ReadToEnd();
            RequestStream.Close();



            if (RequestXml.Length == 0)
            {
                return;
            }



            try
            {
                object requestObject = EncodeHelper.Deserialize(RequestXml);

                if (requestObject is NewOrderNotificationExtended)
                {
                    NewOrderNotificationExtended n1
                        = requestObject as NewOrderNotificationExtended;

                    HandleNewOrderNotificationExtended(n1);
                    return;
                }


                if (requestObject is GCheckout.AutoGen.RiskInformationNotification)
                {
                    RiskInformationNotification n2
                        = requestObject as RiskInformationNotification;

                    HandleRiskInformationNotification(n2);
                    return;
                }

                if (requestObject is GCheckout.AutoGen.ChargeAmountNotification)
                {
                    ChargeAmountNotification n3
                        = requestObject as ChargeAmountNotification;

                    HandleChargeAmountNotification(n3);
                    return;
                }

                if (requestObject is GCheckout.AutoGen.ChargebackAmountNotification)
                {
                    ChargebackAmountNotification n4
                        = requestObject as ChargebackAmountNotification;

                    HandleChargebackAmountNotification(n4);
                    return;
                }

                if (requestObject is GCheckout.AutoGen.AuthorizationAmountNotification)
                {
                    AuthorizationAmountNotification n5
                        = requestObject as AuthorizationAmountNotification;

                    HandleAuthorizationAmountNotification(n5);
                    return;
                }

                if (requestObject is GCheckout.AutoGen.RefundAmountNotification)
                {
                    RefundAmountNotification n6
                        = requestObject as RefundAmountNotification;

                    HandleRefundAmountNotification(n6);
                    return;
                }

                if (requestObject is OrderStateChangeNotification)
                {
                    OrderStateChangeNotification n7
                        = requestObject as OrderStateChangeNotification;

                    HandleOrderStateChangeNotification(n7);
                    return;
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                log.Error(RequestXml);

                // after testing there me be some invalid posts from google
                // for deleted orders or carts. They'll keep sending them for 30 days
                // or until they get a 200 ok response
                // so this option is to allow clearing those without wating 30 days
                // other than during development this should be false
                bool alwaysSendNormalResponse = ConfigHelper.GetBoolProperty("GCheckoutForceNormalResponse", false);

                if (!alwaysSendNormalResponse)
                {
                    throw (ex);
                }
            }


            // probably some hacking or random traffic if we reach here but log it


            //log.Error(RequestXml);
            log.Info("google notification: " + RequestXml);
        }
Beispiel #4
0
 public abstract void HandleAuthorizationAmountNotification(
     string requestXml,
     AuthorizationAmountNotification notification);
Beispiel #5
0
 public override void HandleAuthorizationAmountNotification(
     string requestXml,
     AuthorizationAmountNotification notification)
 {
 }