#[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
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransactionInfo
impl Debug for TransactionInfo
Source§impl Default for TransactionInfo
impl Default for TransactionInfo
Source§fn default() -> TransactionInfo
fn default() -> TransactionInfo
Source§impl Message for TransactionInfo
impl Message for TransactionInfo
Source§impl PartialEq for TransactionInfo
impl PartialEq for TransactionInfo
impl StructuralPartialEq for TransactionInfo
Auto Trait Implementations§
impl Freeze for TransactionInfo
impl RefUnwindSafe for TransactionInfo
impl Send for TransactionInfo
impl Sync for TransactionInfo
impl Unpin for TransactionInfo
impl UnsafeUnpin for TransactionInfo
impl UnwindSafe for TransactionInfo
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request