Пример #1
0
        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}");
        }
Пример #2
0
        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}");
        }