@@ -6,10 +6,11 @@ use serde::{Deserialize, Serialize};
66use serde_with:: skip_serializing_none;
77
88/// The intent to either capture payment immediately or authorize a payment for an order after order creation.
9- #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone ) ]
9+ #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone , Default ) ]
1010#[ serde( rename_all = "SCREAMING_SNAKE_CASE" ) ]
1111pub enum Intent {
1212 /// The merchant intends to capture payment immediately after the customer makes a payment.
13+ #[ default]
1314 Capture ,
1415 /// The merchant intends to authorize a payment and place funds on hold after the customer makes a payment.
1516 /// Authorized payments are guaranteed for up to three days but are available to capture for up to 29 days.
@@ -19,12 +20,6 @@ pub enum Intent {
1920 Authorize ,
2021}
2122
22- impl Default for Intent {
23- fn default ( ) -> Self {
24- Intent :: Capture
25- }
26- }
27-
2823/// Represents a payer name.
2924///
3025/// <https://developer.paypal.com/docs/api/orders/v2/#definition-payer.name>
@@ -197,22 +192,17 @@ pub struct PlatformFee {
197192}
198193
199194/// The funds that are held on behalf of the merchant
200- #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Clone ) ]
195+ #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Clone , Default ) ]
201196pub enum DisbursementMode {
202197 /// The funds are released to the merchant immediately.
198+ #[ default]
203199 Instant ,
204200 /// The funds are held for a finite number of days. The actual duration depends on the region and type of integration.
205201 /// You can release the funds through a referenced payout.
206202 /// Otherwise, the funds disbursed automatically after the specified duration.
207203 Delayed ,
208204}
209205
210- impl Default for DisbursementMode {
211- fn default ( ) -> Self {
212- DisbursementMode :: Instant
213- }
214- }
215-
216206/// Any additional payment instructions for PayPal Commerce Platform customers.
217207#[ skip_serializing_none]
218208#[ derive( Debug , Default , Serialize , Deserialize , Clone , Builder ) ]
@@ -225,12 +215,13 @@ pub struct PaymentInstruction {
225215}
226216
227217/// The item category type.
228- #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone ) ]
218+ #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone , Default ) ]
229219#[ serde( rename_all = "SCREAMING_SNAKE_CASE" ) ]
230220pub enum ItemCategoryType {
231221 /// Goods that are stored, delivered, and used in their electronic format.
232222 /// This value is not currently supported for API callers that leverage
233223 /// the [PayPal for Commerce Platform](https://www.paypal.com/us/webapps/mpp/commerce-platform) product.
224+ #[ default]
234225 DigitalGoods ,
235226 /// A tangible item that can be shipped with proof of delivery.
236227 PhysicalGoods ,
@@ -239,12 +230,6 @@ pub enum ItemCategoryType {
239230 Donation ,
240231}
241232
242- impl Default for ItemCategoryType {
243- fn default ( ) -> Self {
244- ItemCategoryType :: DigitalGoods
245- }
246- }
247-
248233/// The name of the person to whom to ship the items.
249234#[ skip_serializing_none]
250235#[ derive( Debug , Default , Serialize , Deserialize , Clone ) ]
@@ -549,7 +534,7 @@ impl PurchaseUnit {
549534}
550535
551536/// The type of landing page to show on the PayPal site for customer checkout.
552- #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone ) ]
537+ #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone , Default ) ]
553538#[ serde( rename_all = "SCREAMING_SNAKE_CASE" ) ]
554539pub enum LandingPage {
555540 /// When the customer clicks PayPal Checkout, the customer is redirected to a page to log in to PayPal and approve the payment.
@@ -560,71 +545,51 @@ pub enum LandingPage {
560545 /// When the customer clicks PayPal Checkout, the customer is redirected to either a page to log in to PayPal and approve
561546 /// the payment or to a page to enter credit or debit card and other relevant billing information required to complete the purchase,
562547 /// depending on their previous interaction with PayPal.
548+ #[ default]
563549 NoPreference ,
564550}
565551
566- impl Default for LandingPage {
567- fn default ( ) -> Self {
568- LandingPage :: NoPreference
569- }
570- }
571-
572552/// The shipping preference
573- #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone ) ]
553+ #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone , Default ) ]
574554#[ serde( rename_all = "SCREAMING_SNAKE_CASE" ) ]
575555pub enum ShippingPreference {
576556 /// Use the customer-provided shipping address on the PayPal site.
557+ #[ default]
577558 GetFromFile ,
578559 /// Redact the shipping address from the PayPal site. Recommended for digital goods.
579560 NoShipping ,
580561 /// Use the merchant-provided address. The customer cannot change this address on the PayPal site.
581562 SetProvidedAddress ,
582563}
583564
584- impl Default for ShippingPreference {
585- fn default ( ) -> Self {
586- ShippingPreference :: GetFromFile
587- }
588- }
589-
590565/// Configures a Continue or Pay Now checkout flow.
591- #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone ) ]
566+ #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone , Default ) ]
592567#[ serde( rename_all = "SCREAMING_SNAKE_CASE" ) ]
593568pub enum UserAction {
594569 /// After you redirect the customer to the PayPal payment page, a Continue button appears. Use this option when
595570 /// the final amount is not known when the checkout flow is initiated and you want to redirect the customer
596571 /// to the merchant page without processing the payment.
572+ #[ default]
597573 Continue ,
598574 /// After you redirect the customer to the PayPal payment page, a Pay Now button appears.
599575 /// Use this option when the final amount is known when the checkout is initiated and you want to
600576 /// process the payment immediately when the customer clicks Pay Now.
601577 PayNow ,
602578}
603579
604- impl Default for UserAction {
605- fn default ( ) -> Self {
606- UserAction :: Continue
607- }
608- }
609-
610580/// The merchant-preferred payment sources.
611- #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone ) ]
581+ #[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Copy , Clone , Default ) ]
612582#[ serde( rename_all = "SCREAMING_SNAKE_CASE" ) ]
613583pub enum PayeePreferred {
614584 /// Accepts any type of payment from the customer.
585+ #[ default]
615586 Unrestricted ,
616587 /// Accepts only immediate payment from the customer.
617588 /// For example, credit card, PayPal balance, or instant ACH.
618589 /// Ensures that at the time of capture, the payment does not have the `pending` status.
619590 ImmediatePaymentRequired ,
620591}
621592
622- impl Default for PayeePreferred {
623- fn default ( ) -> Self {
624- PayeePreferred :: Unrestricted
625- }
626- }
627-
628593/// A payment method.
629594#[ skip_serializing_none]
630595#[ derive( Debug , Default , Serialize , Deserialize , Clone ) ]
0 commit comments