async-stripe-misc 1.0.0-rc.8

API bindings for the Stripe HTTP API
Documentation
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
use stripe_client_core::{
    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
};

#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct ListIdentityVerificationSessionBuilder {
    #[serde(skip_serializing_if = "Option::is_none")]
    client_reference_id: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    created: Option<stripe_types::RangeQueryTs>,
    #[serde(skip_serializing_if = "Option::is_none")]
    ending_before: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    expand: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    limit: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    related_customer: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    related_customer_account: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    starting_after: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    status: Option<stripe_misc::IdentityVerificationSessionStatus>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListIdentityVerificationSessionBuilder {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("ListIdentityVerificationSessionBuilder").finish_non_exhaustive()
    }
}
impl ListIdentityVerificationSessionBuilder {
    fn new() -> Self {
        Self {
            client_reference_id: None,
            created: None,
            ending_before: None,
            expand: None,
            limit: None,
            related_customer: None,
            related_customer_account: None,
            starting_after: None,
            status: None,
        }
    }
}
/// Returns a list of VerificationSessions
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ListIdentityVerificationSession {
    inner: ListIdentityVerificationSessionBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListIdentityVerificationSession {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("ListIdentityVerificationSession").finish_non_exhaustive()
    }
}
impl ListIdentityVerificationSession {
    /// Construct a new `ListIdentityVerificationSession`.
    pub fn new() -> Self {
        Self { inner: ListIdentityVerificationSessionBuilder::new() }
    }
    /// A string to reference this user.
    /// This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems.
    pub fn client_reference_id(mut self, client_reference_id: impl Into<String>) -> Self {
        self.inner.client_reference_id = Some(client_reference_id.into());
        self
    }
    /// Only return VerificationSessions that were created during the given date interval.
    pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
        self.inner.created = Some(created.into());
        self
    }
    /// A cursor for use in pagination.
    /// `ending_before` is an object ID that defines your place in the list.
    /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
        self.inner.ending_before = Some(ending_before.into());
        self
    }
    /// Specifies which fields in the response should be expanded.
    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
        self.inner.expand = Some(expand.into());
        self
    }
    /// A limit on the number of objects to be returned.
    /// Limit can range between 1 and 100, and the default is 10.
    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
        self.inner.limit = Some(limit.into());
        self
    }
    /// Customer ID
    pub fn related_customer(mut self, related_customer: impl Into<String>) -> Self {
        self.inner.related_customer = Some(related_customer.into());
        self
    }
    /// The ID of the Account representing a customer.
    pub fn related_customer_account(mut self, related_customer_account: impl Into<String>) -> Self {
        self.inner.related_customer_account = Some(related_customer_account.into());
        self
    }
    /// A cursor for use in pagination.
    /// `starting_after` is an object ID that defines your place in the list.
    /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
        self.inner.starting_after = Some(starting_after.into());
        self
    }
    /// Only return VerificationSessions with this status.
    /// [Learn more about the lifecycle of sessions](https://docs.stripe.com/identity/how-sessions-work).
    pub fn status(
        mut self,
        status: impl Into<stripe_misc::IdentityVerificationSessionStatus>,
    ) -> Self {
        self.inner.status = Some(status.into());
        self
    }
}
impl Default for ListIdentityVerificationSession {
    fn default() -> Self {
        Self::new()
    }
}
impl ListIdentityVerificationSession {
    /// Send the request and return the deserialized response.
    pub async fn send<C: StripeClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send(client).await
    }

    /// Send the request and return the deserialized response, blocking until completion.
    pub fn send_blocking<C: StripeBlockingClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send_blocking(client)
    }

    pub fn paginate(
        &self,
    ) -> stripe_client_core::ListPaginator<
        stripe_types::List<stripe_misc::IdentityVerificationSession>,
    > {
        stripe_client_core::ListPaginator::new_list("/identity/verification_sessions", &self.inner)
    }
}

