Developer forum

Forum » Development » Trying to control vat on fee provider

Trying to control vat on fee provider

Anders Ditlevsen
Anders Ditlevsen
Reply

Hi dynamicweb,

I have a customer that specifically wants a vat implementation that means i cannot use country vat or system vat. In essence the vat is unique per user, even users that are from the same country, can have different vat.

To accomondate this i have created following class
      NettoPriceProvider : PriceProvider, ISupportPriceInfo

With following method
      public PriceInfo FindPriceInfo( Product product, double quantity, string variantID, Currency currency, string UnitID, User user )

This enabled me to calculate and control the with and without vat prices, which is exactly what i need.

Here comes now the problem. I also need to calculate the vat, on the feeProvider (shipping fee), however i can only find the overrideable method of  FindFee function in Dynamicweb.Ecommerce.Orders.FeeProvider. Is there an equivalent function for fee calculation as with price calculation where i can return a priceinfo or feeinfo instead of just a priceraw.

Am i missing something?

BR
Anders Ditlevsen

 


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Anders

The feeProvider does only support the rawprice - and there are no other extensibility point that you can use. The closest thing is the Notifications.Ecommerce.Order.BeforeShippingFeeCalculation but it is fired just before the calculation is done, and there is nothing you can do to manipulate the result.

So you would need a Notifications.Ecommerce.Order.AfterShippingFeeCalculation notification to hook into that.

Why do you need this? It does not sound like VAT - and VAT should be VAT and not all other kind of things. Could there be another way to implement this to obtain what you need?

BR Nicolai

Votes for this answer: 1
 
Anders Ditlevsen
Anders Ditlevsen
Reply

Hi Nicolai - We are not trying to use VAT as something else, but to override vat on an individual user level rather than country level.

I have a workaround for this, but i'd much prefer if there was a way to overrule this in dynamicweb with a priceinfo/feeinfo object.

Thanks for your reply, i got what i needed :)

BR
Anders 

 
Nicolai Pedersen
Reply

Hi Anders

Point taken. I just think that VAT is related to country by 'law' - so 2 users could never have different VAT based on their user, but based on their country - so without knowing your use case, I would change the country on the user and get all the VAT out of the box. I do not understand how 2 users can have different VAT in the same country...

BR Nicolai

 

You must be logged in to post in the forum