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