pub struct SqliteTaxRepository { /* private fields */ }Available on crate feature
sqlite only.Expand description
SQLite tax repository
Implementations§
Source§impl SqliteTaxRepository
impl SqliteTaxRepository
pub const fn new(pool: Pool<SqliteConnectionManager>) -> Self
Source§impl SqliteTaxRepository
impl SqliteTaxRepository
Sourcepub fn get_jurisdiction(&self, id: Uuid) -> Result<Option<TaxJurisdiction>>
pub fn get_jurisdiction(&self, id: Uuid) -> Result<Option<TaxJurisdiction>>
Get a jurisdiction by ID
Sourcepub fn get_jurisdiction_by_code(
&self,
code: &str,
) -> Result<Option<TaxJurisdiction>>
pub fn get_jurisdiction_by_code( &self, code: &str, ) -> Result<Option<TaxJurisdiction>>
Get a jurisdiction by code (e.g., “US-CA”)
Sourcepub fn list_jurisdictions(
&self,
filter: TaxJurisdictionFilter,
) -> Result<Vec<TaxJurisdiction>>
pub fn list_jurisdictions( &self, filter: TaxJurisdictionFilter, ) -> Result<Vec<TaxJurisdiction>>
List jurisdictions with optional filter
Sourcepub fn create_jurisdiction(
&self,
input: CreateTaxJurisdiction,
) -> Result<TaxJurisdiction>
pub fn create_jurisdiction( &self, input: CreateTaxJurisdiction, ) -> Result<TaxJurisdiction>
Create a new jurisdiction
Source§impl SqliteTaxRepository
impl SqliteTaxRepository
Sourcepub fn list_rates(&self, filter: TaxRateFilter) -> Result<Vec<TaxRate>>
pub fn list_rates(&self, filter: TaxRateFilter) -> Result<Vec<TaxRate>>
List tax rates with optional filter
Sourcepub fn get_rates_for_address(
&self,
address: &TaxAddress,
category: ProductTaxCategory,
date: NaiveDate,
) -> Result<Vec<TaxRate>>
pub fn get_rates_for_address( &self, address: &TaxAddress, category: ProductTaxCategory, date: NaiveDate, ) -> Result<Vec<TaxRate>>
Get rates for a jurisdiction and product category
Sourcepub fn create_rate(&self, input: CreateTaxRate) -> Result<TaxRate>
pub fn create_rate(&self, input: CreateTaxRate) -> Result<TaxRate>
Create a new tax rate
Source§impl SqliteTaxRepository
impl SqliteTaxRepository
Sourcepub fn get_exemption(&self, id: Uuid) -> Result<Option<TaxExemption>>
pub fn get_exemption(&self, id: Uuid) -> Result<Option<TaxExemption>>
Get an exemption by ID
Sourcepub fn get_customer_exemptions(
&self,
customer_id: Uuid,
) -> Result<Vec<TaxExemption>>
pub fn get_customer_exemptions( &self, customer_id: Uuid, ) -> Result<Vec<TaxExemption>>
Get active exemptions for a customer
Sourcepub fn create_exemption(
&self,
input: CreateTaxExemption,
) -> Result<TaxExemption>
pub fn create_exemption( &self, input: CreateTaxExemption, ) -> Result<TaxExemption>
Create a new exemption
Source§impl SqliteTaxRepository
impl SqliteTaxRepository
Sourcepub fn get_settings(&self) -> Result<TaxSettings>
pub fn get_settings(&self) -> Result<TaxSettings>
Get tax settings
Sourcepub fn update_settings(&self, settings: TaxSettings) -> Result<TaxSettings>
pub fn update_settings(&self, settings: TaxSettings) -> Result<TaxSettings>
Update tax settings
Source§impl SqliteTaxRepository
impl SqliteTaxRepository
Sourcepub fn calculate_tax(
&self,
request: TaxCalculationRequest,
) -> Result<TaxCalculationResult>
pub fn calculate_tax( &self, request: TaxCalculationRequest, ) -> Result<TaxCalculationResult>
Calculate tax for a request
Sourcepub fn save_calculation(
&self,
result: &TaxCalculationResult,
order_id: Option<Uuid>,
cart_id: Option<Uuid>,
customer_id: Option<Uuid>,
address: &TaxAddress,
currency: &str,
) -> Result<()>
pub fn save_calculation( &self, result: &TaxCalculationResult, order_id: Option<Uuid>, cart_id: Option<Uuid>, customer_id: Option<Uuid>, address: &TaxAddress, currency: &str, ) -> Result<()>
Save a tax calculation to the database
Trait Implementations§
Source§impl Debug for SqliteTaxRepository
impl Debug for SqliteTaxRepository
Source§impl TaxRepository for SqliteTaxRepository
impl TaxRepository for SqliteTaxRepository
Source§fn create_jurisdiction(
&self,
input: CreateTaxJurisdiction,
) -> Result<TaxJurisdiction>
fn create_jurisdiction( &self, input: CreateTaxJurisdiction, ) -> Result<TaxJurisdiction>
Create a tax jurisdiction
Source§fn get_jurisdiction(&self, id: Uuid) -> Result<Option<TaxJurisdiction>>
fn get_jurisdiction(&self, id: Uuid) -> Result<Option<TaxJurisdiction>>
Get a tax jurisdiction by ID
Source§fn get_jurisdiction_by_code(
&self,
code: &str,
) -> Result<Option<TaxJurisdiction>>
fn get_jurisdiction_by_code( &self, code: &str, ) -> Result<Option<TaxJurisdiction>>
Get a tax jurisdiction by code
Source§fn list_jurisdictions(
&self,
filter: TaxJurisdictionFilter,
) -> Result<Vec<TaxJurisdiction>>
fn list_jurisdictions( &self, filter: TaxJurisdictionFilter, ) -> Result<Vec<TaxJurisdiction>>
List tax jurisdictions matching a filter
Source§fn create_rate(&self, input: CreateTaxRate) -> Result<TaxRate>
fn create_rate(&self, input: CreateTaxRate) -> Result<TaxRate>
Create a tax rate
Source§fn list_rates(&self, filter: TaxRateFilter) -> Result<Vec<TaxRate>>
fn list_rates(&self, filter: TaxRateFilter) -> Result<Vec<TaxRate>>
List tax rates matching a filter
Source§fn get_rates_for_address(
&self,
address: &TaxAddress,
category: ProductTaxCategory,
date: NaiveDate,
) -> Result<Vec<TaxRate>>
fn get_rates_for_address( &self, address: &TaxAddress, category: ProductTaxCategory, date: NaiveDate, ) -> Result<Vec<TaxRate>>
Get applicable tax rates for an address and category on a date
Source§fn create_exemption(&self, input: CreateTaxExemption) -> Result<TaxExemption>
fn create_exemption(&self, input: CreateTaxExemption) -> Result<TaxExemption>
Create a tax exemption
Source§fn get_exemption(&self, id: Uuid) -> Result<Option<TaxExemption>>
fn get_exemption(&self, id: Uuid) -> Result<Option<TaxExemption>>
Get a tax exemption by ID
Source§fn get_customer_exemptions(
&self,
customer_id: Uuid,
) -> Result<Vec<TaxExemption>>
fn get_customer_exemptions( &self, customer_id: Uuid, ) -> Result<Vec<TaxExemption>>
Get all exemptions for a customer
Source§fn get_settings(&self) -> Result<TaxSettings>
fn get_settings(&self) -> Result<TaxSettings>
Get tax settings
Source§fn update_settings(&self, settings: TaxSettings) -> Result<TaxSettings>
fn update_settings(&self, settings: TaxSettings) -> Result<TaxSettings>
Update tax settings
Source§fn calculate_tax(
&self,
request: TaxCalculationRequest,
) -> Result<TaxCalculationResult>
fn calculate_tax( &self, request: TaxCalculationRequest, ) -> Result<TaxCalculationResult>
Calculate tax for a request
Source§fn save_calculation(
&self,
result: &TaxCalculationResult,
order_id: Option<Uuid>,
cart_id: Option<Uuid>,
customer_id: Option<Uuid>,
address: &TaxAddress,
currency: &str,
) -> Result<()>
fn save_calculation( &self, result: &TaxCalculationResult, order_id: Option<Uuid>, cart_id: Option<Uuid>, customer_id: Option<Uuid>, address: &TaxAddress, currency: &str, ) -> Result<()>
Persist a tax calculation for audit/reporting
Auto Trait Implementations§
impl !RefUnwindSafe for SqliteTaxRepository
impl !UnwindSafe for SqliteTaxRepository
impl Freeze for SqliteTaxRepository
impl Send for SqliteTaxRepository
impl Sync for SqliteTaxRepository
impl Unpin for SqliteTaxRepository
impl UnsafeUnpin for SqliteTaxRepository
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