Overview: Adding a location will create a customer record that is missing address information. In the addresses step of the checkout process the user will be able to choose any customer with the zip code of the cart, or one of these location records. If the user chooses to ship to one of those “partial” customers we need to give the user the opportunity to fill out the rest of the information about that location.
Process:
- Architecture support
- ICustomerService, CustomerService, ICustomerRepository, CustomerRepository
- GetByFilter:
- IncludeLocations as an optional Boolean parameter, default it to False.
- Inside the routine add this new parameter as FLAG to the DB call.
- UI Support:
- CheckoutNewAddressModel
- Add a property for CustomerNbr it will be blank if a completely new Customer is being created. If a “location” is being converted to a customer it will hold the ID of the location / customer being converted.
- CheckoutNewAddressModel
- GetByFilter:
- ICustomerService, CustomerService, ICustomerRepository, CustomerRepository
- CheckoutController
- FindDestinationByZIP
- Pass a hardcoded True to the new optional parameter, IncludeLocations, added just above.
- Add new Ajax method (GetLocationData)
- Input:
- Selected Shipto customer number
- Output:
- Rendered AddressCreateNew partial
- Processing:
- Do a CustomerService.GetByID for selected shipto customer.
- If found customer.postalcode = “” then
- Initializes a CheckoutNewAddressModel sets CustomerName, and CustomerNbr from found customer.
- Returns a RenderPartialView for _AddressCreateNew
- Else no processing needed.
- Input:
- FindDestinationByZIP
- _AddressBlockResult builds a select dropdown. Upon selecting something from that dropdown call the new controller function, GetLocationData, VIA Ajax passing in the selected value for the customer id.
- _AddressCreateNew add a HiddenFor m.CustomerNbr to hold the customer number being created from a location.created from a location.