Hello, interfaces such as IShipment and IInvoice have the user's first and last name combined into the same property like BillToName. Is it possible to access these values separately? My credit card processing api and shipping apis both require them to be separate.
There is a method called TrySplitFirstName() and TrySplitLastName() on the Address model, use those but before you can use those method extensions, you need to get your address using GetBillingAddress()
That's what I used for the shipping first/last name since it doesn't have to be perfect. Unfortunately for billing, first/lastname need to be exact. TrySplitLastName can't handle names like Mary Kate Olsen, it will return "Kate Olsen, Mary" instead of "Olsen, Mary Kate" so credit card validation could fail. I ended up making the user re-enter their first and last name for the credit card form. Not the best solution but it will have to do for now.
I see that first and last name are stored separately in some of the extended data fields in the db. I may either use those or i'll have to override the method that saves the user's address to extended data to store them separately.
Separate first and last name - shipping, payments, etc
Hello, interfaces such as IShipment and IInvoice have the user's first and last name combined into the same property like BillToName. Is it possible to access these values separately? My credit card processing api and shipping apis both require them to be separate.
Thanks!
There is a method called TrySplitFirstName() and TrySplitLastName() on the Address model, use those but before you can use those method extensions, you need to get your address using GetBillingAddress()
That's what I used for the shipping first/last name since it doesn't have to be perfect. Unfortunately for billing, first/lastname need to be exact. TrySplitLastName can't handle names like Mary Kate Olsen, it will return "Kate Olsen, Mary" instead of "Olsen, Mary Kate" so credit card validation could fail. I ended up making the user re-enter their first and last name for the credit card form. Not the best solution but it will have to do for now.
I see that first and last name are stored separately in some of the extended data fields in the db. I may either use those or i'll have to override the method that saves the user's address to extended data to store them separately.
is working on a reply...