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
use crate::api::*;
use crate::{ApiError, ClientConfig, HttpClient, RequestOptions};
use reqwest::Method;
pub struct HostedPaymentPagesClient {
pub http_client: HttpClient,
}
impl HostedPaymentPagesClient {
pub fn new(config: ClientConfig) -> Result<Self, ApiError> {
Ok(Self {
http_client: HttpClient::new(config.clone())?,
})
}
/// Loads all of a payment page's details including `pageIdentifier` and `validationCode`. This endpoint requires an `application` API token.
///
/// # 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 part 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 load_page(
&self,
entry: &str,
subdomain: &str,
options: Option<RequestOptions>,
) -> Result<PayabliPages, ApiError> {
self.http_client
.execute_request(
Method::GET,
&format!("Paypoint/load/{}/{}", entry, subdomain),
None,
None,
options,
)
.await
}
/// Creates a new payment page for a paypoint.
/// Note: this operation doesn't create a new paypoint, just a payment page for an existing paypoint. Paypoints are created by the Payabli team when a boarding application is approved.
///
/// # 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 new_page(
&self,
entry: &str,
request: &PayabliPages,
options: Option<RequestOptions>,
) -> Result<PayabliApiResponse00Responsedatanonobject, ApiError> {
self.http_client
.execute_request(
Method::POST,
&format!("Paypoint/{}", entry),
Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
None,
options,
)
.await
}
/// Updates 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 part 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 save_page(
&self,
entry: &str,
subdomain: &str,
request: &PayabliPages,
options: Option<RequestOptions>,
) -> Result<PayabliApiResponse00Responsedatanonobject, ApiError> {
self.http_client
.execute_request(
Method::PUT,
&format!("Paypoint/{}/{}", entry, subdomain),
Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
None,
options,
)
.await
}
}