feat(tax): introduce tax override data models (#6422)

**What**
- Adds Tax rules to allow overrides of tax rates for certain products, product types or shipping options.

**Punted to future PR**
- Currently, the creation methods only support bulk operations. A later PR will include support for singular operations, too.
- It should be possible to add products, types, and shipping options to a tax rate after creating it. Add, remove, update will come in a later PR.
This commit is contained in:
Sebastian Rindom
2024-02-20 16:50:19 +00:00
committed by GitHub
parent 43ed6a990d
commit 137cc0ebf8
7 changed files with 197 additions and 6 deletions
+26
View File
@@ -73,3 +73,29 @@ export interface FilterableTaxRegionProps
updated_at?: OperatorMap<string>
created_by?: string | string[] | OperatorMap<string>
}
export interface TaxRateRuleDTO {
reference: string
reference_id: string
tax_rate_id: string
tax_rate?: TaxRateDTO
metadata?: Record<string, unknown> | null
created_at: string | Date
updated_at: string | Date
created_by: string | null
}
export interface FilterableTaxRateRuleProps
extends BaseFilterable<FilterableTaxRateRuleProps> {
reference?: string | string[] | OperatorMap<string>
reference_id?: string | string[] | OperatorMap<string>
tax_rate_id?: string | string[] | OperatorMap<string>
tax_rate?: FilterableTaxRateProps
metadata?:
| Record<string, unknown>
| Record<string, unknown>[]
| OperatorMap<Record<string, unknown>>
created_at?: OperatorMap<string>
updated_at?: OperatorMap<string>
created_by?: string | string[] | OperatorMap<string>
}
+8
View File
@@ -21,3 +21,11 @@ export interface CreateTaxRegionDTO {
metadata?: Record<string, unknown>
}
}
export interface CreateTaxRateRuleDTO {
reference: string
reference_id: string
tax_rate_id: string
metadata?: Record<string, unknown>
created_by?: string
}
+18 -1
View File
@@ -6,8 +6,14 @@ import {
FilterableTaxRateProps,
TaxRateDTO,
TaxRegionDTO,
TaxRateRuleDTO,
FilterableTaxRateRuleProps,
} from "./common"
import { CreateTaxRateDTO, CreateTaxRegionDTO } from "./mutations"
import {
CreateTaxRateRuleDTO,
CreateTaxRateDTO,
CreateTaxRegionDTO,
} from "./mutations"
export interface ITaxModuleService extends IModuleService {
retrieve(
@@ -47,4 +53,15 @@ export interface ITaxModuleService extends IModuleService {
config?: FindConfig<TaxRegionDTO>,
sharedContext?: Context
): Promise<TaxRegionDTO[]>
createTaxRateRules(
data: CreateTaxRateRuleDTO[],
sharedContext?: Context
): Promise<TaxRateRuleDTO[]>
listTaxRateRules(
filters?: FilterableTaxRateRuleProps,
config?: FindConfig<TaxRateRuleDTO>,
sharedContext?: Context
): Promise<TaxRateRuleDTO[]>
}