primer_api/
model.rs

1use serde::{Serialize, Deserialize};
2#[derive(Debug, Serialize, Deserialize, Default)]
3pub struct PaymentResponseProcessorApiSchema {
4    ///The payment processor used for this payment.
5    pub name: Option<String>,
6    ///The merchant ID registered at the payment processor used for this payment.
7    pub processor_merchant_id: Option<String>,
8    /**If no refund was performed, this value will be set to `0`.
9
10If one or more partial refunds were performed, this value will be a sum
11of all partial refund amounts.
12*/
13    pub amount_refunded: Option<i64>,
14    /**If no capture was performed, this value will be set to `0`.
15
16If one or more partial captures were performed, this value will be a sum
17of all partial capture amounts.
18*/
19    pub amount_captured: Option<i64>,
20}
21impl std::fmt::Display for PaymentResponseProcessorApiSchema {
22    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
23        write!(f, "{}", serde_json::to_string(self).unwrap())
24    }
25}
26#[derive(Debug, Serialize, Deserialize)]
27pub enum ThreeDSecureSkippedReasonCodeEnum {
28    #[serde(rename = "GATEWAY_UNAVAILABLE")]
29    GatewayUnavailable,
30    #[serde(rename = "DISABLED_BY_MERCHANT")]
31    DisabledByMerchant,
32    #[serde(rename = "NOT_SUPPORTED_BY_ISSUER")]
33    NotSupportedByIssuer,
34    #[serde(rename = "FAILED_TO_NEGOTIATE")]
35    FailedToNegotiate,
36    #[serde(rename = "UNKNOWN_ACS_RESPONSE")]
37    UnknownAcsResponse,
38    #[serde(rename = "3DS_SERVER_ERROR")]
39    ThreeDSecureSkippedReasonCodeEnum3DsServerError,
40    #[serde(rename = "ACQUIRER_NOT_CONFIGURED")]
41    AcquirerNotConfigured,
42    #[serde(rename = "ACQUIRER_NOT_PARTICIPATING")]
43    AcquirerNotParticipating,
44}
45#[derive(Debug, Serialize, Deserialize, Default)]
46pub struct StatusReasonApiSchema {
47    ///If the error is of type `ISSUER_DECLINED`, this will be returned.
48    pub code: Option<String>,
49    ///Type of the status.
50    pub type_: String,
51    ///In case of an error on the processor's part, we will return the message returned by the processor. This is usually a human readable error.
52    pub message: Option<String>,
53    /**If the error is of type `ISSUER_DECLINED` this will be returned.
54
55Declines of type `SOFT_DECLINE` may be retried,
56whereas declines of type `HARD_DECLINE` should not be retried.
57*/
58    pub decline_type: Option<String>,
59}
60impl std::fmt::Display for StatusReasonApiSchema {
61    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
62        write!(f, "{}", serde_json::to_string(self).unwrap())
63    }
64}
65#[derive(Debug, Serialize, Deserialize)]
66pub struct AddressApiSchema {
67    ///Two letter ISO country code
68    pub country_code: CountryCodeEnum,
69    ///Name of the city, district, town or village
70    pub city: String,
71    pub last_name: Option<String>,
72    pub first_name: Option<String>,
73    ///Street name, Company name or PO Box
74    pub address_line1: String,
75    ///State, County or Province
76    pub state: Option<String>,
77    ///Apartment, Unit or Building number
78    pub address_line2: Option<String>,
79    ///Postal or ZIP code
80    pub postal_code: Option<String>,
81}
82impl std::fmt::Display for AddressApiSchema {
83    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
84        write!(f, "{}", serde_json::to_string(self).unwrap())
85    }
86}
87#[derive(Debug, Serialize, Deserialize)]
88pub struct RefundPaymentPaymentsIdRefundPostRequired {
89    pub amount: serde_json::Value,
90    pub id: String,
91    pub reason: String,
92    pub order_id: String,
93}
94impl std::fmt::Display for RefundPaymentPaymentsIdRefundPostRequired {
95    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
96        write!(f, "{}", serde_json::to_string(self).unwrap())
97    }
98}
99#[derive(Debug, Serialize, Deserialize)]
100pub struct CardNetworkEnum(pub String);
101#[derive(Debug, Serialize, Deserialize, Default)]
102pub struct KlarnaTokenDetails {
103    pub type_: String,
104    pub brand: Option<String>,
105    pub expiry_date: Option<String>,
106    pub masked_number: Option<String>,
107}
108impl std::fmt::Display for KlarnaTokenDetails {
109    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
110        write!(f, "{}", serde_json::to_string(self).unwrap())
111    }
112}
113#[derive(Debug, Serialize, Deserialize)]
114pub struct OrderFeesApiSchema {
115    ///The type of fee.
116    pub type_: Option<String>,
117    ///The fee amount charged to the customer, in minor  units. e.g. for $7, use `700`.
118    pub amount: serde_json::Value,
119    ///A description of the fee, e.g. "Currency Conversion Fee".
120    pub description: Option<String>,
121}
122impl std::fmt::Display for OrderFeesApiSchema {
123    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
124        write!(f, "{}", serde_json::to_string(self).unwrap())
125    }
126}
127#[derive(Debug, Serialize, Deserialize)]
128pub struct CheckoutPaymentMethodOptionsApiSchema {
129    ///Whether the payment method should be vaulted on a successful payment or not.
130    pub vault_on_success: Option<bool>,
131    ///A description of the payment, as it would typically appear on a bank statement.
132    pub descriptor: Option<String>,
133    /**Payment types, primarily to be used for recurring payments.
134Note: If you successfully vault a `SINGLE_USE` token on payment creation, then there's no need to set a value for this field and it will be flagged as `FIRST_PAYMENT`. Otherwise, see the table below for all possible values.
135
136| paymentType | Use case |
137| --- | --- |
138| `FIRST_PAYMENT` | a customer-initiated payment which is the first in a series of recurring payments or subscription, or a card on file scenario.
139| `ECOMMERCE` | a customer-initiated payment using stored payment details where the cardholder is present.
140| `SUBSCRIPTION` | a merchant-initiated payment as part of a series of payments on a fixed schedule and a set amount.
141| `UNSCHEDULED` | a merchant-initiated payment using stored payment details with no fixed schedule or amount.*/
142    pub payment_type: Option<String>,
143    /**Additional options for the payment methods.
144*/
145    pub options: Option<serde_json::Value>,
146}
147impl std::fmt::Display for CheckoutPaymentMethodOptionsApiSchema {
148    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
149        write!(f, "{}", serde_json::to_string(self).unwrap())
150    }
151}
152#[derive(Debug, Serialize, Deserialize, Default)]
153pub struct ErrorObject {
154    ///An ID that you can quote when contacting the support team (support@primer.io).
155    pub diagnostics_id: Option<String>,
156    ///An error ID
157    pub error_id: Option<String>,
158    ///A human description of the error
159    pub description: Option<String>,
160    ///Returned in case of a badly formed request
161    pub validation_errors: Option<Vec<serde_json::Value>>,
162}
163impl std::fmt::Display for ErrorObject {
164    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
165        write!(f, "{}", serde_json::to_string(self).unwrap())
166    }
167}
168#[derive(Debug, Serialize, Deserialize)]
169pub struct KlarnaSessionDetailsApiSchema {
170    pub billing_address: KlarnaAddressApiSchema,
171    pub order_lines: Vec<serde_json::Value>,
172    pub recurring_description: Option<String>,
173    pub shipping_address: Option<KlarnaAddressApiSchema>,
174    pub locale: String,
175    pub token_details: Option<KlarnaTokenDetails>,
176    pub purchase_country: String,
177    pub purchase_currency: String,
178}
179impl std::fmt::Display for KlarnaSessionDetailsApiSchema {
180    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
181        write!(f, "{}", serde_json::to_string(self).unwrap())
182    }
183}
184#[derive(Debug, Serialize, Deserialize)]
185pub struct VerifiedMerchantPaymentMethodTokenApiResponse {
186    ///Whether or not this payment method was verified
187    pub is_verified: bool,
188    pub merchant_payment_method_token_api_response: MerchantPaymentMethodTokenApiResponse,
189}
190impl std::fmt::Display for VerifiedMerchantPaymentMethodTokenApiResponse {
191    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
192        write!(f, "{}", serde_json::to_string(self).unwrap())
193    }
194}
195#[derive(Debug, Serialize, Deserialize)]
196pub struct PaymentCaptureApiRequest {
197    /**Indicates whether the capture request is the final capture request.
198
199After a final capture, no subsequent captures are allowed.*/
200    pub final_: Option<bool>,
201    /**The amount you would like to capture, in minor units. The currency used on authorization is assumed.
202
203If no amount is specified it defaults to the full amount.*/
204    pub amount: Option<serde_json::Value>,
205}
206impl std::fmt::Display for PaymentCaptureApiRequest {
207    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
208        write!(f, "{}", serde_json::to_string(self).unwrap())
209    }
210}
211#[derive(Debug, Serialize, Deserialize)]
212pub struct CheckoutPaymentMethodOptionCardNetworkApiSchema {
213    /**Options for the card network `CARD_NETWORK_TYPE`.
214
215[The list of available card networks and their `CARD_NETWORK_TYPE` can be found here.](https://www.notion.so/primerio/Payment-Method-Types-2b971a8c54c3452cae0b2fffe9167d72)
216*/
217    pub card_network_type: Option<serde_json::Value>,
218}
219impl std::fmt::Display for CheckoutPaymentMethodOptionCardNetworkApiSchema {
220    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
221        write!(f, "{}", serde_json::to_string(self).unwrap())
222    }
223}
224#[derive(Debug, Serialize, Deserialize, Default)]
225pub struct PaymentCancelApiRequest {
226    ///You can optionally specify a reason for the cancellation. This is for your own records.
227    pub reason: Option<String>,
228}
229impl std::fmt::Display for PaymentCancelApiRequest {
230    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
231        write!(f, "{}", serde_json::to_string(self).unwrap())
232    }
233}
234#[derive(Debug, Serialize, Deserialize)]
235pub enum BlockingPaymentActionTypeEnum {
236    #[serde(rename = "3DS_AUTHENTICATION")]
237    BlockingPaymentActionTypeEnum3DsAuthentication,
238    #[serde(rename = "USE_PRIMER_SDK")]
239    UsePrimerSdk,
240}
241#[derive(Debug, Serialize, Deserialize)]
242pub struct CreateClientSideTokenClientSessionPostRequired {
243    pub order_id: String,
244    pub metadata: serde_json::Value,
245    pub currency_code: String,
246    pub customer_id: String,
247    pub order: OrderDetailsApiSchema,
248    pub customer: CheckoutCustomerDetailsApiSchema,
249    pub payment_method: CheckoutPaymentMethodOptionsApiSchema,
250    pub amount: serde_json::Value,
251}
252impl std::fmt::Display for CreateClientSideTokenClientSessionPostRequired {
253    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
254        write!(f, "{}", serde_json::to_string(self).unwrap())
255    }
256}
257#[derive(Debug, Serialize, Deserialize, Default)]
258pub struct VerifiedMerchantPaymentMethodTokenListApiResponse {
259    pub data: Option<Vec<VerifiedMerchantPaymentMethodTokenApiResponse>>,
260}
261impl std::fmt::Display for VerifiedMerchantPaymentMethodTokenListApiResponse {
262    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
263        write!(f, "{}", serde_json::to_string(self).unwrap())
264    }
265}
266#[derive(Debug, Serialize, Deserialize)]
267pub enum RecurringTransactionTypeEnum {
268    #[serde(rename = "FIRST_PAYMENT")]
269    FirstPayment,
270    #[serde(rename = "ECOMMERCE")]
271    Ecommerce,
272    #[serde(rename = "SUBSCRIPTION")]
273    Subscription,
274    #[serde(rename = "UNSCHEDULED")]
275    Unscheduled,
276}
277#[derive(Debug, Serialize, Deserialize)]
278pub struct CoreApiApiCommonsSchemasAddessAddressApiSchema {
279    pub address_line1: Option<String>,
280    pub postal_code: Option<String>,
281    pub address_line2: Option<String>,
282    pub last_name: Option<String>,
283    pub state: Option<String>,
284    pub first_name: Option<String>,
285    pub city: Option<String>,
286    ///An enumeration.
287    pub country_code: Option<CountryCodeEnum>,
288}
289impl std::fmt::Display for CoreApiApiCommonsSchemasAddessAddressApiSchema {
290    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
291        write!(f, "{}", serde_json::to_string(self).unwrap())
292    }
293}
294#[derive(Debug, Serialize, Deserialize)]
295pub struct KlarnaAddressApiSchema {
296    pub address_line2: Option<String>,
297    pub email: Option<String>,
298    pub city: Option<String>,
299    pub first_name: Option<String>,
300    pub postal_code: Option<String>,
301    pub title: Option<String>,
302    pub last_name: Option<String>,
303    pub phone_number: Option<String>,
304    pub address_line1: Option<String>,
305    pub address_line3: Option<String>,
306    ///An enumeration.
307    pub country_code: Option<CountryCodeEnum>,
308    pub state: Option<String>,
309}
310impl std::fmt::Display for KlarnaAddressApiSchema {
311    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
312        write!(f, "{}", serde_json::to_string(self).unwrap())
313    }
314}
315#[derive(Debug, Serialize, Deserialize)]
316pub struct PaymentCardTokenApiSchema {
317    pub cardholder_name: Option<String>,
318    pub is_network_tokenized: Option<bool>,
319    pub expiration_month: String,
320    pub network: Option<String>,
321    pub expiration_year: String,
322    pub first6_digits: Option<String>,
323    pub last4_digits: String,
324    pub bin_data: Option<BinDataApiSchema>,
325}
326impl std::fmt::Display for PaymentCardTokenApiSchema {
327    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
328        write!(f, "{}", serde_json::to_string(self).unwrap())
329    }
330}
331#[derive(Debug, Serialize, Deserialize)]
332pub enum PrepaidReloadableEnum {
333    #[serde(rename = "RELOADABLE")]
334    Reloadable,
335    #[serde(rename = "NON_RELOADABLE")]
336    NonReloadable,
337    #[serde(rename = "NOT_APPLICABLE")]
338    NotApplicable,
339    #[serde(rename = "UNKNOWN")]
340    Unknown,
341}
342#[derive(Debug, Serialize, Deserialize)]
343pub struct ThreeDSecureAuthenticationApiSchema {
344    pub protocol_version: Option<String>,
345    ///An enumeration.
346    pub response_code: String,
347    pub challenge_issued: Option<bool>,
348    pub reason_text: Option<String>,
349    pub reason_code: Option<serde_json::Value>,
350}
351impl std::fmt::Display for ThreeDSecureAuthenticationApiSchema {
352    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
353        write!(f, "{}", serde_json::to_string(self).unwrap())
354    }
355}
356#[derive(Debug, Serialize, Deserialize)]
357pub struct OrderShippingApiSchema {
358    ///The shipping amount charged to the customer, in minor units. e.g. for $7, use `700`.
359    pub amount: Option<serde_json::Value>,
360}
361impl std::fmt::Display for OrderShippingApiSchema {
362    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
363        write!(f, "{}", serde_json::to_string(self).unwrap())
364    }
365}
366#[derive(Debug, Serialize, Deserialize)]
367pub struct PaymentApiResponse {
368    ///The payment method options provided in the request, as well as the token used to process the payment.
369    pub payment_method: Option<PaymentResponsePaymentMethodOptionsApiSchema>,
370    ///Your reference for the payment.
371    pub order_id: Option<String>,
372    ///The unique identifier for your customer.
373    pub customer_id: Option<String>,
374    ///More information associated with the customer.
375    pub customer: Option<CustomerDetailsApiSchema>,
376    ///More information associated with the payment processor, including the processor name.
377    pub processor: Option<PaymentResponseProcessorApiSchema>,
378    /**A list summarizing the transactions that occurred while processing the payment.
379
380Note: a refund is a separate transaction and so will appear in this `transactions` list if a refund was performed.*/
381    pub transactions: Option<Vec<TransactionOverviewApiSchema>>,
382    ///The date and time at which the payment was created in UTC format.
383    pub date: Option<String>,
384    /**Additional data to be used throughout the payment lifecycle.
385*/
386    pub metadata: Option<serde_json::Value>,
387    ///More information associated with the order.
388    pub order: Option<OrderDetailsApiSchema>,
389    /**The unique payment ID.
390
391You can use this ID to retrieve the payment details, or perform downstream
392operations.
393*/
394    pub id: Option<String>,
395    /**Check this field for more information regarding the payment's status. This is especially useful when the status is `DECLINED` or `FAILED`.
396*/
397    pub status_reason: Option<StatusReasonApiSchema>,
398    ///See the payment [status table](../docs#payment-status) for more information.
399    pub status: Option<String>,
400    /**The 3-letter currency code in [ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes).
401e.g. use `USD` for US dollars.
402*/
403    pub currency_code: Option<String>,
404    ///The amount you charged the customer, in minor units.
405    pub amount: Option<serde_json::Value>,
406    ///Required action to perform in order to resume the payment workflow. This can be requiring a 3DS check from the customer for instance.
407    pub required_action: Option<PaymentRequiredActionApiSchema>,
408}
409impl std::fmt::Display for PaymentApiResponse {
410    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
411        write!(f, "{}", serde_json::to_string(self).unwrap())
412    }
413}
414#[derive(Debug, Serialize, Deserialize)]
415pub struct KlarnaCustomerTokenApiSchema {
416    pub klarna_customer_token: String,
417    pub session_data: KlarnaSessionDetailsApiSchema,
418}
419impl std::fmt::Display for KlarnaCustomerTokenApiSchema {
420    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
421        write!(f, "{}", serde_json::to_string(self).unwrap())
422    }
423}
424#[derive(Debug, Serialize, Deserialize, Default)]
425pub struct BinDataOptionalApiSchema {
426    /**[The list of available card networks and their `CARD_NETWORK_TYPE` can be found here.](https://www.notion.so/primerio/Payment-Method-Types-2b971a8c54c3452cae0b2fffe9167d72)
427*/
428    pub network: Option<String>,
429}
430impl std::fmt::Display for BinDataOptionalApiSchema {
431    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
432        write!(f, "{}", serde_json::to_string(self).unwrap())
433    }
434}
435#[derive(Debug, Serialize, Deserialize)]
436pub enum DeclineTypeEnum {
437    #[serde(rename = "SOFT_DECLINE")]
438    SoftDecline,
439    #[serde(rename = "HARD_DECLINE")]
440    HardDecline,
441}
442#[derive(Debug, Serialize, Deserialize)]
443pub struct PaymentRefundApiRequest {
444    /**The amount you would like to refund the customer, in minor units. e.g. for $7, use `700`.
445
446Defaults to remaining non-refunded amount.*/
447    pub amount: Option<serde_json::Value>,
448    ///You can optionally specify a reason for the refund. This is for your own records.
449    pub reason: Option<String>,
450    /**Optionally you can pass a specific order ID for the refund.
451
452By default this will be set to the original `orderId` given on payment creation.*/
453    pub order_id: Option<String>,
454}
455impl std::fmt::Display for PaymentRefundApiRequest {
456    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
457        write!(f, "{}", serde_json::to_string(self).unwrap())
458    }
459}
460#[derive(Debug, Serialize, Deserialize)]
461pub enum ProductTypeEnum {
462    #[serde(rename = "PHYSICAL")]
463    Physical,
464    #[serde(rename = "DIGITAL")]
465    Digital,
466}
467#[derive(Debug, Serialize, Deserialize, Default)]
468pub struct PaymentRequiredActionApiSchema {
469    ///Action name
470    pub name: String,
471    ///Human description of the required action to perform.
472    pub description: String,
473    ///If the action requires customer data, instantiate the checkout SDK with this client session token to resume the session.
474    pub client_token: Option<String>,
475}
476impl std::fmt::Display for PaymentRequiredActionApiSchema {
477    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
478        write!(f, "{}", serde_json::to_string(self).unwrap())
479    }
480}
481#[derive(Debug, Serialize, Deserialize, Default)]
482pub struct MerchantPaymentMethodTokenListApiResponse {
483    pub data: Option<Vec<MerchantPaymentMethodTokenApiResponse>>,
484}
485impl std::fmt::Display for MerchantPaymentMethodTokenListApiResponse {
486    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
487        write!(f, "{}", serde_json::to_string(self).unwrap())
488    }
489}
490#[derive(Debug, Serialize, Deserialize)]
491pub struct Currency(pub serde_json::Value);
492#[derive(Debug, Serialize, Deserialize, Default)]
493pub struct ClientSessionWarningsApiResponse {
494    ///A unique code describing the particular issue
495    pub code: Option<String>,
496    ///More information as to the reason for the warning
497    pub message: Option<String>,
498    ///The type of the connection involved
499    pub type_: Option<String>,
500}
501impl std::fmt::Display for ClientSessionWarningsApiResponse {
502    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
503        write!(f, "{}", serde_json::to_string(self).unwrap())
504    }
505}
506#[derive(Debug, Serialize, Deserialize)]
507pub struct PaymentSummaryApiSchema {
508    ///Your reference for the payment.
509    pub order_id: String,
510    ///The payment amount, in minor units. e.g. $7 would show as `700`.
511    pub amount: i64,
512    /**The unique payment ID.
513
514You can use this ID to retrieve the payment details, or perform downstream
515operations.
516*/
517    pub id: String,
518    ///The payment processor used for this payment.
519    pub processor: Option<String>,
520    ///See the payment [status table](../docs#payment-status) for more information.
521    pub status: String,
522    /**Additional data to be used throughout the payment lifecycle.
523
524A dictionary of key-value pairs where the values can only be strings or
525integers.
526
527e.g. `{"productId": 1001, "merchantId": "a13bsd62s"}`
528*/
529    pub metadata: Option<serde_json::Value>,
530    ///The date and time at which the payment was created in UTC format.
531    pub date: String,
532    /**The 3-letter currency code in [ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes).
533e.g. use `USD` for US dollars.
534*/
535    pub currency_code: String,
536}
537impl std::fmt::Display for PaymentSummaryApiSchema {
538    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
539        write!(f, "{}", serde_json::to_string(self).unwrap())
540    }
541}
542#[derive(Debug, Serialize, Deserialize)]
543pub struct Error422Response {
544    pub error_object: ErrorObject,
545}
546impl std::fmt::Display for Error422Response {
547    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
548        write!(f, "{}", serde_json::to_string(self).unwrap())
549    }
550}
551#[derive(Debug, Serialize, Deserialize)]
552pub struct PayPalOrderTokenApiSchema {
553    ///Information about the PayPal customer
554    pub external_payer_info: Option<PayPalExternalPayerInfoApiSchema>,
555    pub paypal_status: Option<String>,
556    pub paypal_order_id: String,
557}
558impl std::fmt::Display for PayPalOrderTokenApiSchema {
559    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
560        write!(f, "{}", serde_json::to_string(self).unwrap())
561    }
562}
563#[derive(Debug, Serialize, Deserialize)]
564pub struct ClientSessionApiRequest {
565    /**A unique identifier for your customer.
566Create a client session token with a `customerId` to enable the client-side SDK to retrieve and manage your customer's saved payment methods. A client session token also enables saving payment methods against this customer id.*/
567    pub customer_id: Option<String>,
568    ///Your reference for the payment.
569    pub order_id: Option<String>,
570    /**The amount you would like to charge the customer, in minor units. e.g. for $7, use `700`.
571
572Some currencies, such as Japanese Yen, do not have minor units. In this case you should use the value as it is, without any formatting. For example for ¥100, use `100`.
573
574If the amount is provided on this level, it would override any amount calculated from the provided line items, shipping and other amounts.*/
575    pub amount: Option<serde_json::Value>,
576    ///More information associated with the customer.
577    pub customer: Option<CheckoutCustomerDetailsApiSchema>,
578    ///More information associated with the order.
579    pub order: Option<OrderDetailsApiSchema>,
580    ///Enable certain options associated with the payment method.
581    pub payment_method: Option<CheckoutPaymentMethodOptionsApiSchema>,
582    /**The 3-letter currency code in [ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes).
583e.g. use `USD` for US dollars.
584*/
585    pub currency_code: Option<String>,
586    /**Additional data to be used throughout the payment lifecycle.
587
588A dictionary of key-value pairs where the values can only be strings or
589integers.
590
591e.g. `{"productId": 1001, "merchantId": "a13bsd62s"}`
592*/
593    pub metadata: Option<serde_json::Value>,
594}
595impl std::fmt::Display for ClientSessionApiRequest {
596    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
597        write!(f, "{}", serde_json::to_string(self).unwrap())
598    }
599}
600#[derive(Debug, Serialize, Deserialize)]
601pub struct Error400Response {
602    pub error_object: ErrorObject,
603}
604impl std::fmt::Display for Error400Response {
605    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
606        write!(f, "{}", serde_json::to_string(self).unwrap())
607    }
608}
609#[derive(Debug, Serialize, Deserialize, Default)]
610pub struct PaymentResumeApiRequest {
611    ///A token containing any information that is sent back from the checkout to complete a blocked payment flow.
612    pub resume_token: String,
613}
614impl std::fmt::Display for PaymentResumeApiRequest {
615    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
616        write!(f, "{}", serde_json::to_string(self).unwrap())
617    }
618}
619#[derive(Debug, Serialize, Deserialize, Default)]
620pub struct PaymentRequestPaymentMethodOptionsApiSchema {
621    ///A description of the payment, as it would typically appear on a bank statement.
622    pub descriptor: Option<String>,
623    ///Whether the payment method should be vaulted on a successful payment or not.
624    pub vault_on_success: Option<bool>,
625    /**Payment types, primarily to be used for recurring payments.
626Note: If you successfully vault a `SINGLE_USE` token on payment creation, then there's no need to set a value for this field and it will be flagged as `FIRST_PAYMENT`. Otherwise, see the table below for all possible values.
627
628| paymentType | Use case |
629| --- | --- |
630| `FIRST_PAYMENT` | a customer-initiated payment which is the first in a series of recurring payments or subscription, or a card on file scenario.
631| `ECOMMERCE` | a customer-initiated payment using stored payment details where the cardholder is present.
632| `SUBSCRIPTION` | a merchant-initiated payment as part of a series of payments on a fixed schedule and a set amount.
633| `UNSCHEDULED` | a merchant-initiated payment using stored payment details with no fixed schedule or amount.*/
634    pub payment_type: Option<String>,
635}
636impl std::fmt::Display for PaymentRequestPaymentMethodOptionsApiSchema {
637    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
638        write!(f, "{}", serde_json::to_string(self).unwrap())
639    }
640}
641#[derive(Debug, Serialize, Deserialize)]
642pub struct CheckoutPaymentMethodOptionApiSchema {
643    ///Surcharge information
644    pub surcharge: Option<CheckoutPaymentMethodOptionSurchargeApiSchema>,
645}
646impl std::fmt::Display for CheckoutPaymentMethodOptionApiSchema {
647    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
648        write!(f, "{}", serde_json::to_string(self).unwrap())
649    }
650}
651#[derive(Debug, Serialize, Deserialize)]
652pub struct TransactionOverviewApiSchema {
653    ///Processor's unique identifier for the transaction
654    pub processor_transaction_id: Option<String>,
655    ///Date & time of the transaction (UTC)
656    pub date: String,
657    ///Transaction status, please refer to the [Transaction Status Codes](#section/API-Usage-Guide/Payment-Status) table for more information
658    pub processor_status: Option<String>,
659    /**Processor's main account identifier.
660
661* Adyen: Account code
662* Braintree: Merchant ID
663* Stripe: Account ID"
664*/
665    pub processor_merchant_id: String,
666    ///Transaction amount in minor units
667    pub amount: serde_json::Value,
668    /**
669The 3-letter currency code in [ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes).
670e.g. use `USD` for US dollars.
671*/
672    pub currency_code: String,
673    ///An identifier of a processor.
674    pub processor_name: Option<String>,
675    /**If the transaction has a declined or failed status.
676
677Only if the status is `DECLINED` or `FAILED`, otherwise `null`.
678*/
679    pub processor_status_reason: Option<StatusReasonApiSchema>,
680    pub transaction_type: Option<String>,
681}
682impl std::fmt::Display for TransactionOverviewApiSchema {
683    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
684        write!(f, "{}", serde_json::to_string(self).unwrap())
685    }
686}
687#[derive(Debug, Serialize, Deserialize)]
688pub enum AccountFundingTypeEnum {
689    #[serde(rename = "CREDIT")]
690    Credit,
691    #[serde(rename = "DEBIT")]
692    Debit,
693    #[serde(rename = "PREPAID")]
694    Prepaid,
695    #[serde(rename = "CHARGE")]
696    Charge,
697    #[serde(rename = "DEFERRED_DEBIT")]
698    DeferredDebit,
699    #[serde(rename = "UNKNOWN")]
700    Unknown,
701}
702#[derive(Debug, Serialize, Deserialize)]
703pub struct ClientSessionUpdateApiRequest {
704    /**More information associated with the order.
705
706Each of the fields in this object must be updated in its entirety, i.e. provide the entire object to update it. Anything provided previously will be overwritten.
707*/
708    pub order: Option<OrderDetailsApiSchema>,
709    ///Your reference for the order.
710    pub order_id: Option<String>,
711    /**More information associated with the customer.
712
713Each of the fields in this object must be updated in its entirety, i.e. provide the entire object to update it. Anything provided previously will be overwritten.
714*/
715    pub customer: Option<CheckoutCustomerDetailsApiSchema>,
716    ///Enable certain options associated with the payment method. Provide the entire object to update it. Anything provided previously will be overwritten.
717    pub payment_method: Option<CheckoutPaymentMethodOptionsApiSchema>,
718    /**
719The 3-letter currency code in [ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes).
720e.g. use `USD` for US dollars.
721*/
722    pub currency_code: Option<String>,
723    /**The amount you would like to charge the customer, in minor units. e.g. for $7, use `700`.
724
725Some currencies, such as Japanese Yen, do not have minor units. In this case you should use the value as it is, without any formatting. For example for ¥100, use `100`.
726
727If the amount is provided on this level, it would override any amount calculated from the provided line items, shipping and other amounts.*/
728    pub amount: Option<serde_json::Value>,
729    /**Additional data to be used throughout the payment lifecycle.
730
731Provide the entire object to update it. Anything provided previously will be overwritten.
732*/
733    pub metadata: Option<serde_json::Value>,
734    ///A unique identifier for your customer.
735    pub customer_id: Option<String>,
736    ///Client token for use in the Primer-JS SDK obtained via `POST` /client-session API call.
737    pub client_token: Option<String>,
738}
739impl std::fmt::Display for ClientSessionUpdateApiRequest {
740    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
741        write!(f, "{}", serde_json::to_string(self).unwrap())
742    }
743}
744#[derive(Debug, Serialize, Deserialize)]
745pub struct ClientSessionApiResponse {
746    ///More information associated with the customer.
747    pub customer: Option<CustomerDetailsApiSchema>,
748    ///A unique identifier for your customer.
749    pub customer_id: Option<String>,
750    ///More information associated with the order.
751    pub order: Option<OrderDetailsApiSchema>,
752    ///Your reference for the payment.
753    pub order_id: Option<String>,
754    /**Additional data to be used throughout the payment lifecycle.
755*/
756    pub metadata: Option<serde_json::Value>,
757    /**The amount you are going to charge the customer, in minor units. This amount is calculated from the line items, shipping and other amounts provided in the `order`.
758If a top-level amount is provided, it would override any calculated amount.*/
759    pub amount: Option<serde_json::Value>,
760    ///Enable certain options associated with the payment methods.
761    pub payment_method: Option<CheckoutPaymentMethodOptionsApiSchema>,
762    /**The 3-letter currency code in [ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes).
763e.g. use `USD` for US dollars.
764*/
765    pub currency_code: Option<String>,
766}
767impl std::fmt::Display for ClientSessionApiResponse {
768    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
769        write!(f, "{}", serde_json::to_string(self).unwrap())
770    }
771}
772#[derive(Debug, Serialize, Deserialize, Default)]
773pub struct PaymentListApiResponse {
774    pub next_cursor: Option<String>,
775    pub data: Option<Vec<PaymentSummaryApiSchema>>,
776    pub prev_cursor: Option<String>,
777}
778impl std::fmt::Display for PaymentListApiResponse {
779    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
780        write!(f, "{}", serde_json::to_string(self).unwrap())
781    }
782}
783#[derive(Debug, Serialize, Deserialize)]
784pub struct PaymentResponsePaymentMethodOptionsApiSchema {
785    ///The payment method token used to authorize the transaction.
786    pub payment_method_token: Option<String>,
787    ///Payment method type
788    pub payment_method_type: Option<String>,
789    ///Whether the payment method token represents a vaulted payment method and can be used for future payments.
790    pub is_vaulted: Option<bool>,
791    ///The description of the payment, as it would typically appear on a bank statement.
792    pub descriptor: Option<String>,
793    ///Unique analytics identifier corresponding to a payment method
794    pub analytics_id: Option<String>,
795    ///Payment method data
796    pub payment_method_data: Option<serde_json::Value>,
797    pub three_d_secure_authentication: Option<ThreeDSecureAuthenticationApiSchema>,
798}
799impl std::fmt::Display for PaymentResponsePaymentMethodOptionsApiSchema {
800    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
801        write!(f, "{}", serde_json::to_string(self).unwrap())
802    }
803}
804#[derive(Debug, Serialize, Deserialize)]
805pub struct CountryCodeEnum(pub serde_json::Value);
806#[derive(Debug, Serialize, Deserialize)]
807pub enum ThreeDSecureFailedReasonCodeEnum {
808    #[serde(rename = "UNKNOWN")]
809    Unknown,
810    #[serde(rename = "REJECTED_BY_ISSUER")]
811    RejectedByIssuer,
812    #[serde(rename = "CARD_AUTHENTICATION_FAILED")]
813    CardAuthenticationFailed,
814    #[serde(rename = "UNKNOWN_DEVICE")]
815    UnknownDevice,
816    #[serde(rename = "UNSUPPORTED_DEVICE")]
817    UnsupportedDevice,
818    #[serde(rename = "EXCEEDS_AUTHENTICATION_FREQUENCY_LIMIT")]
819    ExceedsAuthenticationFrequencyLimit,
820    #[serde(rename = "EXPIRED_CARD")]
821    ExpiredCard,
822    #[serde(rename = "INVALID_CARD_NUMBER")]
823    InvalidCardNumber,
824    #[serde(rename = "INVALID_TRANSACTION")]
825    InvalidTransaction,
826    #[serde(rename = "NO_CARD_RECORD")]
827    NoCardRecord,
828    #[serde(rename = "SECURITY_FAILURE")]
829    SecurityFailure,
830    #[serde(rename = "STOLEN_CARD")]
831    StolenCard,
832    #[serde(rename = "SUSPECTED_FRAUD")]
833    SuspectedFraud,
834    #[serde(rename = "TRANSACTION_NOT_PERMITTED_TO_CARDHOLDER")]
835    TransactionNotPermittedToCardholder,
836    #[serde(rename = "CARDHOLDER_NOT_ENROLLED_IN_SERVICE")]
837    CardholderNotEnrolledInService,
838    #[serde(rename = "TRANSACTION_TIMED_OUT_AT_THE_ACS")]
839    TransactionTimedOutAtTheAcs,
840    #[serde(rename = "LOW_CONFIDENCE")]
841    LowConfidence,
842    #[serde(rename = "MEDIUM_CONFIDENCE")]
843    MediumConfidence,
844    #[serde(rename = "HIGH_CONFIDENCE")]
845    HighConfidence,
846    #[serde(rename = "VERY_HIGH_CONFIDENCE")]
847    VeryHighConfidence,
848    #[serde(rename = "EXCEEDS_ACS_MAXIMUM_CHALLENGES")]
849    ExceedsAcsMaximumChallenges,
850    #[serde(rename = "NON_PAYMENT_NOT_SUPPORTED")]
851    NonPaymentNotSupported,
852    #[serde(rename = "THREE_RI_NOT_SUPPORTED")]
853    ThreeRiNotSupported,
854    #[serde(rename = "ACS_TECHNICAL_ISSUE")]
855    AcsTechnicalIssue,
856    #[serde(rename = "DECOUPLED_REQUIRED_BY_ACS")]
857    DecoupledRequiredByAcs,
858    #[serde(rename = "DECOUPLED_MAX_EXPIRY_EXCEEDED")]
859    DecoupledMaxExpiryExceeded,
860    #[serde(rename = "DECOUPLED_AUTHENTICATION_INSUFFICIENT_TIME")]
861    DecoupledAuthenticationInsufficientTime,
862    #[serde(rename = "AUTHENTICATION_ATTEMPTED_BUT_NOT_PERFORMED_BY_CARDHOLDER")]
863    AuthenticationAttemptedButNotPerformedByCardholder,
864    #[serde(rename = "ACS_TIMED_OUT")]
865    AcsTimedOut,
866    #[serde(rename = "INVALID_ACS_RESPONSE")]
867    InvalidAcsResponse,
868    #[serde(rename = "ACS_SYSTEM_ERROR_RESPONSE")]
869    AcsSystemErrorResponse,
870    #[serde(rename = "ERROR_GENERATING_CAVV")]
871    ErrorGeneratingCavv,
872    #[serde(rename = "PROTOCOL_VERSION_NOT_SUPPORTED")]
873    ProtocolVersionNotSupported,
874    #[serde(rename = "TRANSACTION_EXCLUDED_FROM_ATTEMPTS_PROCESSING")]
875    TransactionExcludedFromAttemptsProcessing,
876    #[serde(rename = "REQUESTED_PROGRAM_NOT_SUPPORTED")]
877    RequestedProgramNotSupported,
878}
879#[derive(Debug, Serialize, Deserialize)]
880pub struct CheckoutCustomerDetailsApiSchema {
881    ///The customer's last name
882    pub last_name: Option<String>,
883    /**Customer email address.
884*/
885    pub email_address: Option<String>,
886    ///Customer shipping address
887    pub shipping_address: Option<CoreApiApiCommonsSchemasAddessAddressApiSchema>,
888    /**Customer billing address.
889*/
890    pub billing_address: Option<CoreApiApiCommonsSchemasAddessAddressApiSchema>,
891    ///The customer's tax id number for tax exemptions
892    pub tax_id: Option<String>,
893    ///The customer's first name
894    pub first_name: Option<String>,
895    ///The customer's mobile number
896    pub mobile_number: Option<String>,
897    ///The customer's national identification number
898    pub national_document_id: Option<String>,
899}
900impl std::fmt::Display for CheckoutCustomerDetailsApiSchema {
901    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
902        write!(f, "{}", serde_json::to_string(self).unwrap())
903    }
904}
905#[derive(Debug, Serialize, Deserialize)]
906pub struct MerchantPaymentMethodTokenApiResponse {
907    ///Creation date & time of the object (UTC)
908    pub created_at: Option<String>,
909    ///Date & time when this object was revoked. (UTC)
910    pub deleted_at: Option<String>,
911    ///The ID representing the customer
912    pub customer_id: Option<String>,
913    ///Whether or not this object has been revoked.
914    pub deleted: Option<bool>,
915    ///Payment method type
916    pub payment_method_type: Option<String>,
917    ///Unique analytics identifier corresponding to a payment method
918    pub analytics_id: Option<String>,
919    ///Payment method data
920    pub payment_method_data: Option<serde_json::Value>,
921    ///Whether or not this payment method is the default
922    pub default: Option<bool>,
923    ///A friendly description given by the user
924    pub description: Option<String>,
925    ///The vaulted payment method token.
926    pub token: Option<String>,
927    ///* `MULTI_USE` a vaulted token that can be re-used with subsequent payments
928    pub token_type: Option<String>,
929}
930impl std::fmt::Display for MerchantPaymentMethodTokenApiResponse {
931    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
932        write!(f, "{}", serde_json::to_string(self).unwrap())
933    }
934}
935#[derive(Debug, Serialize, Deserialize)]
936pub enum TransactionDeclineReasonV2Enum {
937    #[serde(rename = "ERROR")]
938    Error,
939    #[serde(rename = "INVALID_CARD_NUMBER")]
940    InvalidCardNumber,
941    #[serde(rename = "EXPIRED_CARD")]
942    ExpiredCard,
943    #[serde(rename = "LOST_OR_STOLEN_CARD")]
944    LostOrStolenCard,
945    #[serde(rename = "SUSPECTED_FRAUD")]
946    SuspectedFraud,
947    #[serde(rename = "UNKNOWN")]
948    Unknown,
949    #[serde(rename = "DECLINED")]
950    Declined,
951    #[serde(rename = "REFER_TO_CARD_ISSUER")]
952    ReferToCardIssuer,
953    #[serde(rename = "DO_NOT_HONOR")]
954    DoNotHonor,
955    #[serde(rename = "INSUFFICIENT_FUNDS")]
956    InsufficientFunds,
957    #[serde(rename = "WITHDRAWAL_LIMIT_EXCEEDED")]
958    WithdrawalLimitExceeded,
959    #[serde(rename = "ISSUER_TEMPORARILY_UNAVAILABLE")]
960    IssuerTemporarilyUnavailable,
961    #[serde(rename = "AUTHENTICATION_REQUIRED")]
962    AuthenticationRequired,
963}
964#[derive(Debug, Serialize, Deserialize, Default)]
965pub struct CheckoutPaymentMethodOptionSurchargeApiSchema {
966    ///The surcharge amount, in minor units. Surcharge amount must be used in conjunction with line item amounts, if a top level amount is passed then surcharge will not be calculated.
967    pub amount: Option<i64>,
968}
969impl std::fmt::Display for CheckoutPaymentMethodOptionSurchargeApiSchema {
970    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
971        write!(f, "{}", serde_json::to_string(self).unwrap())
972    }
973}
974#[derive(Debug, Serialize, Deserialize, Default)]
975pub struct VaultPaymentMethodApiRequest {
976    ///The ID representing the customer
977    pub customer_id: String,
978    ///Whether the payment method should be verified before vaulting or not
979    pub verify: Option<bool>,
980}
981impl std::fmt::Display for VaultPaymentMethodApiRequest {
982    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
983        write!(f, "{}", serde_json::to_string(self).unwrap())
984    }
985}
986#[derive(Debug, Serialize, Deserialize)]
987pub enum CardRegionRestrictionEnum {
988    #[serde(rename = "DOMESTIC_USE_ONLY")]
989    DomesticUseOnly,
990    #[serde(rename = "NONE")]
991    None,
992    #[serde(rename = "UNKNOWN")]
993    Unknown,
994}
995#[derive(Debug, Serialize, Deserialize, Default)]
996pub struct OrderLineItemsProductDataApiSchema {
997    ///The product brand
998    pub brand: Option<String>,
999    ///The product SKU
1000    pub sku: Option<String>,
1001    ///The product color
1002    pub color: Option<String>,
1003    ///The product Global Trade Item Number (e.g. ISBN)
1004    pub global_trade_item_number: Option<String>,
1005    ///The product weight unit (e.g. kg, g)
1006    pub weight_unit: Option<String>,
1007    ///The product Manufacturer Part Number
1008    pub manufacturer_part_number: Option<String>,
1009    ///The product weight
1010    pub weight: Option<f64>,
1011}
1012impl std::fmt::Display for OrderLineItemsProductDataApiSchema {
1013    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1014        write!(f, "{}", serde_json::to_string(self).unwrap())
1015    }
1016}
1017#[derive(Debug, Serialize, Deserialize)]
1018pub struct ClientSessionWithTokenApiResponse {
1019    /**The amount you would like to charge the customer, in minor units. e.g. for $7, use `700`.
1020
1021Some currencies, such as Japanese Yen, do not have minor units. In this case you should use the value as it is, without any formatting. For example for ¥100, use `100`.
1022
1023If the amount is provided on this level, it would override any amount calculated from the provided line items, shipping and other amounts.*/
1024    pub amount: Option<serde_json::Value>,
1025    ///Your reference for the payment.
1026    pub order_id: Option<String>,
1027    ///Expiration date & time of the client token (UTC with no timezoneinfo).
1028    pub client_token_expiration_date: Option<String>,
1029    ///Client token used to initialize the SDK on all platforms.
1030    pub client_token: Option<String>,
1031    ///More information associated with the order.
1032    pub order: Option<OrderDetailsApiSchema>,
1033    ///A unique identifier for your customer.
1034    pub customer_id: Option<String>,
1035    ///More information associated with the customer.
1036    pub customer: Option<CustomerDetailsApiSchema>,
1037    ///Enable certain options associated with the payment methods.
1038    pub payment_method: Option<CheckoutPaymentMethodOptionsApiSchema>,
1039    /**e.g. use `USD` for US dollars.
1040*/
1041    pub currency_code: Option<String>,
1042    ///Warning messages to indicate missing information that are required for payment methods, checkout modules and other features; or when third-party services are unavailable.
1043    pub warnings: Option<ClientSessionWarningsApiResponse>,
1044    /**Additional data to be used throughout the payment lifecycle.
1045*/
1046    pub metadata: Option<serde_json::Value>,
1047}
1048impl std::fmt::Display for ClientSessionWithTokenApiResponse {
1049    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1050        write!(f, "{}", serde_json::to_string(self).unwrap())
1051    }
1052}
1053#[derive(Debug, Serialize, Deserialize, Default)]
1054pub struct IdealPayNlTokenApiSchema {
1055    pub payment_method_config_id: String,
1056}
1057impl std::fmt::Display for IdealPayNlTokenApiSchema {
1058    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1059        write!(f, "{}", serde_json::to_string(self).unwrap())
1060    }
1061}
1062#[derive(Debug, Serialize, Deserialize, Default)]
1063pub struct ApayaCustomerTokenApiSchema {
1064    pub mnc: Option<i64>,
1065    pub mx: String,
1066    pub mcc: Option<i64>,
1067}
1068impl std::fmt::Display for ApayaCustomerTokenApiSchema {
1069    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1070        write!(f, "{}", serde_json::to_string(self).unwrap())
1071    }
1072}
1073#[derive(Debug, Serialize, Deserialize)]
1074pub struct PaymentCreationApiRequest {
1075    ///Your reference for the payment.
1076    pub order_id: Option<String>,
1077    /**Additional data to be used throughout the payment lifecycle.
1078
1079A dictionary of key-value pairs where the values can only be strings or
1080integers.
1081
1082e.g. `{"productId": 1001, "merchantId": "a13bsd62s"}`
1083*/
1084    pub metadata: Option<serde_json::Value>,
1085    ///Enable certain options associated with the payment method.
1086    pub payment_method: Option<PaymentRequestPaymentMethodOptionsApiSchema>,
1087    /**The amount you would like to charge the customer, in minor units. e.g. for $7, use `700`.
1088
1089Some currencies, such as Japanese Yen, do not have minor units. In this case you should use the value as it is, without any formatting. For example for ¥100, use `100`.*/
1090    pub amount: Option<serde_json::Value>,
1091    /**A unique identifier for your customer.
1092This attribute is required if `paymentMethod.vaultOnSuccess` is set to `True`.*/
1093    pub customer_id: Option<String>,
1094    /**The 3-letter currency code in [ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217#Active_codes).
1095e.g. use `USD` for US dollars.
1096*/
1097    pub currency_code: Option<String>,
1098    /**The payment method token used to authorize the payment.
1099*/
1100    pub payment_method_token: String,
1101    /**More information associated with the customer.
1102*/
1103    pub customer: Option<CustomerDetailsApiSchema>,
1104    ///More information associated with the order.
1105    pub order: Option<OrderDetailsApiSchema>,
1106}
1107impl std::fmt::Display for PaymentCreationApiRequest {
1108    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1109        write!(f, "{}", serde_json::to_string(self).unwrap())
1110    }
1111}
1112#[derive(Debug, Serialize, Deserialize)]
1113pub struct OrderDetailsApiSchema {
1114    ///The details of fees charged.
1115    pub fees: Option<Vec<OrderFeesApiSchema>>,
1116    ///The country in which the order is created
1117    pub country_code: Option<CountryCodeEnum>,
1118    ///The details of shipping charged.
1119    pub shipping: Option<OrderShippingApiSchema>,
1120    ///The details of the line items of the order.
1121    pub line_items: Option<Vec<OrderLineItemsApiSchema>>,
1122}
1123impl std::fmt::Display for OrderDetailsApiSchema {
1124    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1125        write!(f, "{}", serde_json::to_string(self).unwrap())
1126    }
1127}
1128#[derive(Debug, Serialize, Deserialize)]
1129pub struct PaymentMethodTypeEnum(pub String);
1130#[derive(Debug, Serialize, Deserialize)]
1131pub struct CheckoutPaymentMethodCardOptionApiSchema {
1132    pub networks: Option<CheckoutPaymentMethodOptionCardNetworkApiSchema>,
1133}
1134impl std::fmt::Display for CheckoutPaymentMethodCardOptionApiSchema {
1135    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1136        write!(f, "{}", serde_json::to_string(self).unwrap())
1137    }
1138}
1139#[derive(Debug, Serialize, Deserialize)]
1140pub enum ThreeDSecureAuthResponseCodeEnum {
1141    #[serde(rename = "NOT_PERFORMED")]
1142    NotPerformed,
1143    #[serde(rename = "SKIPPED")]
1144    Skipped,
1145    #[serde(rename = "AUTH_SUCCESS")]
1146    AuthSuccess,
1147    #[serde(rename = "AUTH_FAILED")]
1148    AuthFailed,
1149    #[serde(rename = "CHALLENGE")]
1150    Challenge,
1151    #[serde(rename = "METHOD")]
1152    Method,
1153}
1154#[derive(Debug, Serialize, Deserialize)]
1155pub enum TransactionTypeEnum {
1156    #[serde(rename = "SALE")]
1157    Sale,
1158    #[serde(rename = "REFUND")]
1159    Refund,
1160}
1161#[derive(Debug, Serialize, Deserialize)]
1162pub struct CustomerDetailsApiSchema {
1163    /**Customer email address.
1164
1165Note: It is recommended to include this field if a 3DS check will be performed
1166*/
1167    pub email_address: Option<String>,
1168    ///The customer's first name
1169    pub first_name: Option<String>,
1170    ///The customer's last name
1171    pub last_name: Option<String>,
1172    /**Customer billing address.
1173
1174Note: It is recommended to include this field if a 3DS check will be performed
1175*/
1176    pub billing_address: Option<CoreApiApiCommonsSchemasAddessAddressApiSchema>,
1177    ///The customer's mobile number
1178    pub mobile_number: Option<String>,
1179    ///Customer shipping address
1180    pub shipping_address: Option<CoreApiApiCommonsSchemasAddessAddressApiSchema>,
1181    ///The customer's tax id number for tax exemptions
1182    pub tax_id: Option<String>,
1183    ///The customer's national identification number
1184    pub national_document_id: Option<String>,
1185}
1186impl std::fmt::Display for CustomerDetailsApiSchema {
1187    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1188        write!(f, "{}", serde_json::to_string(self).unwrap())
1189    }
1190}
1191#[derive(Debug, Serialize, Deserialize)]
1192pub struct BinDataApiSchema {
1193    ///Enumerates all supported currencies
1194    pub issuer_currency_code: Option<Currency>,
1195    /**[The list of available card networks and their `CARD_NETWORK_TYPE` can be found here.](https://www.notion.so/primerio/Payment-Method-Types-2b971a8c54c3452cae0b2fffe9167d72)
1196*/
1197    pub network: String,
1198    ///An enumeration.
1199    pub product_usage_type: String,
1200    pub product_code: String,
1201    ///An enumeration.
1202    pub issuer_country_code: Option<CountryCodeEnum>,
1203    ///An enumeration.
1204    pub regional_restriction: String,
1205    ///An enumeration.
1206    pub account_number_type: String,
1207    ///An enumeration.
1208    pub account_funding_type: String,
1209    pub issuer_name: Option<String>,
1210    ///An enumeration.
1211    pub prepaid_reloadable_indicator: String,
1212    pub product_name: String,
1213}
1214impl std::fmt::Display for BinDataApiSchema {
1215    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1216        write!(f, "{}", serde_json::to_string(self).unwrap())
1217    }
1218}
1219#[derive(Debug, Serialize, Deserialize, Default)]
1220pub struct PaymentSummaryProcessorApiSchema {
1221    ///The merchant ID registered at the payment processor used for this payment.
1222    pub processor_merchant_id: Option<String>,
1223    ///The payment processor used for this payment.
1224    pub name: String,
1225}
1226impl std::fmt::Display for PaymentSummaryProcessorApiSchema {
1227    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1228        write!(f, "{}", serde_json::to_string(self).unwrap())
1229    }
1230}
1231#[derive(Debug, Serialize, Deserialize, Default)]
1232pub struct GoCardlessMandateApiSchema {
1233    ///Unique identifier of a GoCardless mandate agreement
1234    pub gocardless_mandate_id: String,
1235}
1236impl std::fmt::Display for GoCardlessMandateApiSchema {
1237    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1238        write!(f, "{}", serde_json::to_string(self).unwrap())
1239    }
1240}
1241#[derive(Debug, Serialize, Deserialize, Default)]
1242pub struct PayPalExternalPayerInfoApiSchema {
1243    pub last_name: Option<String>,
1244    pub external_payer_id: Option<String>,
1245    pub first_name: Option<String>,
1246    pub email: Option<String>,
1247}
1248impl std::fmt::Display for PayPalExternalPayerInfoApiSchema {
1249    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1250        write!(f, "{}", serde_json::to_string(self).unwrap())
1251    }
1252}
1253#[derive(Debug, Serialize, Deserialize)]
1254pub enum CardAccountNumberTypeEnum {
1255    #[serde(rename = "PRIMARY_ACCOUNT_NUMBER")]
1256    PrimaryAccountNumber,
1257    #[serde(rename = "NETWORK_TOKEN")]
1258    NetworkToken,
1259    #[serde(rename = "UNKNOWN")]
1260    Unknown,
1261}
1262#[derive(Debug, Serialize, Deserialize)]
1263pub struct KlarnaPaymentSessionApiSchema {
1264    pub session_data: KlarnaSessionDetailsApiSchema,
1265    pub klarna_authorization_token: String,
1266}
1267impl std::fmt::Display for KlarnaPaymentSessionApiSchema {
1268    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1269        write!(f, "{}", serde_json::to_string(self).unwrap())
1270    }
1271}
1272#[derive(Debug, Serialize, Deserialize)]
1273pub enum TokenTypeEnum {
1274    #[serde(rename = "MULTI_USE")]
1275    MultiUse,
1276    #[serde(rename = "SINGLE_USE")]
1277    SingleUse,
1278}
1279#[derive(Debug, Serialize, Deserialize)]
1280pub enum PaymentStatus {
1281    #[serde(rename = "PENDING")]
1282    Pending,
1283    #[serde(rename = "FAILED")]
1284    Failed,
1285    #[serde(rename = "AUTHORIZED")]
1286    Authorized,
1287    #[serde(rename = "SETTLING")]
1288    Settling,
1289    #[serde(rename = "PARTIALLY_SETTLED")]
1290    PartiallySettled,
1291    #[serde(rename = "SETTLED")]
1292    Settled,
1293    #[serde(rename = "DECLINED")]
1294    Declined,
1295    #[serde(rename = "CANCELLED")]
1296    Cancelled,
1297}
1298#[derive(Debug, Serialize, Deserialize)]
1299pub struct OrderLineItemsApiSchema {
1300    ///A unique identifier for the line item.
1301    pub item_id: Option<String>,
1302    ///The number of the particular line item that is being ordered.
1303    pub quantity: Option<i64>,
1304    ///The tax code associated with this item, in minor units. This is required for Primer-initiated tax calculations.
1305    pub tax_code: Option<String>,
1306    ///A name of the item.
1307    pub name: Option<String>,
1308    ///The amount charged to the customer, in minor units.
1309    pub amount: serde_json::Value,
1310    ///Details related to the product
1311    pub product_data: Option<OrderLineItemsProductDataApiSchema>,
1312    ///An identifier for the product type.
1313    pub product_type: Option<String>,
1314    ///Any discount applicable to this item, in minor units. This discount is applied for the entire line item, and not per `quantity`.
1315    pub discount_amount: Option<serde_json::Value>,
1316    ///The tax charged on this item, in minor units. This tax amount is applied for the entire line item, and not per `quantity`.
1317    pub tax_amount: Option<i64>,
1318    ///A description of the item.
1319    pub description: Option<String>,
1320}
1321impl std::fmt::Display for OrderLineItemsApiSchema {
1322    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1323        write!(f, "{}", serde_json::to_string(self).unwrap())
1324    }
1325}
1326#[derive(Debug, Serialize, Deserialize)]
1327pub struct PayPalBillingAgreementApiSchema {
1328    ///The PayPal customer's shipping address
1329    pub shipping_address: Option<AddressApiSchema>,
1330    ///Information about the PayPal customer
1331    pub external_payer_info: Option<PayPalExternalPayerInfoApiSchema>,
1332    pub paypal_billing_agreement_id: String,
1333    pub paypal_status: Option<String>,
1334}
1335impl std::fmt::Display for PayPalBillingAgreementApiSchema {
1336    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1337        write!(f, "{}", serde_json::to_string(self).unwrap())
1338    }
1339}
1340#[derive(Debug, Serialize, Deserialize, Default)]
1341pub struct PaymentCardTokenApiSchemaPaymentMethodsApi {
1342    ///The type of card, e.g. Debit, Credit
1343    pub account_funding_type: Option<String>,
1344    pub last4_digits: String,
1345    pub cardholder_name: Option<String>,
1346    pub expiration_year: String,
1347    pub expiration_month: String,
1348    ///An ID for the transaction assigned by the card network. Used to correlate recurring payments.
1349    pub network_transaction_id: Option<String>,
1350    pub network: Option<String>,
1351}
1352impl std::fmt::Display for PaymentCardTokenApiSchemaPaymentMethodsApi {
1353    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1354        write!(f, "{}", serde_json::to_string(self).unwrap())
1355    }
1356}
1357#[derive(Debug, Serialize, Deserialize)]
1358pub enum PaymentStatusTypeEnum {
1359    #[serde(rename = "APPLICATION_ERROR")]
1360    ApplicationError,
1361    #[serde(rename = "GATEWAY_REJECTED")]
1362    GatewayRejected,
1363    #[serde(rename = "ISSUER_DECLINED")]
1364    IssuerDeclined,
1365}
1366#[derive(Debug, Serialize, Deserialize)]
1367pub struct UpdateClientSideTokenClientSessionPatchRequired {
1368    pub currency_code: String,
1369    pub customer: CheckoutCustomerDetailsApiSchema,
1370    pub amount: serde_json::Value,
1371    pub metadata: serde_json::Value,
1372    pub order: OrderDetailsApiSchema,
1373    pub order_id: String,
1374    pub customer_id: String,
1375    pub client_token: String,
1376    pub payment_method: CheckoutPaymentMethodOptionsApiSchema,
1377}
1378impl std::fmt::Display for UpdateClientSideTokenClientSessionPatchRequired {
1379    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1380        write!(f, "{}", serde_json::to_string(self).unwrap())
1381    }
1382}
1383#[derive(Debug, Serialize, Deserialize)]
1384pub enum CardProductTypeEnum {
1385    #[serde(rename = "CONSUMER")]
1386    Consumer,
1387    #[serde(rename = "BUSINESS")]
1388    Business,
1389    #[serde(rename = "GOVERNMENT")]
1390    Government,
1391    #[serde(rename = "UNKNOWN")]
1392    Unknown,
1393}