baselinker/requests/orders/
get_order_payments_history.rs

1use crate::common::RequestTrait;
2use chrono::serde::ts_seconds;
3use chrono::{DateTime, Utc};
4use rust_decimal::Decimal;
5use serde::{Deserialize, Serialize};
6
7#[derive(Serialize, Deserialize, Debug)]
8pub struct Payment {
9    /// total amount paid before the given change
10    pub paid_before: Decimal,
11    /// total amount paid after the change
12    pub paid_after: Decimal,
13    pub total_price: Decimal,
14    pub currency: String,
15    /// external payment identifier
16    pub external_payment_id: String,
17    /// date of change record (unix time format)
18    #[serde(with = "ts_seconds")]
19    pub date: DateTime<Utc>,
20    pub comment: String,
21}
22
23#[derive(Serialize, Deserialize, Debug)]
24pub struct GetOrderPaymentsHistoryResponse {
25    pub payments: Vec<Payment>,
26}
27
28/// The method allows you to retrieve payment history for a selected order, including an external payment identifier from the payment gateway.
29///
30/// One order can have multiple payment history entries, caused by surcharges, order value changes, manual payment editing
31#[derive(Serialize, Deserialize, Debug)]
32pub struct GetOrderPaymentsHistory {
33    pub order_id: i64,
34    /// (false by default) Download full payment history, including order value change entries, manual order payment edits.
35    ///
36    /// False by default - only returns entries containing an external payment identifier (most commonly used)
37    pub show_full_history: Option<bool>,
38}
39
40impl RequestTrait<GetOrderPaymentsHistoryResponse> for GetOrderPaymentsHistory {
41    const METHOD: &'static str = "getOrderPaymentsHistory";
42}