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 _ => <dyn Visitor>::ignore(),
65 })
66 }
67
68 fn deser_default() -> Self {
69 Self {
70 buyer_id: Deserialize::default(),
71 fingerprint: Deserialize::default(),
72 transaction_id: Deserialize::default(),
73 }
74 }
75
76 fn take_out(&mut self) -> Option<Self::Out> {
77 let (Some(buyer_id), Some(fingerprint), Some(transaction_id)) =
78 (self.buyer_id.take(), self.fingerprint.take(), self.transaction_id.take())
79 else {
80 return None;
81 };
82 Some(Self::Out { buyer_id, fingerprint, transaction_id })
83 }
84 }
85
86 impl Map for Builder<'_> {
87 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
88 self.builder.key(k)
89 }
90
91 fn finish(&mut self) -> Result<()> {
92 *self.out = self.builder.take_out();
93 Ok(())
94 }
95 }
96
97 impl ObjectDeser for PaymentFlowsPrivatePaymentMethodsAlipayDetails {
98 type Builder = PaymentFlowsPrivatePaymentMethodsAlipayDetailsBuilder;
99 }
100
101 impl FromValueOpt for PaymentFlowsPrivatePaymentMethodsAlipayDetails {
102 fn from_value(v: Value) -> Option<Self> {
103 let Value::Object(obj) = v else {
104 return None;
105 };
106 let mut b = PaymentFlowsPrivatePaymentMethodsAlipayDetailsBuilder::deser_default();
107 for (k, v) in obj {
108 match k.as_str() {
109 "buyer_id" => b.buyer_id = FromValueOpt::from_value(v),
110 "fingerprint" => b.fingerprint = FromValueOpt::from_value(v),
111 "transaction_id" => b.transaction_id = FromValueOpt::from_value(v),
112 _ => {}
113 }
114 }
115 b.take_out()
116 }
117 }
118};