pub struct Tax { /* private fields */ }Implementations§
Source§impl Tax
impl Tax
pub fn into_reference(val: Tax, env: Env) -> Result<Reference<Tax>>
pub fn into_instance(self, env: Env) -> Result<ClassInstance<Tax>>
Source§impl Tax
impl Tax
Sourcepub async fn calculate(
&self,
input: TaxCalculationInput,
) -> Result<TaxCalculationOutput>
pub async fn calculate( &self, input: TaxCalculationInput, ) -> Result<TaxCalculationOutput>
Calculate tax for a transaction
Sourcepub async fn calculate_for_item(
&self,
unit_price: f64,
quantity: f64,
category: Option<String>,
shipping_address: TaxAddressInput,
) -> Result<f64>
pub async fn calculate_for_item( &self, unit_price: f64, quantity: f64, category: Option<String>, shipping_address: TaxAddressInput, ) -> Result<f64>
Calculate tax for a single item
Sourcepub async fn get_effective_rate(
&self,
address: TaxAddressInput,
category: Option<String>,
) -> Result<f64>
pub async fn get_effective_rate( &self, address: TaxAddressInput, category: Option<String>, ) -> Result<f64>
Get the effective tax rate for an address and category
Sourcepub async fn get_jurisdiction(
&self,
id: String,
) -> Result<Option<TaxJurisdictionOutput>>
pub async fn get_jurisdiction( &self, id: String, ) -> Result<Option<TaxJurisdictionOutput>>
Get a jurisdiction by ID
Sourcepub async fn get_jurisdiction_by_code(
&self,
code: String,
) -> Result<Option<TaxJurisdictionOutput>>
pub async fn get_jurisdiction_by_code( &self, code: String, ) -> Result<Option<TaxJurisdictionOutput>>
Get a jurisdiction by code
Sourcepub async fn list_jurisdictions(
&self,
filter: Option<JurisdictionFilterInput>,
) -> Result<Vec<TaxJurisdictionOutput>>
pub async fn list_jurisdictions( &self, filter: Option<JurisdictionFilterInput>, ) -> Result<Vec<TaxJurisdictionOutput>>
List jurisdictions with optional filtering
Sourcepub async fn create_jurisdiction(
&self,
input: CreateJurisdictionInput,
) -> Result<TaxJurisdictionOutput>
pub async fn create_jurisdiction( &self, input: CreateJurisdictionInput, ) -> Result<TaxJurisdictionOutput>
Create a new jurisdiction
Sourcepub async fn list_rates(
&self,
filter: Option<TaxRateFilterInput>,
) -> Result<Vec<TaxRateOutput>>
pub async fn list_rates( &self, filter: Option<TaxRateFilterInput>, ) -> Result<Vec<TaxRateOutput>>
List tax rates with optional filtering
Sourcepub async fn create_rate(
&self,
input: CreateTaxRateInput,
) -> Result<TaxRateOutput>
pub async fn create_rate( &self, input: CreateTaxRateInput, ) -> Result<TaxRateOutput>
Create a new tax rate
Sourcepub async fn get_exemption(
&self,
id: String,
) -> Result<Option<TaxExemptionOutput>>
pub async fn get_exemption( &self, id: String, ) -> Result<Option<TaxExemptionOutput>>
Get an exemption by ID
Sourcepub async fn get_customer_exemptions(
&self,
customer_id: String,
) -> Result<Vec<TaxExemptionOutput>>
pub async fn get_customer_exemptions( &self, customer_id: String, ) -> Result<Vec<TaxExemptionOutput>>
Get exemptions for a customer
Sourcepub async fn create_exemption(
&self,
input: CreateExemptionInput,
) -> Result<TaxExemptionOutput>
pub async fn create_exemption( &self, input: CreateExemptionInput, ) -> Result<TaxExemptionOutput>
Create a tax exemption
Sourcepub async fn customer_is_exempt(&self, customer_id: String) -> Result<bool>
pub async fn customer_is_exempt(&self, customer_id: String) -> Result<bool>
Check if a customer is tax exempt
Sourcepub async fn get_settings(&self) -> Result<TaxSettingsOutput>
pub async fn get_settings(&self) -> Result<TaxSettingsOutput>
Get tax settings
Sourcepub async fn update_settings(
&self,
input: TaxSettingsInput,
) -> Result<TaxSettingsOutput>
pub async fn update_settings( &self, input: TaxSettingsInput, ) -> Result<TaxSettingsOutput>
Update tax settings
Sourcepub async fn set_enabled(&self, enabled: bool) -> Result<TaxSettingsOutput>
pub async fn set_enabled(&self, enabled: bool) -> Result<TaxSettingsOutput>
Enable or disable tax calculation
Sourcepub async fn is_enabled(&self) -> Result<bool>
pub async fn is_enabled(&self) -> Result<bool>
Check if tax calculation is enabled
Sourcepub fn get_us_state_info(state_code: String) -> Option<UsStateTaxInfoOutput>
pub fn get_us_state_info(state_code: String) -> Option<UsStateTaxInfoOutput>
Get US state tax information
Sourcepub fn get_eu_vat_info(country_code: String) -> Option<EuVatInfoOutput>
pub fn get_eu_vat_info(country_code: String) -> Option<EuVatInfoOutput>
Get EU VAT information
Sourcepub fn get_canadian_tax_info(
province_code: String,
) -> Option<CanadianTaxInfoOutput>
pub fn get_canadian_tax_info( province_code: String, ) -> Option<CanadianTaxInfoOutput>
Get Canadian tax information
Sourcepub fn is_eu_country(country_code: String) -> bool
pub fn is_eu_country(country_code: String) -> bool
Check if a country is in the EU
Trait Implementations§
Source§impl FromNapiMutRef for Tax
impl FromNapiMutRef for Tax
Source§unsafe fn from_napi_mut_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static mut Self>
unsafe fn from_napi_mut_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static mut Self>
Safety Read more
Source§impl FromNapiRef for Tax
impl FromNapiRef for Tax
Source§unsafe fn from_napi_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static Self>
unsafe fn from_napi_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static Self>
Safety Read more
Source§impl FromNapiValue for &Tax
impl FromNapiValue for &Tax
Source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
Safety Read more
fn from_unknown(value: JsUnknown) -> Result<Self, Error>
Source§impl FromNapiValue for &mut Tax
impl FromNapiValue for &mut Tax
Source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
Safety Read more
fn from_unknown(value: JsUnknown) -> Result<Self, Error>
Source§impl ToNapiValue for Tax
impl ToNapiValue for Tax
Source§unsafe fn to_napi_value(env: napi_env, val: Tax) -> Result<napi_value>
unsafe fn to_napi_value(env: napi_env, val: Tax) -> Result<napi_value>
Safety Read more
Source§impl ValidateNapiValue for &Tax
impl ValidateNapiValue for &Tax
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Source§impl ValidateNapiValue for &mut Tax
impl ValidateNapiValue for &mut Tax
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Auto Trait Implementations§
impl Freeze for Tax
impl !RefUnwindSafe for Tax
impl Send for Tax
impl Sync for Tax
impl Unpin for Tax
impl UnsafeUnpin for Tax
impl !UnwindSafe for Tax
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more