コード例 #1
0
 /// <summary>
 /// This method adds a merchant-calculated shipping method to an order.
 /// This method handles merchant-calculated shipping methods that have
 /// shipping restrictions.
 /// </summary>
 /// <param name="Name">The name of the shipping method. This value will be
 /// displayed on the Google Checkout order review page.</param>
 /// <param name="DefaultCost">The default cost associated with the shipping
 /// method. This value is the amount that Gogle Checkout will charge for
 /// shipping if the merchant calculation callback request fails.</param>
 /// <param name="Restrictions">A list of country, state or zip code areas
 /// where the shipping method is either available or unavailable.</param>
 public void AddMerchantCalculatedShippingMethod(string Name,
                                                 decimal DefaultCost, ShippingRestrictions Restrictions)
 {
     AutoGen.MerchantCalculatedShipping Method =
         new AutoGen.MerchantCalculatedShipping();
     Method.name           = Name;
     Method.price          = new AutoGen.Money();
     Method.price.currency = _Currency;
     Method.price.Value    = DefaultCost;
     if (Restrictions != null)
     {
         Method.shippingrestrictions = Restrictions.XmlRestrictions;
     }
     AddNewShippingMethod(Method);
 }
        /// <summary>
        /// This method adds a merchant-calculated shipping method to an order. 
        /// This method handles merchant-calculated shipping methods that have 
        /// shipping restrictions.
        /// </summary>
        /// <param name="Name">The name of the shipping method. This value will be 
        /// displayed on the Google Checkout order review page.</param>
        /// <param name="DefaultCost">The default cost associated with the shipping 
        /// method. This value is the amount that Gogle Checkout will charge for 
        /// shipping if the merchant calculation callback request fails.</param>
        /// <param name="Restrictions">A list of country, state or zip code areas 
        /// where the shipping method is either available or unavailable.</param>
        /// <param name="AddressFilters">enables you to specify a geographic area 
        /// where a particular merchant-calculated shipping method is available or
        /// unavailable. Google Checkout applies address filters before sending you
        /// a &lt;merchantcalculation-callback&gt; request so that you are not asked
        /// to calculate shipping costs for a shipping method that is not actually 
        /// available.</param>
        public void AddMerchantCalculatedShippingMethod(string Name,
            decimal DefaultCost, ShippingRestrictions Restrictions,
            ShippingRestrictions AddressFilters)
        {
            DefaultCost = Math.Round(DefaultCost, 2); //no fractional cents

              AutoGen.MerchantCalculatedShipping Method =
            new AutoGen.MerchantCalculatedShipping();
              Method.name = Name;
              Method.price = new AutoGen.MerchantCalculatedShippingPrice();
              Method.price.currency = _Currency;
              Method.price.Value = DefaultCost;
              if (Restrictions != null) {
            Method.shippingrestrictions = Restrictions.XmlRestrictions;
              }
              if (AddressFilters != null) {
            Method.addressfilters = AddressFilters.XmlRestrictions;
              }
              AddNewShippingMethod(Method);
        }
コード例 #3
0
 /// <summary>
 /// This method adds a merchant-calculated shipping method to an order. 
 /// This method handles merchant-calculated shipping methods that have 
 /// shipping restrictions.
 /// </summary>
 /// <param name="Name">The name of the shipping method. This value will be 
 /// displayed on the Google Checkout order review page.</param>
 /// <param name="DefaultCost">The default cost associated with the shipping 
 /// method. This value is the amount that Gogle Checkout will charge for 
 /// shipping if the merchant calculation callback request fails.</param>
 /// <param name="Restrictions">A list of country, state or zip code areas 
 /// where the shipping method is either available or unavailable.</param>
 public void AddMerchantCalculatedShippingMethod(string Name, 
   decimal DefaultCost, ShippingRestrictions Restrictions) {
   AutoGen.MerchantCalculatedShipping Method = 
     new AutoGen.MerchantCalculatedShipping();
   Method.name = Name;
   Method.price = new AutoGen.Money();
   Method.price.currency = _Currency;
   Method.price.Value = DefaultCost;        
   if (Restrictions != null) {
     Method.shippingrestrictions = Restrictions.XmlRestrictions;
   }
   AddNewShippingMethod(Method);
 }