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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
use crate::api::*;
use crate::{ApiError, ClientConfig, HttpClient, QueryBuilder, RequestOptions};
use reqwest::Method;
pub struct PaypointClient {
pub http_client: HttpClient,
}
impl PaypointClient {
pub fn new(config: ClientConfig) -> Result<Self, ApiError> {
Ok(Self {
http_client: HttpClient::new(config.clone())?,
})
}
/// Gets the basic details for a paypoint.
///
/// # Arguments
///
/// * `entry` - The paypoint's entrypoint identifier. [Learn more](/developers/api-reference/api-overview#entrypoint-vs-entry)
/// * `options` - Additional request options such as headers, timeout, etc.
///
/// # Returns
///
/// JSON response from the API
pub async fn get_basic_entry(
&self,
entry: &str,
options: Option<RequestOptions>,
) -> Result<GetBasicEntryResponse, ApiError> {
self.http_client
.execute_request(
Method::GET,
&format!("Paypoint/basic/{}", entry),
None,
None,
options,
)
.await
}
/// Retrieves the basic details for a paypoint by ID.
///
/// # Arguments
///
/// * `id_paypoint` - Paypoint ID. You can find this value by querying `/api/Query/paypoints/{orgId}`
/// * `options` - Additional request options such as headers, timeout, etc.
///
/// # Returns
///
/// JSON response from the API
pub async fn get_basic_entry_by_id(
&self,
id_paypoint: &str,
options: Option<RequestOptions>,
) -> Result<GetBasicEntryByIdResponse, ApiError> {
self.http_client
.execute_request(
Method::GET,
&format!("Paypoint/basicById/{}", id_paypoint),
None,
None,
options,
)
.await
}
/// Gets the details for a single paypoint.
///
/// # Arguments
///
/// * `entry` - The paypoint's entrypoint identifier. [Learn more](/developers/api-reference/api-overview#entrypoint-vs-entry)
/// * `options` - Additional request options such as headers, timeout, etc.
///
/// # Returns
///
/// JSON response from the API
pub async fn get_entry_config(
&self,
entry: &str,
request: &GetEntryConfigQueryRequest,
options: Option<RequestOptions>,
) -> Result<GetEntryConfigResponse, ApiError> {
self.http_client
.execute_request(
Method::GET,
&format!("Paypoint/{}", entry),
None,
QueryBuilder::new()
.string("entrypages", request.entrypages.clone())
.build(),
options,
)
.await
}
/// Gets the details for single payment page for a paypoint.
///
/// # Arguments
///
/// * `entry` - The paypoint's entrypoint identifier. [Learn more](/developers/api-reference/api-overview#entrypoint-vs-entry)
/// * `subdomain` - Payment page identifier. The subdomain value is the last portion of the payment page URL. For example, in`https://paypages-sandbox.payabli.com/513823dc10/pay-your-fees-1`, the subdomain is `pay-your-fees-1`.
/// * `options` - Additional request options such as headers, timeout, etc.
///
/// # Returns
///
/// JSON response from the API
pub async fn get_page(
&self,
entry: &str,
subdomain: &str,
options: Option<RequestOptions>,
) -> Result<PayabliPages, ApiError> {
self.http_client
.execute_request(
Method::GET,
&format!("Paypoint/{}/{}", entry, subdomain),
None,
None,
options,
)
.await
}
/// Deletes a payment page in a paypoint.
///
/// # Arguments
///
/// * `entry` - The paypoint's entrypoint identifier. [Learn more](/developers/api-reference/api-overview#entrypoint-vs-entry)
/// * `subdomain` - Payment page identifier. The subdomain value is the last portion of the payment page URL. For example, in`https://paypages-sandbox.payabli.com/513823dc10/pay-your-fees-1`, the subdomain is `pay-your-fees-1`.
/// * `options` - Additional request options such as headers, timeout, etc.
///
/// # Returns
///
/// JSON response from the API
pub async fn remove_page(
&self,
entry: &str,
subdomain: &str,
options: Option<RequestOptions>,
) -> Result<PayabliApiResponseGeneric2Part, ApiError> {
self.http_client
.execute_request(
Method::DELETE,
&format!("Paypoint/{}/{}", entry, subdomain),
None,
None,
options,
)
.await
}
/// Updates a paypoint logo.
///
/// # Arguments
///
/// * `entry` - The paypoint's entrypoint identifier. [Learn more](/developers/api-reference/api-overview#entrypoint-vs-entry)
/// * `options` - Additional request options such as headers, timeout, etc.
///
/// # Returns
///
/// JSON response from the API
pub async fn save_logo(
&self,
entry: &str,
request: &FileContent,
options: Option<RequestOptions>,
) -> Result<PayabliApiResponse00Responsedatanonobject, ApiError> {
self.http_client
.execute_request(
Method::PUT,
&format!("Paypoint/logo/{}", entry),
Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
None,
options,
)
.await
}
/// Retrieves an paypoint's basic settings like custom fields, identifiers, and invoicing settings.
///
/// # Arguments
///
/// * `entry` - The paypoint's entrypoint identifier. [Learn more](/developers/api-reference/api-overview#entrypoint-vs-entry)
/// * `options` - Additional request options such as headers, timeout, etc.
///
/// # Returns
///
/// JSON response from the API
pub async fn settings_page(
&self,
entry: &str,
options: Option<RequestOptions>,
) -> Result<SettingsQueryRecord, ApiError> {
self.http_client
.execute_request(
Method::GET,
&format!("Paypoint/settings/{}", entry),
None,
None,
options,
)
.await
}
/// Migrates a paypoint to a new parent organization.
///
/// # Arguments
///
/// * `options` - Additional request options such as headers, timeout, etc.
///
/// # Returns
///
/// JSON response from the API
pub async fn migrate(
&self,
request: &PaypointMoveRequest,
options: Option<RequestOptions>,
) -> Result<MigratePaypointResponse, ApiError> {
self.http_client
.execute_request(
Method::POST,
"Paypoint/migrate",
Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
None,
options,
)
.await
}
}