Struct PaymentRequest

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

Payment Request message body (TAIP-14)

Fields§

§asset: Option<AssetId>

Asset identifier in CAIP-19 format (optional if currency is provided)

§currency: Option<String>

ISO 4217 currency code for fiat amount (optional if asset is provided)

§amount: String

Amount requested in the specified asset or currency

§supported_assets: Option<Vec<String>>

Array of CAIP-19 asset identifiers that can be used to settle a fiat currency amount

§invoice: Option<Invoice>

Structured invoice information according to TAIP-16

§expiry: Option<String>

ISO 8601 timestamp when the request expires

§merchant: Participant

Party information for the merchant (beneficiary)

§customer: Option<Participant>

Party information for the customer (originator) (optional)

§agents: Vec<Participant>

Array of agents involved in the payment request

§metadata: HashMap<String, Value>

Additional metadata for the payment request

Implementations§

Source§

impl PaymentRequest

Source

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

Creates a new PaymentRequest message body

Source

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

Creates a new PaymentRequest message with asset specification

Source

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

Creates a new PaymentRequest message with currency specification

Source

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

Validates the PaymentRequest message body

Trait Implementations§

Source§

impl Clone for PaymentRequest

Source§

fn clone(&self) -> PaymentRequest

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 PaymentRequest

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 PaymentRequest

Source§

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

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

impl<'de> Deserialize<'de> for PaymentRequest

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 PaymentRequest

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 TapMessageBody for PaymentRequest

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: Option<&str>) -> Result<Message>

Convert this body to a DIDComm message.
Source§

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

Convert this body to a DIDComm message with a sender and multiple recipients. Read more
Source§

fn from_didcomm(message: &Message) -> Result<Self>
where Self: Sized,

Extract this body type from a DIDComm message.

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> Same for T

Source§

type Output = T

Should always be Self
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>,