public static void RecurringChargeRightAway() { CheckoutShoppingCartRequest cartRequest = new CheckoutShoppingCartRequest("123456", "merchantkey", EnvironmentType.Sandbox, "USD", 120); //if you are using a web page and it has the Google Checkout button, you would use this syntax. //= GCheckoutButton1.CreateRequest() Subscription gSubscription = new Subscription(); SubscriptionPayment maxCharge = new SubscriptionPayment(); DigitalItem urlDigitalItem = new DigitalItem(new Uri("http://www.url.com/login.aspx"), "Congratulations, your account has been created!"); DigitalItem urlDigitalItemSubscription = new DigitalItem(new Uri("http://www.url.com/login.aspx"), "You may now continue to login to your account."); ShoppingCartItem gRecurrentItem = new ShoppingCartItem(); maxCharge.MaximumCharge = 29.99M; gRecurrentItem.Name = "Entry Level Plan"; gRecurrentItem.Description = "Allows for basic stuff. Monthly Subscription:"; gRecurrentItem.Quantity = 1; gRecurrentItem.Price = 29.99M; gRecurrentItem.DigitalContent = urlDigitalItemSubscription; gRecurrentItem.DigitalContent.Disposition = DisplayDisposition.Pessimistic; urlDigitalItem.Disposition = DisplayDisposition.Pessimistic; gSubscription.Type = SubscriptionType.google; gSubscription.Period = GCheckout.AutoGen.DatePeriod.MONTHLY; gSubscription.AddSubscriptionPayment(maxCharge); gSubscription.RecurrentItem = gRecurrentItem; cartRequest.AddItem("Entry Level Plan", "Allows for basic stuff.", 1, gSubscription); cartRequest.AddItem("Entry Level Plan", "First Month:", 29.99M, 1, urlDigitalItem); cartRequest.MerchantPrivateData = "UserName:Joe87"; Debug.WriteLine(EncodeHelper.Utf8BytesToString(cartRequest.GetXml())); //Send the request to Google //GCheckout.Util.GCheckoutResponse resp = cartRequest.Send(); //Uncommment this line or perform additional actions //if (resp.IsGood) { //Response.Redirect(resp.RedirectUrl, True) //} //else{ //Response.Write("Resp.ResponseXml = " & Resp.ResponseXml & "<br>"); //Response.Write("Resp.RedirectUrl = " & Resp.RedirectUrl & "<br>"); //Response.Write("Resp.IsGood = " & Resp.IsGood & "<br>"); //Response.Write("Resp.ErrorMessage = " & Resp.ErrorMessage & "<br>"); //} }
/// <summary> /// This method adds an item to an order. This method handles items that /// do not have <merchant-private-item-data> XML blocks associated /// with them. /// </summary> /// <param name="Name">The name of the item. This value corresponds to the /// value of the <item-name> tag in the Checkout API request.</param> /// <param name="Description">The description of the item. This value /// corresponds to the value of the <item-description> tag in the /// Checkout API request.</param> /// <param name="MerchantItemID">The Merchant Item Id that uniquely /// identifies the product in your system.</param> /// <param name="Price">The price of the item. This value corresponds to /// the value of the <unit-price> tag in the Checkout API /// request.</param> /// <param name="Quantity">The number of this item that is included in the /// order. This value corresponds to the value of the <quantity> tag /// in the Checkout API request.</param> /// <param name="digitalItem"> /// The <digital-content> tag contains information relating to /// digital delivery of an item. /// </param> public ShoppingCartItem AddItem(string Name, string Description, string MerchantItemID, decimal Price, int Quantity, DigitalItem digitalItem) { ShoppingCartItem item = new ShoppingCartItem(Name, Description, MerchantItemID, Price, Quantity); item.DigitalContent = digitalItem; _items.Add(item); return item; }
/// <summary> /// This method adds an item to an order. This method handles items that /// do not have <merchant-private-item-data> XML blocks associated /// with them. /// </summary> /// <param name="Name">The name of the item. This value corresponds to the /// value of the <item-name> tag in the Checkout API request.</param> /// <param name="Description">The description of the item. This value /// corresponds to the value of the <item-description> tag in the /// Checkout API request.</param> /// <param name="MerchantItemID">The Merchant Item Id that uniquely /// identifies the product in your system.</param> /// <param name="Quantity">The number of this item that is included in the /// order. This value corresponds to the value of the <quantity> tag /// in the Checkout API request.</param> /// <param name="digitalItem"> /// The <digital-content> tag contains information relating to /// digital delivery of an item. /// </param> /// <param name="subscription">The subscription item</param> public ShoppingCartItem AddItem(string Name, string Description, string MerchantItemID, int Quantity, DigitalItem digitalItem, Subscription subscription) { ShoppingCartItem retVal = new ShoppingCartItem(Name, Description, MerchantItemID, 0, Quantity); retVal.DigitalContent = digitalItem; retVal.Subscription = subscription; _items.Add(retVal); return retVal; }
/// <summary> /// This method adds an item to an order. This method handles items that /// do not have <merchant-private-item-data> XML blocks associated /// with them. /// </summary> /// <param name="Name">The name of the item. This value corresponds to the /// value of the <item-name> tag in the Checkout API request.</param> /// <param name="Description">The description of the item. This value /// corresponds to the value of the <item-description> tag in the /// Checkout API request.</param> /// <param name="Price">The price of the item. This value corresponds to /// the value of the <unit-price> tag in the Checkout API /// request.</param> /// <param name="Quantity">The number of this item that is included in the /// order. This value corresponds to the value of the <quantity> tag /// in the Checkout API request.</param> /// <param name="taxTable">The <see cref="AlternateTaxTable"/> /// To assign to the item </param> /// <param name="digitalItem"> /// The <digital-content> tag contains information relating to /// digital delivery of an item. /// </param> public ShoppingCartItem AddItem(string Name, string Description, decimal Price, int Quantity, AlternateTaxTable taxTable, DigitalItem digitalItem) { _alternateTaxTables.VerifyTaxRule(taxTable); ShoppingCartItem item = new ShoppingCartItem(Name, Description, string.Empty, Price, Quantity, taxTable); item.DigitalContent = digitalItem; _items.Add(item); return item; }
/// <summary> /// This method adds an item to an order. This method handles items that /// have <merchant-private-item-data> XML blocks associated with them. /// </summary> /// <param name="Name">The name of the item. This value corresponds to the /// value of the <item-name> tag in the Checkout API request.</param> /// <param name="Description">The description of the item. This value /// corresponds to the value of the <item-description> tag in the /// Checkout API request.</param> /// <param name="MerchantItemID">The Merchant Item Id that uniquely /// identifies the product in your system.</param> /// <param name="Price">The price of the item. This value corresponds to /// the value of the <unit-price> tag in the Checkout API /// request.</param> /// <param name="Quantity">The number of this item that is included in the /// order. This value corresponds to the value of the <quantity> tag /// in the Checkout API request.</param> /// <param name="MerchantPrivateItemDataNodes">An array of XML nodes that /// should be /// associated with the item in the Checkout API request. This value /// corresponds to the value of the value of the /// <merchant-private-item-data> tag in the Checkout API /// request.</param> /// <param name="digitalItem"> /// The <digital-content> tag contains information relating to /// digital delivery of an item. /// </param> public ShoppingCartItem AddItem(string Name, string Description, string MerchantItemID, decimal Price, int Quantity, DigitalItem digitalItem, params XmlNode[] MerchantPrivateItemDataNodes) { ShoppingCartItem item = new ShoppingCartItem(Name, Description, MerchantItemID, Price, Quantity, AlternateTaxTable.Empty, MerchantPrivateItemDataNodes); item.DigitalContent = digitalItem; _items.Add(item); return item; }
/// <summary> /// This method adds an item to an order. This method handles items that /// have <merchant-private-item-data> XML blocks associated with them. /// </summary> /// <param name="Name">The name of the item. This value corresponds to the /// value of the <item-name> tag in the Checkout API request.</param> /// <param name="Description">The description of the item. This value /// corresponds to the value of the <item-description> tag in the /// Checkout API request.</param> /// <param name="MerchantItemID">The Merchant Item Id that uniquely /// identifies the product in your system.</param> /// <param name="Price">The price of the item. This value corresponds to /// the value of the <unit-price> tag in the Checkout API /// request.</param> /// <param name="Quantity">The number of this item that is included in the /// order. This value corresponds to the value of the <quantity> tag /// in the Checkout API request.</param> /// <param name="MerchantPrivateItemDataNodes">An XML node that should be /// associated with the item in the Checkout API request. This value /// corresponds to the value of the value of the /// <merchant-private-item-data> tag in the Checkout API /// request.</param> /// <param name="taxTable">The <see cref="AlternateTaxTable"/> /// To assign to the item </param> /// <param name="digitalItem"> /// The <digital-content> tag contains information relating to /// digital delivery of an item. /// </param> public ShoppingCartItem AddItem(string Name, string Description, string MerchantItemID, decimal Price, int Quantity, XmlNode MerchantPrivateItemDataNodes, AlternateTaxTable taxTable, DigitalItem digitalItem) { _alternateTaxTables.VerifyTaxRule(taxTable); ShoppingCartItem item = new ShoppingCartItem(Name, Description, MerchantItemID, Price, Quantity, taxTable, MerchantPrivateItemDataNodes); item.DigitalContent = digitalItem; _items.Add(item); return item; }
public void Test_Digital_Item_Expect_Failure_1024_Char_Limit() { DigitalItem aaa = new DigitalItem(new Uri(CONST_URL), "Url Description for item 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"); }
public void Test_DigitalItem_EncodedUrls() { string url = CONST_URL; DigitalItem urlDigitalItem = new DigitalItem(new Uri(url), "Url Description for item"); Assert.AreEqual(url, urlDigitalItem.Url); url = "HTTP://www.ConToso.com/thick%20and%20thin.htm"; urlDigitalItem = new DigitalItem(new Uri(url), "Url Description for item"); Assert.AreEqual(url.ToLower(), urlDigitalItem.Url); Uri uri = new Uri(url); Assert.AreEqual(url.ToLower(), uri.AbsoluteUri.ToLower()); Assert.IsFalse(url.ToLower().Equals(uri.ToString().ToLower())); }