tktax_amazon/
amazon_store_medical_purchase.rs

1// ---------------- [ File: tktax-amazon/src/amazon_store_medical_purchase.rs ]
2crate::ix!();
3
4#[derive(Builder,Getters,Debug,Clone)]
5#[getset(get="pub")]
6#[builder(setter(into))]
7pub struct AmazonStoreMedicalPurchase {
8    name:           &'static str,
9    quantity:       Decimal,
10    price:          MonetaryAmount,
11    purchase_date:  NaiveDate,
12}
13
14impl<TxCat:TransactionCategory + 'static> LineItem<TxCat> for AmazonStoreMedicalPurchase {
15
16    fn tag() -> &'static str {
17        "amazon-store-medical-purchase"
18    }
19
20    fn quantity(&self) -> Decimal {
21        self.quantity
22    }
23
24    fn price(&self) -> MonetaryAmount {
25        self.price
26    }
27
28    fn category(&self) -> TxCat {
29        *TxCat::amazon_store_medical_purchase_category()
30    }
31
32    fn tx_amount(&self) -> MonetaryAmount {
33        *self.price() * *self.quantity()
34    }
35
36    fn tx(&self) -> Option<&Transaction> {
37        None
38    }
39}