impl StripeRequest for ListIdentityVerificationSession {
    type Output = stripe_types::List<stripe_misc::IdentityVerificationSession>;

    fn build(&self) -> RequestBuilder {
        RequestBuilder::new(StripeMethod::Get, "/identity/verification_sessions").query(&self.inner)
    }
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct RetrieveIdentityVerificationSessionBuilder {
    #[serde(skip_serializing_if = "Option::is_none")]
    expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveIdentityVerificationSessionBuilder {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("RetrieveIdentityVerificationSessionBuilder").finish_non_exhaustive()
    }
}
impl RetrieveIdentityVerificationSessionBuilder {
    fn new() -> Self {
        Self { expand: None }
    }
}
/// Retrieves the details of a VerificationSession that was previously created.
///
/// When the session status is `requires_input`, you can use this method to retrieve a valid
/// `client_secret` or `url` to allow re-submission.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct RetrieveIdentityVerificationSession {
    inner: RetrieveIdentityVerificationSessionBuilder,
    session: stripe_misc::IdentityVerificationSessionId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveIdentityVerificationSession {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("RetrieveIdentityVerificationSession").finish_non_exhaustive()
    }
}
impl RetrieveIdentityVerificationSession {
    /// Construct a new `RetrieveIdentityVerificationSession`.
    pub fn new(session: impl Into<stripe_misc::IdentityVerificationSessionId>) -> Self {
        Self { session: session.into(), inner: RetrieveIdentityVerificationSessionBuilder::new() }
    }
    /// Specifies which fields in the response should be expanded.
    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
        self.inner.expand = Some(expand.into());
        self
    }
}
impl RetrieveIdentityVerificationSession {
    /// Send the request and return the deserialized response.
    pub async fn send<C: StripeClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send(client).await
    }

    /// Send the request and return the deserialized response, blocking until completion.
    pub fn send_blocking<C: StripeBlockingClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send_blocking(client)
    }
}

impl StripeRequest for RetrieveIdentityVerificationSession {
    type Output = stripe_misc::IdentityVerificationSession;

