Struct Payment

Source
pub struct Payment {
    pub asset: Option<AssetId>,
    pub amount: String,
    pub currency_code: Option<String>,
    pub supported_assets: Option<Vec<AssetId>>,
    pub customer: Option<Participant>,
    pub merchant: Participant,
    pub transaction_id: String,
    pub memo: Option<String>,
    pub expiry: Option<String>,
    pub invoice: Option<Invoice>,
    pub agents: Vec<Participant>,
    pub metadata: HashMap<String, Value>,
}
Expand description

Payment message body (TAIP-14).

A Payment is a DIDComm message initiated by the merchant’s agent and sent to the customer’s agent to request a blockchain payment. It must include either an asset or a currency to denominate the payment, along with the amount and recipient information.

Fields§

§asset: Option<AssetId>

Asset identifier (CAIP-19 format).

§amount: String

Payment amount.

§currency_code: Option<String>

Currency code for fiat amounts (e.g., USD).

§supported_assets: Option<Vec<AssetId>>

Supported assets for this payment (when currency_code is specified)

§customer: Option<Participant>

Customer (payer) details.

§merchant: Participant

Merchant (payee) details.

§transaction_id: String

Transaction identifier.

§memo: Option<String>

Memo for the payment (optional).

§expiry: Option<String>

Expiration time in ISO 8601 format (optional).

§invoice: Option<Invoice>

Invoice details (optional) per TAIP-16

§agents: Vec<Participant>

Other agents involved in the payment.

§metadata: HashMap<String, Value>

Additional metadata (optional).

Implementations§

Source§

impl Payment

Source

pub fn with_asset( asset: AssetId, amount: String, merchant: Participant, agents: Vec<Participant>, ) -> Self

Creates a new Payment with an asset

Source

pub fn with_currency( currency_code: String, amount: String, merchant: Participant, agents: Vec<Participant>, ) -> Self

Creates a new Payment with a currency

Source

pub fn with_currency_and_assets( currency_code: String, amount: String, supported_assets: Vec<AssetId>, merchant: Participant, agents: Vec<Participant>, ) -> Self

Creates a new Payment with a currency and supported assets

Trait Implementations§

Source§

impl Authorizable for Payment

Source§

fn authorize(&self, note: Option<String>) -> Authorize

Create an Authorize message for this object.
Source§

fn update_policies( &self, transaction_id: String, policies: Vec<Policy>, ) -> UpdatePolicies

Create an UpdatePolicies message for this object.
Source§

fn replace_agent( &self, transaction_id: String, original_agent: String, replacement: Participant, ) -> ReplaceAgent

Create a ReplaceAgent message for this object.
Source§

fn remove_agent(&self, transaction_id: String, agent: String) -> RemoveAgent

Create a RemoveAgent message for this object.
Source§

impl Clone for Payment

Source§

fn clone(&self) -> Payment

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Connectable for Payment

Source§

fn with_connection(&mut self, connect_id: &str) -> &mut Self

Connect this message to a prior Connect message by setting the parent thread ID (pthid). Read more
Source§

fn has_connection(&self) -> bool

Check if this message is connected to a prior Connect message. Read more
Source§

fn connection_id(&self) -> Option<&str>

Get the connection ID if present. Read more
Source§

impl Debug for Payment

Source§

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

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

impl<'de> Deserialize<'de> for Payment

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Payment

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TapMessage for Payment

Source§

fn validate(&self) -> Result<()>

Validates a TAP message. Read more
Source§

fn is_tap_message(&self) -> bool

Checks if this message is a TAP message.
Source§

fn get_tap_type(&self) -> Option<String>

Gets the TAP message type from this message.
Source§

fn body_as<T: TapMessageBody>(&self) -> Result<T>

Extract a specific message body type from this message. Read more
Source§

fn get_all_participants(&self) -> Vec<String>

Get all participant DIDs from this message. Read more
Source§

fn create_reply<T: TapMessageBody>( &self, body: &T, creator_did: &str, ) -> Result<PlainMessage>

Create a reply to this message. Read more
Source§

fn message_type(&self) -> &'static str

Get the message type for this message
Source§

fn thread_id(&self) -> Option<&str>

Get the thread ID for this message
Source§

fn parent_thread_id(&self) -> Option<&str>

Get the parent thread ID for this message
Source§

fn message_id(&self) -> &str

Get the message ID for this message
Source§

impl TapMessageBody for Payment

Source§

fn message_type() -> &'static str

Get the message type string for this body type.
Source§

fn validate(&self) -> Result<()>

Validate the message body.
Source§

fn to_didcomm(&self, from_did: &str) -> Result<PlainMessage>

Convert this body to a DIDComm message.
Source§

fn from_didcomm(message: &PlainMessage) -> Result<Self>

Extract this body type from a DIDComm message.
Source§

fn to_didcomm_with_route<'a, I>( &self, from: &str, to: I, ) -> Result<PlainMessage>
where I: IntoIterator<Item = &'a str>,

Convert this body to a DIDComm message with a custom routing path. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,