amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * The Selling Partner API for Amazon Seller Wallet Open Banking API
 *
 * The Selling Partner API for Seller Wallet (Seller Wallet API) provides financial information that is relevant to a seller's Seller Wallet account. You can obtain financial events, balances, and transfer schedules for Seller Wallet accounts. You can also schedule and initiate transactions.
 *
 * The version of the OpenAPI document: 2024-03-01
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// Transaction : The current transaction status and related historical details.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Transaction {
    /// The unique identifier provided by Amazon to the transaction 
    #[serde(rename = "transactionId")]
    pub transaction_id: String,
    #[serde(rename = "transactionType")]
    pub transaction_type: models::seller_wallet_2024_03_01::TransactionType,
    #[serde(rename = "transactionStatus")]
    pub transaction_status: models::seller_wallet_2024_03_01::TransactionStatus,
    /// The date when the transaction was initiated.
    #[serde(rename = "transactionRequestDate")]
    pub transaction_request_date: String,
    /// Expected completion date of a transaction, for existing active Payees (Trusted Beneficiaries) it will be 24 hours but for new destination bank accounts the value could go up to 5 days 
    #[serde(rename = "expectedCompletionDate", skip_serializing_if = "Option::is_none")]
    pub expected_completion_date: Option<String>,
    /// Transaction completion date 
    #[serde(rename = "transactionActualCompletionDate", skip_serializing_if = "Option::is_none")]
    pub transaction_actual_completion_date: Option<String>,
    /// The last update date on the transaction 
    #[serde(rename = "lastUpdateDate")]
    pub last_update_date: String,
    /// Amazon SW customer who requested the transaction 
    #[serde(rename = "requesterName", skip_serializing_if = "Option::is_none")]
    pub requester_name: Option<String>,
    /// The transaction initiation source. This value is either the Amazon portal or PISP name that the customer used to start the transaction.
    #[serde(rename = "transactionRequesterSource")]
    pub transaction_requester_source: String,
    /// A description of the transaction that the requester provides when they initiate the transaction.
    #[serde(rename = "transactionDescription")]
    pub transaction_description: String,
    #[serde(rename = "transactionSourceAccount")]
    pub transaction_source_account: Box<models::seller_wallet_2024_03_01::TransactionAccount>,
    #[serde(rename = "transactionDestinationAccount")]
    pub transaction_destination_account: Box<models::seller_wallet_2024_03_01::TransactionAccount>,
    #[serde(rename = "transactionRequestAmount")]
    pub transaction_request_amount: Box<models::seller_wallet_2024_03_01::Currency>,
    #[serde(rename = "transferRateDetails")]
    pub transfer_rate_details: Box<models::seller_wallet_2024_03_01::TransferRatePreview>,
    #[serde(rename = "transactionFinalAmount", skip_serializing_if = "Option::is_none")]
    pub transaction_final_amount: Option<Box<models::seller_wallet_2024_03_01::Currency>>,
    /// Description in case the transaction fails before completion 
    #[serde(rename = "transactionFailureReason", skip_serializing_if = "Option::is_none")]
    pub transaction_failure_reason: Option<String>,
}

impl Transaction {
    /// The current transaction status and related historical details.
    pub fn new(transaction_id: String, transaction_type: models::seller_wallet_2024_03_01::TransactionType, transaction_status: models::seller_wallet_2024_03_01::TransactionStatus, transaction_request_date: String, last_update_date: String, transaction_requester_source: String, transaction_description: String, transaction_source_account: models::seller_wallet_2024_03_01::TransactionAccount, transaction_destination_account: models::seller_wallet_2024_03_01::TransactionAccount, transaction_request_amount: models::seller_wallet_2024_03_01::Currency, transfer_rate_details: models::seller_wallet_2024_03_01::TransferRatePreview) -> Transaction {
        Transaction {
            transaction_id,
            transaction_type,
            transaction_status,
            transaction_request_date,
            expected_completion_date: None,
            transaction_actual_completion_date: None,
            last_update_date,
            requester_name: None,
            transaction_requester_source,
            transaction_description,
            transaction_source_account: Box::new(transaction_source_account),
            transaction_destination_account: Box::new(transaction_destination_account),
            transaction_request_amount: Box::new(transaction_request_amount),
            transfer_rate_details: Box::new(transfer_rate_details),
            transaction_final_amount: None,
            transaction_failure_reason: None,
        }
    }
}