protected virtual IShipment CreateShipment( IPurchaseOrder purchaseOrder, IOrderForm orderForm, CustomerContact customerContact, SaleShippingViewModel kachingShipping, SaleViewModel kachingSale, SaleLineItemViewModel shippingLineItem) { IShipment shipment = _orderGroupFactory.CreateShipment(purchaseOrder); shipment.OrderShipmentStatus = kachingShipping != null ? OrderShipmentStatus.AwaitingInventory : OrderShipmentStatus.Shipped; if (kachingShipping != null) { // If this shipment is awaiting delivery, then the whole order is still in-progress. purchaseOrder.OrderStatus = OrderStatus.InProgress; } return(shipment); }
protected virtual IOrderAddress ConvertToAddress( IOrderGroup orderGroup, SaleShippingViewModel shipping) { if (shipping == null) { return(null); } var orderAddress = _orderGroupFactory.CreateOrderAddress(orderGroup); orderAddress.Id = "Shipping"; orderAddress.City = shipping.Address.City; orderAddress.CountryCode = shipping.Address.CountryCode; orderAddress.CountryName = shipping.Address.Country; orderAddress.DaytimePhoneNumber = shipping.CustomerInfo.Phone; orderAddress.Email = shipping.CustomerInfo.Email; orderAddress.FirstName = shipping.Address.Name; orderAddress.Line1 = shipping.Address.Street; orderAddress.PostalCode = shipping.Address.PostalCode; return(orderAddress); }
/// <summary> /// Populates default fields on the first shipment. Override to populate custom shipment fields. /// </summary> protected virtual void PopulateMetaFields( IShipment shipment, IMarket market, SaleShippingViewModel kachingShipping, SaleViewModel kachingSale) { // By default, use the shipping address supplied by Ka-ching. // Override this method if you need to use the customer's registered address. if (kachingShipping?.Address != null) { shipment.ShippingAddress = ConvertToAddress(shipment.ParentOrderGroup, kachingShipping); } else if (kachingSale.Summary?.Customer != null) { shipment.ShippingAddress = ConvertToAddress(shipment.ParentOrderGroup, kachingSale.Summary.Customer); } if (kachingShipping?.MethodId != null && Guid.TryParse(kachingShipping.MethodId, out Guid shippingMethodId)) { shipment.ShippingMethodId = shippingMethodId; } }