    fn build(&self) -> RequestBuilder {
        let session = &self.session;
        RequestBuilder::new(StripeMethod::Get, format!("/identity/verification_sessions/{session}"))
            .query(&self.inner)
    }
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct CreateIdentityVerificationSessionBuilder {
    #[serde(skip_serializing_if = "Option::is_none")]
    client_reference_id: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    expand: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    metadata: Option<std::collections::HashMap<String, String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    options: Option<CreateIdentityVerificationSessionOptions>,
    #[serde(skip_serializing_if = "Option::is_none")]
    provided_details: Option<ProvidedDetailsParam>,
    #[serde(skip_serializing_if = "Option::is_none")]
    related_customer: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    related_customer_account: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    related_person: Option<CreateIdentityVerificationSessionRelatedPerson>,
    #[serde(skip_serializing_if = "Option::is_none")]
    return_url: Option<String>,
    #[serde(rename = "type")]
    #[serde(skip_serializing_if = "Option::is_none")]
    type_: Option<CreateIdentityVerificationSessionType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    verification_flow: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreateIdentityVerificationSessionBuilder {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("CreateIdentityVerificationSessionBuilder").finish_non_exhaustive()
    }
}
impl CreateIdentityVerificationSessionBuilder {
    fn new() -> Self {
        Self {
            client_reference_id: None,
            expand: None,
            metadata: None,
            options: None,
            provided_details: None,
            related_customer: None,
            related_customer_account: None,
            related_person: None,
            return_url: None,
            type_: None,
            verification_flow: None,
        }
    }
}
/// A set of options for the session’s verification checks.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreateIdentityVerificationSessionOptions {
    /// Options that apply to the [document check](https://docs.stripe.com/identity/verification-checks?type=document).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub document: Option<CreateIdentityVerificationSessionOptionsDocument>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreateIdentityVerificationSessionOptions {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("CreateIdentityVerificationSessionOptions").finish_non_exhaustive()
    }
}
impl CreateIdentityVerificationSessionOptions {
    pub fn new() -> Self {
        Self { document: None }
    }
}
impl Default for CreateIdentityVerificationSessionOptions {
    fn default() -> Self {
        Self::new()
    }
}
/// Options that apply to the [document check](https://docs.stripe.com/identity/verification-checks?type=document).
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreateIdentityVerificationSessionOptionsDocument {
    /// Array of strings of allowed identity document types.
    /// If the provided identity document isn’t one of the allowed types, the verification check will fail with a document_type_not_allowed error code.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub allowed_types: Option<Vec<CreateIdentityVerificationSessionOptionsDocumentAllowedTypes>>,
    /// Collect an ID number and perform an [ID number check](https://docs.stripe.com/identity/verification-checks?type=id-number) with the document’s extracted name and date of birth.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub require_id_number: Option<bool>,
    /// Disable image uploads, identity document images have to be captured using the device’s camera.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub require_live_capture: Option<bool>,
    /// Capture a face image and perform a [selfie check](https://docs.stripe.com/identity/verification-checks?type=selfie) comparing a photo ID and a picture of your user’s face.
    /// [Learn more](https://docs.stripe.com/identity/selfie).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub require_matching_selfie: Option<bool>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreateIdentityVerificationSessionOptionsDocument {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("CreateIdentityVerificationSessionOptionsDocument").finish_non_exhaustive()
    }
}
impl CreateIdentityVerificationSessionOptionsDocument {
    pub fn new() -> Self {
        Self {
            allowed_types: None,
            require_id_number: None,
            require_live_capture: None,
            require_matching_selfie: None,
        }
    }
}
impl Default for CreateIdentityVerificationSessionOptionsDocument {
    fn default() -> Self {
        Self::new()
    }
}
/// Array of strings of allowed identity document types.
/// If the provided identity document isn’t one of the allowed types, the verification check will fail with a document_type_not_allowed error code.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    DrivingLicense,
    IdCard,
    Passport,
    /// An unrecognized value from Stripe. Should not be used as a request parameter.
    Unknown(String),
}
impl CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    pub fn as_str(&self) -> &str {
        use CreateIdentityVerificationSessionOptionsDocumentAllowedTypes::*;
        match self {
            DrivingLicense => "driving_license",
            IdCard => "id_card",
            Passport => "passport",
            Unknown(v) => v,
        }
    }
}

impl std::str::FromStr for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    type Err = std::convert::Infallible;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        use CreateIdentityVerificationSessionOptionsDocumentAllowedTypes::*;
        match s {
            "driving_license" => Ok(DrivingLicense),
            "id_card" => Ok(IdCard),
            "passport" => Ok(Passport),
            v => {
                tracing::warn!(
                    "Unknown value '{}' for enum '{}'",
                    v,
                    "CreateIdentityVerificationSessionOptionsDocumentAllowedTypes"
                );
                Ok(Unknown(v.to_owned()))
            }
        }
    }
}
impl std::fmt::Display for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct(stringify!(CreateIdentityVerificationSessionOptionsDocumentAllowedTypes))
            .finish_non_exhaustive()
    }
}
impl serde::Serialize for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        use std::str::FromStr;
        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
        Ok(Self::from_str(&s).expect("infallible"))
    }
}
/// Tokens referencing a Person resource and its associated account.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreateIdentityVerificationSessionRelatedPerson {
    /// A token representing a connected account.
    /// If provided, the person parameter is also required and must be associated with the account.
    pub account: String,
    /// A token referencing a Person resource that this verification is being used to verify.
    pub person: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreateIdentityVerificationSessionRelatedPerson {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("CreateIdentityVerificationSessionRelatedPerson").finish_non_exhaustive()
    }
}
impl CreateIdentityVerificationSessionRelatedPerson {
    pub fn new(account: impl Into<String>, person: impl Into<String>) -> Self {
        Self { account: account.into(), person: person.into() }
    }
}
/// The type of [verification check](https://docs.stripe.com/identity/verification-checks) to be performed.
/// You must provide a `type` if not passing `verification_flow`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreateIdentityVerificationSessionType {
    Document,
    IdNumber,
    /// An unrecognized value from Stripe. Should not be used as a request parameter.
    Unknown(String),
}
impl CreateIdentityVerificationSessionType {
    pub fn as_str(&self) -> &str {
        use CreateIdentityVerificationSessionType::*;
        match self {
            Document => "document",
            IdNumber => "id_number",
            Unknown(v) => v,
        }
    }
}

