Beispiel #1
0
        /// <summary>
        /// Create an instance of carrier-calculated-shipping-option
        /// </summary>
        /// <param name="currency"></param>
        /// <param name="shippingType">
        /// The &lt;shipping-type&gt; tag identifies the shipping option
        /// that is being offered to the buyer.
        /// </param>
        /// <param name="defaultPrice">
        /// The default cost for the shipping option.
        /// The default cost will be assessed if Google's attempt to obtain the
        /// carrier's shipping rates fails for any reason.
        /// </param>
        public CarrierCalculatedShippingOption(string currency,
                                               ShippingType shippingType, decimal defaultPrice)
        {
            defaultPrice  = Math.Round(defaultPrice, 2); //fix for sending in fractional cents
            _autoGenClass = new GCheckout.AutoGen.CarrierCalculatedShippingOption();

            _currency           = currency;
            _statedShippingType = shippingType;

            //must call the setter to set the price.
            Price = defaultPrice;

            //set the defaults that the object needs.
            _autoGenClass.shippingtype    = ShippingType;
            _autoGenClass.shippingcompany = ShippingCompany;
            _autoGenClass.carrierpickup   = CarrierPickup.ToString();
        }
Beispiel #2
0
        /// <summary>
        /// Create a new Carrier Calculated Shipping Option with the minimum
        /// Amount of information needed.
        /// </summary>
        /// <param name="shippingType">The Shipping Type to add
        /// (This must be unique)</param>
        /// <param name="defaultValue">The default cost for the shipping option.
        /// The default cost will be assessed if Google's attempt to obtain the
        /// carrier's shipping rates fails for any reason.</param>
        /// <param name="carrierPickup">
        /// The &lt;carrier-pickup&gt; tag specifies how the package will be
        /// transferred from the merchant to the shipper. Valid values for this
        /// tag are REGULAR_PICKUP, SPECIAL_PICKUP and DROP_OFF. The default
        /// value for this tag is DROP_OFF.
        /// </param>
        /// <param name="additionalFixedCharge">
        /// The &lt;additional-fixed-charge&gt; tag allows you to specify a fixed
        /// charge that will be added to the total cost of an order if the buyer
        /// selects the associated shipping option. If you also adjust the
        /// calculated shipping cost using the
        /// &lt;additional-variable-charge-percent&gt; tag, the fixed charge will
        /// be added to the adjusted shipping rate.
        /// </param>
        /// <param name="additionalVariableChargePercent">
        /// The &lt;additional-variable-charge-percent&gt; tag specifies a
        /// percentage amount by which a carrier-calculated shipping rate will be
        /// adjusted. The tag's value may be positive or negative. For example, if
        /// the tag's value is 15, then the carrier's shipping rate will
        /// effectively be multiplied by 1.15 to determine the shipping cost
        /// presented to the buyer. So, if the carrier shipping rate were $10.00,
        /// the adjusted shipping rate would be $11.50 – i.e. $10.00 +
        /// ($10.00 X 15%). If the &lt;additional-variable-charge-percent&gt; tag
        /// value is negative, the calculated shipping rate will be discounted by
        /// the specified percentage.
        /// </param>
        /// <returns></returns>
        public CarrierCalculatedShippingOption AddShippingOption(
            ShippingType shippingType, decimal defaultValue,
            CarrierPickup carrierPickup, decimal additionalFixedCharge,
            double additionalVariableChargePercent)
        {
            //CarrierCalculatedShippingOption verifies the fractional cents
            //call the default Add to perform the validation
            CarrierCalculatedShippingOption retVal
                = AddShippingOption(shippingType, defaultValue);

            additionalFixedCharge = Math.Round(additionalFixedCharge, 2);

            retVal.CarrierPickup         = carrierPickup;
            retVal.AdditionalFixedCharge = additionalFixedCharge;

            if (additionalVariableChargePercent != 0)
            {
                retVal.AdditionalVariableChargePercent
                    = additionalVariableChargePercent;
            }

            return(retVal);
        }
 /// <summary>
 /// Create a new Carrier Calculated Shipping Option with the minimum
 /// Amount of information needed.
 /// </summary>
 /// <param name="shippingType">The Shipping Type to add
 /// (This must be unique)</param>
 /// <param name="defaultValue">The default cost for the shipping option. 
 /// The default cost will be assessed if Google's attempt to obtain the 
 /// carrier's shipping rates fails for any reason.</param>
 /// <param name="carrierPickup">
 /// The &lt;carrier-pickup&gt; tag specifies how the package will be 
 /// transferred from the merchant to the shipper. Valid values for this
 /// tag are REGULAR_PICKUP, SPECIAL_PICKUP and DROP_OFF. The default
 /// value for this tag is DROP_OFF.
 /// </param>
 /// <param name="additionalFixedCharge">
 /// The &lt;additional-fixed-charge&gt; tag allows you to specify a fixed
 /// charge that will be added to the total cost of an order if the buyer
 /// selects the associated shipping option. If you also adjust the
 /// calculated shipping cost using the
 /// &lt;additional-variable-charge-percent&gt; tag, the fixed charge will
 /// be added to the adjusted shipping rate.
 /// </param>
 /// <param name="additionalVariableChargePercent">
 /// The &lt;additional-variable-charge-percent&gt; tag specifies a
 /// percentage amount by which a carrier-calculated shipping rate will be
 /// adjusted. The tag's value may be positive or negative. For example, if
 /// the tag's value is 15, then the carrier's shipping rate will
 /// effectively be multiplied by 1.15 to determine the shipping cost
 /// presented to the buyer. So, if the carrier shipping rate were $10.00,
 /// the adjusted shipping rate would be $11.50 – i.e. $10.00 +
 /// ($10.00 X 15%). If the &lt;additional-variable-charge-percent&gt; tag
 /// value is negative, the calculated shipping rate will be discounted by 
 /// the specified percentage.
 /// </param>
 /// <returns></returns>
 public CarrierCalculatedShippingOption AddCarrierCalculatedShippingOption(
     ShippingType shippingType, decimal defaultValue,
     CarrierPickup carrierPickup, decimal additionalFixedCharge,
     double additionalVariableChargePercent)
 {
     return _carrierCalculatedShipping.AddShippingOption(shippingType,
     defaultValue, carrierPickup, additionalFixedCharge,
     additionalVariableChargePercent);
 }
        /// <summary>
        /// Create a new Carrier Calculated Shipping Option with the minimum
        /// Amount of information needed.
        /// </summary>
        /// <param name="shippingType">The Shipping Type to add
        /// (This must be unique)</param>
        /// <param name="defaultValue">The default cost for the shipping option. 
        /// The default cost will be assessed if Google's attempt to obtain the 
        /// carrier's shipping rates fails for any reason.</param>
        /// <param name="carrierPickup">
        /// The &lt;carrier-pickup&gt; tag specifies how the package will be 
        /// transferred from the merchant to the shipper. Valid values for this
        /// tag are REGULAR_PICKUP, SPECIAL_PICKUP and DROP_OFF. The default
        /// value for this tag is DROP_OFF.
        /// </param>
        /// <param name="additionalFixedCharge">
        /// The &lt;additional-fixed-charge&gt; tag allows you to specify a fixed
        /// charge that will be added to the total cost of an order if the buyer
        /// selects the associated shipping option. If you also adjust the
        /// calculated shipping cost using the
        /// &lt;additional-variable-charge-percent&gt; tag, the fixed charge will
        /// be added to the adjusted shipping rate.
        /// </param>
        /// <param name="additionalVariableChargePercent">
        /// The &lt;additional-variable-charge-percent&gt; tag specifies a
        /// percentage amount by which a carrier-calculated shipping rate will be
        /// adjusted. The tag's value may be positive or negative. For example, if
        /// the tag's value is 15, then the carrier's shipping rate will
        /// effectively be multiplied by 1.15 to determine the shipping cost
        /// presented to the buyer. So, if the carrier shipping rate were $10.00,
        /// the adjusted shipping rate would be $11.50 – i.e. $10.00 +
        /// ($10.00 X 15%). If the &lt;additional-variable-charge-percent&gt; tag
        /// value is negative, the calculated shipping rate will be discounted by 
        /// the specified percentage.
        /// </param>
        /// <returns></returns>
        public CarrierCalculatedShippingOption AddShippingOption(
            ShippingType shippingType, decimal defaultValue,
            CarrierPickup carrierPickup, decimal additionalFixedCharge,
            double additionalVariableChargePercent)
        {
            //CarrierCalculatedShippingOption verifies the fractional cents
              //call the default Add to perform the validation
              CarrierCalculatedShippingOption retVal
            = AddShippingOption(shippingType, defaultValue);

              additionalFixedCharge = Math.Round(additionalFixedCharge, 2);

              retVal.CarrierPickup = carrierPickup;
              retVal.AdditionalFixedCharge = additionalFixedCharge;

              if (additionalVariableChargePercent != 0)
            retVal.AdditionalVariableChargePercent
              = additionalVariableChargePercent;

              return retVal;
        }