stripe_shared/
dispute_enhanced_evidence_visa_compelling_evidence3.rs1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct DisputeEnhancedEvidenceVisaCompellingEvidence3 {
5 pub disputed_transaction:
7 Option<stripe_shared::DisputeVisaCompellingEvidence3DisputedTransaction>,
8 pub prior_undisputed_transactions:
10 Vec<stripe_shared::DisputeVisaCompellingEvidence3PriorUndisputedTransaction>,
11}
12#[doc(hidden)]
13pub struct DisputeEnhancedEvidenceVisaCompellingEvidence3Builder {
14 disputed_transaction:
15 Option<Option<stripe_shared::DisputeVisaCompellingEvidence3DisputedTransaction>>,
16 prior_undisputed_transactions:
17 Option<Vec<stripe_shared::DisputeVisaCompellingEvidence3PriorUndisputedTransaction>>,
18}
19
20#[allow(
21 unused_variables,
22 irrefutable_let_patterns,
23 clippy::let_unit_value,
24 clippy::match_single_binding,
25 clippy::single_match
26)]
27const _: () = {
28 use miniserde::de::{Map, Visitor};
29 use miniserde::json::Value;
30 use miniserde::{Deserialize, Result, make_place};
31 use stripe_types::miniserde_helpers::FromValueOpt;
32 use stripe_types::{MapBuilder, ObjectDeser};
33
34 make_place!(Place);
35
36 impl Deserialize for DisputeEnhancedEvidenceVisaCompellingEvidence3 {
37 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
38 Place::new(out)
39 }
40 }
41
42 struct Builder<'a> {
43 out: &'a mut Option<DisputeEnhancedEvidenceVisaCompellingEvidence3>,
44 builder: DisputeEnhancedEvidenceVisaCompellingEvidence3Builder,
45 }
46
47 impl Visitor for Place<DisputeEnhancedEvidenceVisaCompellingEvidence3> {
48 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
49 Ok(Box::new(Builder {
50 out: &mut self.out,
51 builder: DisputeEnhancedEvidenceVisaCompellingEvidence3Builder::deser_default(),
52 }))
53 }
54 }
55
56 impl MapBuilder for DisputeEnhancedEvidenceVisaCompellingEvidence3Builder {
57 type Out = DisputeEnhancedEvidenceVisaCompellingEvidence3;
58 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
59 Ok(match k {
60 "disputed_transaction" => Deserialize::begin(&mut self.disputed_transaction),
61 "prior_undisputed_transactions" => {
62 Deserialize::begin(&mut self.prior_undisputed_transactions)
63 }
64 _ => <dyn Visitor>::ignore(),
65 })
66 }
67
68 fn deser_default() -> Self {
69 Self {
70 disputed_transaction: Deserialize::default(),
71 prior_undisputed_transactions: Deserialize::default(),
72 }
73 }
74
75 fn take_out(&mut self) -> Option<Self::Out> {
76 let (Some(disputed_transaction), Some(prior_undisputed_transactions)) =
77 (self.disputed_transaction.take(), self.prior_undisputed_transactions.take())
78 else {
79 return None;
80 };
81 Some(Self::Out { disputed_transaction, prior_undisputed_transactions })
82 }
83 }
84
85 impl Map for Builder<'_> {
86 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
87 self.builder.key(k)
88 }
89
90 fn finish(&mut self) -> Result<()> {
91 *self.out = self.builder.take_out();
92 Ok(())
93 }
94 }
95
96 impl ObjectDeser for DisputeEnhancedEvidenceVisaCompellingEvidence3 {
97 type Builder = DisputeEnhancedEvidenceVisaCompellingEvidence3Builder;
98 }
99
100 impl FromValueOpt for DisputeEnhancedEvidenceVisaCompellingEvidence3 {
101 fn from_value(v: Value) -> Option<Self> {
102 let Value::Object(obj) = v else {
103 return None;
104 };
105 let mut b = DisputeEnhancedEvidenceVisaCompellingEvidence3Builder::deser_default();
106 for (k, v) in obj {
107 match k.as_str() {
108 "disputed_transaction" => b.disputed_transaction = FromValueOpt::from_value(v),
109 "prior_undisputed_transactions" => {
110 b.prior_undisputed_transactions = FromValueOpt::from_value(v)
111 }
112 _ => {}
113 }
114 }
115 b.take_out()
116 }
117 }
118};