impl std::str::FromStr for CreateIdentityVerificationSessionType {
    type Err = std::convert::Infallible;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        use CreateIdentityVerificationSessionType::*;
        match s {
            "document" => Ok(Document),
            "id_number" => Ok(IdNumber),
            v => {
                tracing::warn!(
                    "Unknown value '{}' for enum '{}'",
                    v,
                    "CreateIdentityVerificationSessionType"
                );
                Ok(Unknown(v.to_owned()))
            }
        }
    }
}
impl std::fmt::Display for CreateIdentityVerificationSessionType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreateIdentityVerificationSessionType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreateIdentityVerificationSessionType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct(stringify!(CreateIdentityVerificationSessionType)).finish_non_exhaustive()
    }
}
impl serde::Serialize for CreateIdentityVerificationSessionType {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreateIdentityVerificationSessionType {
    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        use std::str::FromStr;
        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
        Ok(Self::from_str(&s).expect("infallible"))
    }
}
/// Creates a VerificationSession object.
///
/// After the VerificationSession is created, display a verification modal using the session `client_secret` or send your users to the session’s `url`.
///
/// If your API key is in test mode, verification checks won’t actually process, though everything else will occur as if in live mode.
///
/// Related guide: [Verify your users’ identity documents](https://stripe.com/docs/identity/verify-identity-documents).
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreateIdentityVerificationSession {
    inner: CreateIdentityVerificationSessionBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreateIdentityVerificationSession {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("CreateIdentityVerificationSession").finish_non_exhaustive()
    }
}
impl CreateIdentityVerificationSession {
    /// Construct a new `CreateIdentityVerificationSession`.
    pub fn new() -> Self {
        Self { inner: CreateIdentityVerificationSessionBuilder::new() }
    }
    /// A string to reference this user.
    /// This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems.
    pub fn client_reference_id(mut self, client_reference_id: impl Into<String>) -> Self {
        self.inner.client_reference_id = Some(client_reference_id.into());
        self
    }
    /// Specifies which fields in the response should be expanded.
    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
        self.inner.expand = Some(expand.into());
        self
    }
    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
    /// This can be useful for storing additional information about the object in a structured format.
    /// Individual keys can be unset by posting an empty value to them.
    /// All keys can be unset by posting an empty value to `metadata`.
    pub fn metadata(
        mut self,
        metadata: impl Into<std::collections::HashMap<String, String>>,
    ) -> Self {
        self.inner.metadata = Some(metadata.into());
        self
    }
    /// A set of options for the session’s verification checks.
    pub fn options(mut self, options: impl Into<CreateIdentityVerificationSessionOptions>) -> Self {
        self.inner.options = Some(options.into());
        self
    }
    /// Details provided about the user being verified. These details might be shown to the user.
    pub fn provided_details(mut self, provided_details: impl Into<ProvidedDetailsParam>) -> Self {
        self.inner.provided_details = Some(provided_details.into());
        self
    }
    /// Customer ID
    pub fn related_customer(mut self, related_customer: impl Into<String>) -> Self {
        self.inner.related_customer = Some(related_customer.into());
        self
    }
    /// The ID of the Account representing a customer.
    pub fn related_customer_account(mut self, related_customer_account: impl Into<String>) -> Self {
        self.inner.related_customer_account = Some(related_customer_account.into());
        self
    }
    /// Tokens referencing a Person resource and its associated account.
    pub fn related_person(
        mut self,
        related_person: impl Into<CreateIdentityVerificationSessionRelatedPerson>,
    ) -> Self {
        self.inner.related_person = Some(related_person.into());
        self
    }
    /// The URL that the user will be redirected to upon completing the verification flow.
    pub fn return_url(mut self, return_url: impl Into<String>) -> Self {
        self.inner.return_url = Some(return_url.into());
        self
    }
    /// The type of [verification check](https://docs.stripe.com/identity/verification-checks) to be performed.
    /// You must provide a `type` if not passing `verification_flow`.
    pub fn type_(mut self, type_: impl Into<CreateIdentityVerificationSessionType>) -> Self {
        self.inner.type_ = Some(type_.into());
        self
    }
    /// The ID of a verification flow from the Dashboard.
    /// See <https://docs.stripe.com/identity/verification-flows>.
    pub fn verification_flow(mut self, verification_flow: impl Into<String>) -> Self {
        self.inner.verification_flow = Some(verification_flow.into());
        self
    }
}
impl Default for CreateIdentityVerificationSession {
    fn default() -> Self {
        Self::new()
    }
}
impl CreateIdentityVerificationSession {
    /// Send the request and return the deserialized response.
    pub async fn send<C: StripeClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send(client).await
    }

    /// Send the request and return the deserialized response, blocking until completion.
    pub fn send_blocking<C: StripeBlockingClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send_blocking(client)
    }
}

