paystack/models/transaction_split.rs
1//! Transaction Splits Models
2//! ====================
3//! This file contains the models for working with the transaction splits endpoint.
4use crate::{BearerType, Currency, SplitType, SubaccountBody};
5use derive_builder::Builder;
6use serde::Serialize;
7
8/// This struct is used to create a split payment on your integration.
9/// The struct is constructed using the `CreateTransactionSplitBodyBuilder`
10#[derive(Serialize, Debug, Default, Builder)]
11pub struct CreateTransactionSplitBody {
12 /// Name of the transaction split
13 name: String,
14 /// The type of transaction split you want to create
15 #[serde(rename = "type")]
16 split_type: SplitType,
17 /// Any of the supported currency
18 currency: Currency,
19 /// A list of object containing subaccount code and number of shares: `[{subaccount: ‘ACT_xxxxxxxxxx’, share: xxx},{...}]`
20 subaccounts: Vec<SubaccountBody>,
21 /// Any of subaccount
22 bearer_type: BearerType,
23 /// Subaccount code
24 bearer_subaccount: String,
25}
26
27/// This struct is used to update a transaction split details on your integration.
28/// The struct is constructed using the `UpdateTransactionSplitBodyBuilder`
29#[derive(Serialize, Debug, Builder, Default)]
30pub struct UpdateTransactionSplitBody {
31 /// Name of the transaction split
32 name: String,
33 /// True or False
34 active: bool,
35 /// Any of subaccount
36 #[builder(default = "None")]
37 bearer_type: Option<BearerType>,
38 /// Subaccount code of a subaccount in the split group. This should be specified only if the `bearer_type is subaccount
39 #[builder(default = "None")]
40 bearer_subaccount: Option<SubaccountBody>,
41}