#[non_exhaustive]pub struct TransactionInfo {
pub value: Option<f32>,
pub currency: String,
pub transaction_id: String,
pub tax: Option<f32>,
pub cost: Option<f32>,
pub discount_value: Option<f32>,
/* private fields */
}recommendation-service or user-event-service only.Expand description
A transaction represents the entire purchase transaction.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.value: Option<f32>Required. Total non-zero value associated with the transaction. This value may include shipping, tax, or other adjustments to the total value that you want to include.
currency: StringRequired. Currency code. Use three-character ISO-4217 code.
transaction_id: StringThe transaction ID with a length limit of 128 characters.
tax: Option<f32>All the taxes associated with the transaction.
cost: Option<f32>All the costs associated with the products. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs, such that:
discount_value: Option<f32>The total discount(s) value applied to this transaction. This figure should be excluded from TransactionInfo.value
For example, if a user paid TransactionInfo.value amount, then nominal (pre-discount) value of the transaction is the sum of TransactionInfo.value and TransactionInfo.discount_value
This means that profit is calculated the same way, regardless of the discount value, and that TransactionInfo.discount_value can be larger than TransactionInfo.value:
Implementations§
Source§impl TransactionInfo
impl TransactionInfo
pub fn new() -> Self
Sourcepub fn set_or_clear_value<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_value<T>(self, v: Option<T>) -> Self
Sourcepub fn set_currency<T: Into<String>>(self, v: T) -> Self
pub fn set_currency<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_transaction_id<T: Into<String>>(self, v: T) -> Self
pub fn set_transaction_id<T: Into<String>>(self, v: T) -> Self
Sets the value of transaction_id.
§Example
let x = TransactionInfo::new().set_transaction_id("example");Sourcepub fn set_or_clear_tax<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_tax<T>(self, v: Option<T>) -> Self
Sourcepub fn set_or_clear_cost<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_cost<T>(self, v: Option<T>) -> Self
Sourcepub fn set_discount_value<T>(self, v: T) -> Self
pub fn set_discount_value<T>(self, v: T) -> Self
Sets the value of discount_value.
§Example
let x = TransactionInfo::new().set_discount_value(42.0);Sourcepub fn set_or_clear_discount_value<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_discount_value<T>(self, v: Option<T>) -> Self
Sets or clears the value of discount_value.
§Example
let x = TransactionInfo::new().set_or_clear_discount_value(Some(42.0));
let x = TransactionInfo::new().set_or_clear_discount_value(None::<f32>);Trait Implementations§
Source§impl Clone for TransactionInfo
impl Clone for TransactionInfo
Source§fn clone(&self) -> TransactionInfo
fn clone(&self) -> TransactionInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more