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();
        }
Ejemplo n.º 2
0
        private static List <GoogleCheckoutLog> LoadListFromReader(IDataReader reader)
        {
            List <GoogleCheckoutLog> googleCheckoutLogList = new List <GoogleCheckoutLog>();

            try
            {
                while (reader.Read())
                {
                    GoogleCheckoutLog googleCheckoutLog = new GoogleCheckoutLog();
                    googleCheckoutLog.rowGuid          = new Guid(reader["RowGuid"].ToString());
                    googleCheckoutLog.createdUtc       = Convert.ToDateTime(reader["CreatedUtc"]);
                    googleCheckoutLog.siteGuid         = new Guid(reader["SiteGuid"].ToString());
                    googleCheckoutLog.userGuid         = new Guid(reader["UserGuid"].ToString());
                    googleCheckoutLog.storeGuid        = new Guid(reader["StoreGuid"].ToString());
                    googleCheckoutLog.cartGuid         = new Guid(reader["CartGuid"].ToString());
                    googleCheckoutLog.notificationType = reader["NotificationType"].ToString();
                    googleCheckoutLog.rawResponse      = reader["RawResponse"].ToString();
                    googleCheckoutLog.serialNumber     = reader["SerialNumber"].ToString();
                    googleCheckoutLog.gTimestamp       = Convert.ToDateTime(reader["GTimestamp"]);
                    googleCheckoutLog.orderNumber      = reader["OrderNumber"].ToString();
                    googleCheckoutLog.buyerId          = reader["BuyerId"].ToString();
                    googleCheckoutLog.fullfillState    = reader["FullfillState"].ToString();
                    googleCheckoutLog.financeState     = reader["FinanceState"].ToString();
                    googleCheckoutLog.emailListOptIn   = Convert.ToBoolean(reader["EmailListOptIn"]);
                    googleCheckoutLog.avsResponse      = reader["AvsResponse"].ToString();
                    googleCheckoutLog.cvnResponse      = reader["CvnResponse"].ToString();
                    googleCheckoutLog.authExpDate      = Convert.ToDateTime(reader["AuthExpDate"]);
                    googleCheckoutLog.authAmt          = Convert.ToDecimal(reader["AuthAmt"]);
                    googleCheckoutLog.discountTotal    = Convert.ToDecimal(reader["DiscountTotal"]);
                    googleCheckoutLog.shippingTotal    = Convert.ToDecimal(reader["ShippingTotal"]);
                    googleCheckoutLog.taxTotal         = Convert.ToDecimal(reader["TaxTotal"]);
                    googleCheckoutLog.orderTotal       = Convert.ToDecimal(reader["OrderTotal"]);
                    googleCheckoutLog.latestChgAmt     = Convert.ToDecimal(reader["LatestChgAmt"]);
                    googleCheckoutLog.totalChgAmt      = Convert.ToDecimal(reader["TotalChgAmt"]);
                    googleCheckoutLog.latestRefundAmt  = Convert.ToDecimal(reader["LatestRefundAmt"]);
                    googleCheckoutLog.totalRefundAmt   = Convert.ToDecimal(reader["TotalRefundAmt"]);
                    googleCheckoutLog.latestChargeback = Convert.ToDecimal(reader["LatestChargeback"]);
                    googleCheckoutLog.totalChargeback  = Convert.ToDecimal(reader["TotalChargeback"]);
                    googleCheckoutLog.cartXml          = reader["CartXml"].ToString();
                    googleCheckoutLog.providerName     = reader["ProviderName"].ToString();
                    googleCheckoutLogList.Add(googleCheckoutLog);
                }
            }
            finally
            {
                reader.Close();
            }

            return(googleCheckoutLogList);
        }
        private void HandleNewOrderNotificationExtended(NewOrderNotificationExtended newOrder)
        {
            NotificationSerialNumber = newOrder.serialnumber;

            string merchantDataString = GetMerchantData(newOrder.shoppingcart.merchantprivatedata.Any);
            MerchantData merchantData = DeserializeMerchantData(merchantDataString);

            if (merchantData != null)
            {
                GCheckoutNotificationHandlerProvider provider
                    = GCheckoutNotificationManager.Providers[merchantData.ProviderName];

                if (provider != null)
                {
                    provider.HandleNewOrderNotificationExtended(RequestXml, newOrder, merchantData);

                    return;
                }

            }

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

            GoogleCheckoutLog gLog = new GoogleCheckoutLog();
            gLog.SiteGuid = siteSettings.SiteGuid;
            gLog.RawResponse = RequestXml;
            gLog.NotificationType = "NewOrderNotification";
            gLog.SerialNumber = newOrder.serialnumber;
            gLog.OrderNumber = newOrder.googleordernumber;
            gLog.OrderTotal = newOrder.ordertotal.Value;
            gLog.BuyerId = newOrder.buyerid.ToString(CultureInfo.InvariantCulture);
            gLog.FullfillState = newOrder.fulfillmentorderstate.ToString();
            gLog.FinanceState = newOrder.financialorderstate.ToString();
            gLog.ShippingTotal = newOrder.ShippingCost;
            gLog.TaxTotal = newOrder.orderadjustment.totaltax.Value;
            //gLog.DiscountTotal = ext.orderadjustment.adjustmenttotal.Value;
            gLog.EmailListOptIn = newOrder.buyermarketingpreferences.emailallowed;
            gLog.GTimestamp = newOrder.timestamp;
            gLog.CartXml = merchantDataString;
            gLog.Save();
        }
        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);
                    }
                }

            }
        }
