1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! Transaction Split Models
//! ========================
//! This file contains the models for working with the transaction splits endpoint.
use crate::{BearerType, Currency, Domain, SplitType, SubaccountBody, SubaccountData};
use derive_builder::Builder;
use serde::{Deserialize, Serialize};
/// This struct is used to create a split payment on your integration.
/// The struct is constructed using the `TransactionSplitRequestBuilder`
#[derive(Serialize, Debug, Default, Builder)]
pub struct TransactionSplitRequest {
/// Name of the transaction split
name: String,
/// The type of transaction split you want to create
#[serde(rename = "type")]
split_type: SplitType,
/// Any of the supported currency
currency: Currency,
/// A list of object containing subaccount code and number of shares: `[{subaccount: ‘ACT_xxxxxxxxxx’, share: xxx},{...}]`
subaccounts: Vec<SubaccountBody>,
/// Any of subaccount
bearer_type: BearerType,
/// Subaccount code
bearer_subaccount: String,
}
/// Represents the percentage split data received in the JSON response.
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct TransactionSplitResponseData {
/// The ID of the percentage split.
pub id: u32,
/// The name of the percentage split.
pub name: String,
/// The type of the percentage split.
#[serde(rename = "type")]
pub split_type: String,
/// The currency used for the percentage split.
pub currency: String,
/// The integration associated with the percentage split.
pub integration: u32,
/// The domain associated with the percentage split.
pub domain: Domain,
/// The split code of the percentage split.
pub split_code: String,
/// Indicates whether the percentage split is active or not.
#[serde(default)]
pub active: Option<bool>,
/// The bearer type of the percentage split.
pub bearer_type: String,
/// The subaccount ID of the bearer associated with the percentage split.
pub bearer_subaccount: u32,
/// The creation timestamp of the percentage split.
#[serde(rename = "createdAt")]
pub created_at: Option<String>,
/// The last update timestamp of the percentage split.
#[serde(rename = "updatedAt")]
pub updated_at: Option<String>,
pub is_dynamic: Option<bool>,
/// The list of subaccounts involved in the percentage split.
pub subaccounts: Vec<SubaccountData>,
/// The total count of subaccounts in the percentage split.
pub total_subaccounts: u32,
}
/// This struct is used to update a transaction split details on your integration.
/// The struct is constructed using the `UpdateTransactionSplitRequestBuilder`
#[derive(Serialize, Debug, Builder, Default)]
pub struct UpdateTransactionSplitRequest {
/// Name of the transaction split
name: String,
/// True or False
active: bool,
/// Any of subaccount
#[builder(setter(strip_option), default)]
bearer_type: Option<BearerType>,
/// Subaccount code of a subaccount in the split group. This should be specified only if the `bearer_type is subaccount
#[builder(setter(strip_option), default)]
bearer_subaccount: Option<SubaccountBody>,
}