Example #1
0
        public AlternateTaxTable Factory(string name, bool standalone)
        {
            if (name == null || name == string.Empty || name.Trim() == string.Empty)
            {
                throw new ArgumentNullException("name", "The name of the Tax table must" +
                                                " not be empty. If you wish to use an Empty Tax table, please call" +
                                                " AlternateTaxTable.Empty");
            }

            name = name.ToLower();
            AlternateTaxTable retVal = this[name];

            if (retVal == null)
            {
                retVal = new AlternateTaxTable(name, standalone);
                _taxTables.Add(name, retVal);
            }
            else
            {
                //a duplicate tax table is being added.
                throw new ApplicationException(GetDuplicateTaxTableError(name));
            }

            return(retVal);
        }
 /// <summary>
 /// Initialize a new instance of the
 /// <see cref="ShoppingCartItem"/> class, which creates an object
 /// corresponding to an individual item in an order. This method
 /// is used for items that do have an associated
 /// &lt;merchant-private-item-data&gt; XML block.
 /// </summary>
 /// <param name="name">The name of the item.</param>
 /// <param name="description">A description of the item.</param>
 /// <param name="merchantItemID">The Merchant Item Id that uniquely
 /// identifies the product in your system. (optional)</param>
 /// <param name="price">The price of the item, per item.</param>
 /// <param name="quantity">The number of the item that is
 /// included in the order.</param>
 /// <param name="merchantPrivateItemData">The merchant private
 /// item data associated with the item.</param>
 /// <param name="taxTable">The <see cref="AlternateTaxTable"/>
 /// To assign to the item </param>
 public ShoppingCartItem(string name, string description,
                         string merchantItemID, decimal price, int quantity,
                         AlternateTaxTable taxTable,
                         params XmlNode[] merchantPrivateItemData)
 {
     Name        = name;
     Description = description;
     if (merchantItemID == string.Empty)
     {
         merchantItemID = null;
     }
     MerchantItemID = merchantItemID;
     Price          = price; //is checked for fractions
     Quantity       = quantity;
     MerchantPrivateItemDataNodes = merchantPrivateItemData;
     TaxTable = taxTable;
 }
Example #3
0
        /// <summary>
        /// Verify that the tax table is unique and that it not empty
        /// </summary>
        /// <param name="taxTable">the <see cref="AlternateTaxTable"/> to verify.</param>
        internal void VerifyTaxRule(AlternateTaxTable taxTable)
        {
            //Now we need to see if the item exists in the collection

            AlternateTaxTable existing = this[taxTable.Name];

            if (existing != null)
            {
                if (!object.ReferenceEquals(existing, taxTable))
                {
                    throw new ApplicationException(GetDuplicateTaxTableError(taxTable.Name));
                }
            }
            else
            {
                //Add the item to the collection
                _taxTables.Add(taxTable.Name.ToLower(), taxTable);
            }
        }
