Exemplo n.º 1
0
        public void SetShippingContact(Contact contact)
        {
            ShippingContact = contact;

            if(ShippingContact == null)
            {
                ShippingMethod = null;
            }
            else
            { 
                // If the new shipping country is in the same zone , we can leave the current shipping
                // method for this order in place. If not, we need to change it to a shipping method which is
                // valid for the new shipping country
                if(ShippingMethod == null || ShippingMethod.ShippingZone.Code != ShippingContact.Country.ShippingZone.Code)
                {
                    var shippingMethod = GetValidShippingMethods().FirstOrDefault();

                    if(shippingMethod == null)
                        throw new Exception($"No valid shipping method found for shipping country {contact.Country}");

                    ShippingMethod = shippingMethod;
                }
            }
        }
Exemplo n.º 2
0
 public void SetBillingContact(Contact contact)
 {
     BillingContact = contact;
 }