objc2_pass_kit/generated/
PKPaymentMethod.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-contacts")]
6use objc2_contacts::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11/// [Apple's documentation](https://developer.apple.com/documentation/passkit/pkpaymentmethodtype?language=objc)
12// NS_ENUM
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct PKPaymentMethodType(pub NSUInteger);
16impl PKPaymentMethodType {
17    #[doc(alias = "PKPaymentMethodTypeUnknown")]
18    pub const Unknown: Self = Self(0);
19    #[doc(alias = "PKPaymentMethodTypeDebit")]
20    pub const Debit: Self = Self(1);
21    #[doc(alias = "PKPaymentMethodTypeCredit")]
22    pub const Credit: Self = Self(2);
23    #[doc(alias = "PKPaymentMethodTypePrepaid")]
24    pub const Prepaid: Self = Self(3);
25    #[doc(alias = "PKPaymentMethodTypeStore")]
26    pub const Store: Self = Self(4);
27    #[doc(alias = "PKPaymentMethodTypeEMoney")]
28    pub const EMoney: Self = Self(5);
29}
30
31unsafe impl Encode for PKPaymentMethodType {
32    const ENCODING: Encoding = NSUInteger::ENCODING;
33}
34
35unsafe impl RefEncode for PKPaymentMethodType {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39extern_class!(
40    /// [Apple's documentation](https://developer.apple.com/documentation/passkit/pkpaymentmethod?language=objc)
41    #[unsafe(super(NSObject))]
42    #[derive(Debug, PartialEq, Eq, Hash)]
43    pub struct PKPaymentMethod;
44);
45
46extern_conformance!(
47    unsafe impl NSObjectProtocol for PKPaymentMethod {}
48);
49
50impl PKPaymentMethod {
51    extern_methods!(
52        #[unsafe(method(displayName))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn displayName(&self) -> Option<Retained<NSString>>;
55
56        #[cfg(feature = "PKConstants")]
57        #[unsafe(method(network))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn network(&self) -> Option<Retained<PKPaymentNetwork>>;
60
61        #[unsafe(method(type))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn r#type(&self) -> PKPaymentMethodType;
64
65        #[cfg(all(
66            feature = "PKObject",
67            feature = "PKPass",
68            feature = "PKPaymentPass",
69            feature = "PKSecureElementPass"
70        ))]
71        #[deprecated = "Use -[PKPass secureElementPass] instead"]
72        #[unsafe(method(paymentPass))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn paymentPass(&self) -> Option<Retained<PKPaymentPass>>;
75
76        #[cfg(all(
77            feature = "PKObject",
78            feature = "PKPass",
79            feature = "PKSecureElementPass"
80        ))]
81        #[unsafe(method(secureElementPass))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn secureElementPass(&self) -> Option<Retained<PKSecureElementPass>>;
84
85        #[cfg(feature = "objc2-contacts")]
86        #[unsafe(method(billingAddress))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn billingAddress(&self) -> Option<Retained<CNContact>>;
89    );
90}
91
92/// Methods declared on superclass `NSObject`.
93impl PKPaymentMethod {
94    extern_methods!(
95        #[unsafe(method(init))]
96        #[unsafe(method_family = init)]
97        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
98
99        #[unsafe(method(new))]
100        #[unsafe(method_family = new)]
101        pub unsafe fn new() -> Retained<Self>;
102    );
103}