paypal_rust/resources/enums/user_action.rs
1use serde::{Deserialize, Serialize};
2
3/// Configures a Continue or Pay Now checkout flow.
4#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
5pub enum UserAction {
6 /// After you redirect the customer to the PayPal payment page, a Continue button appears. Use this option when the final
7 /// amount is not known when the checkout flow is initiated and you want to redirect the customer to the merchant page without processing
8 #[serde(rename = "CONTINUE")]
9 Continue,
10 /// After you redirect the customer to the PayPal payment page, a Pay Now button appears. Use this option when the final
11 /// amount is known when the checkout is initiated and you want to process the payment immediately when the customer clicks Pay Now.
12 #[serde(rename = "PAY_NOW")]
13 PayNow,
14}
15
16impl UserAction {
17 pub const fn as_str(self) -> &'static str {
18 match self {
19 Self::Continue => "CONTINUE",
20 Self::PayNow => "PAY_NOW",
21 }
22 }
23}
24
25impl AsRef<str> for UserAction {
26 fn as_ref(&self) -> &str {
27 self.as_str()
28 }
29}
30
31impl std::fmt::Display for UserAction {
32 fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33 self.as_str().fmt(formatter)
34 }
35}