public override void HandleOrderStateChangeNotification(
            string requestXml,
            OrderStateChangeNotification notification)
        {
            GoogleCheckoutLog gLog = new GoogleCheckoutLog();

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

            gLog.RawResponse = requestXml;
            gLog.NotificationType = "OrderStateChangeNotification";
            gLog.ProviderName = "WebStoreGCheckoutNotificationHandlerProvider";
            gLog.SerialNumber = notification.serialnumber;
            gLog.OrderNumber = notification.googleordernumber;
            gLog.FinanceState = notification.newfinancialorderstate.ToString();
            gLog.FullfillState = notification.newfulfillmentorderstate.ToString();
            gLog.GTimestamp = notification.timestamp;
            gLog.AvsResponse = notification.reason;
            gLog.CartGuid = orderGuid;
            gLog.Save();

            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();

            if (notification.newfinancialorderstate == FinancialOrderState.CHARGED)
            {
                order.StatusGuid = OrderStatus.OrderStatusFulfillableGuid;
                order.Save();

                if (!order.HasShippingProducts())
                {
                    // order only has download products so tell google the order is fulfilled

                    try
                    {
                        CommerceConfiguration commerceConfig = SiteUtils.GetCommerceConfig();

                        string gEvironment;
                        if (commerceConfig.GoogleEnvironment == GCheckout.EnvironmentType.Sandbox)
                        {
                            gEvironment = "Sandbox";
                        }
                        else
                        {
                            gEvironment = "Production";
                        }

                        GCheckout.OrderProcessing.DeliverOrderRequest fulfillNotification
                            = new GCheckout.OrderProcessing.DeliverOrderRequest(
                                commerceConfig.GoogleMerchantID,
                                commerceConfig.GoogleMerchantKey,
                                gEvironment,
                                notification.googleordernumber);

                        fulfillNotification.Send();

                        StoreHelper.ConfirmOrder(store, order);
                        PayPalLog.DeleteByCart(order.OrderGuid);

                        log.Info("Sent DeliverOrderRequest to google api for google order " + notification.googleordernumber);
                    }
                    catch (Exception ex)
                    {
                        log.Error(ex);
                    }
                }

            }
        }
        public override void HandleOrderStateChangeNotification(
            string requestXml,
            OrderStateChangeNotification notification)
        {
            GoogleCheckoutLog gLog = new GoogleCheckoutLog();

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

            gLog.RawResponse      = requestXml;
            gLog.NotificationType = "OrderStateChangeNotification";
            gLog.ProviderName     = "WebStoreGCheckoutNotificationHandlerProvider";
            gLog.SerialNumber     = notification.serialnumber;
            gLog.OrderNumber      = notification.googleordernumber;
            gLog.FinanceState     = notification.newfinancialorderstate.ToString();
            gLog.FullfillState    = notification.newfulfillmentorderstate.ToString();
            gLog.GTimestamp       = notification.timestamp;
            gLog.AvsResponse      = notification.reason;
            gLog.CartGuid         = orderGuid;
            gLog.Save();

            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();


            if (notification.newfinancialorderstate == FinancialOrderState.CHARGED)
            {
                order.StatusGuid = OrderStatus.OrderStatusFulfillableGuid;
                order.Save();

                if (!order.HasShippingProducts())
                {
                    // order only has download products so tell google the order is fulfilled

                    try
                    {
                        CommerceConfiguration commerceConfig = SiteUtils.GetCommerceConfig();

                        string gEvironment;
                        if (commerceConfig.GoogleEnvironment == GCheckout.EnvironmentType.Sandbox)
                        {
                            gEvironment = "Sandbox";
                        }
                        else
                        {
                            gEvironment = "Production";
                        }

                        GCheckout.OrderProcessing.DeliverOrderRequest fulfillNotification
                            = new GCheckout.OrderProcessing.DeliverOrderRequest(
                                  commerceConfig.GoogleMerchantID,
                                  commerceConfig.GoogleMerchantKey,
                                  gEvironment,
                                  notification.googleordernumber);

                        fulfillNotification.Send();

                        StoreHelper.ConfirmOrder(store, order);
                        PayPalLog.DeleteByCart(order.OrderGuid);


                        log.Info("Sent DeliverOrderRequest to google api for google order " + notification.googleordernumber);
                    }
                    catch (Exception ex)
                    {
                        log.Error(ex);
                    }
                }
            }
        }