Developer forum

Forum » Development » Guidance for custom AddressValidatorProvider

Guidance for custom AddressValidatorProvider

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I am building my own AddressValidatorProvider against a public service. I looked at the Avalara implementation to get some inspiration, but still could use some guidance.

For example, how do I use order.AddressValidatorResults? Since it's a collection it seems you can add multiple items. Is the intend to add one per type (billing and shipping) or could you add multiple results per address type? The address service I am using is able to suggest multiple corrected addresses so I wonder how I could provide those back to the user.

Thanks,

Imar


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Bump Any suggestions? Anyone knows more about the AddressValidatorProvider base class?

Thanks,

Imar

 
Viktor
Reply
This post has been marked as an answer

Hi Imar,

Take a look at attached class, I guess it is clear enough to build your own validator. Results of the provider attached in screen.

If there are more questions I will be glad to help.

Best regards, Viktor Letavin
DynamicWEB Software A/S, Russian team

Untitled.jpg
Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Viktor,

Thanks for your reply. CS files can't be downloaded here so can you please change the extension to .txt or so?

Thanks!

Imar

 
Nicolai Høeg Pedersen
Reply

Changed it to a zip file instead!

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Thanks for the code, Viktor. That looks very useful. I'll experiment with it.

And thanks Nicolai for making the code available.

Imar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi guys,

Thanks again for the example; it helped me a lot while building my own validator.

I have a general question about the address validators: how do you tie this into order step validation? Currently, when an address is invalid, you can still move to the next step in the checkout process. It would be great if you prevent that from happening just like you can do with standard order validation. Any suggestions on how to implement that?

Imar

 

You must be logged in to post in the forum