EU VAT - Customer with invalid VAT should not be able to order

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 年 前
Hey,

I have a two problems with the EU VAT. I activated the VAT option under configuration => settings => taxes and also activated the Webservice and the notification when a new VAT number is entered.

1. Problem
Our shop allows Guest-Purchases, so a customer does not need to register when ordering some items. The VAT Number can only be entered when a Customer registers or edits his account informationen. I know that I can add a custom checkout attribute, but this won't be checked by the Webservice, because of this i don't know if the entered VAT is valid or invalid.
So I need some way to enter the VAT in the billing address field and check it there.


2. Problem
If the Vat number is incorrect, I don't want the customer to be able order anything. Instead I would like to redirect to the account settings with a notification that ordering is only available with a correct/valid VAT Number. Is there a attribute for the Customer that I can use as a condition in any way?
6 年 前
Hi Chris,

Thanks!

1. This work item already exists - https://github.com/nopSolutions/nopCommerce/issues/1961
2. And here is a new one - https://github.com/nopSolutions/nopCommerce/issues/2435
6 年 前
So I managed to add this behaviour in my nopCommerce installation (some really nasty things, will need to do a lot of refactoring here).

One thing I'm missing is to receive the VatNumberStatus of the current logged in user.

Right now I simply always use the ITaxService to recheck the VatNumber:

var status = EngineContext.Current.Resolve<ITaxService>().GetVatNumberStatus(vatNumber).ToString();
if (status != "Valid")
  --- do something


Is there any way to get the current validation status of the VatNumber without rechecking it the way I did it?

The problem that I'm facing is the following:
Let's say a customer wants to register in our store. I validate the VatNumber on registration, but the VatNumber entered is always invalid. The customer then sends us an email or calls us via phone and can show us that the VatNumber is actually valid. Now I can manually create a Customer in the AdminBackend.
When the customer now enters the ShoppingCart, he won't be able to order anything because I use the iTaxServer again to validate the VatNumber instead of using the Customers VatNumberStatus (I hope the explanation is understandable).

Can someone point me in the right direction?

Regards,

Chris
6 年 前
If anyone is trying to implement this behaviour these are the steps that I've done to make this work:

For registered Users:
1. Require VatNumber on Registration/update of the profile data
2. Validate the VatNumber with the ITaxService, and set the VatNumberStatudId.
3. Shopping Cart ('myshop.com/cart'-page):
    - check if CurrentUsers VatNumberStatusId equals 20
    - If this does not apply, recheck with ITaxService the VatNumber
    - If this returns invalid, reload the ShoppingCart-Page with a error message

For Guest Users:
1. Add a string attribute named VatNumber to the AddressModel (Nop.Web.Models.Common.AddressModel.cs)
2. Add a validation to the AddressValidator (Nop.Web.Validators.Common.AddressValidator.cs)
    - check if CurrentUser is a Guest
    - If he is not a guest, return null
    - If he is a guest check if VatNumber IsNullOrEmpty => return require VatNumber error message
    - If VatNumber value is not empty, use ITaxService to check the vatnumber

Keep in  mind that you also need to adjust the templates for registration, customerinfo and billing/Shipping address.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.