Example #4
0
        /// <summary>
        /// Append this collection of tax tables to the request object.
        /// </summary>
        /// <param name="taxTables">The <see cref="AutoGen.TaxTables"/> used in the request</param>
        internal void AppendToRequest(AutoGen.TaxTables taxTables)
        {
            if (this.Count > 0)
            {
                AlternateTaxTable[] items = new AlternateTaxTable[this.Count];
                _taxTables.Values.CopyTo(items, 0);

                AutoGen.AlternateTaxTable[] altTables
                    = new GCheckout.AutoGen.AlternateTaxTable[items.Length];

                for (int i = 0; i < items.Length; i++)
                {
                    altTables[i] = items[i].GetAutoGenTable();
                }

                taxTables.alternatetaxtables = altTables;
            }
            else
            {
                //Console.WriteLine("AlternateTaxTable:" + 0);
            }
        }
 /// <summary>
 /// This method adds an item to an order. This method handles items that 
 /// do not have &lt;merchant-private-item-data&gt; XML blocks associated 
 /// with them.
 /// </summary>
 /// <param name="Name">The name of the item. This value corresponds to the 
 /// value of the &lt;item-name&gt; tag in the Checkout API request.</param>
 /// <param name="Description">The description of the item. This value 
 /// corresponds to the value of the &lt;item-description&gt; 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 &lt;quantity&gt; tag 
 /// in the Checkout API request.</param>
 /// <param name="taxTable">The <see cref="AlternateTaxTable"/> 
 /// To assign to the item </param>
 /// <param name="subscription">The subscription item</param>
 public ShoppingCartItem AddItem(string Name, string Description,
     string MerchantItemID, int Quantity, AlternateTaxTable taxTable,
     Subscription subscription)
 {
     _alternateTaxTables.VerifyTaxRule(taxTable);
       ShoppingCartItem retVal
     = new ShoppingCartItem(Name, Description, MerchantItemID, 0,
     Quantity, taxTable);
       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 &lt;merchant-private-item-data&gt; XML blocks associated 
 /// with them.
 /// </summary>
 /// <param name="Name">The name of the item. This value corresponds to the 
 /// value of the &lt;item-name&gt; tag in the Checkout API request.</param>
 /// <param name="Description">The description of the item. This value 
 /// corresponds to the value of the &lt;item-description&gt; 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 &lt;unit-price&gt; 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 &lt;quantity&gt; tag 
 /// in the Checkout API request.</param>
 /// <param name="taxTable">The <see cref="AlternateTaxTable"/> 
 /// To assign to the item </param>
 public ShoppingCartItem AddItem(string Name, string Description,
     string MerchantItemID, decimal Price, int Quantity,
     AlternateTaxTable taxTable)
 {
     _alternateTaxTables.VerifyTaxRule(taxTable);
       ShoppingCartItem retVal
     = new ShoppingCartItem(Name, Description, MerchantItemID, Price,
     Quantity, taxTable);
       _items.Add(retVal);
       return retVal;
 }
 /// <summary>
 /// This method adds an item to an order. This method handles items that 
 /// do not have &lt;merchant-private-item-data&gt; XML blocks associated 
 /// with them.
 /// </summary>
 /// <param name="Name">The name of the item. This value corresponds to the 
 /// value of the &lt;item-name&gt; tag in the Checkout API request.</param>
 /// <param name="Description">The description of the item. This value 
 /// corresponds to the value of the &lt;item-description&gt; tag in the 
 /// Checkout API request.</param>
 /// <param name="Price">The price of the item. This value corresponds to 
 /// the value of the &lt;unit-price&gt; 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 &lt;quantity&gt; tag 
 /// in the Checkout API request.</param>
 /// <param name="taxTable">The <see cref="AlternateTaxTable"/> 
 /// To assign to the item </param>
 /// <param name="digitalItem">
 /// The &lt;digital-content&gt; 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 &lt;merchant-private-item-data&gt; XML blocks associated with them.
 /// </summary>
 /// <param name="Name">The name of the item. This value corresponds to the 
 /// value of the &lt;item-name&gt; tag in the Checkout API request.</param>
 /// <param name="Description">The description of the item. This value 
 /// corresponds to the value of the &lt;item-description&gt; 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 &lt;unit-price&gt; 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 &lt;quantity&gt; tag 
 /// in the Checkout API request.</param>
 /// <param name="MerchantPrivateItemDataNodes">An XML node array that should be 
 /// associated with the item in the Checkout API request. This value 
 /// corresponds to the value of the value of the 
 /// &lt;merchant-private-item-data&gt; tag in the Checkout API 
 /// request.</param>
 /// <param name="taxTable">The <see cref="AlternateTaxTable"/> 
 /// To assign to the item </param>
 /// <param name="digitalItem">
 /// The &lt;digital-content&gt; tag contains information relating to
 /// digital delivery of an item.
 /// </param>
 public ShoppingCartItem AddItem(string Name, string Description,
     string MerchantItemID,
     decimal Price, int Quantity, AlternateTaxTable taxTable,
     DigitalItem digitalItem, params XmlNode[] MerchantPrivateItemDataNodes)
 {
     _alternateTaxTables.VerifyTaxRule(taxTable);
       ShoppingCartItem item = new ShoppingCartItem(Name, Description,
     MerchantItemID, Price, Quantity, taxTable, MerchantPrivateItemDataNodes);
       item.DigitalContent = digitalItem;
       _items.Add(item);
       return item;
 }
 /// <summary>
 /// This method adds an item to an order. This method handles items that 
 /// have &lt;merchant-private-item-data&gt; XML blocks associated with them.
 /// </summary>
 /// <param name="Name">The name of the item. This value corresponds to the 
 /// value of the &lt;item-name&gt; tag in the Checkout API request.</param>
 /// <param name="Description">The description of the item. This value 
 /// corresponds to the value of the &lt;item-description&gt; tag in the 
 /// Checkout API request.</param>
 /// <param name="Price">The price of the item. This value corresponds to 
 /// the value of the &lt;unit-price&gt; 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 &lt;quantity&gt; 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 
 /// &lt;merchant-private-item-data&gt; tag in the Checkout API 
 /// request.</param>
 /// <param name="taxTable">The <see cref="AlternateTaxTable"/> 
 /// To assign to the item </param>
 public ShoppingCartItem AddItem(string Name, string Description,
     decimal Price, int Quantity, XmlNode MerchantPrivateItemDataNodes,
     AlternateTaxTable taxTable)
 {
     _alternateTaxTables.VerifyTaxRule(taxTable);
       ShoppingCartItem retVal
     = new ShoppingCartItem(Name, Description, string.Empty, Price,
     Quantity, taxTable, MerchantPrivateItemDataNodes);
       _items.Add(retVal);
       return retVal;
 }
Example #10
0
 /// <summary>
 /// Add an <see cref="AlternateTaxTable"/> to the collection
 /// </summary>
 /// <param name="taxTable">The tax table to add.</param>
 public void Add(AlternateTaxTable taxTable)
 {
     VerifyTaxRule(taxTable);
 }
 /// <summary>
 /// Initialize a new instance of the 
 /// <see cref="ShoppingCartItem"/> class, which creates an object
 /// corresponding to an individual item in an order. This method 
 /// is used for items that do have an associated
 /// &lt;merchant-private-item-data&gt; XML block.
 /// </summary>
 /// <param name="name">The name of the item.</param>
 /// <param name="description">A description of the item.</param>
 /// <param name="merchantItemID">The Merchant Item Id that uniquely 
 /// identifies the product in your system. (optional)</param>
 /// <param name="price">The price of the item, per item.</param>
 /// <param name="quantity">The number of the item that is 
 /// included in the order.</param>
 /// <param name="merchantPrivateItemData">The merchant private
 /// item data associated with the item.</param>
 /// <param name="taxTable">The <see cref="AlternateTaxTable"/> 
 /// To assign to the item </param>
 public ShoppingCartItem(string name, string description,
     string merchantItemID, decimal price, int quantity,
     AlternateTaxTable taxTable,
     params XmlNode[] merchantPrivateItemData)
 {
     Name = name;
       Description = description;
       if (merchantItemID == string.Empty)
     merchantItemID = null;
       MerchantItemID = merchantItemID;
       Price = price; //is checked for fractions
       Quantity = quantity;
       MerchantPrivateItemDataNodes = merchantPrivateItemData;
       TaxTable = taxTable;
 }
 /// <summary>
 /// Add an <see cref="AlternateTaxTable"/> to the collection
 /// </summary>
 /// <param name="taxTable">The tax table to add.</param>
 public void Add(AlternateTaxTable taxTable)
 {
     VerifyTaxRule(taxTable);
 }
        /// <summary>
        /// Verify that the tax table is unique and that it not empty
        /// </summary>
        /// <param name="taxTable">the <see cref="AlternateTaxTable"/> to verify.</param>
        internal void VerifyTaxRule(AlternateTaxTable taxTable)
        {
            //Now we need to see if the item exists in the collection

              AlternateTaxTable existing = this[taxTable.Name];

              if (existing != null) {
            if (!object.ReferenceEquals(existing, taxTable)) {
              throw new ApplicationException(GetDuplicateTaxTableError(taxTable.Name));
            }
              }
              else {
            //Add the item to the collection
            _taxTables.Add(taxTable.Name.ToLower(), taxTable);
              }
        }
        /// <summary>
        /// Append this collection of tax tables to the request object.
        /// </summary>
        /// <param name="taxTables">The <see cref="AutoGen.TaxTables"/> used in the request</param>
        internal void AppendToRequest(AutoGen.TaxTables taxTables)
        {
            if (this.Count > 0) {
            AlternateTaxTable[] items = new AlternateTaxTable[this.Count];
            _taxTables.Values.CopyTo(items, 0);

            AutoGen.AlternateTaxTable[] altTables
              = new GCheckout.AutoGen.AlternateTaxTable[items.Length];

            for(int i = 0; i < items.Length; i++) {
              altTables[i] = items[i].GetAutoGenTable();
            }

            taxTables.alternatetaxtables = altTables;
              }
              else {
            //Console.WriteLine("AlternateTaxTable:" + 0);
              }
        }
        public AlternateTaxTable Factory(string name, bool standalone)
        {
            if(name == null || name == string.Empty || name.Trim() == string.Empty) {
            throw new ArgumentNullException("name", "The name of the Tax table must" +
              " not be empty. If you wish to use an Empty Tax table, please call" +
              " AlternateTaxTable.Empty");
              }

              name = name.ToLower();
              AlternateTaxTable retVal = this[name];

              if (retVal == null) {
            retVal = new AlternateTaxTable(name, standalone);
            _taxTables.Add(name, retVal);
              }
              else {
            //a duplicate tax table is being added.
            throw new ApplicationException(GetDuplicateTaxTableError(name));
              }

              return retVal;
        }