Ejemplo n.º 5
0
        private static List<GoogleCheckoutLog> LoadListFromReader(IDataReader reader)
        {
            List<GoogleCheckoutLog> googleCheckoutLogList = new List<GoogleCheckoutLog>();
            try
            {
                while (reader.Read())
                {
                    GoogleCheckoutLog googleCheckoutLog = new GoogleCheckoutLog();
                    googleCheckoutLog.rowGuid = new Guid(reader["RowGuid"].ToString());
                    googleCheckoutLog.createdUtc = Convert.ToDateTime(reader["CreatedUtc"]);
                    googleCheckoutLog.siteGuid = new Guid(reader["SiteGuid"].ToString());
                    googleCheckoutLog.userGuid = new Guid(reader["UserGuid"].ToString());
                    googleCheckoutLog.storeGuid = new Guid(reader["StoreGuid"].ToString());
                    googleCheckoutLog.cartGuid = new Guid(reader["CartGuid"].ToString());
                    googleCheckoutLog.notificationType = reader["NotificationType"].ToString();
                    googleCheckoutLog.rawResponse = reader["RawResponse"].ToString();
                    googleCheckoutLog.serialNumber = reader["SerialNumber"].ToString();
                    googleCheckoutLog.gTimestamp = Convert.ToDateTime(reader["GTimestamp"]);
                    googleCheckoutLog.orderNumber = reader["OrderNumber"].ToString();
                    googleCheckoutLog.buyerId = reader["BuyerId"].ToString();
                    googleCheckoutLog.fullfillState = reader["FullfillState"].ToString();
                    googleCheckoutLog.financeState = reader["FinanceState"].ToString();
                    googleCheckoutLog.emailListOptIn = Convert.ToBoolean(reader["EmailListOptIn"]);
                    googleCheckoutLog.avsResponse = reader["AvsResponse"].ToString();
                    googleCheckoutLog.cvnResponse = reader["CvnResponse"].ToString();
                    googleCheckoutLog.authExpDate = Convert.ToDateTime(reader["AuthExpDate"]);
                    googleCheckoutLog.authAmt = Convert.ToDecimal(reader["AuthAmt"]);
                    googleCheckoutLog.discountTotal = Convert.ToDecimal(reader["DiscountTotal"]);
                    googleCheckoutLog.shippingTotal = Convert.ToDecimal(reader["ShippingTotal"]);
                    googleCheckoutLog.taxTotal = Convert.ToDecimal(reader["TaxTotal"]);
                    googleCheckoutLog.orderTotal = Convert.ToDecimal(reader["OrderTotal"]);
                    googleCheckoutLog.latestChgAmt = Convert.ToDecimal(reader["LatestChgAmt"]);
                    googleCheckoutLog.totalChgAmt = Convert.ToDecimal(reader["TotalChgAmt"]);
                    googleCheckoutLog.latestRefundAmt = Convert.ToDecimal(reader["LatestRefundAmt"]);
                    googleCheckoutLog.totalRefundAmt = Convert.ToDecimal(reader["TotalRefundAmt"]);
                    googleCheckoutLog.latestChargeback = Convert.ToDecimal(reader["LatestChargeback"]);
                    googleCheckoutLog.totalChargeback = Convert.ToDecimal(reader["TotalChargeback"]);
                    googleCheckoutLog.cartXml = reader["CartXml"].ToString();
                    googleCheckoutLog.providerName = reader["ProviderName"].ToString();
                    googleCheckoutLogList.Add(googleCheckoutLog);

                }
            }
            finally
            {
                reader.Close();
            }

            return googleCheckoutLogList;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByRawResponse(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return googleCheckoutLog1.RawResponse.CompareTo(googleCheckoutLog2.RawResponse);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByNotificationType(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return googleCheckoutLog1.NotificationType.CompareTo(googleCheckoutLog2.NotificationType);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByFullfillState(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return googleCheckoutLog1.FullfillState.CompareTo(googleCheckoutLog2.FullfillState);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareBySerialNumber(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return(googleCheckoutLog1.SerialNumber.CompareTo(googleCheckoutLog2.SerialNumber));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByNotificationType(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return(googleCheckoutLog1.NotificationType.CompareTo(googleCheckoutLog2.NotificationType));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByCreatedUtc(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return(googleCheckoutLog1.CreatedUtc.CompareTo(googleCheckoutLog2.CreatedUtc));
 }
        private void HandleRiskInformationNotification(RiskInformationNotification notification)
        {
            NotificationSerialNumber = notification.serialnumber;

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

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

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

                    return;
                }

            }

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

            GoogleCheckoutLog gLog = new GoogleCheckoutLog();
            gLog.SiteGuid = siteSettings.SiteGuid;
            gLog.RawResponse = RequestXml;
            gLog.NotificationType = "RiskInformationNotification";
            gLog.SerialNumber = notification.serialnumber;
            gLog.OrderNumber = notification.googleordernumber;
            gLog.GTimestamp = notification.timestamp;
            gLog.AvsResponse = notification.riskinformation.avsresponse;
            gLog.CvnResponse = notification.riskinformation.cvnresponse;
            gLog.BuyerId = notification.riskinformation.ipaddress;
            gLog.Save();
        }
        private void HandleRefundAmountNotification(RefundAmountNotification notification)
        {
            NotificationSerialNumber = notification.serialnumber;

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

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

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

                    return;
                }

            }

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

            GoogleCheckoutLog gLog = new GoogleCheckoutLog();
            gLog.SiteGuid = siteSettings.SiteGuid;
            gLog.NotificationType = "RefundAmountNotification";
            gLog.RawResponse = RequestXml;
            gLog.SerialNumber = notification.serialnumber;
            gLog.OrderNumber = notification.googleordernumber;
            gLog.GTimestamp = notification.timestamp;

            gLog.LatestRefundAmt = notification.latestrefundamount.Value;
            gLog.TotalRefundAmt = notification.totalrefundamount.Value;

            gLog.Save();
        }
        private void HandleOrderStateChangeNotification(OrderStateChangeNotification notification)
        {
            NotificationSerialNumber = notification.serialnumber;

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

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

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

                    return;
                }

            }

            // if no provider found just log it
            log.Info("No GCheckoutNotification Provider found for google order " + notification.googleordernumber + " so just logging it");

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

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            GoogleCheckoutLog gLog = new GoogleCheckoutLog();
            gLog.SiteGuid = siteSettings.SiteGuid;
            gLog.RawResponse = RequestXml;
            gLog.NotificationType = "OrderStateChangeNotification";
            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();
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByBuyerId(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return googleCheckoutLog1.BuyerId.CompareTo(googleCheckoutLog2.BuyerId);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByGTimestamp(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return(googleCheckoutLog1.GTimestamp.CompareTo(googleCheckoutLog2.GTimestamp));
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByCreatedUtc(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return googleCheckoutLog1.CreatedUtc.CompareTo(googleCheckoutLog2.CreatedUtc);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByOrderNumber(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return(googleCheckoutLog1.OrderNumber.CompareTo(googleCheckoutLog2.OrderNumber));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByGTimestamp(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return googleCheckoutLog1.GTimestamp.CompareTo(googleCheckoutLog2.GTimestamp);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByBuyerId(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return(googleCheckoutLog1.BuyerId.CompareTo(googleCheckoutLog2.BuyerId));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByOrderNumber(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return googleCheckoutLog1.OrderNumber.CompareTo(googleCheckoutLog2.OrderNumber);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByFinanceState(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return(googleCheckoutLog1.FinanceState.CompareTo(googleCheckoutLog2.FinanceState));
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareBySerialNumber(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return googleCheckoutLog1.SerialNumber.CompareTo(googleCheckoutLog2.SerialNumber);
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByCvnResponse(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return(googleCheckoutLog1.CvnResponse.CompareTo(googleCheckoutLog2.CvnResponse));
 }
        public override void HandleNewOrderNotificationExtended(
            string requestXml,
            NewOrderNotificationExtended newOrder, 
            MerchantData merchantData)
        {
            //NotificationSerialNumber = newOrder.serialnumber;

            GoogleCheckoutLog gLog = new GoogleCheckoutLog();
            gLog.ProviderName = "WebStoreGCheckoutNotificationHandlerProvider";
            gLog.RawResponse = requestXml;
            gLog.NotificationType = "NewOrderNotification";
            gLog.SerialNumber = newOrder.serialnumber;
            gLog.OrderNumber = newOrder.googleordernumber;
            gLog.OrderTotal = newOrder.ordertotal.Value;
            gLog.BuyerId = newOrder.buyerid.ToString(CultureInfo.InvariantCulture);
            gLog.FullfillState = newOrder.fulfillmentorderstate.ToString();
            gLog.FinanceState = newOrder.financialorderstate.ToString();
            gLog.ShippingTotal = newOrder.ShippingCost;
            gLog.TaxTotal = newOrder.orderadjustment.totaltax.Value;
            //gLog.DiscountTotal = ext.orderadjustment.adjustmenttotal.Value;
            gLog.EmailListOptIn = newOrder.buyermarketingpreferences.emailallowed;
            gLog.GTimestamp = newOrder.timestamp;
            gLog.CartXml = SerializationHelper.RestoreXmlDeclaration(merchantData.SerializedObject);
            gLog.Save();

            Cart gCart = DeserializeCart(merchantData);

            Guid cartGuid = Guid.Empty;
            if (gCart != null)
                cartGuid = gCart.CartGuid;

            if (cartGuid == Guid.Empty) return;

            Cart cart = new Cart(cartGuid);
            if (cart.CartGuid != cartGuid) return;

            Store store = new Store(gCart.StoreGuid);
            if (store.Guid != cart.StoreGuid) return;

            gCart.DeSerializeCartOffers();

            gLog.SiteGuid = store.SiteGuid;
            gLog.UserGuid = gCart.UserGuid;
            gLog.CartGuid = gCart.CartGuid;
            gLog.StoreGuid = gCart.StoreGuid;
            gLog.Save();

            gCart.OrderInfo.CompletedFromIP = SiteUtils.GetIP4Address();

            gCart.OrderInfo.Completed = DateTime.UtcNow;
            if (newOrder.buyerbillingaddress.structuredname != null)
            {
                gCart.OrderInfo.CustomerFirstName = newOrder.buyerbillingaddress.structuredname.firstname;
                gCart.OrderInfo.CustomerLastName = newOrder.buyerbillingaddress.structuredname.lastname;
            }
            else
            {
                gCart.OrderInfo.CustomerFirstName = newOrder.buyerbillingaddress.contactname;
                gCart.OrderInfo.CustomerLastName = newOrder.buyerbillingaddress.contactname;
            }
            gCart.OrderInfo.CustomerEmail = newOrder.buyerbillingaddress.email;
            gCart.OrderInfo.CustomerCompany = newOrder.buyerbillingaddress.companyname;
            gCart.OrderInfo.CustomerAddressLine1 = newOrder.buyerbillingaddress.address1;
            gCart.OrderInfo.CustomerAddressLine2 = newOrder.buyerbillingaddress.address2;
            gCart.OrderInfo.CustomerCity = newOrder.buyerbillingaddress.city;
            gCart.OrderInfo.CustomerState = newOrder.buyerbillingaddress.region;
            gCart.OrderInfo.CustomerCountry = newOrder.buyerbillingaddress.countrycode;
            gCart.OrderInfo.CustomerPostalCode = newOrder.buyerbillingaddress.postalcode;
            gCart.OrderInfo.CustomerTelephoneDay = newOrder.buyerbillingaddress.phone;

            gCart.CopyCustomerToBilling();

            if (newOrder.buyershippingaddress.structuredname != null)
            {
                gCart.OrderInfo.DeliveryFirstName = newOrder.buyershippingaddress.structuredname.firstname;
                gCart.OrderInfo.DeliveryLastName = newOrder.buyershippingaddress.structuredname.lastname;
            }
            else
            {
                gCart.OrderInfo.DeliveryFirstName = newOrder.buyershippingaddress.contactname;
                gCart.OrderInfo.DeliveryLastName = newOrder.buyershippingaddress.contactname;
            }
            gCart.OrderInfo.DeliveryCompany = newOrder.buyershippingaddress.companyname;
            gCart.OrderInfo.DeliveryAddress1 = newOrder.buyershippingaddress.address1;
            gCart.OrderInfo.DeliveryAddress2 = newOrder.buyershippingaddress.address2;
            gCart.OrderInfo.DeliveryCity = newOrder.buyershippingaddress.city;
            gCart.OrderInfo.DeliveryState = newOrder.buyershippingaddress.region;
            gCart.OrderInfo.DeliveryCountry = newOrder.buyershippingaddress.countrycode;
            gCart.OrderInfo.DeliveryPostalCode = newOrder.buyershippingaddress.postalcode;

            gCart.TaxTotal = newOrder.orderadjustment.totaltax.Value;
            if (newOrder.ShippingCost > 0)
            {
                gCart.ShippingTotal = newOrder.ShippingCost;
            }
            gCart.OrderTotal = newOrder.ordertotal.Value;

            Guid orderStatusGuid = OrderStatus.OrderStatusReceivedGuid;

            if (
                (newOrder.financialorderstate == FinancialOrderState.CHARGEABLE)
                || (newOrder.financialorderstate == FinancialOrderState.CHARGED)
                || (newOrder.financialorderstate == FinancialOrderState.CHARGING)
                )
            {
                orderStatusGuid = OrderStatus.OrderStatusFulfillableGuid;

            }

            StoreHelper.EnsureUserForOrder(gCart);

            gCart.Save();

            //Currency currency = new Currency(store.DefaultCurrencyId);
            SiteSettings siteSettings = new SiteSettings(store.SiteGuid);

            Order order = Order.CreateOrder(
                store,
                gCart,
                gLog.RawResponse,
                gLog.OrderNumber,
                string.Empty,
                siteSettings.GetCurrency().Code,
                "GoogleCheckout",
                orderStatusGuid);

            //StoreHelper.ClearCartCookie(cart.StoreGuid);
            if (orderStatusGuid == OrderStatus.OrderStatusFulfillableGuid)
            {
                StoreHelper.ConfirmOrder(store, order);
                PayPalLog.DeleteByCart(order.OrderGuid);

            }

            if (orderStatusGuid == OrderStatus.OrderStatusReceivedGuid)
            {
                StoreHelper.ConfirmOrderReceived(store, order);
            }
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByAuthExpDate(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return(googleCheckoutLog1.AuthExpDate.CompareTo(googleCheckoutLog2.AuthExpDate));
 }
        public override void HandleRiskInformationNotification(
            string requestXml,
            RiskInformationNotification notification)
        {
            GoogleCheckoutLog gLog = new GoogleCheckoutLog();
            gLog.ProviderName = "WebStoreGCheckoutNotificationHandlerProvider";
            gLog.RawResponse = requestXml;
            gLog.NotificationType = "RiskInformationNotification";
            gLog.SerialNumber = notification.serialnumber;
            gLog.OrderNumber = notification.googleordernumber;
            gLog.GTimestamp = notification.timestamp;
            gLog.AvsResponse = notification.riskinformation.avsresponse;
            gLog.CvnResponse = notification.riskinformation.cvnresponse;
            gLog.BuyerId = notification.riskinformation.ipaddress;
            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();
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Compares 2 instances of GoogleCheckoutLog.
 /// </summary>
 public static int CompareByAuthExpDate(GoogleCheckoutLog googleCheckoutLog1, GoogleCheckoutLog googleCheckoutLog2)
 {
     return googleCheckoutLog1.AuthExpDate.CompareTo(googleCheckoutLog2.AuthExpDate);
 }
        public override void HandleChargeAmountNotification(
            string requestXml,
            ChargeAmountNotification notification)
        {
            GoogleCheckoutLog gLog = new GoogleCheckoutLog();
            gLog.ProviderName = "WebStoreGCheckoutNotificationHandlerProvider";
            gLog.RawResponse = requestXml;
            gLog.NotificationType = "ChargeAmountNotification";
            gLog.SerialNumber = notification.serialnumber;
            gLog.OrderNumber = notification.googleordernumber;
            gLog.GTimestamp = notification.timestamp;
            gLog.TotalChgAmt = notification.totalchargeamount.Value;
            gLog.LatestChgAmt = notification.latestchargeamount.Value;

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