public static void HandleAuthorizationAmountNotification(GCheckout.AutoGen.AuthorizationAmountNotification authnotification)
 {
     string googleOrderID = authnotification.googleordernumber;
     Cart order = new Cart().GetByPayment(googleOrderID);
     if (order.getPayment().status != "Complete") {
         order.UpdatePayment(authnotification.ordersummary.financialorderstate.ToString());
     }
 }
 /// <summary>
 /// ctor used by the extended notification class
 /// </summary>
 /// <param name="theItem"></param>
 public ShoppingCartItem(GCheckout.AutoGen.Item theItem)
 {
     if (theItem.digitalcontent != null)
     this.DigitalContent = new DigitalItem(theItem.digitalcontent);
       this.Description = theItem.itemdescription;
       this.MerchantItemID = theItem.merchantitemid;
       if (theItem.merchantprivateitemdata != null)
     this.MerchantPrivateItemDataNodes
       = theItem.merchantprivateitemdata.Any;
       else
     this.MerchantPrivateItemDataNodes = new XmlNode[] { };
       this.Name = theItem.itemname;
       this.Price = theItem.unitprice.Value; //is checked for fractions
       this.Quantity = theItem.quantity;
       _taxtableselector = theItem.taxtableselector;
       _notificationItem = theItem;
       if (theItem.subscription != null) {
     this.Subscription = new Subscription(theItem.subscription);
       }
 }
 /// <summary>
 /// used by the extended notification class.
 /// </summary>
 /// <param name="content"></param>
 internal DigitalItem(GCheckout.AutoGen.DigitalContent content)
 {
     this._description = content.description;
       this._emaildelivery = content.emaildelivery;
       this._key = content.key;
       this._url = content.url;
 }
 public static void HandleChargeAmountNotification(GCheckout.AutoGen.ChargeAmountNotification chargenotification)
 {
     string googleOrderID = chargenotification.googleordernumber;
     Cart order = new Cart().GetByPayment(googleOrderID);
     if (order.getTotal() == chargenotification.totalchargeamount.Value) {
         order.UpdatePayment("Complete");
         order.SendConfirmation();
         EDI edi = new EDI();
         edi.CreatePurchaseOrder(order.ID);
     }
 }
 public static void HandleOrderStateChangeNotification(GCheckout.AutoGen.OrderStateChangeNotification statechange)
 {
     string googleOrderID = statechange.googleordernumber;
     Cart order = new Cart().GetByPayment(googleOrderID);
     if (order.getPayment().status != "Complete") {
         order.UpdatePayment(statechange.newfinancialorderstate.ToString());
     }
 }
 public static void HandleNewOrderNotification(GCheckout.AutoGen.NewOrderNotification neworder)
 {
     string googleOrderID = neworder.googleordernumber;
     int orderID = 0;
     System.Xml.XmlNode[] privateData = neworder.shoppingcart.merchantprivatedata.Any;
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     try {
         orderID = Convert.ToInt32(privateData.Where(x => x.Name.ToLower().Equals("ordernumber")).Select(x => x.InnerText).First());
     } catch { };
     Cart order = new Cart().Get(orderID);
     order.UpdatePaymentConfirmationCode(googleOrderID);
     order.UpdatePayment(neworder.financialorderstate.ToString());
 }
    private static void HandleNewOrderNotification(GCheckout.AutoGen.NewOrderNotification inputNewOrderNotification)
    {


        try
        {
            if (inputNewOrderNotification.shoppingcart.merchantprivatedata != null && inputNewOrderNotification.shoppingcart.merchantprivatedata.Any != null && inputNewOrderNotification.shoppingcart.merchantprivatedata.Any.Length > 0)
            {
                //Retrieve data from MerchantPrivateData
                GCheckout.AutoGen.anyMultiple oneAnyMultiple = inputNewOrderNotification.shoppingcart.merchantprivatedata;
                System.Xml.XmlNode[] oneXmlNodeArray = oneAnyMultiple.Any;
                foreach (XmlNode xn in oneXmlNodeArray)
                {


                    if (xn.Name == "OrderID")
                    {
                        orderID = Int32.Parse(xn.InnerText.ToString());
                    }

                    if (xn.Name == "userName")
                    {
                        userName = xn.InnerText.ToString();
                    }

                    if (xn.Name == "amount")
                    {
                        totalAmount = decimal.Parse(xn.InnerText.ToString());
                    }

                    if (xn.Name == "selectedCurrency")
                    {
                        selectedCurrency = xn.InnerText.ToString();
                    }

                    if (xn.Name == "portalID")
                    {
                        portalID = int.Parse(xn.InnerText.ToString());
                    }
                    if (xn.Name == "customerID")
                    {
                        customerID = int.Parse(xn.InnerText.ToString());
                    }
                    if (xn.Name == "itemIds")
                    {
                        itemIds = xn.InnerText.ToString();
                    }
                    if (xn.Name == "storeID")
                    {
                        storeID = int.Parse(xn.InnerText.ToString());
                    }
                    if (xn.Name == "couponCode")
                    {
                        couponCode = xn.InnerText.ToString();
                    }
                    if (xn.Name == "sessionCode")
                    {
                        sessionCode = xn.InnerText.ToString();
                    }
                    if (xn.Name == "pgID")
                    {
                        pgID = int.Parse(xn.InnerText.ToString());
                    }
                    if (xn.Name == "MerchantID")
                    {
                        MerchantID = xn.InnerText.ToString();
                    }
                    if (xn.Name == "MerchantKey")
                    {
                        MerchantID = xn.InnerText.ToString();
                    }
                }
                paymentStatus = GCNotificationStatus.Succeeded.ToString();
                transID = inputNewOrderNotification.googleordernumber;

                if (paymentStatus == "Succeeded")
                {
                    TransactionLogInfo tinfo = new TransactionLogInfo();
                    TransactionLog Tlog = new TransactionLog();
                    OrderDetailsCollection odc = new OrderDetailsCollection();
                   
                    tinfo.ResponseReasonText = "Succeeded";
                    tinfo.OrderID = orderID;
                    tinfo.StoreID = storeID;
                    tinfo.PortalID = portalID;
                    tinfo.AddedBy = userName;
                    tinfo.CustomerID = customerID;
                    tinfo.SessionCode = sessionCode;
                    tinfo.PaymentGatewayID = pgID;
                    tinfo.PaymentStatus = paymentStatus;
                    tinfo.PayerEmail = "";
                    tinfo.CreditCard = "";
                    tinfo.TotalAmount = totalAmount;
                    tinfo.TransactionID = transID;
                    tinfo.RecieverEmail = "";
                    tinfo.CurrencyCode = selectedCurrency;
                    Tlog.SaveTransactionLog(tinfo);

                    GoogleCheckOutHandler.ParseIPN(orderID, transID, paymentStatus, storeID, portalID, userName, customerID, sessionCode);
                    GoogleCheckOutHandler.UpdateItemQuantity(itemIds, couponCode, storeID, portalID, userName);
                    CartManageSQLProvider cms = new CartManageSQLProvider();
                    AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
                    aspxCommonObj.CustomerID = customerID;
                    aspxCommonObj.SessionCode = sessionCode;
                    aspxCommonObj.StoreID = storeID;
                    aspxCommonObj.PortalID = portalID;
                    aspxCommonObj.CultureName = null;
                    aspxCommonObj.UserName = null;                    
                    cms.ClearCartAfterPayment(aspxCommonObj);

                   
                   

                }

            }
        }
        catch (Exception ex)
        {

            throw ex;
        }
        
        // TODO: Process the MerchantPrivateData if provided

        foreach (GCheckout.AutoGen.Item oneItem in inputNewOrderNotification.shoppingcart.items)
        {
            // TODO: Get MerchantItemId from shopping cart item (oneItem.merchantitemid) and process it
        }

        // TODO: Add custom processing for this notification type
    }
 private static void HandleChargeAmountNotification(GCheckout.AutoGen.ChargeAmountNotification inputChargeAmountNotification)
 {
     // TODO: Add custom processing for this notification type
 }
 private static void HandleAuthorizationAmountNotification(GCheckout.AutoGen.AuthorizationAmountNotification inputAuthorizationAmountNotification)
 {
     // TODO: Add custom processing for this notification type
 }
 private static void HandleRiskInformationNotification(GCheckout.AutoGen.RiskInformationNotification inputRiskInformationNotification)
 {
     // TODO: Add custom processing for this notification type
 }
    private static void HandleOrderStateChangeNotification(GCheckout.AutoGen.OrderStateChangeNotification inputOrderStateChangeNotification)
    {
        // Charge Order If Chargeable
        if ((inputOrderStateChangeNotification.previousfinancialorderstate.ToString().Equals("REVIEWING")) && (inputOrderStateChangeNotification.newfinancialorderstate.ToString().Equals("CHARGEABLE")))
        {
            GCheckout.OrderProcessing.ChargeOrderRequest oneChargeOrderRequest = new GCheckout.OrderProcessing.ChargeOrderRequest(inputOrderStateChangeNotification.googleordernumber);
            GCheckout.Util.GCheckoutResponse oneGCheckoutResponse = oneChargeOrderRequest.Send();
        }

        // Update License If Charged
        if ((inputOrderStateChangeNotification.previousfinancialorderstate.ToString().Equals("CHARGING")) && (inputOrderStateChangeNotification.newfinancialorderstate.ToString().Equals("CHARGED")))
        {
            // TODO: For each shopping cart item received in the NewOrderNotification, authorize the license
        }

        // TODO: Add custom processing for this notification type
    }