impl StripeRequest for CreateIdentityVerificationSession {
    type Output = stripe_misc::IdentityVerificationSession;

    fn build(&self) -> RequestBuilder {
        RequestBuilder::new(StripeMethod::Post, "/identity/verification_sessions").form(&self.inner)
    }
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct UpdateIdentityVerificationSessionBuilder {
    #[serde(skip_serializing_if = "Option::is_none")]
    expand: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    metadata: Option<std::collections::HashMap<String, String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    options: Option<UpdateIdentityVerificationSessionOptions>,
    #[serde(skip_serializing_if = "Option::is_none")]
    provided_details: Option<ProvidedDetailsParam>,
    #[serde(rename = "type")]
    #[serde(skip_serializing_if = "Option::is_none")]
    type_: Option<UpdateIdentityVerificationSessionType>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdateIdentityVerificationSessionBuilder {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("UpdateIdentityVerificationSessionBuilder").finish_non_exhaustive()
    }
}
impl UpdateIdentityVerificationSessionBuilder {
    fn new() -> Self {
        Self { expand: None, metadata: None, options: None, provided_details: None, type_: None }
    }
}
/// A set of options for the session’s verification checks.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdateIdentityVerificationSessionOptions {
    /// Options that apply to the [document check](https://docs.stripe.com/identity/verification-checks?type=document).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub document: Option<UpdateIdentityVerificationSessionOptionsDocument>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdateIdentityVerificationSessionOptions {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("UpdateIdentityVerificationSessionOptions").finish_non_exhaustive()
    }
}
impl UpdateIdentityVerificationSessionOptions {
    pub fn new() -> Self {
        Self { document: None }
    }
}
impl Default for UpdateIdentityVerificationSessionOptions {
    fn default() -> Self {
        Self::new()
    }
}
/// Options that apply to the [document check](https://docs.stripe.com/identity/verification-checks?type=document).
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdateIdentityVerificationSessionOptionsDocument {
    /// Array of strings of allowed identity document types.
    /// If the provided identity document isn’t one of the allowed types, the verification check will fail with a document_type_not_allowed error code.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub allowed_types: Option<Vec<UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes>>,
    /// Collect an ID number and perform an [ID number check](https://docs.stripe.com/identity/verification-checks?type=id-number) with the document’s extracted name and date of birth.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub require_id_number: Option<bool>,
    /// Disable image uploads, identity document images have to be captured using the device’s camera.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub require_live_capture: Option<bool>,
    /// Capture a face image and perform a [selfie check](https://docs.stripe.com/identity/verification-checks?type=selfie) comparing a photo ID and a picture of your user’s face.
    /// [Learn more](https://docs.stripe.com/identity/selfie).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub require_matching_selfie: Option<bool>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdateIdentityVerificationSessionOptionsDocument {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("UpdateIdentityVerificationSessionOptionsDocument").finish_non_exhaustive()
    }
}
impl UpdateIdentityVerificationSessionOptionsDocument {
    pub fn new() -> Self {
        Self {
            allowed_types: None,
            require_id_number: None,
            require_live_capture: None,
            require_matching_selfie: None,
        }
    }
}
impl Default for UpdateIdentityVerificationSessionOptionsDocument {
    fn default() -> Self {
        Self::new()
    }
}
/// Array of strings of allowed identity document types.
/// If the provided identity document isn’t one of the allowed types, the verification check will fail with a document_type_not_allowed error code.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    DrivingLicense,
    IdCard,
    Passport,
    /// An unrecognized value from Stripe. Should not be used as a request parameter.
    Unknown(String),
}
impl UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    pub fn as_str(&self) -> &str {
        use UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes::*;
        match self {
            DrivingLicense => "driving_license",
            IdCard => "id_card",
            Passport => "passport",
            Unknown(v) => v,
        }
    }
}

