delopay 0.20.0

Official Rust SDK for the DeloPay payments API
Documentation
//! The hosted payment link model.

use serde::Deserialize;
use serde_json::Value;

/// A hosted payment link as returned by the API.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct PaymentLinkResponse {
    /// The shopper-facing payment link URL.
    pub link: String,
    /// Unique payment link ID.
    pub payment_link_id: String,
    /// Secure variant of the link, when the API issues one.
    #[serde(default)]
    pub secure_link: Option<String>,
    /// The origin (scheme, host and port) of the website the buyer arrived
    /// from when the hosted checkout first opened.
    #[serde(default)]
    pub site_origin: Option<String>,
    /// Any additional response fields not modeled above.
    #[serde(flatten)]
    pub extra: serde_json::Map<String, Value>,
}

/// One payment link, as [`PaymentLinks::retrieve`](crate::resources::payment_links::PaymentLinks::retrieve)
/// answers it.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct RetrievePaymentLinkResponse {
    /// Identifier of the payment link.
    pub payment_link_id: String,
    /// The merchant the link belongs to.
    pub merchant_id: String,
    /// The open link, without security checks or saved payment methods.
    pub link_to_pay: String,
    /// The payment amount, in minor units.
    pub amount: i64,
    /// ISO 8601 creation time.
    pub created_at: String,
    /// ISO 8601 expiry time.
    #[serde(default)]
    pub expiry: Option<String>,
    /// Description of the link.
    #[serde(default)]
    pub description: Option<String>,
    /// `"active"` or `"expired"`.
    pub status: String,
    /// Three-letter ISO 4217 currency code.
    #[serde(default)]
    pub currency: Option<String>,
    /// The secure link, with security checks and saved payment methods.
    #[serde(default)]
    pub secure_link: Option<String>,
    /// Any additional response fields not modeled above.
    #[serde(flatten)]
    pub extra: serde_json::Map<String, Value>,
}

/// The merchant and payment an opaque hosted checkout link opens.
///
/// A link the API issues names only its `payment_link_id`, so neither the
/// merchant nor the payment can be read off it; this answers which ones it
/// means.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct CheckoutLinkResolveResponse {
    /// The merchant the payment belongs to.
    pub merchant_id: String,
    /// The payment the link opens.
    pub payment_id: String,
    /// Any additional response fields not modeled above.
    #[serde(flatten)]
    pub extra: serde_json::Map<String, Value>,
}