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};

/// TransferRatePreview : The fees and foreign exchange rates that apply to the transaction.  If the fees are in terms of the `baseAmount` (source account) currency, then the effective rate is equal to **1 - (fees * `baseRate` / `baseAmount`)**.  If the fees are in terms of the `transferAmount` (destination account) currency, then the effective rate is equal to **`baseRate` - (fees / `baseAmount`)**.  In the preceding expressions, **fees** is equal to the sum of all `feeAmount.currencyAmount` values in the `fees` array.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TransferRatePreview {
    #[serde(rename = "baseAmount")]
    pub base_amount: Box<models::seller_wallet_2024_03_01::Currency>,
    #[serde(rename = "fxRateDetails")]
    pub fx_rate_details: Box<models::seller_wallet_2024_03_01::FxRateDetails>,
    #[serde(rename = "transferAmount")]
    pub transfer_amount: Box<models::seller_wallet_2024_03_01::Currency>,
    /// List of fees 
    #[serde(rename = "fees")]
    pub fees: Vec<models::seller_wallet_2024_03_01::Fee>,
}

impl TransferRatePreview {
    /// The fees and foreign exchange rates that apply to the transaction.  If the fees are in terms of the `baseAmount` (source account) currency, then the effective rate is equal to **1 - (fees * `baseRate` / `baseAmount`)**.  If the fees are in terms of the `transferAmount` (destination account) currency, then the effective rate is equal to **`baseRate` - (fees / `baseAmount`)**.  In the preceding expressions, **fees** is equal to the sum of all `feeAmount.currencyAmount` values in the `fees` array.
    pub fn new(base_amount: models::seller_wallet_2024_03_01::Currency, fx_rate_details: models::seller_wallet_2024_03_01::FxRateDetails, transfer_amount: models::seller_wallet_2024_03_01::Currency, fees: Vec<models::seller_wallet_2024_03_01::Fee>) -> TransferRatePreview {
        TransferRatePreview {
            base_amount: Box::new(base_amount),
            fx_rate_details: Box::new(fx_rate_details),
            transfer_amount: Box::new(transfer_amount),
            fees,
        }
    }
}