Closed sarahelsaig closed 1 year ago
So, on the Checkout page, there needs to be a "Corporation" checkbox, that part seems clear enough. However, what exactly should ticking it affect?
The value of the checkbox during checkout should be added to PromotionAndTaxProviderContext
, so any tax provider can use it for calculation.
For the OrchardCore.Commerce.Tax.CustomTaxRates
feature you want to be able to match if the checkbox is checked, unchecked or don't care. This happens in TaxRateTaxProvider
. So OrchardCore.Commerce.Tax.CustomTaxRates
needs another property (enum or three-state bool) to configure this option with TaxRateSettings_Edit.cshtml.
Same for the VAT number text field.
The value of the checkbox during checkout should be added to
PromotionAndTaxProviderContext
So the IsCorporation
bool (i.e. the checkbox on Checkout) is to be used based on the value of the new enum site setting.
IsCorporation
is true:Checked
, match tax rates.Unchecked
, do not match tax rates.Ignored
, do not match tax rates.IsCorporation
is false, do not look at the setting's value and match tax rates as usual.I'm certain I got this wrong. Please elaborate, for I am confusion.
2.
Same for the VAT number text field
Other than adding this to PromotionAndTaxProviderContext
as well, is it to be somehow used for matching in TaxRateTaxProvider
too? Or anywhere else?
Sorry, I think I did a bad job at describing the idea. You should have one enum for each tax rate row, in other words put it into the TaxRateSetting
class. Then when matching the tax rates check its value along with the rest of the TaxRateSetting
properties:
TaxRateSetting.IsCorporation
is set to Checked, match the tax rate if PromotionAndTaxProviderContext.IsCorporation == true
and the other conditions match too.TaxRateSetting.IsCorporation
is set to Unchecked, match the tax rate if PromotionAndTaxProviderContext.IsCorporation == false
and the other conditions match too.TaxRateSetting.IsCorporation
is set to Ignored, match the tax rate if the other conditions match.Add a string property to the TaxRateSetting
class. Since this is just another text field you can use the IsMatchingOrEmptyPattern
method in TaxRateTaxProvider.MatchTaxRate
to check it just like e.g. taxCode
is done there.
Add two new columns in TaxRateSettings_Edit.cshtml
for these two new TaxRateSetting
properties and update TaxRateSettingsDisplayDriver
. If it's still not clear, ping me and let's have a call.
Is your feature request related to a problem? Please describe
In some cases they are taxed differently, e.g. the corporation doesn't have to pay VAT for certain regions.
Describe the solution you'd like
Add a checkbox to checkout for corporation. Also VAT number.
Describe alternatives you've considered
Not sure, let's discuss!
Jira issue