@gmisoftware/react-native-pay 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NitroPay.podspec +31 -0
- package/README.md +455 -0
- package/android/CMakeLists.txt +29 -0
- package/android/build.gradle +144 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +8 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/pay/Constants.kt +49 -0
- package/android/src/main/java/com/margelo/nitro/pay/GooglePayButtonFactory.kt +95 -0
- package/android/src/main/java/com/margelo/nitro/pay/GooglePayRequestBuilder.kt +170 -0
- package/android/src/main/java/com/margelo/nitro/pay/HybridGooglePayButton.kt +146 -0
- package/android/src/main/java/com/margelo/nitro/pay/HybridPaymentHandler.kt +184 -0
- package/android/src/main/java/com/margelo/nitro/pay/NitroPayPackage.kt +26 -0
- package/android/src/main/java/com/margelo/nitro/pay/PaymentMapper.kt +89 -0
- package/app.plugin.js +1 -0
- package/ios/ApplePayButtonFactory.swift +53 -0
- package/ios/Bridge.h +8 -0
- package/ios/HybridApplePayButton.swift +60 -0
- package/ios/HybridPaymentHandler.swift +248 -0
- package/ios/PassKitTypeMapper.swift +192 -0
- package/lib/hooks/index.d.ts +7 -0
- package/lib/hooks/index.js +10 -0
- package/lib/hooks/usePaymentCheckout.d.ts +95 -0
- package/lib/hooks/usePaymentCheckout.js +183 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +29 -0
- package/lib/plugin/index.d.ts +4 -0
- package/lib/plugin/index.js +10 -0
- package/lib/plugin/type.d.ts +4 -0
- package/lib/plugin/type.js +2 -0
- package/lib/plugin/withApplePay.d.ts +4 -0
- package/lib/plugin/withApplePay.js +32 -0
- package/lib/plugin/withGooglePay.d.ts +4 -0
- package/lib/plugin/withGooglePay.js +24 -0
- package/lib/specs/ApplePayButton.nitro.d.ts +13 -0
- package/lib/specs/ApplePayButton.nitro.js +2 -0
- package/lib/specs/GooglePayButton.nitro.d.ts +14 -0
- package/lib/specs/GooglePayButton.nitro.js +2 -0
- package/lib/specs/PaymentHandler.nitro.d.ts +10 -0
- package/lib/specs/PaymentHandler.nitro.js +2 -0
- package/lib/types/Contact.d.ts +51 -0
- package/lib/types/Contact.js +6 -0
- package/lib/types/Payment.d.ts +67 -0
- package/lib/types/Payment.js +6 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +18 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +20 -0
- package/lib/utils/paymentHelpers.d.ts +144 -0
- package/lib/utils/paymentHelpers.js +190 -0
- package/nitro.json +30 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroPay+autolinking.cmake +87 -0
- package/nitrogen/generated/android/NitroPay+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroPayOnLoad.cpp +58 -0
- package/nitrogen/generated/android/NitroPayOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JCNContact.hpp +202 -0
- package/nitrogen/generated/android/c++/JCNContactType.hpp +59 -0
- package/nitrogen/generated/android/c++/JCNLabeledEmailAddress.hpp +62 -0
- package/nitrogen/generated/android/c++/JCNLabeledPhoneNumber.hpp +64 -0
- package/nitrogen/generated/android/c++/JCNLabeledPostalAddress.hpp +64 -0
- package/nitrogen/generated/android/c++/JCNPhoneNumber.hpp +57 -0
- package/nitrogen/generated/android/c++/JCNPostalAddress.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +74 -0
- package/nitrogen/generated/android/c++/JGooglePayButtonTheme.hpp +59 -0
- package/nitrogen/generated/android/c++/JGooglePayButtonType.hpp +77 -0
- package/nitrogen/generated/android/c++/JGooglePayEnvironment.hpp +59 -0
- package/nitrogen/generated/android/c++/JHybridGooglePayButtonSpec.cpp +96 -0
- package/nitrogen/generated/android/c++/JHybridGooglePayButtonSpec.hpp +71 -0
- package/nitrogen/generated/android/c++/JHybridPaymentHandlerSpec.cpp +154 -0
- package/nitrogen/generated/android/c++/JHybridPaymentHandlerSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JPKSecureElementPass.hpp +96 -0
- package/nitrogen/generated/android/c++/JPassActivationState.hpp +68 -0
- package/nitrogen/generated/android/c++/JPayServiceStatus.hpp +61 -0
- package/nitrogen/generated/android/c++/JPaymentItem.hpp +67 -0
- package/nitrogen/generated/android/c++/JPaymentItemType.hpp +59 -0
- package/nitrogen/generated/android/c++/JPaymentMethod.hpp +97 -0
- package/nitrogen/generated/android/c++/JPaymentMethodType.hpp +68 -0
- package/nitrogen/generated/android/c++/JPaymentNetwork.hpp +86 -0
- package/nitrogen/generated/android/c++/JPaymentRequest.hpp +181 -0
- package/nitrogen/generated/android/c++/JPaymentResult.hpp +97 -0
- package/nitrogen/generated/android/c++/JPaymentToken.hpp +91 -0
- package/nitrogen/generated/android/c++/views/JHybridGooglePayButtonStateUpdater.cpp +68 -0
- package/nitrogen/generated/android/c++/views/JHybridGooglePayButtonStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/CNContact.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/CNContactType.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/CNLabeledEmailAddress.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/CNLabeledPhoneNumber.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/CNLabeledPostalAddress.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/CNPhoneNumber.kt +36 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/CNPostalAddress.kt +51 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/GooglePayButtonTheme.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/GooglePayButtonType.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/GooglePayEnvironment.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/HybridGooglePayButtonSpec.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/HybridPaymentHandlerSpec.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/NitroPayOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/PKSecureElementPass.kt +63 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/PassActivationState.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/PayServiceStatus.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/PaymentItem.kt +42 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/PaymentItemType.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/PaymentMethod.kt +48 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/PaymentMethodType.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/PaymentNetwork.kt +30 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/PaymentRequest.kt +72 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/PaymentResult.kt +45 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/PaymentToken.kt +42 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/views/HybridGooglePayButtonManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pay/views/HybridGooglePayButtonStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/NitroPay+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroPay-Swift-Cxx-Bridge.cpp +73 -0
- package/nitrogen/generated/ios/NitroPay-Swift-Cxx-Bridge.hpp +415 -0
- package/nitrogen/generated/ios/NitroPay-Swift-Cxx-Umbrella.hpp +116 -0
- package/nitrogen/generated/ios/NitroPayAutolinking.mm +41 -0
- package/nitrogen/generated/ios/NitroPayAutolinking.swift +40 -0
- package/nitrogen/generated/ios/c++/HybridApplePayButtonSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridApplePayButtonSpecSwift.hpp +92 -0
- package/nitrogen/generated/ios/c++/HybridPaymentHandlerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridPaymentHandlerSpecSwift.hpp +148 -0
- package/nitrogen/generated/ios/c++/views/HybridApplePayButtonComponent.mm +106 -0
- package/nitrogen/generated/ios/swift/ApplePayButtonStyle.swift +44 -0
- package/nitrogen/generated/ios/swift/ApplePayButtonType.swift +84 -0
- package/nitrogen/generated/ios/swift/CNContact.swift +329 -0
- package/nitrogen/generated/ios/swift/CNContactType.swift +40 -0
- package/nitrogen/generated/ios/swift/CNLabeledEmailAddress.swift +65 -0
- package/nitrogen/generated/ios/swift/CNLabeledPhoneNumber.swift +65 -0
- package/nitrogen/generated/ios/swift/CNLabeledPostalAddress.swift +65 -0
- package/nitrogen/generated/ios/swift/CNPhoneNumber.swift +35 -0
- package/nitrogen/generated/ios/swift/CNPostalAddress.swift +204 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_PaymentResult.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/GooglePayEnvironment.swift +40 -0
- package/nitrogen/generated/ios/swift/HybridApplePayButtonSpec.swift +51 -0
- package/nitrogen/generated/ios/swift/HybridApplePayButtonSpec_cxx.swift +175 -0
- package/nitrogen/generated/ios/swift/HybridPaymentHandlerSpec.swift +52 -0
- package/nitrogen/generated/ios/swift/HybridPaymentHandlerSpec_cxx.swift +155 -0
- package/nitrogen/generated/ios/swift/PKSecureElementPass.swift +191 -0
- package/nitrogen/generated/ios/swift/PassActivationState.swift +52 -0
- package/nitrogen/generated/ios/swift/PayServiceStatus.swift +46 -0
- package/nitrogen/generated/ios/swift/PaymentItem.swift +57 -0
- package/nitrogen/generated/ios/swift/PaymentItemType.swift +40 -0
- package/nitrogen/generated/ios/swift/PaymentMethod.swift +134 -0
- package/nitrogen/generated/ios/swift/PaymentMethodType.swift +52 -0
- package/nitrogen/generated/ios/swift/PaymentNetwork.swift +76 -0
- package/nitrogen/generated/ios/swift/PaymentRequest.swift +341 -0
- package/nitrogen/generated/ios/swift/PaymentResult.swift +118 -0
- package/nitrogen/generated/ios/swift/PaymentToken.swift +57 -0
- package/nitrogen/generated/shared/c++/ApplePayButtonStyle.hpp +80 -0
- package/nitrogen/generated/shared/c++/ApplePayButtonType.hpp +120 -0
- package/nitrogen/generated/shared/c++/CNContact.hpp +168 -0
- package/nitrogen/generated/shared/c++/CNContactType.hpp +76 -0
- package/nitrogen/generated/shared/c++/CNLabeledEmailAddress.hpp +80 -0
- package/nitrogen/generated/shared/c++/CNLabeledPhoneNumber.hpp +82 -0
- package/nitrogen/generated/shared/c++/CNLabeledPostalAddress.hpp +82 -0
- package/nitrogen/generated/shared/c++/CNPhoneNumber.hpp +75 -0
- package/nitrogen/generated/shared/c++/CNPostalAddress.hpp +96 -0
- package/nitrogen/generated/shared/c++/GooglePayButtonTheme.hpp +76 -0
- package/nitrogen/generated/shared/c++/GooglePayButtonType.hpp +100 -0
- package/nitrogen/generated/shared/c++/GooglePayEnvironment.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridApplePayButtonSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridApplePayButtonSpec.hpp +73 -0
- package/nitrogen/generated/shared/c++/HybridGooglePayButtonSpec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridGooglePayButtonSpec.hpp +75 -0
- package/nitrogen/generated/shared/c++/HybridPaymentHandlerSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridPaymentHandlerSpec.hpp +74 -0
- package/nitrogen/generated/shared/c++/PKSecureElementPass.hpp +114 -0
- package/nitrogen/generated/shared/c++/PassActivationState.hpp +88 -0
- package/nitrogen/generated/shared/c++/PayServiceStatus.hpp +79 -0
- package/nitrogen/generated/shared/c++/PaymentItem.hpp +85 -0
- package/nitrogen/generated/shared/c++/PaymentItemType.hpp +76 -0
- package/nitrogen/generated/shared/c++/PaymentMethod.hpp +103 -0
- package/nitrogen/generated/shared/c++/PaymentMethodType.hpp +88 -0
- package/nitrogen/generated/shared/c++/PaymentNetwork.hpp +112 -0
- package/nitrogen/generated/shared/c++/PaymentRequest.hpp +130 -0
- package/nitrogen/generated/shared/c++/PaymentResult.hpp +90 -0
- package/nitrogen/generated/shared/c++/PaymentToken.hpp +85 -0
- package/nitrogen/generated/shared/c++/views/HybridApplePayButtonComponent.cpp +111 -0
- package/nitrogen/generated/shared/c++/views/HybridApplePayButtonComponent.hpp +111 -0
- package/nitrogen/generated/shared/c++/views/HybridGooglePayButtonComponent.cpp +123 -0
- package/nitrogen/generated/shared/c++/views/HybridGooglePayButtonComponent.hpp +112 -0
- package/nitrogen/generated/shared/json/ApplePayButtonConfig.json +12 -0
- package/nitrogen/generated/shared/json/GooglePayButtonConfig.json +13 -0
- package/package.json +116 -0
- package/react-native.config.js +16 -0
- package/src/hooks/index.ts +12 -0
- package/src/hooks/usePaymentCheckout.ts +281 -0
- package/src/index.ts +32 -0
- package/src/plugin/index.ts +17 -0
- package/src/plugin/type.ts +4 -0
- package/src/plugin/withApplePay.ts +44 -0
- package/src/plugin/withGooglePay.ts +41 -0
- package/src/specs/ApplePayButton.nitro.ts +37 -0
- package/src/specs/GooglePayButton.nitro.ts +34 -0
- package/src/specs/PaymentHandler.nitro.ts +13 -0
- package/src/types/Contact.ts +58 -0
- package/src/types/Payment.ts +104 -0
- package/src/types/index.ts +2 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/paymentHelpers.ts +215 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CNLabeledPostalAddress.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `CNPostalAddress` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::pay { struct CNPostalAddress; }
|
|
28
|
+
|
|
29
|
+
#include <string>
|
|
30
|
+
#include <optional>
|
|
31
|
+
#include "CNPostalAddress.hpp"
|
|
32
|
+
|
|
33
|
+
namespace margelo::nitro::pay {
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A struct which can be represented as a JavaScript object (CNLabeledPostalAddress).
|
|
37
|
+
*/
|
|
38
|
+
struct CNLabeledPostalAddress {
|
|
39
|
+
public:
|
|
40
|
+
std::optional<std::string> label SWIFT_PRIVATE;
|
|
41
|
+
CNPostalAddress value SWIFT_PRIVATE;
|
|
42
|
+
|
|
43
|
+
public:
|
|
44
|
+
CNLabeledPostalAddress() = default;
|
|
45
|
+
explicit CNLabeledPostalAddress(std::optional<std::string> label, CNPostalAddress value): label(label), value(value) {}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
} // namespace margelo::nitro::pay
|
|
49
|
+
|
|
50
|
+
namespace margelo::nitro {
|
|
51
|
+
|
|
52
|
+
// C++ CNLabeledPostalAddress <> JS CNLabeledPostalAddress (object)
|
|
53
|
+
template <>
|
|
54
|
+
struct JSIConverter<margelo::nitro::pay::CNLabeledPostalAddress> final {
|
|
55
|
+
static inline margelo::nitro::pay::CNLabeledPostalAddress fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
56
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
57
|
+
return margelo::nitro::pay::CNLabeledPostalAddress(
|
|
58
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "label")),
|
|
59
|
+
JSIConverter<margelo::nitro::pay::CNPostalAddress>::fromJSI(runtime, obj.getProperty(runtime, "value"))
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::pay::CNLabeledPostalAddress& arg) {
|
|
63
|
+
jsi::Object obj(runtime);
|
|
64
|
+
obj.setProperty(runtime, "label", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.label));
|
|
65
|
+
obj.setProperty(runtime, "value", JSIConverter<margelo::nitro::pay::CNPostalAddress>::toJSI(runtime, arg.value));
|
|
66
|
+
return obj;
|
|
67
|
+
}
|
|
68
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
69
|
+
if (!value.isObject()) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
jsi::Object obj = value.getObject(runtime);
|
|
73
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "label"))) return false;
|
|
77
|
+
if (!JSIConverter<margelo::nitro::pay::CNPostalAddress>::canConvert(runtime, obj.getProperty(runtime, "value"))) return false;
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CNPhoneNumber.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::pay {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A struct which can be represented as a JavaScript object (CNPhoneNumber).
|
|
34
|
+
*/
|
|
35
|
+
struct CNPhoneNumber {
|
|
36
|
+
public:
|
|
37
|
+
std::string stringValue SWIFT_PRIVATE;
|
|
38
|
+
|
|
39
|
+
public:
|
|
40
|
+
CNPhoneNumber() = default;
|
|
41
|
+
explicit CNPhoneNumber(std::string stringValue): stringValue(stringValue) {}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace margelo::nitro::pay
|
|
45
|
+
|
|
46
|
+
namespace margelo::nitro {
|
|
47
|
+
|
|
48
|
+
// C++ CNPhoneNumber <> JS CNPhoneNumber (object)
|
|
49
|
+
template <>
|
|
50
|
+
struct JSIConverter<margelo::nitro::pay::CNPhoneNumber> final {
|
|
51
|
+
static inline margelo::nitro::pay::CNPhoneNumber fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
52
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
53
|
+
return margelo::nitro::pay::CNPhoneNumber(
|
|
54
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "stringValue"))
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::pay::CNPhoneNumber& arg) {
|
|
58
|
+
jsi::Object obj(runtime);
|
|
59
|
+
obj.setProperty(runtime, "stringValue", JSIConverter<std::string>::toJSI(runtime, arg.stringValue));
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
63
|
+
if (!value.isObject()) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
jsi::Object obj = value.getObject(runtime);
|
|
67
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "stringValue"))) return false;
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CNPostalAddress.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
#include <optional>
|
|
30
|
+
|
|
31
|
+
namespace margelo::nitro::pay {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A struct which can be represented as a JavaScript object (CNPostalAddress).
|
|
35
|
+
*/
|
|
36
|
+
struct CNPostalAddress {
|
|
37
|
+
public:
|
|
38
|
+
std::optional<std::string> street SWIFT_PRIVATE;
|
|
39
|
+
std::optional<std::string> city SWIFT_PRIVATE;
|
|
40
|
+
std::optional<std::string> state SWIFT_PRIVATE;
|
|
41
|
+
std::optional<std::string> postalCode SWIFT_PRIVATE;
|
|
42
|
+
std::optional<std::string> country SWIFT_PRIVATE;
|
|
43
|
+
std::optional<std::string> isoCountryCode SWIFT_PRIVATE;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
CNPostalAddress() = default;
|
|
47
|
+
explicit CNPostalAddress(std::optional<std::string> street, std::optional<std::string> city, std::optional<std::string> state, std::optional<std::string> postalCode, std::optional<std::string> country, std::optional<std::string> isoCountryCode): street(street), city(city), state(state), postalCode(postalCode), country(country), isoCountryCode(isoCountryCode) {}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
} // namespace margelo::nitro::pay
|
|
51
|
+
|
|
52
|
+
namespace margelo::nitro {
|
|
53
|
+
|
|
54
|
+
// C++ CNPostalAddress <> JS CNPostalAddress (object)
|
|
55
|
+
template <>
|
|
56
|
+
struct JSIConverter<margelo::nitro::pay::CNPostalAddress> final {
|
|
57
|
+
static inline margelo::nitro::pay::CNPostalAddress fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
58
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
59
|
+
return margelo::nitro::pay::CNPostalAddress(
|
|
60
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "street")),
|
|
61
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "city")),
|
|
62
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "state")),
|
|
63
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "postalCode")),
|
|
64
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "country")),
|
|
65
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "isoCountryCode"))
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::pay::CNPostalAddress& arg) {
|
|
69
|
+
jsi::Object obj(runtime);
|
|
70
|
+
obj.setProperty(runtime, "street", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.street));
|
|
71
|
+
obj.setProperty(runtime, "city", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.city));
|
|
72
|
+
obj.setProperty(runtime, "state", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.state));
|
|
73
|
+
obj.setProperty(runtime, "postalCode", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.postalCode));
|
|
74
|
+
obj.setProperty(runtime, "country", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.country));
|
|
75
|
+
obj.setProperty(runtime, "isoCountryCode", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.isoCountryCode));
|
|
76
|
+
return obj;
|
|
77
|
+
}
|
|
78
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
79
|
+
if (!value.isObject()) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
jsi::Object obj = value.getObject(runtime);
|
|
83
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "street"))) return false;
|
|
87
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "city"))) return false;
|
|
88
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "state"))) return false;
|
|
89
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "postalCode"))) return false;
|
|
90
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "country"))) return false;
|
|
91
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "isoCountryCode"))) return false;
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GooglePayButtonTheme.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::pay {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (GooglePayButtonTheme).
|
|
30
|
+
*/
|
|
31
|
+
enum class GooglePayButtonTheme {
|
|
32
|
+
DARK SWIFT_NAME(dark) = 0,
|
|
33
|
+
LIGHT SWIFT_NAME(light) = 1,
|
|
34
|
+
} CLOSED_ENUM;
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro::pay
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro {
|
|
39
|
+
|
|
40
|
+
// C++ GooglePayButtonTheme <> JS GooglePayButtonTheme (union)
|
|
41
|
+
template <>
|
|
42
|
+
struct JSIConverter<margelo::nitro::pay::GooglePayButtonTheme> final {
|
|
43
|
+
static inline margelo::nitro::pay::GooglePayButtonTheme fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
44
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
45
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
46
|
+
case hashString("dark"): return margelo::nitro::pay::GooglePayButtonTheme::DARK;
|
|
47
|
+
case hashString("light"): return margelo::nitro::pay::GooglePayButtonTheme::LIGHT;
|
|
48
|
+
default: [[unlikely]]
|
|
49
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum GooglePayButtonTheme - invalid value!");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::pay::GooglePayButtonTheme arg) {
|
|
53
|
+
switch (arg) {
|
|
54
|
+
case margelo::nitro::pay::GooglePayButtonTheme::DARK: return JSIConverter<std::string>::toJSI(runtime, "dark");
|
|
55
|
+
case margelo::nitro::pay::GooglePayButtonTheme::LIGHT: return JSIConverter<std::string>::toJSI(runtime, "light");
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert GooglePayButtonTheme to JS - invalid value: "
|
|
58
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
62
|
+
if (!value.isString()) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
66
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
67
|
+
case hashString("dark"):
|
|
68
|
+
case hashString("light"):
|
|
69
|
+
return true;
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GooglePayButtonType.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::pay {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (GooglePayButtonType).
|
|
30
|
+
*/
|
|
31
|
+
enum class GooglePayButtonType {
|
|
32
|
+
BUY SWIFT_NAME(buy) = 0,
|
|
33
|
+
BOOK SWIFT_NAME(book) = 1,
|
|
34
|
+
DONATE SWIFT_NAME(donate) = 2,
|
|
35
|
+
ORDER SWIFT_NAME(order) = 3,
|
|
36
|
+
CHECKOUT SWIFT_NAME(checkout) = 4,
|
|
37
|
+
PAY SWIFT_NAME(pay) = 5,
|
|
38
|
+
SUBSCRIBE SWIFT_NAME(subscribe) = 6,
|
|
39
|
+
PLAIN SWIFT_NAME(plain) = 7,
|
|
40
|
+
} CLOSED_ENUM;
|
|
41
|
+
|
|
42
|
+
} // namespace margelo::nitro::pay
|
|
43
|
+
|
|
44
|
+
namespace margelo::nitro {
|
|
45
|
+
|
|
46
|
+
// C++ GooglePayButtonType <> JS GooglePayButtonType (union)
|
|
47
|
+
template <>
|
|
48
|
+
struct JSIConverter<margelo::nitro::pay::GooglePayButtonType> final {
|
|
49
|
+
static inline margelo::nitro::pay::GooglePayButtonType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
50
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
51
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
52
|
+
case hashString("buy"): return margelo::nitro::pay::GooglePayButtonType::BUY;
|
|
53
|
+
case hashString("book"): return margelo::nitro::pay::GooglePayButtonType::BOOK;
|
|
54
|
+
case hashString("donate"): return margelo::nitro::pay::GooglePayButtonType::DONATE;
|
|
55
|
+
case hashString("order"): return margelo::nitro::pay::GooglePayButtonType::ORDER;
|
|
56
|
+
case hashString("checkout"): return margelo::nitro::pay::GooglePayButtonType::CHECKOUT;
|
|
57
|
+
case hashString("pay"): return margelo::nitro::pay::GooglePayButtonType::PAY;
|
|
58
|
+
case hashString("subscribe"): return margelo::nitro::pay::GooglePayButtonType::SUBSCRIBE;
|
|
59
|
+
case hashString("plain"): return margelo::nitro::pay::GooglePayButtonType::PLAIN;
|
|
60
|
+
default: [[unlikely]]
|
|
61
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum GooglePayButtonType - invalid value!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::pay::GooglePayButtonType arg) {
|
|
65
|
+
switch (arg) {
|
|
66
|
+
case margelo::nitro::pay::GooglePayButtonType::BUY: return JSIConverter<std::string>::toJSI(runtime, "buy");
|
|
67
|
+
case margelo::nitro::pay::GooglePayButtonType::BOOK: return JSIConverter<std::string>::toJSI(runtime, "book");
|
|
68
|
+
case margelo::nitro::pay::GooglePayButtonType::DONATE: return JSIConverter<std::string>::toJSI(runtime, "donate");
|
|
69
|
+
case margelo::nitro::pay::GooglePayButtonType::ORDER: return JSIConverter<std::string>::toJSI(runtime, "order");
|
|
70
|
+
case margelo::nitro::pay::GooglePayButtonType::CHECKOUT: return JSIConverter<std::string>::toJSI(runtime, "checkout");
|
|
71
|
+
case margelo::nitro::pay::GooglePayButtonType::PAY: return JSIConverter<std::string>::toJSI(runtime, "pay");
|
|
72
|
+
case margelo::nitro::pay::GooglePayButtonType::SUBSCRIBE: return JSIConverter<std::string>::toJSI(runtime, "subscribe");
|
|
73
|
+
case margelo::nitro::pay::GooglePayButtonType::PLAIN: return JSIConverter<std::string>::toJSI(runtime, "plain");
|
|
74
|
+
default: [[unlikely]]
|
|
75
|
+
throw std::invalid_argument("Cannot convert GooglePayButtonType to JS - invalid value: "
|
|
76
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
80
|
+
if (!value.isString()) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
84
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
85
|
+
case hashString("buy"):
|
|
86
|
+
case hashString("book"):
|
|
87
|
+
case hashString("donate"):
|
|
88
|
+
case hashString("order"):
|
|
89
|
+
case hashString("checkout"):
|
|
90
|
+
case hashString("pay"):
|
|
91
|
+
case hashString("subscribe"):
|
|
92
|
+
case hashString("plain"):
|
|
93
|
+
return true;
|
|
94
|
+
default:
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GooglePayEnvironment.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::pay {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (GooglePayEnvironment).
|
|
30
|
+
*/
|
|
31
|
+
enum class GooglePayEnvironment {
|
|
32
|
+
TEST SWIFT_NAME(test) = 0,
|
|
33
|
+
PRODUCTION SWIFT_NAME(production) = 1,
|
|
34
|
+
} CLOSED_ENUM;
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro::pay
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro {
|
|
39
|
+
|
|
40
|
+
// C++ GooglePayEnvironment <> JS GooglePayEnvironment (union)
|
|
41
|
+
template <>
|
|
42
|
+
struct JSIConverter<margelo::nitro::pay::GooglePayEnvironment> final {
|
|
43
|
+
static inline margelo::nitro::pay::GooglePayEnvironment fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
44
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
45
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
46
|
+
case hashString("TEST"): return margelo::nitro::pay::GooglePayEnvironment::TEST;
|
|
47
|
+
case hashString("PRODUCTION"): return margelo::nitro::pay::GooglePayEnvironment::PRODUCTION;
|
|
48
|
+
default: [[unlikely]]
|
|
49
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum GooglePayEnvironment - invalid value!");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::pay::GooglePayEnvironment arg) {
|
|
53
|
+
switch (arg) {
|
|
54
|
+
case margelo::nitro::pay::GooglePayEnvironment::TEST: return JSIConverter<std::string>::toJSI(runtime, "TEST");
|
|
55
|
+
case margelo::nitro::pay::GooglePayEnvironment::PRODUCTION: return JSIConverter<std::string>::toJSI(runtime, "PRODUCTION");
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert GooglePayEnvironment to JS - invalid value: "
|
|
58
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
62
|
+
if (!value.isString()) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
66
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
67
|
+
case hashString("TEST"):
|
|
68
|
+
case hashString("PRODUCTION"):
|
|
69
|
+
return true;
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridApplePayButtonSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridApplePayButtonSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::pay {
|
|
11
|
+
|
|
12
|
+
void HybridApplePayButtonSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("buttonType", &HybridApplePayButtonSpec::getButtonType);
|
|
18
|
+
prototype.registerHybridSetter("buttonType", &HybridApplePayButtonSpec::setButtonType);
|
|
19
|
+
prototype.registerHybridGetter("buttonStyle", &HybridApplePayButtonSpec::getButtonStyle);
|
|
20
|
+
prototype.registerHybridSetter("buttonStyle", &HybridApplePayButtonSpec::setButtonStyle);
|
|
21
|
+
prototype.registerHybridGetter("onPress", &HybridApplePayButtonSpec::getOnPress);
|
|
22
|
+
prototype.registerHybridSetter("onPress", &HybridApplePayButtonSpec::setOnPress);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
} // namespace margelo::nitro::pay
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridApplePayButtonSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `ApplePayButtonType` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::pay { enum class ApplePayButtonType; }
|
|
18
|
+
// Forward declaration of `ApplePayButtonStyle` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::pay { enum class ApplePayButtonStyle; }
|
|
20
|
+
|
|
21
|
+
#include "ApplePayButtonType.hpp"
|
|
22
|
+
#include "ApplePayButtonStyle.hpp"
|
|
23
|
+
#include <functional>
|
|
24
|
+
#include <optional>
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::pay {
|
|
27
|
+
|
|
28
|
+
using namespace margelo::nitro;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* An abstract base class for `ApplePayButton`
|
|
32
|
+
* Inherit this class to create instances of `HybridApplePayButtonSpec` in C++.
|
|
33
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
34
|
+
* @example
|
|
35
|
+
* ```cpp
|
|
36
|
+
* class HybridApplePayButton: public HybridApplePayButtonSpec {
|
|
37
|
+
* public:
|
|
38
|
+
* HybridApplePayButton(...): HybridObject(TAG) { ... }
|
|
39
|
+
* // ...
|
|
40
|
+
* };
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
class HybridApplePayButtonSpec: public virtual HybridObject {
|
|
44
|
+
public:
|
|
45
|
+
// Constructor
|
|
46
|
+
explicit HybridApplePayButtonSpec(): HybridObject(TAG) { }
|
|
47
|
+
|
|
48
|
+
// Destructor
|
|
49
|
+
~HybridApplePayButtonSpec() override = default;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Properties
|
|
53
|
+
virtual ApplePayButtonType getButtonType() = 0;
|
|
54
|
+
virtual void setButtonType(ApplePayButtonType buttonType) = 0;
|
|
55
|
+
virtual ApplePayButtonStyle getButtonStyle() = 0;
|
|
56
|
+
virtual void setButtonStyle(ApplePayButtonStyle buttonStyle) = 0;
|
|
57
|
+
virtual std::optional<std::function<void()>> getOnPress() = 0;
|
|
58
|
+
virtual void setOnPress(const std::optional<std::function<void()>>& onPress) = 0;
|
|
59
|
+
|
|
60
|
+
public:
|
|
61
|
+
// Methods
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
protected:
|
|
65
|
+
// Hybrid Setup
|
|
66
|
+
void loadHybridMethods() override;
|
|
67
|
+
|
|
68
|
+
protected:
|
|
69
|
+
// Tag for logging
|
|
70
|
+
static constexpr auto TAG = "ApplePayButton";
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
} // namespace margelo::nitro::pay
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridGooglePayButtonSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridGooglePayButtonSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::pay {
|
|
11
|
+
|
|
12
|
+
void HybridGooglePayButtonSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("buttonType", &HybridGooglePayButtonSpec::getButtonType);
|
|
18
|
+
prototype.registerHybridSetter("buttonType", &HybridGooglePayButtonSpec::setButtonType);
|
|
19
|
+
prototype.registerHybridGetter("theme", &HybridGooglePayButtonSpec::getTheme);
|
|
20
|
+
prototype.registerHybridSetter("theme", &HybridGooglePayButtonSpec::setTheme);
|
|
21
|
+
prototype.registerHybridGetter("radius", &HybridGooglePayButtonSpec::getRadius);
|
|
22
|
+
prototype.registerHybridSetter("radius", &HybridGooglePayButtonSpec::setRadius);
|
|
23
|
+
prototype.registerHybridGetter("onPress", &HybridGooglePayButtonSpec::getOnPress);
|
|
24
|
+
prototype.registerHybridSetter("onPress", &HybridGooglePayButtonSpec::setOnPress);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
} // namespace margelo::nitro::pay
|