paystack/models/
dedicated_virtual_account_models.rs

1use derive_builder::Builder;
2use serde::{Deserialize, Serialize};
3
4use super::{Currency, CustomerResponseData};
5
6#[derive(Debug, Clone, Serialize, Deserialize, Default, Builder)]
7pub struct DedicatedVirtualAccountRequest {
8    /// Customer ID or Code
9    pub customer: String,
10    /// The bank slug for preferred bank. To get a list of available banks, use the List Providers endpoint.
11    #[builder(setter(strip_option), default)]
12    pub preferred_bank: Option<String>,
13    /// Subaccount code of the account you want to split the transaction with
14    #[builder(setter(strip_option), default)]
15    pub subaccount: Option<String>,
16    /// Split code consisting of the lists of accounts you want to split the transaction with
17    #[builder(setter(strip_option), default)]
18    pub split_code: Option<String>,
19    /// Customer's first name
20    #[builder(setter(strip_option), default)]
21    pub first_name: Option<String>,
22    /// Customer's last name
23    #[builder(setter(strip_option), default)]
24    pub last_name: Option<String>,
25    /// Customer's phone number
26    #[builder(setter(strip_option), default)]
27    pub phone: Option<String>,
28    /// Customer's email address
29    #[builder(setter(strip_option), default)]
30    pub email: Option<String>,
31    /// Currently accepts NG and GH only
32    #[builder(setter(strip_option), default)]
33    pub country: Option<String>,
34    /// Customer's account number
35    #[builder(setter(strip_option), default)]
36    pub account_number: Option<String>,
37    /// Customer's Bank Verification Number (Nigeria only)
38    #[builder(setter(strip_option), default)]
39    pub bvn: Option<String>,
40    /// Customer's bank code
41    #[builder(setter(strip_option), default)]
42    pub bank_code: Option<String>,
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize, Default)]
46pub struct DedicatedVirtualAccountResponseData {
47    pub bank: Option<Bank>,
48    pub account_name: String,
49    pub account_number: String,
50    pub assigned: bool,
51    pub currency: Currency,
52    pub metadata: Option<String>,
53    pub active: bool,
54    pub id: u64,
55    pub created_at: String,
56    pub updated_at: String,
57    pub assignment: Assignment,
58    pub customer: Option<CustomerResponseData>,
59    pub split_config: Option<SplitConfig>,
60}
61
62#[derive(Debug, Clone, Serialize, Default, Deserialize)]
63pub struct SplitConfig {
64    pub split_code: String,
65}
66
67#[derive(Debug, Clone, Deserialize, Serialize, Default)]
68pub struct Bank {
69    pub name: String,
70    pub id: u64,
71    pub slug: String,
72}
73
74#[derive(Debug, Clone, Deserialize, Serialize, Default)]
75pub struct Assignment {
76    pub integration: u64,
77    pub assignee_id: u64,
78    pub assignee_type: String,
79    pub expired: bool,
80    pub account_type: String,
81    pub assinged_at: String,
82}
83
84#[derive(Debug, Clone, Deserialize, Serialize)]
85pub struct BankProviderData {
86    pub provider_slug: String,
87    pub bank_id: u64,
88    pub bank_name: String,
89    pub id: u64,
90}
91
92#[derive(Clone, Debug, Deserialize, Serialize, Default, Builder)]
93pub struct ListDedicatedAccountFilter {
94    /// Status of the dedicated virtual account
95    #[builder(setter(strip_option), default)]
96    pub active: Option<bool>,
97    /// The currency of the dedicated virtual account.
98    #[builder(setter(strip_option), default)]
99    pub currency: Option<Currency>,
100    /// The bank's slug in lowercase, without spaces.
101    #[builder(setter(strip_option), default)]
102    pub provider_slug: Option<String>,
103    /// The bank's ID
104    #[builder(setter(strip_option), default)]
105    pub bank_id: Option<String>,
106    /// The customer's ID
107    #[builder(setter(strip_option), default)]
108    pub customer: Option<String>,
109}
110
111#[derive(Clone, Debug, Deserialize, Serialize, Default, Builder)]
112pub struct SplitDedicatedAccountTransactionRequest {
113    /// Customer ID or code
114    pub customer: String,
115    /// Subaccount code of the account you want to split the transaction with
116    #[builder(setter(strip_option), default)]
117    pub subaccount: Option<String>,
118    /// Split code consisting of the lists of accounts you want to split the transaction with
119    #[builder(setter(strip_option), default)]
120    pub split_code: Option<String>,
121    /// The bank slug for preferred bank. To get a list of available banks, use the List Providers endpoint
122    #[builder(setter(strip_option), default)]
123    pub preferred_bank: Option<String>,
124}