Skip to main content

SqliteTaxRepository

Struct SqliteTaxRepository 

Source
pub struct SqliteTaxRepository { /* private fields */ }
Available on crate feature sqlite only.
Expand description

SQLite tax repository

Implementations§

Source§

impl SqliteTaxRepository

Source

pub const fn new(pool: Pool<SqliteConnectionManager>) -> Self

Source§

impl SqliteTaxRepository

Source

pub fn get_jurisdiction(&self, id: Uuid) -> Result<Option<TaxJurisdiction>>

Get a jurisdiction by ID

Source

pub fn get_jurisdiction_by_code( &self, code: &str, ) -> Result<Option<TaxJurisdiction>>

Get a jurisdiction by code (e.g., “US-CA”)

Source

pub fn list_jurisdictions( &self, filter: TaxJurisdictionFilter, ) -> Result<Vec<TaxJurisdiction>>

List jurisdictions with optional filter

Source

pub fn create_jurisdiction( &self, input: CreateTaxJurisdiction, ) -> Result<TaxJurisdiction>

Create a new jurisdiction

Source§

impl SqliteTaxRepository

Source

pub fn get_rate(&self, id: Uuid) -> Result<Option<TaxRate>>

Get a tax rate by ID

Source

pub fn list_rates(&self, filter: TaxRateFilter) -> Result<Vec<TaxRate>>

List tax rates with optional filter

Source

pub fn get_rates_for_address( &self, address: &TaxAddress, category: ProductTaxCategory, date: NaiveDate, ) -> Result<Vec<TaxRate>>

Get rates for a jurisdiction and product category

Source

pub fn create_rate(&self, input: CreateTaxRate) -> Result<TaxRate>

Create a new tax rate

Source§

impl SqliteTaxRepository

Source

pub fn get_exemption(&self, id: Uuid) -> Result<Option<TaxExemption>>

Get an exemption by ID

Source

pub fn get_customer_exemptions( &self, customer_id: Uuid, ) -> Result<Vec<TaxExemption>>

Get active exemptions for a customer

Source

pub fn create_exemption( &self, input: CreateTaxExemption, ) -> Result<TaxExemption>

Create a new exemption

Source§

impl SqliteTaxRepository

Source

pub fn get_settings(&self) -> Result<TaxSettings>

Get tax settings

Source

pub fn update_settings(&self, settings: TaxSettings) -> Result<TaxSettings>

Update tax settings

Source§

impl SqliteTaxRepository

Source

pub fn calculate_tax( &self, request: TaxCalculationRequest, ) -> Result<TaxCalculationResult>

Calculate tax for a request

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl TaxRepository for SqliteTaxRepository

Source§

fn create_jurisdiction( &self, input: CreateTaxJurisdiction, ) -> Result<TaxJurisdiction>

Create a tax jurisdiction
Source§

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>>

Get a tax jurisdiction by code
Source§

fn list_jurisdictions( &self, filter: TaxJurisdictionFilter, ) -> Result<Vec<TaxJurisdiction>>

List tax jurisdictions matching a filter
Source§

fn create_rate(&self, input: CreateTaxRate) -> Result<TaxRate>

Create a tax rate
Source§

fn get_rate(&self, id: Uuid) -> Result<Option<TaxRate>>

Get a tax rate by ID
Source§

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>>

Get applicable tax rates for an address and category on a date
Source§

fn create_exemption(&self, input: CreateTaxExemption) -> Result<TaxExemption>

Create a tax exemption
Source§

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>>

Get all exemptions for a customer
Source§

fn get_settings(&self) -> Result<TaxSettings>

Get tax settings
Source§

fn update_settings(&self, settings: TaxSettings) -> Result<TaxSettings>

Update tax settings
Source§

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<()>

Persist a tax calculation for audit/reporting

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more