paypal_rust/resources/enums/processing_instruction.rs
1use serde::{Deserialize, Serialize};
2
3/// The instruction to process an order.
4#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
5pub enum ProcessingInstruction {
6 /// API Caller expects the Order to be auto completed (i.e. for PayPal to authorize or capture depending on the intent)
7 /// on completion of payer approval. This option is not relevant for payment_source that typically do not require a
8 /// payer approval or interaction. This option is currently only available for the following payment_source:
9 /// Alipay, Bancontact, BLIK, boletobancario, eps, giropay, GrabPay, iDEAL, Multibanco, MyBank, OXXO, P24, PayU, PUI,
10 /// SafetyPay, SatisPay, Sofort, Trustly, Verkkopankki, WeChat Pay
11 #[serde(rename = "ORDER_COMPLETE_ON_PAYMENT_APPROVAL")]
12 OrderCompleteOnPaymentApproval,
13 /// The API caller intends to authorize v2/checkout/orders/id/authorize or capture
14 /// v2/checkout/orders/id/capture after the payer approves the order.
15 #[serde(rename = "NO_INSTRUCTION")]
16 NoInstruction,
17}
18
19impl ProcessingInstruction {
20 pub const fn as_str(self) -> &'static str {
21 match self {
22 Self::OrderCompleteOnPaymentApproval => "ORDER_COMPLETE_ON_PAYMENT_APPROVAL",
23 Self::NoInstruction => "NO_INSTRUCTION",
24 }
25 }
26}
27
28impl AsRef<str> for ProcessingInstruction {
29 fn as_ref(&self) -> &str {
30 self.as_str()
31 }
32}
33
34impl std::fmt::Display for ProcessingInstruction {
35 fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
36 self.as_str().fmt(formatter)
37 }
38}