impl std::str::FromStr for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    type Err = std::convert::Infallible;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        use UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes::*;
        match s {
            "driving_license" => Ok(DrivingLicense),
            "id_card" => Ok(IdCard),
            "passport" => Ok(Passport),
            v => {
                tracing::warn!(
                    "Unknown value '{}' for enum '{}'",
                    v,
                    "UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes"
                );
                Ok(Unknown(v.to_owned()))
            }
        }
    }
}
impl std::fmt::Display for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct(stringify!(UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes))
            .finish_non_exhaustive()
    }
}
impl serde::Serialize for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdateIdentityVerificationSessionOptionsDocumentAllowedTypes {
    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        use std::str::FromStr;
        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
        Ok(Self::from_str(&s).expect("infallible"))
    }
}
/// The type of [verification check](https://docs.stripe.com/identity/verification-checks) to be performed.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdateIdentityVerificationSessionType {
    Document,
    IdNumber,
    /// An unrecognized value from Stripe. Should not be used as a request parameter.
    Unknown(String),
}
impl UpdateIdentityVerificationSessionType {
    pub fn as_str(&self) -> &str {
        use UpdateIdentityVerificationSessionType::*;
        match self {
            Document => "document",
            IdNumber => "id_number",
            Unknown(v) => v,
        }
    }
}

