paypal_rust/resources/enums/landing_page.rs
1use serde::{Deserialize, Serialize};
2
3/// The type of landing page to show on the PayPal site for customer checkout.
4#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
5pub enum LandingPage {
6 /// When the customer clicks PayPal Checkout, the customer is redirected to a page to log in to PayPal and approve the payment.
7 #[serde(rename = "LOGIN")]
8 Login,
9 /// When the customer clicks PayPal Checkout, the customer is redirected to a page to enter credit or debit card and other
10 /// relevant billing information required to complete the purchase.
11 #[serde(rename = "BILLING")]
12 Billing,
13 /// When the customer clicks PayPal Checkout, the customer is redirected to either a page to log in to PayPal and
14 /// approve the payment or to a page to enter credit or debit card and other relevant billing information required to complete the
15 /// purchase, depending on their previous interaction with PayPal.
16 #[serde(rename = "NO_PREFERENCE")]
17 NoPreference,
18}
19
20impl LandingPage {
21 pub const fn as_str(self) -> &'static str {
22 match self {
23 Self::Login => "LOGIN",
24 Self::Billing => "BILLING",
25 Self::NoPreference => "NO_PREFERENCE",
26 }
27 }
28}
29
30impl AsRef<str> for LandingPage {
31 fn as_ref(&self) -> &str {
32 self.as_str()
33 }
34}
35
36impl std::fmt::Display for LandingPage {
37 fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38 self.as_str().fmt(formatter)
39 }
40}