/// <summary>
 /// SwedishPostalServiceShippingProvider constructor
 /// </summary>
 /// <param name="apiKey">API key value</param>
 /// <param name="shippingCostCalculator">order shipping cost calculator instance</param>
 /// <param name="customsHandlingOptions">order customs handling options instance</param>
 /// <param name="insuranceOptions">order insurance options instance</param>
 public SwedishPostalServiceShippingProvider(string apiKey, ShippingCostCalculator shippingCostCalculator,
                                             CustomsHandlingOptions customsHandlingOptions, InsuranceOptions insuranceOptions)
 {
     this.ShippingCostCalculator = shippingCostCalculator;
     this.CustomsHandlingOptions = customsHandlingOptions;
     this.InsuranceOptions       = insuranceOptions;
     this._apiKey = apiKey;
 }
Exemple #2
0
 /// <summary>
 /// AustraliaPostShippingProvider constructor
 /// </summary>
 /// <param name="clientId">client id value</param>
 /// <param name="secret">secret value</param>
 /// <param name="shippingCostCalculator">order shipping cost calculator instance</param>
 /// <param name="customsHandlingOptions">order customs handling options instance</param>
 /// <param name="insuranceOptions">order insurance options instance</param>
 public AustraliaPostShippingProvider(string clientId, string secret,
                                      ShippingCostCalculator shippingCostCalculator,
                                      CustomsHandlingOptions customsHandlingOptions, InsuranceOptions insuranceOptions)
 {
     this.ShippingCostCalculator = shippingCostCalculator;
     this.CustomsHandlingOptions = customsHandlingOptions;
     this.InsuranceOptions       = insuranceOptions;
     this._clientId = clientId;
     this._secret   = secret;
 }
        /// <inheritdoc cref="ShippingProvider.GenerateShippingLabelFor"/>
        public override string GenerateShippingLabelFor(Order order)
        {
            var shippingId = GetShippingId();

            var shippingCost = ShippingCostCalculator.CalculateFor(order.Recipient.Country,
                                                                   order.Sender.Country,
                                                                   order.TotalWeight);

            return($"Shipping Id: {shippingId} {Environment.NewLine}" +
                   $"To: {order.Recipient.To} {Environment.NewLine}" +
                   $"Order total: {order.Total} {Environment.NewLine}" +
                   $"Tax: {CustomsHandlingOptions.TaxOptions} {Environment.NewLine}" +
                   $"Shipping Cost: {shippingCost}");
        }
Exemple #4
0
        /// <inheritdoc cref="ShippingProvider.GenerateShippingLabelFor"/>
        /// <exception cref="NotSupportedException">if given order need shipping not into same country</exception>
        public override string GenerateShippingLabelFor(Order order)
        {
            var shippingId = GetShippingId();

            if (order.Recipient.Country != order.Sender.Country)
            {
                throw new NotSupportedException("International shipping not supported");
            }

            var shippingCost =
                ShippingCostCalculator.CalculateFor(order.Recipient.Country, order.Sender.Country,
                                                    order.TotalWeight);

            return($"Shipping Id: {shippingId} {Environment.NewLine}" +
                   $"To: {order.Recipient.To} {Environment.NewLine}" +
                   $"Order total: {order.Total} {Environment.NewLine}" +
                   $"Tax: {CustomsHandlingOptions.TaxOptions} {Environment.NewLine}" +
                   $"Shipping Cost: {shippingCost}");
        }