impl std::str::FromStr for UpdateIdentityVerificationSessionType {
    type Err = std::convert::Infallible;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        use UpdateIdentityVerificationSessionType::*;
        match s {
            "document" => Ok(Document),
            "id_number" => Ok(IdNumber),
            v => {
                tracing::warn!(
                    "Unknown value '{}' for enum '{}'",
                    v,
                    "UpdateIdentityVerificationSessionType"
                );
                Ok(Unknown(v.to_owned()))
            }
        }
    }
}
impl std::fmt::Display for UpdateIdentityVerificationSessionType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdateIdentityVerificationSessionType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdateIdentityVerificationSessionType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct(stringify!(UpdateIdentityVerificationSessionType)).finish_non_exhaustive()
    }
}
impl serde::Serialize for UpdateIdentityVerificationSessionType {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdateIdentityVerificationSessionType {
    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        use std::str::FromStr;
        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
        Ok(Self::from_str(&s).expect("infallible"))
    }
}
/// Updates a VerificationSession object.
///
/// When the session status is `requires_input`, you can use this method to update the
/// verification check and options.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdateIdentityVerificationSession {
    inner: UpdateIdentityVerificationSessionBuilder,
    session: stripe_misc::IdentityVerificationSessionId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdateIdentityVerificationSession {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("UpdateIdentityVerificationSession").finish_non_exhaustive()
    }
}
impl UpdateIdentityVerificationSession {
    /// Construct a new `UpdateIdentityVerificationSession`.
    pub fn new(session: impl Into<stripe_misc::IdentityVerificationSessionId>) -> Self {
        Self { session: session.into(), inner: UpdateIdentityVerificationSessionBuilder::new() }
    }
    /// Specifies which fields in the response should be expanded.
    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
        self.inner.expand = Some(expand.into());
        self
    }
    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
    /// This can be useful for storing additional information about the object in a structured format.
    /// Individual keys can be unset by posting an empty value to them.
    /// All keys can be unset by posting an empty value to `metadata`.
    pub fn metadata(
        mut self,
        metadata: impl Into<std::collections::HashMap<String, String>>,
    ) -> Self {
        self.inner.metadata = Some(metadata.into());
        self
    }
    /// A set of options for the session’s verification checks.
    pub fn options(mut self, options: impl Into<UpdateIdentityVerificationSessionOptions>) -> Self {
        self.inner.options = Some(options.into());
        self
    }
    /// Details provided about the user being verified. These details may be shown to the user.
    pub fn provided_details(mut self, provided_details: impl Into<ProvidedDetailsParam>) -> Self {
        self.inner.provided_details = Some(provided_details.into());
        self
    }
    /// The type of [verification check](https://docs.stripe.com/identity/verification-checks) to be performed.
    pub fn type_(mut self, type_: impl Into<UpdateIdentityVerificationSessionType>) -> Self {
        self.inner.type_ = Some(type_.into());
        self
    }
}
impl UpdateIdentityVerificationSession {
    /// Send the request and return the deserialized response.
    pub async fn send<C: StripeClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send(client).await
    }

    /// Send the request and return the deserialized response, blocking until completion.
    pub fn send_blocking<C: StripeBlockingClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send_blocking(client)
    }
}

impl StripeRequest for UpdateIdentityVerificationSession {
    type Output = stripe_misc::IdentityVerificationSession;

    fn build(&self) -> RequestBuilder {
        let session = &self.session;
        RequestBuilder::new(
            StripeMethod::Post,
            format!("/identity/verification_sessions/{session}"),
        )
        .form(&self.inner)
    }
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct CancelIdentityVerificationSessionBuilder {
    #[serde(skip_serializing_if = "Option::is_none")]
    expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CancelIdentityVerificationSessionBuilder {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("CancelIdentityVerificationSessionBuilder").finish_non_exhaustive()
    }
}
impl CancelIdentityVerificationSessionBuilder {
    fn new() -> Self {
        Self { expand: None }
    }
}
/// A VerificationSession object can be canceled when it is in `requires_input` [status](https://stripe.com/docs/identity/how-sessions-work).
///
/// Once canceled, future submission attempts are disabled.
/// This cannot be undone.
/// [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel).
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CancelIdentityVerificationSession {
    inner: CancelIdentityVerificationSessionBuilder,
    session: stripe_misc::IdentityVerificationSessionId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CancelIdentityVerificationSession {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("CancelIdentityVerificationSession").finish_non_exhaustive()
    }
}
impl CancelIdentityVerificationSession {
    /// Construct a new `CancelIdentityVerificationSession`.
    pub fn new(session: impl Into<stripe_misc::IdentityVerificationSessionId>) -> Self {
        Self { session: session.into(), inner: CancelIdentityVerificationSessionBuilder::new() }
    }
    /// Specifies which fields in the response should be expanded.
    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
        self.inner.expand = Some(expand.into());
        self
    }
}
impl CancelIdentityVerificationSession {
    /// Send the request and return the deserialized response.
    pub async fn send<C: StripeClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send(client).await
    }

    /// Send the request and return the deserialized response, blocking until completion.
    pub fn send_blocking<C: StripeBlockingClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send_blocking(client)
    }
}

