payjp_core/three_d_secure_request/
requests.rs

1use payjp_client_core::{PayjpClient, BlockingClient, PayjpRequest, RequestBuilder, PayjpMethod};
2
3#[derive(Clone,Debug,)]#[derive(serde::Serialize)]
4 struct ListThreeDSecureRequestBuilder {
5#[serde(skip_serializing_if = "Option::is_none")]
6 limit: Option<i64>,
7#[serde(skip_serializing_if = "Option::is_none")]
8 offset: Option<i64>,
9#[serde(skip_serializing_if = "Option::is_none")]
10 since: Option<i64>,
11#[serde(skip_serializing_if = "Option::is_none")]
12 until: Option<i64>,
13#[serde(skip_serializing_if = "Option::is_none")]
14 resource_id: Option<String>,
15#[serde(skip_serializing_if = "Option::is_none")]
16 tenant_id: Option<String>,
17
18}
19impl ListThreeDSecureRequestBuilder {
20     fn new() -> Self {
21    Self {
22        limit: None,offset: None,since: None,until: None,resource_id: None,tenant_id: None,
23    }
24}
25
26}
27        /// 3Dセキュアリクエスト情報のリストを取得します。
28#[derive(Clone,Debug,)]#[derive(serde::Serialize)]
29pub struct ListThreeDSecureRequest {
30 inner: ListThreeDSecureRequestBuilder,
31
32}
33impl ListThreeDSecureRequest {
34    /// Construct a new `ListThreeDSecureRequest`.
35pub fn new() -> Self {
36    Self {
37        inner: ListThreeDSecureRequestBuilder::new()
38    }
39}
40    /// 取得するデータ数の最大値(1~100まで)。指定がない場合は 10 となる。
41pub fn limit(mut self, limit: impl Into<i64>) -> Self {
42    self.inner.limit = Some(limit.into());
43    self
44}
45    /// 基準点からのデータ取得を行う開始位置。指定がない場合は 0 となる。
46pub fn offset(mut self, offset: impl Into<i64>) -> Self {
47    self.inner.offset = Some(offset.into());
48    self
49}
50    /// ここに指定したタイムスタンプ以降に作成されたデータを取得
51pub fn since(mut self, since: impl Into<i64>) -> Self {
52    self.inner.since = Some(since.into());
53    self
54}
55    /// ここに指定したタイムスタンプ以前に作成されたデータを取得
56pub fn until(mut self, until: impl Into<i64>) -> Self {
57    self.inner.until = Some(until.into());
58    self
59}
60    /// 3Dセキュア処理対象リソースのID
61pub fn resource_id(mut self, resource_id: impl Into<String>) -> Self {
62    self.inner.resource_id = Some(resource_id.into());
63    self
64}
65    /// テナントID
66pub fn tenant_id(mut self, tenant_id: impl Into<String>) -> Self {
67    self.inner.tenant_id = Some(tenant_id.into());
68    self
69}
70
71}
72    impl Default for ListThreeDSecureRequest {
73    fn default() -> Self {
74        Self::new()
75    }
76}impl ListThreeDSecureRequest {
77    /// Send the request and return the deserialized response.
78    pub async fn send<C: PayjpClient>(&self, client: &C) -> Result<<Self as PayjpRequest>::Output, C::Err> {
79        self.customize().send(client).await
80    }
81
82    /// Send the request and return the deserialized response, blocking until completion.
83    pub fn send_blocking<C: BlockingClient>(&self, client: &C) -> Result<<Self as PayjpRequest>::Output, C::Err> {
84        self.customize().send_blocking(client)
85    }
86
87    pub fn paginate(&self) -> payjp_client_core::ListPaginator<payjp_types::List<payjp_core::ThreeDSecureRequest>> {
88    
89    payjp_client_core::ListPaginator::new_list("/three_d_secure_requests", &self.inner)
90}
91
92}
93
94impl PayjpRequest for ListThreeDSecureRequest {
95    type Output = payjp_types::List<payjp_core::ThreeDSecureRequest>;
96
97    fn build(&self) -> RequestBuilder {
98    RequestBuilder::new(PayjpMethod::Get, "/three_d_secure_requests").query(&self.inner)
99}
100
101}
102#[derive(Clone,Debug,)]#[derive(serde::Serialize)]
103 struct CreateThreeDSecureRequestBuilder {
104 resource_id: String,
105#[serde(skip_serializing_if = "Option::is_none")]
106 tenant_id: Option<String>,
107
108}
109impl CreateThreeDSecureRequestBuilder {
110     fn new(resource_id: impl Into<String>,) -> Self {
111    Self {
112        resource_id: resource_id.into(),tenant_id: None,
113    }
114}
115
116}
117        /// 顧客カードIDを指定して3Dセキュアリクエストを作成します。
118#[derive(Clone,Debug,)]#[derive(serde::Serialize)]
119pub struct CreateThreeDSecureRequest {
120 inner: CreateThreeDSecureRequestBuilder,
121
122}
123impl CreateThreeDSecureRequest {
124    /// Construct a new `CreateThreeDSecureRequest`.
125pub fn new(resource_id:impl Into<String>) -> Self {
126    Self {
127        inner: CreateThreeDSecureRequestBuilder::new(resource_id.into(),)
128    }
129}
130    /// テナントID。PAY.JP Platform のみ設定可能
131pub fn tenant_id(mut self, tenant_id: impl Into<String>) -> Self {
132    self.inner.tenant_id = Some(tenant_id.into());
133    self
134}
135
136}
137    impl CreateThreeDSecureRequest {
138    /// Send the request and return the deserialized response.
139    pub async fn send<C: PayjpClient>(&self, client: &C) -> Result<<Self as PayjpRequest>::Output, C::Err> {
140        self.customize().send(client).await
141    }
142
143    /// Send the request and return the deserialized response, blocking until completion.
144    pub fn send_blocking<C: BlockingClient>(&self, client: &C) -> Result<<Self as PayjpRequest>::Output, C::Err> {
145        self.customize().send_blocking(client)
146    }
147
148    
149}
150
151impl PayjpRequest for CreateThreeDSecureRequest {
152    type Output = payjp_core::ThreeDSecureRequest;
153
154    fn build(&self) -> RequestBuilder {
155    RequestBuilder::new(PayjpMethod::Post, "/three_d_secure_requests").form(&self.inner)
156}
157
158}
159    /// 3Dセキュアリクエスト情報を取得します。
160#[derive(Clone,Debug,)]#[derive(serde::Serialize)]
161pub struct RetrieveThreeDSecureRequest {
162 three_d_secure_request: payjp_core::ThreeDSecureRequestId,
163
164}
165impl RetrieveThreeDSecureRequest {
166    /// Construct a new `RetrieveThreeDSecureRequest`.
167pub fn new(three_d_secure_request:impl Into<payjp_core::ThreeDSecureRequestId>) -> Self {
168    Self {
169        three_d_secure_request: three_d_secure_request.into(),
170    }
171}
172
173}
174    impl RetrieveThreeDSecureRequest {
175    /// Send the request and return the deserialized response.
176    pub async fn send<C: PayjpClient>(&self, client: &C) -> Result<<Self as PayjpRequest>::Output, C::Err> {
177        self.customize().send(client).await
178    }
179
180    /// Send the request and return the deserialized response, blocking until completion.
181    pub fn send_blocking<C: BlockingClient>(&self, client: &C) -> Result<<Self as PayjpRequest>::Output, C::Err> {
182        self.customize().send_blocking(client)
183    }
184
185    
186}
187
188impl PayjpRequest for RetrieveThreeDSecureRequest {
189    type Output = payjp_core::ThreeDSecureRequest;
190
191    fn build(&self) -> RequestBuilder {
192    let three_d_secure_request = &self.three_d_secure_request;
193RequestBuilder::new(PayjpMethod::Get, format!("/three_d_secure_requests/{three_d_secure_request}"))
194}
195
196}
197