/// <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}");
        }
Esempio n. 2
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}");
        }