TaxRate
TaxRate
A TaxRate defines the rate of tax to apply to a ProductVariant based on three factors:
- the ProductVariant's TaxCategory
- the applicable Zone ("applicable" being defined by the configured TaxZoneStrategy)
- the CustomerGroup of the current Customer
Signature
class TaxRate extends VendureEntity implements HasCustomFields {
constructor(input?: DeepPartial<TaxRate>)
@Column() name: string;
@Column() enabled: boolean;
@Column({ type: 'decimal', precision: 5, scale: 2, transformer: new DecimalTransformer() }) value: number;
@Index()
@ManyToOne(type => TaxCategory, taxCategory => taxCategory.taxRates)
category: TaxCategory;
@EntityId({ nullable: true })
categoryId: ID;
@Index()
@ManyToOne(type => Zone, zone => zone.taxRates)
zone: Zone;
@EntityId({ nullable: true })
zoneId: ID;
@Index()
@ManyToOne(type => CustomerGroup, customerGroup => customerGroup.taxRates, { nullable: true })
customerGroup?: CustomerGroup;
@Column(type => CustomTaxRateFields)
customFields: CustomTaxRateFields;
taxComponentOf(grossPrice: number) => number;
netPriceOf(grossPrice: number) => number;
taxPayableOn(netPrice: number) => number;
grossPriceOf(netPrice: number) => number;
apply(price: number) => TaxLine;
test(zone: Zone | ID, taxCategory: TaxCategory | ID) => boolean;
}
-
Extends:
VendureEntity
-
Implements:
HasCustomFields
constructor
method
(input?: DeepPartial<TaxRate>) => TaxRate
name
property
string
enabled
property
boolean
value
property
number
category
property
categoryId
property
zone
property
zoneId
property
customerGroup
property
customFields
property
CustomTaxRateFields
taxComponentOf
method
(grossPrice: number) => number
netPriceOf
method
(grossPrice: number) => number
taxPayableOn
method
(netPrice: number) => number
grossPriceOf
method
(netPrice: number) => number
apply
method
(price: number) => TaxLine
test
method
(zone: Zone | ID, taxCategory: TaxCategory | ID) => boolean