1use stripe_client_core::{
2 RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Debug, serde::Serialize)]
6struct ListIdentityVerificationSessionBuilder {
7 #[serde(skip_serializing_if = "Option::is_none")]
8 client_reference_id: Option<String>,
9 #[serde(skip_serializing_if = "Option::is_none")]
10 created: Option<stripe_types::RangeQueryTs>,
11 #[serde(skip_serializing_if = "Option::is_none")]
12 ending_before: Option<String>,
13 #[serde(skip_serializing_if = "Option::is_none")]
14 expand: Option<Vec<String>>,
15 #[serde(skip_serializing_if = "Option::is_none")]
16 limit: Option<i64>,
17 #[serde(skip_serializing_if = "Option::is_none")]
18 related_customer: Option<String>,
19 #[serde(skip_serializing_if = "Option::is_none")]
20 starting_after: Option<String>,
21 #[serde(skip_serializing_if = "Option::is_none")]
22 status: Option<stripe_misc::IdentityVerificationSessionStatus>,
23}
24impl ListIdentityVerificationSessionBuilder {
25 fn new() -> Self {
26 Self {
27 client_reference_id: None,
28 created: None,
29 ending_before: None,
30 expand: None,
31 limit: None,
32 related_customer: None,
33 starting_after: None,
34 status: None,
35 }
36 }
37}
38#[derive(Clone, Debug, serde::Serialize)]
40pub struct ListIdentityVerificationSession {
41 inner: ListIdentityVerificationSessionBuilder,
42}
43impl ListIdentityVerificationSession {
44 pub fn new() -> Self {
46 Self { inner: ListIdentityVerificationSessionBuilder::new() }
47 }
48 pub fn client_reference_id(mut self, client_reference_id: impl Into<String>) -> Self {
51 self.inner.client_reference_id = Some(client_reference_id.into());
52 self
53 }
54 pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
56 self.inner.created = Some(created.into());
57 self
58 }
59 pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
63 self.inner.ending_before = Some(ending_before.into());
64 self
65 }
66 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
68 self.inner.expand = Some(expand.into());
69 self
70 }
71 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
74 self.inner.limit = Some(limit.into());
75 self
76 }
77 pub fn related_customer(mut self, related_customer: impl Into<String>) -> Self {
78 self.inner.related_customer = Some(related_customer.into());
79 self
80 }
81 pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
85 self.inner.starting_after = Some(starting_after.into());
86 self
87 }
88 pub fn status(
91 mut self,
92 status: impl Into<stripe_misc::IdentityVerificationSessionStatus>,
93 ) -> Self {
94 self.inner.status = Some(status.into());
95 self
96 }
97}
98impl Default for ListIdentityVerificationSession {
99 fn default() -> Self {
100 Self::new()
101 }
102}
103impl ListIdentityVerificationSession {
104 pub async fn send<C: StripeClient>(
106 &self,
107 client: &C,
108 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
109 self.customize().send(client).await
110 }
111
112 pub fn send_blocking<C: StripeBlockingClient>(
114 &self,
115 client: &C,
116 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
117 self.customize().send_blocking(client)
118 }
119
120 pub fn paginate(
121 &self,
122 ) -> stripe_client_core::ListPaginator<
123 stripe_types::List<stripe_misc::IdentityVerificationSession>,
124 > {
125 stripe_client_core::ListPaginator::new_list("/identity/verification_sessions", &self.inner)
126 }
127}
128
129impl StripeRequest for ListIdentityVerificationSession {
130 type Output = stripe_types::List<stripe_misc::IdentityVerificationSession>;
131
132 fn build(&self) -> RequestBuilder {
133 RequestBuilder::new(StripeMethod::Get, "/identity/verification_sessions").query(&self.inner)
134 }
135}
136#[derive(Clone, Debug, serde::Serialize)]
137struct RetrieveIdentityVerificationSessionBuilder {
138 #[serde(skip_serializing_if = "Option::is_none")]
139 expand: Option<Vec<String>>,
140}
141impl RetrieveIdentityVerificationSessionBuilder {
142 fn new() -> Self {
143 Self { expand: None }
144 }
145}
146#[derive(Clone, Debug, serde::Serialize)]
151pub struct RetrieveIdentityVerificationSession {
152 inner: RetrieveIdentityVerificationSessionBuilder,
153 session: stripe_misc::IdentityVerificationSessionId,
154}
155impl RetrieveIdentityVerificationSession {
156 pub fn new(session: impl Into<stripe_misc::IdentityVerificationSessionId>) -> Self {
158 Self { session: session.into(), inner: RetrieveIdentityVerificationSessionBuilder::new() }
159 }
160 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
162 self.inner.expand = Some(expand.into());
163 self
164 }
165}
166impl RetrieveIdentityVerificationSession {
167 pub async fn send<C: StripeClient>(
169 &self,
170 client: &C,
171 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
172 self.customize().send(client).await
173 }
174
175 pub fn send_blocking<C: StripeBlockingClient>(
177 &self,
178 client: &C,
179 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
180 self.customize().send_blocking(client)
181 }
182}
183
184impl StripeRequest for RetrieveIdentityVerificationSession {
185 type Output = stripe_misc::IdentityVerificationSession;
186
187 fn build(&self) -> RequestBuilder {
188 let session = &self.session;
189 RequestBuilder::new(StripeMethod::Get, format!("/identity/verification_sessions/{session}"))
190 .query(&self.inner)
191 }
192}
193#[derive(Clone, Debug, serde::Serialize)]
194struct CreateIdentityVerificationSessionBuilder {
195 #[serde(skip_serializing_if = "Option::is_none")]
196 client_reference_id: Option<String>,
197 #[serde(skip_serializing_if = "Option::is_none")]
198 expand: Option<Vec<String>>,
199 #[serde(skip_serializing_if = "Option::is_none")]
200 metadata: Option<std::collections::HashMap<String, String>>,
201 #[serde(skip_serializing_if = "Option::is_none")]
202 options: Option<CreateIdentityVerificationSessionOptions>,
203 #[serde(skip_serializing_if = "Option::is_none")]
204 provided_details: Option<ProvidedDetailsParam>,
205 #[serde(skip_serializing_if = "Option::is_none")]
206 related_customer: Option<String>,
207 #[serde(skip_serializing_if = "Option::is_none")]
208 related_person: Option<CreateIdentityVerificationSessionRelatedPerson>,
209 #[serde(skip_serializing_if = "Option::is_none")]
210 return_url: Option<String>,
211 #[serde(rename = "type")]
212 #[serde(skip_serializing_if = "Option::is_none")]
213 type_: Option<CreateIdentityVerificationSessionType>,
214 #[serde(skip_serializing_if = "Option::is_none")]
215 verification_flow: Option<String>,
216}
217impl CreateIdentityVerificationSessionBuilder {
218 fn new() -> Self {
219 Self {
220 client_reference_id: None,
221 expand: None,
222 metadata: None,
223 options: None,
224 provided_details: None,
225 related_customer: None,
226 related_person: None,
227 return_url: None,
228 type_: None,
229 verification_flow: None,
230 }
231 }
232}
233#[derive(Clone, Debug, serde::Serialize)]
235pub struct CreateIdentityVerificationSessionOptions {
236 #[serde(skip_serializing_if = "Option::is_none")]
238 pub document: Option<CreateIdentityVerificationSessionOptionsDocument>,
239}
240impl CreateIdentityVerificationSessionOptions {
241 pub fn new() -> Self {
242 Self { document: None }
243 }
244}
245impl Default for CreateIdentityVerificationSessionOptions {
246 fn default() -> Self {
247 Self::new()
248 }
249}
250#[derive(Clone, Debug, serde::Serialize)]
252pub struct CreateIdentityVerificationSessionOptionsDocument {
253 #[serde(skip_serializing_if = "Option::is_none")]
256 pub allowed_types: Option<Vec<CreateIdentityVerificationSessionOptionsDocumentAllowedTypes>>,
257 #[serde(skip_serializing_if = "Option::is_none")]
259 pub require_id_number: Option<bool>,
260 #[serde(skip_serializing_if = "Option::is_none")]
262 pub require_live_capture: Option<bool>,
263 #[serde(skip_serializing_if = "Option::is_none")]
266 pub require_matching_selfie: Option<bool>,
267}
268impl CreateIdentityVerificationSessionOptionsDocument {
269 pub fn new() -> Self {
270 Self {
271 allowed_types: None,
272 require_id_number: None,
273 require_live_capture: None,
274 require_matching_selfie: None,
275 }
276 }
277}
278impl Default for CreateIdentityVerificationSessionOptionsDocument {
279 fn default() -> Self {
280 Self::new()
281 }
282}
283#[derive(Clone, Eq, PartialEq)]
286#[non_exhaustive]
287pub enum CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
288 DrivingLicense,
289 IdCard,
290 Passport,
291 Unknown(String),
293}
294impl CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
295 pub fn as_str(&self) -> &str {
296 use CreateIdentityVerificationSessionOptionsDocumentAllowedTypes::*;
297 match self {
298 DrivingLicense => "driving_license",
299 IdCard => "id_card",
300 Passport => "passport",
301 Unknown(v) => v,
302 }
303 }
304}
305
306impl std::str::FromStr for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
307 type Err = std::convert::Infallible;
308 fn from_str(s: &str) -> Result<Self, Self::Err> {
309 use CreateIdentityVerificationSessionOptionsDocumentAllowedTypes::*;
310 match s {
311 "driving_license" => Ok(DrivingLicense),
312 "id_card" => Ok(IdCard),
313 "passport" => Ok(Passport),
314 v => {
315 tracing::warn!(
316 "Unknown value '{}' for enum '{}'",
317 v,
318 "CreateIdentityVerificationSessionOptionsDocumentAllowedTypes"
319 );
320 Ok(Unknown(v.to_owned()))
321 }
322 }
323 }
324}
325impl std::fmt::Display for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
326 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
327 f.write_str(self.as_str())
328 }
329}
330
331impl std::fmt::Debug for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
332 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
333 f.write_str(self.as_str())
334 }
335}
336impl serde::Serialize for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
337 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
338 where
339 S: serde::Serializer,
340 {
341 serializer.serialize_str(self.as_str())
342 }
343}
344#[cfg(feature = "deserialize")]
345impl<'de> serde::Deserialize<'de> for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
346 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
347 use std::str::FromStr;
348 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
349 Ok(Self::from_str(&s).expect("infallible"))
350 }
351}
352#[derive(Clone, Debug, serde::Serialize)]
354pub struct CreateIdentityVerificationSessionRelatedPerson {
355 pub account: String,
358 pub person: String,
360}
361impl CreateIdentityVerificationSessionRelatedPerson {
362 pub fn new(account: impl Into<String>, person: impl Into<String>) -> Self {
363 Self { account: account.into(), person: person.into() }
364 }
365}
366#[derive(Clone, Eq, PartialEq)]
369#[non_exhaustive]
370pub enum CreateIdentityVerificationSessionType {
371 Document,
372 IdNumber,
373 Unknown(String),
375}
376impl CreateIdentityVerificationSessionType {
377 pub fn as_str(&self) -> &str {
378 use CreateIdentityVerificationSessionType::*;
379 match self {
380 Document => "document",
381 IdNumber => "id_number",
382 Unknown(v) => v,
383 }
384 }
385}
386
387impl std::str::FromStr for CreateIdentityVerificationSessionType {
388 type Err = std::convert::Infallible;
389 fn from_str(s: &str) -> Result<Self, Self::Err> {
390 use CreateIdentityVerificationSessionType::*;
391 match s {
392 "document" => Ok(Document),
393 "id_number" => Ok(IdNumber),
394 v => {
395 tracing::warn!(
396 "Unknown value '{}' for enum '{}'",
397 v,
398 "CreateIdentityVerificationSessionType"
399 );
400 Ok(Unknown(v.to_owned()))
401 }
402 }
403 }
404}
405impl std::fmt::Display for CreateIdentityVerificationSessionType {
406 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
407 f.write_str(self.as_str())
408 }
409}
410
411impl std::fmt::Debug for CreateIdentityVerificationSessionType {
412 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
413 f.write_str(self.as_str())
414 }
415}
416impl serde::Serialize for CreateIdentityVerificationSessionType {
417 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
418 where
419 S: serde::Serializer,
420 {
421 serializer.serialize_str(self.as_str())
422 }
423}
424#[cfg(feature = "deserialize")]
425impl<'de> serde::Deserialize<'de> for CreateIdentityVerificationSessionType {
426 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
427 use std::str::FromStr;
428 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
429 Ok(Self::from_str(&s).expect("infallible"))
430 }
431}
432#[derive(Clone, Debug, serde::Serialize)]
440pub struct CreateIdentityVerificationSession {
441 inner: CreateIdentityVerificationSessionBuilder,
442}
443impl CreateIdentityVerificationSession {
444 pub fn new() -> Self {
446 Self { inner: CreateIdentityVerificationSessionBuilder::new() }
447 }
448 pub fn client_reference_id(mut self, client_reference_id: impl Into<String>) -> Self {
451 self.inner.client_reference_id = Some(client_reference_id.into());
452 self
453 }
454 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
456 self.inner.expand = Some(expand.into());
457 self
458 }
459 pub fn metadata(
464 mut self,
465 metadata: impl Into<std::collections::HashMap<String, String>>,
466 ) -> Self {
467 self.inner.metadata = Some(metadata.into());
468 self
469 }
470 pub fn options(mut self, options: impl Into<CreateIdentityVerificationSessionOptions>) -> Self {
472 self.inner.options = Some(options.into());
473 self
474 }
475 pub fn provided_details(mut self, provided_details: impl Into<ProvidedDetailsParam>) -> Self {
477 self.inner.provided_details = Some(provided_details.into());
478 self
479 }
480 pub fn related_customer(mut self, related_customer: impl Into<String>) -> Self {
482 self.inner.related_customer = Some(related_customer.into());
483 self
484 }
485 pub fn related_person(
487 mut self,
488 related_person: impl Into<CreateIdentityVerificationSessionRelatedPerson>,
489 ) -> Self {
490 self.inner.related_person = Some(related_person.into());
491 self
492 }
493 pub fn return_url(mut self, return_url: impl Into<String>) -> Self {
495 self.inner.return_url = Some(return_url.into());
496 self
497 }
498 pub fn type_(mut self, type_: impl Into<CreateIdentityVerificationSessionType>) -> Self {
501 self.inner.type_ = Some(type_.into());
502 self
503 }
504 pub fn verification_flow(mut self, verification_flow: impl Into<String>) -> Self {
507 self.inner.verification_flow = Some(verification_flow.into());
508 self
509 }
510}
511impl Default for CreateIdentityVerificationSession {
512 fn default() -> Self {
513 Self::new()
514 }
515}
516impl CreateIdentityVerificationSession {
517 pub async fn send<C: StripeClient>(
519 &self,
520 client: &C,
521 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
522 self.customize().send(client).await
523 }
524
525 pub fn send_blocking<C: StripeBlockingClient>(
527 &self,
528 client: &C,
529 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
530 self.customize().send_blocking(client)
531 }
532}
533
534impl StripeRequest for CreateIdentityVerificationSession {
535 type Output = stripe_misc::IdentityVerificationSession;
536
537 fn build(&self) -> RequestBuilder {
538 RequestBuilder::new(StripeMethod::Post, "/identity/verification_sessions").form(&self.inner)
539 }
540}
541#[derive(Clone, Debug, serde::Serialize)]
542struct UpdateIdentityVerificationSessionBuilder {
543 #[serde(skip_serializing_if = "Option::is_none")]
544 expand: Option<Vec<String>>,
545 #[serde(skip_serializing_if = "Option::is_none")]
546 metadata: Option<std::collections::HashMap<String, String>>,
547 #[serde(skip_serializing_if = "Option::is_none")]
548 options: Option<UpdateIdentityVerificationSessionOptions>,
549 #[serde(skip_serializing_if = "Option::is_none")]
550 provided_details: Option<ProvidedDetailsParam>,
551 #[serde(rename = "type")]
552 #[serde(skip_serializing_if = "Option::is_none")]
553 type_: Option<UpdateIdentityVerificationSessionType>,
554}
555impl UpdateIdentityVerificationSessionBuilder {
556 fn new() -> Self {
557 Self { expand: None, metadata: None, options: None, provided_details: None, type_: None }
558 }
559}
560#[derive(Clone, Debug, serde::Serialize)]
562pub struct UpdateIdentityVerificationSessionOptions {
563 #[serde(skip_serializing_if = "Option::is_none")]
565 pub document: Option<UpdateIdentityVerificationSessionOptionsDocument>,
566}
567impl UpdateIdentityVerificationSessionOptions {
568 pub fn new() -> Self {
569 Self { document: None }
570 }
571}
572impl Default for UpdateIdentityVerificationSessionOptions {
573 fn default() -> Self {
574 Self::new()
575 }
576}
577#[derive(Clone, Debug, serde::Serialize)]
579pub struct UpdateIdentityVerificationSessionOptionsDocument {
580 #[serde(skip_serializing_if = "Option::is_none")]
583 pub allowed_types: Option<Vec<UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes>>,
584 #[serde(skip_serializing_if = "Option::is_none")]
586 pub require_id_number: Option<bool>,
587 #[serde(skip_serializing_if = "Option::is_none")]
589 pub require_live_capture: Option<bool>,
590 #[serde(skip_serializing_if = "Option::is_none")]
593 pub require_matching_selfie: Option<bool>,
594}
595impl UpdateIdentityVerificationSessionOptionsDocument {
596 pub fn new() -> Self {
597 Self {
598 allowed_types: None,
599 require_id_number: None,
600 require_live_capture: None,
601 require_matching_selfie: None,
602 }
603 }
604}
605impl Default for UpdateIdentityVerificationSessionOptionsDocument {
606 fn default() -> Self {
607 Self::new()
608 }
609}
610#[derive(Clone, Eq, PartialEq)]
613#[non_exhaustive]
614pub enum UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
615 DrivingLicense,
616 IdCard,
617 Passport,
618 Unknown(String),
620}
621impl UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
622 pub fn as_str(&self) -> &str {
623 use UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes::*;
624 match self {
625 DrivingLicense => "driving_license",
626 IdCard => "id_card",
627 Passport => "passport",
628 Unknown(v) => v,
629 }
630 }
631}
632
633impl std::str::FromStr for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
634 type Err = std::convert::Infallible;
635 fn from_str(s: &str) -> Result<Self, Self::Err> {
636 use UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes::*;
637 match s {
638 "driving_license" => Ok(DrivingLicense),
639 "id_card" => Ok(IdCard),
640 "passport" => Ok(Passport),
641 v => {
642 tracing::warn!(
643 "Unknown value '{}' for enum '{}'",
644 v,
645 "UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes"
646 );
647 Ok(Unknown(v.to_owned()))
648 }
649 }
650 }
651}
652impl std::fmt::Display for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
653 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
654 f.write_str(self.as_str())
655 }
656}
657
658impl std::fmt::Debug for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
659 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
660 f.write_str(self.as_str())
661 }
662}
663impl serde::Serialize for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
664 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
665 where
666 S: serde::Serializer,
667 {
668 serializer.serialize_str(self.as_str())
669 }
670}
671#[cfg(feature = "deserialize")]
672impl<'de> serde::Deserialize<'de> for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
673 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
674 use std::str::FromStr;
675 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
676 Ok(Self::from_str(&s).expect("infallible"))
677 }
678}
679#[derive(Clone, Eq, PartialEq)]
681#[non_exhaustive]
682pub enum UpdateIdentityVerificationSessionType {
683 Document,
684 IdNumber,
685 Unknown(String),
687}
688impl UpdateIdentityVerificationSessionType {
689 pub fn as_str(&self) -> &str {
690 use UpdateIdentityVerificationSessionType::*;
691 match self {
692 Document => "document",
693 IdNumber => "id_number",
694 Unknown(v) => v,
695 }
696 }
697}
698
699impl std::str::FromStr for UpdateIdentityVerificationSessionType {
700 type Err = std::convert::Infallible;
701 fn from_str(s: &str) -> Result<Self, Self::Err> {
702 use UpdateIdentityVerificationSessionType::*;
703 match s {
704 "document" => Ok(Document),
705 "id_number" => Ok(IdNumber),
706 v => {
707 tracing::warn!(
708 "Unknown value '{}' for enum '{}'",
709 v,
710 "UpdateIdentityVerificationSessionType"
711 );
712 Ok(Unknown(v.to_owned()))
713 }
714 }
715 }
716}
717impl std::fmt::Display for UpdateIdentityVerificationSessionType {
718 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
719 f.write_str(self.as_str())
720 }
721}
722
723impl std::fmt::Debug for UpdateIdentityVerificationSessionType {
724 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
725 f.write_str(self.as_str())
726 }
727}
728impl serde::Serialize for UpdateIdentityVerificationSessionType {
729 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
730 where
731 S: serde::Serializer,
732 {
733 serializer.serialize_str(self.as_str())
734 }
735}
736#[cfg(feature = "deserialize")]
737impl<'de> serde::Deserialize<'de> for UpdateIdentityVerificationSessionType {
738 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
739 use std::str::FromStr;
740 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
741 Ok(Self::from_str(&s).expect("infallible"))
742 }
743}
744#[derive(Clone, Debug, serde::Serialize)]
749pub struct UpdateIdentityVerificationSession {
750 inner: UpdateIdentityVerificationSessionBuilder,
751 session: stripe_misc::IdentityVerificationSessionId,
752}
753impl UpdateIdentityVerificationSession {
754 pub fn new(session: impl Into<stripe_misc::IdentityVerificationSessionId>) -> Self {
756 Self { session: session.into(), inner: UpdateIdentityVerificationSessionBuilder::new() }
757 }
758 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
760 self.inner.expand = Some(expand.into());
761 self
762 }
763 pub fn metadata(
768 mut self,
769 metadata: impl Into<std::collections::HashMap<String, String>>,
770 ) -> Self {
771 self.inner.metadata = Some(metadata.into());
772 self
773 }
774 pub fn options(mut self, options: impl Into<UpdateIdentityVerificationSessionOptions>) -> Self {
776 self.inner.options = Some(options.into());
777 self
778 }
779 pub fn provided_details(mut self, provided_details: impl Into<ProvidedDetailsParam>) -> Self {
781 self.inner.provided_details = Some(provided_details.into());
782 self
783 }
784 pub fn type_(mut self, type_: impl Into<UpdateIdentityVerificationSessionType>) -> Self {
786 self.inner.type_ = Some(type_.into());
787 self
788 }
789}
790impl UpdateIdentityVerificationSession {
791 pub async fn send<C: StripeClient>(
793 &self,
794 client: &C,
795 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
796 self.customize().send(client).await
797 }
798
799 pub fn send_blocking<C: StripeBlockingClient>(
801 &self,
802 client: &C,
803 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
804 self.customize().send_blocking(client)
805 }
806}
807
808impl StripeRequest for UpdateIdentityVerificationSession {
809 type Output = stripe_misc::IdentityVerificationSession;
810
811 fn build(&self) -> RequestBuilder {
812 let session = &self.session;
813 RequestBuilder::new(
814 StripeMethod::Post,
815 format!("/identity/verification_sessions/{session}"),
816 )
817 .form(&self.inner)
818 }
819}
820#[derive(Clone, Debug, serde::Serialize)]
821struct CancelIdentityVerificationSessionBuilder {
822 #[serde(skip_serializing_if = "Option::is_none")]
823 expand: Option<Vec<String>>,
824}
825impl CancelIdentityVerificationSessionBuilder {
826 fn new() -> Self {
827 Self { expand: None }
828 }
829}
830#[derive(Clone, Debug, serde::Serialize)]
836pub struct CancelIdentityVerificationSession {
837 inner: CancelIdentityVerificationSessionBuilder,
838 session: stripe_misc::IdentityVerificationSessionId,
839}
840impl CancelIdentityVerificationSession {
841 pub fn new(session: impl Into<stripe_misc::IdentityVerificationSessionId>) -> Self {
843 Self { session: session.into(), inner: CancelIdentityVerificationSessionBuilder::new() }
844 }
845 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
847 self.inner.expand = Some(expand.into());
848 self
849 }
850}
851impl CancelIdentityVerificationSession {
852 pub async fn send<C: StripeClient>(
854 &self,
855 client: &C,
856 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
857 self.customize().send(client).await
858 }
859
860 pub fn send_blocking<C: StripeBlockingClient>(
862 &self,
863 client: &C,
864 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
865 self.customize().send_blocking(client)
866 }
867}
868
869impl StripeRequest for CancelIdentityVerificationSession {
870 type Output = stripe_misc::IdentityVerificationSession;
871
872 fn build(&self) -> RequestBuilder {
873 let session = &self.session;
874 RequestBuilder::new(
875 StripeMethod::Post,
876 format!("/identity/verification_sessions/{session}/cancel"),
877 )
878 .form(&self.inner)
879 }
880}
881#[derive(Clone, Debug, serde::Serialize)]
882struct RedactIdentityVerificationSessionBuilder {
883 #[serde(skip_serializing_if = "Option::is_none")]
884 expand: Option<Vec<String>>,
885}
886impl RedactIdentityVerificationSessionBuilder {
887 fn new() -> Self {
888 Self { expand: None }
889 }
890}
891#[derive(Clone, Debug, serde::Serialize)]
912pub struct RedactIdentityVerificationSession {
913 inner: RedactIdentityVerificationSessionBuilder,
914 session: stripe_misc::IdentityVerificationSessionId,
915}
916impl RedactIdentityVerificationSession {
917 pub fn new(session: impl Into<stripe_misc::IdentityVerificationSessionId>) -> Self {
919 Self { session: session.into(), inner: RedactIdentityVerificationSessionBuilder::new() }
920 }
921 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
923 self.inner.expand = Some(expand.into());
924 self
925 }
926}
927impl RedactIdentityVerificationSession {
928 pub async fn send<C: StripeClient>(
930 &self,
931 client: &C,
932 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
933 self.customize().send(client).await
934 }
935
936 pub fn send_blocking<C: StripeBlockingClient>(
938 &self,
939 client: &C,
940 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
941 self.customize().send_blocking(client)
942 }
943}
944
945impl StripeRequest for RedactIdentityVerificationSession {
946 type Output = stripe_misc::IdentityVerificationSession;
947
948 fn build(&self) -> RequestBuilder {
949 let session = &self.session;
950 RequestBuilder::new(
951 StripeMethod::Post,
952 format!("/identity/verification_sessions/{session}/redact"),
953 )
954 .form(&self.inner)
955 }
956}
957
958#[derive(Clone, Debug, serde::Serialize)]
959pub struct ProvidedDetailsParam {
960 #[serde(skip_serializing_if = "Option::is_none")]
962 pub email: Option<String>,
963 #[serde(skip_serializing_if = "Option::is_none")]
965 pub phone: Option<String>,
966}
967impl ProvidedDetailsParam {
968 pub fn new() -> Self {
969 Self { email: None, phone: None }
970 }
971}
972impl Default for ProvidedDetailsParam {
973 fn default() -> Self {
974 Self::new()
975 }
976}