impl StripeRequest for CancelIdentityVerificationSession {
    type Output = stripe_misc::IdentityVerificationSession;

    fn build(&self) -> RequestBuilder {
        let session = &self.session;
        RequestBuilder::new(
            StripeMethod::Post,
            format!("/identity/verification_sessions/{session}/cancel"),
        )
        .form(&self.inner)
    }
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct RedactIdentityVerificationSessionBuilder {
    #[serde(skip_serializing_if = "Option::is_none")]
    expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RedactIdentityVerificationSessionBuilder {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("RedactIdentityVerificationSessionBuilder").finish_non_exhaustive()
    }
}
impl RedactIdentityVerificationSessionBuilder {
    fn new() -> Self {
        Self { expand: None }
    }
}
/// Redact a VerificationSession to remove all collected information from Stripe. This will redact
/// the VerificationSession and all objects related to it, including VerificationReports, Events,
/// request logs, etc.
///
/// A VerificationSession object can be redacted when it is in `requires_input` or `verified`
/// [status](https://stripe.com/docs/identity/how-sessions-work).
/// Redacting a VerificationSession in `requires_action`.
/// state will automatically cancel it.
///
/// The redaction process may take up to four days. When the redaction process is in progress, the
/// VerificationSession’s `redaction.status` field will be set to `processing`; when the process is
/// finished, it will change to `redacted` and an `identity.verification_session.redacted` event
/// will be emitted.
///
/// Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
/// fields that contain personal data will be replaced by the string `[redacted]` or a similar
/// placeholder. The `metadata` field will also be erased. Redacted objects cannot be updated or
/// used for any purpose.
///
/// [Learn more](https://stripe.com/docs/identity/verification-sessions#redact).
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct RedactIdentityVerificationSession {
    inner: RedactIdentityVerificationSessionBuilder,
    session: stripe_misc::IdentityVerificationSessionId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RedactIdentityVerificationSession {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("RedactIdentityVerificationSession").finish_non_exhaustive()
    }
}
impl RedactIdentityVerificationSession {
    /// Construct a new `RedactIdentityVerificationSession`.
    pub fn new(session: impl Into<stripe_misc::IdentityVerificationSessionId>) -> Self {
        Self { session: session.into(), inner: RedactIdentityVerificationSessionBuilder::new() }
    }
    /// Specifies which fields in the response should be expanded.
    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
        self.inner.expand = Some(expand.into());
        self
    }
}
impl RedactIdentityVerificationSession {
    /// Send the request and return the deserialized response.
    pub async fn send<C: StripeClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send(client).await
    }

    /// Send the request and return the deserialized response, blocking until completion.
    pub fn send_blocking<C: StripeBlockingClient>(
        &self,
        client: &C,
    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
        self.customize().send_blocking(client)
    }
}

impl StripeRequest for RedactIdentityVerificationSession {
    type Output = stripe_misc::IdentityVerificationSession;

    fn build(&self) -> RequestBuilder {
        let session = &self.session;
        RequestBuilder::new(
            StripeMethod::Post,
            format!("/identity/verification_sessions/{session}/redact"),
        )
        .form(&self.inner)
    }
}

#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ProvidedDetailsParam {
    /// Email of user being verified
    #[serde(skip_serializing_if = "Option::is_none")]
    pub email: Option<String>,
    /// Phone number of user being verified
    #[serde(skip_serializing_if = "Option::is_none")]
    pub phone: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ProvidedDetailsParam {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("ProvidedDetailsParam").finish_non_exhaustive()
    }
}
impl ProvidedDetailsParam {
    pub fn new() -> Self {
        Self { email: None, phone: None }
    }
}
impl Default for ProvidedDetailsParam {
    fn default() -> Self {
        Self::new()
    }
}