Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alex Clavelle 13 posts 124 karma points
    Dec 13, 2017 @ 04:33
    Alex Clavelle
    0

    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!

  • Tolu Jemilua 39 posts 166 karma points
    Dec 15, 2017 @ 16:19
    Tolu Jemilua
    0

    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()

  • Alex Clavelle 13 posts 124 karma points
    Dec 15, 2017 @ 16:32
    Alex Clavelle
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft