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