@padosoft/react-native-ecr17 0.0.0
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/Ecr17.podspec +39 -0
- package/README.md +348 -0
- package/android/CMakeLists.txt +41 -0
- package/android/build.gradle +149 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +9 -0
- package/android/src/main/java/com/margelo/nitro/ecr17/HybridEcr17Transport.kt +233 -0
- package/android/src/main/java/com/padosoft/ecr17/Ecr17Package.kt +30 -0
- package/cpp/Ecr17.cpp +1 -0
- package/cpp/Ecr17.hpp +2 -0
- package/cpp/Ecr17Client/HybridEcr17Client.cpp +598 -0
- package/cpp/Ecr17Client/HybridEcr17Client.hpp +85 -0
- package/cpp/Ecr17Protocol/Ecr17Protocol.cpp +277 -0
- package/cpp/Ecr17Protocol/Ecr17Protocol.hpp +103 -0
- package/cpp/Ecr17Response/Ecr17Response.cpp +155 -0
- package/cpp/Ecr17Response/Ecr17Response.hpp +113 -0
- package/cpp/Lcr/Lcr.cpp +42 -0
- package/cpp/Lcr/Lcr.hpp +22 -0
- package/cpp/PacketCodec/PacketCodec.cpp +146 -0
- package/cpp/PacketCodec/PacketCodec.hpp +48 -0
- package/cpp/Session/Ecr17Session.cpp +260 -0
- package/cpp/Session/Ecr17Session.hpp +97 -0
- package/cpp/Session/RetryPolicy.hpp +23 -0
- package/cpp/Transport/FakeTransport.hpp +95 -0
- package/cpp/Transport/NativeTransportAdapter.cpp +42 -0
- package/cpp/Transport/NativeTransportAdapter.hpp +32 -0
- package/cpp/Transport/Transport.hpp +31 -0
- package/cpp/tests/CMakeLists.txt +55 -0
- package/cpp/tests/PosixTcpTransport.hpp +105 -0
- package/cpp/tests/stubs/LrcMode.hpp +25 -0
- package/cpp/tests/test_flows.cpp +148 -0
- package/cpp/tests/test_integration_terminal.cpp +72 -0
- package/cpp/tests/test_lrc.cpp +66 -0
- package/cpp/tests/test_packet_codec.cpp +164 -0
- package/cpp/tests/test_protocol.cpp +102 -0
- package/cpp/tests/test_protocol_commands.cpp +190 -0
- package/cpp/tests/test_response.cpp +164 -0
- package/cpp/tests/test_retry_policy.cpp +28 -0
- package/cpp/tests/test_session.cpp +262 -0
- package/ios/Bridge.h +1 -0
- package/ios/HybridEcr17Transport.swift +103 -0
- package/nitro.json +30 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/Ecr17+autolinking.cmake +82 -0
- package/nitrogen/generated/android/Ecr17+autolinking.gradle +27 -0
- package/nitrogen/generated/android/Ecr17OnLoad.cpp +68 -0
- package/nitrogen/generated/android/Ecr17OnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__shared_ptr_ArrayBuffer_.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridEcr17TransportSpec.cpp +93 -0
- package/nitrogen/generated/android/c++/JHybridEcr17TransportSpec.hpp +68 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/ecr17/Ecr17OnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/ecr17/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/ecr17/Func_void_std__shared_ptr_ArrayBuffer_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/ecr17/HybridEcr17TransportSpec.kt +86 -0
- package/nitrogen/generated/ios/Ecr17+autolinking.rb +62 -0
- package/nitrogen/generated/ios/Ecr17-Swift-Cxx-Bridge.cpp +57 -0
- package/nitrogen/generated/ios/Ecr17-Swift-Cxx-Bridge.hpp +154 -0
- package/nitrogen/generated/ios/Ecr17-Swift-Cxx-Umbrella.hpp +47 -0
- package/nitrogen/generated/ios/Ecr17Autolinking.mm +43 -0
- package/nitrogen/generated/ios/Ecr17Autolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridEcr17TransportSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridEcr17TransportSpecSwift.hpp +119 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_ArrayBuffer_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridEcr17TransportSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridEcr17TransportSpec_cxx.swift +211 -0
- package/nitrogen/generated/shared/c++/CardType.hpp +84 -0
- package/nitrogen/generated/shared/c++/CardVerificationRequest.hpp +97 -0
- package/nitrogen/generated/shared/c++/CardVerificationResult.hpp +136 -0
- package/nitrogen/generated/shared/c++/CloseSessionResult.hpp +106 -0
- package/nitrogen/generated/shared/c++/ConnectionState.hpp +80 -0
- package/nitrogen/generated/shared/c++/CurrencyExchange.hpp +100 -0
- package/nitrogen/generated/shared/c++/Ecr17Config.hpp +138 -0
- package/nitrogen/generated/shared/c++/HybridEcr17ClientSpec.cpp +42 -0
- package/nitrogen/generated/shared/c++/HybridEcr17ClientSpec.hpp +138 -0
- package/nitrogen/generated/shared/c++/HybridEcr17TransportSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridEcr17TransportSpec.hpp +70 -0
- package/nitrogen/generated/shared/c++/IncrementalAuthRequest.hpp +96 -0
- package/nitrogen/generated/shared/c++/LrcMode.hpp +84 -0
- package/nitrogen/generated/shared/c++/PaymentCardType.hpp +84 -0
- package/nitrogen/generated/shared/c++/PaymentRequest.hpp +109 -0
- package/nitrogen/generated/shared/c++/PaymentResult.hpp +139 -0
- package/nitrogen/generated/shared/c++/PosStatusResponse.hpp +96 -0
- package/nitrogen/generated/shared/c++/PreAuthClosureRequest.hpp +96 -0
- package/nitrogen/generated/shared/c++/PreAuthRequest.hpp +109 -0
- package/nitrogen/generated/shared/c++/PreAuthResult.hpp +144 -0
- package/nitrogen/generated/shared/c++/ProgressEvent.hpp +83 -0
- package/nitrogen/generated/shared/c++/ReceiptLine.hpp +83 -0
- package/nitrogen/generated/shared/c++/ReversalRequest.hpp +88 -0
- package/nitrogen/generated/shared/c++/ReversalResult.hpp +132 -0
- package/nitrogen/generated/shared/c++/TokenizationRequest.hpp +89 -0
- package/nitrogen/generated/shared/c++/TokenizationService.hpp +76 -0
- package/nitrogen/generated/shared/c++/TotalsResult.hpp +93 -0
- package/nitrogen/generated/shared/c++/TransactionEntryMode.hpp +92 -0
- package/nitrogen/generated/shared/c++/TransactionOutcome.hpp +88 -0
- package/nitrogen/generated/shared/c++/VasResult.hpp +96 -0
- package/package.json +102 -0
- package/react-native.config.js +18 -0
- package/src/index.ts +4 -0
- package/src/specs/client.nitro.ts +102 -0
- package/src/specs/transport.nitro.ts +25 -0
- package/src/types/client.ts +196 -0
- package/src/utils/client.ts +10 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReversalResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `TransactionOutcome` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::ecr17 { enum class TransactionOutcome; }
|
|
33
|
+
// Forward declaration of `TransactionEntryMode` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::ecr17 { enum class TransactionEntryMode; }
|
|
35
|
+
// Forward declaration of `CardType` to properly resolve imports.
|
|
36
|
+
namespace margelo::nitro::ecr17 { enum class CardType; }
|
|
37
|
+
|
|
38
|
+
#include "TransactionOutcome.hpp"
|
|
39
|
+
#include <string>
|
|
40
|
+
#include <optional>
|
|
41
|
+
#include "TransactionEntryMode.hpp"
|
|
42
|
+
#include "CardType.hpp"
|
|
43
|
+
|
|
44
|
+
namespace margelo::nitro::ecr17 {
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A struct which can be represented as a JavaScript object (ReversalResult).
|
|
48
|
+
*/
|
|
49
|
+
struct ReversalResult final {
|
|
50
|
+
public:
|
|
51
|
+
TransactionOutcome outcome SWIFT_PRIVATE;
|
|
52
|
+
std::string resultCode SWIFT_PRIVATE;
|
|
53
|
+
std::optional<std::string> pan SWIFT_PRIVATE;
|
|
54
|
+
std::optional<TransactionEntryMode> entryMode SWIFT_PRIVATE;
|
|
55
|
+
std::optional<std::string> hostDateTime SWIFT_PRIVATE;
|
|
56
|
+
std::optional<CardType> cardType SWIFT_PRIVATE;
|
|
57
|
+
std::optional<std::string> acquirerId SWIFT_PRIVATE;
|
|
58
|
+
std::optional<std::string> stan SWIFT_PRIVATE;
|
|
59
|
+
std::optional<std::string> onlineId SWIFT_PRIVATE;
|
|
60
|
+
std::optional<std::string> actionCode SWIFT_PRIVATE;
|
|
61
|
+
std::optional<std::string> errorDescription SWIFT_PRIVATE;
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
ReversalResult() = default;
|
|
65
|
+
explicit ReversalResult(TransactionOutcome outcome, std::string resultCode, std::optional<std::string> pan, std::optional<TransactionEntryMode> entryMode, std::optional<std::string> hostDateTime, std::optional<CardType> cardType, std::optional<std::string> acquirerId, std::optional<std::string> stan, std::optional<std::string> onlineId, std::optional<std::string> actionCode, std::optional<std::string> errorDescription): outcome(outcome), resultCode(resultCode), pan(pan), entryMode(entryMode), hostDateTime(hostDateTime), cardType(cardType), acquirerId(acquirerId), stan(stan), onlineId(onlineId), actionCode(actionCode), errorDescription(errorDescription) {}
|
|
66
|
+
|
|
67
|
+
public:
|
|
68
|
+
friend bool operator==(const ReversalResult& lhs, const ReversalResult& rhs) = default;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} // namespace margelo::nitro::ecr17
|
|
72
|
+
|
|
73
|
+
namespace margelo::nitro {
|
|
74
|
+
|
|
75
|
+
// C++ ReversalResult <> JS ReversalResult (object)
|
|
76
|
+
template <>
|
|
77
|
+
struct JSIConverter<margelo::nitro::ecr17::ReversalResult> final {
|
|
78
|
+
static inline margelo::nitro::ecr17::ReversalResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
79
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
80
|
+
return margelo::nitro::ecr17::ReversalResult(
|
|
81
|
+
JSIConverter<margelo::nitro::ecr17::TransactionOutcome>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outcome"))),
|
|
82
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resultCode"))),
|
|
83
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pan"))),
|
|
84
|
+
JSIConverter<std::optional<margelo::nitro::ecr17::TransactionEntryMode>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entryMode"))),
|
|
85
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hostDateTime"))),
|
|
86
|
+
JSIConverter<std::optional<margelo::nitro::ecr17::CardType>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cardType"))),
|
|
87
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "acquirerId"))),
|
|
88
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stan"))),
|
|
89
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onlineId"))),
|
|
90
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "actionCode"))),
|
|
91
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "errorDescription")))
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ecr17::ReversalResult& arg) {
|
|
95
|
+
jsi::Object obj(runtime);
|
|
96
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "outcome"), JSIConverter<margelo::nitro::ecr17::TransactionOutcome>::toJSI(runtime, arg.outcome));
|
|
97
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "resultCode"), JSIConverter<std::string>::toJSI(runtime, arg.resultCode));
|
|
98
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "pan"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.pan));
|
|
99
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "entryMode"), JSIConverter<std::optional<margelo::nitro::ecr17::TransactionEntryMode>>::toJSI(runtime, arg.entryMode));
|
|
100
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "hostDateTime"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.hostDateTime));
|
|
101
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cardType"), JSIConverter<std::optional<margelo::nitro::ecr17::CardType>>::toJSI(runtime, arg.cardType));
|
|
102
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "acquirerId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.acquirerId));
|
|
103
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "stan"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.stan));
|
|
104
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "onlineId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.onlineId));
|
|
105
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "actionCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.actionCode));
|
|
106
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "errorDescription"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.errorDescription));
|
|
107
|
+
return obj;
|
|
108
|
+
}
|
|
109
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
110
|
+
if (!value.isObject()) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
jsi::Object obj = value.getObject(runtime);
|
|
114
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
if (!JSIConverter<margelo::nitro::ecr17::TransactionOutcome>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outcome")))) return false;
|
|
118
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resultCode")))) return false;
|
|
119
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pan")))) return false;
|
|
120
|
+
if (!JSIConverter<std::optional<margelo::nitro::ecr17::TransactionEntryMode>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entryMode")))) return false;
|
|
121
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hostDateTime")))) return false;
|
|
122
|
+
if (!JSIConverter<std::optional<margelo::nitro::ecr17::CardType>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cardType")))) return false;
|
|
123
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "acquirerId")))) return false;
|
|
124
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stan")))) return false;
|
|
125
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onlineId")))) return false;
|
|
126
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "actionCode")))) return false;
|
|
127
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "errorDescription")))) return false;
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// TokenizationRequest.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `TokenizationService` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::ecr17 { enum class TokenizationService; }
|
|
33
|
+
|
|
34
|
+
#include "TokenizationService.hpp"
|
|
35
|
+
#include <string>
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::ecr17 {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (TokenizationRequest).
|
|
41
|
+
*/
|
|
42
|
+
struct TokenizationRequest final {
|
|
43
|
+
public:
|
|
44
|
+
TokenizationService service SWIFT_PRIVATE;
|
|
45
|
+
std::string contractCode SWIFT_PRIVATE;
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
TokenizationRequest() = default;
|
|
49
|
+
explicit TokenizationRequest(TokenizationService service, std::string contractCode): service(service), contractCode(contractCode) {}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
friend bool operator==(const TokenizationRequest& lhs, const TokenizationRequest& rhs) = default;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace margelo::nitro::ecr17
|
|
56
|
+
|
|
57
|
+
namespace margelo::nitro {
|
|
58
|
+
|
|
59
|
+
// C++ TokenizationRequest <> JS TokenizationRequest (object)
|
|
60
|
+
template <>
|
|
61
|
+
struct JSIConverter<margelo::nitro::ecr17::TokenizationRequest> final {
|
|
62
|
+
static inline margelo::nitro::ecr17::TokenizationRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
63
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
64
|
+
return margelo::nitro::ecr17::TokenizationRequest(
|
|
65
|
+
JSIConverter<margelo::nitro::ecr17::TokenizationService>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "service"))),
|
|
66
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contractCode")))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ecr17::TokenizationRequest& arg) {
|
|
70
|
+
jsi::Object obj(runtime);
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "service"), JSIConverter<margelo::nitro::ecr17::TokenizationService>::toJSI(runtime, arg.service));
|
|
72
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "contractCode"), JSIConverter<std::string>::toJSI(runtime, arg.contractCode));
|
|
73
|
+
return obj;
|
|
74
|
+
}
|
|
75
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
76
|
+
if (!value.isObject()) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
jsi::Object obj = value.getObject(runtime);
|
|
80
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
if (!JSIConverter<margelo::nitro::ecr17::TokenizationService>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "service")))) return false;
|
|
84
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contractCode")))) return false;
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// TokenizationService.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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::ecr17 {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (TokenizationService).
|
|
30
|
+
*/
|
|
31
|
+
enum class TokenizationService {
|
|
32
|
+
RECURRING SWIFT_NAME(recurring) = 0,
|
|
33
|
+
UNSCHEDULEDORONECLICK SWIFT_NAME(unscheduledoroneclick) = 1,
|
|
34
|
+
} CLOSED_ENUM;
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro::ecr17
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro {
|
|
39
|
+
|
|
40
|
+
// C++ TokenizationService <> JS TokenizationService (union)
|
|
41
|
+
template <>
|
|
42
|
+
struct JSIConverter<margelo::nitro::ecr17::TokenizationService> final {
|
|
43
|
+
static inline margelo::nitro::ecr17::TokenizationService 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("recurring"): return margelo::nitro::ecr17::TokenizationService::RECURRING;
|
|
47
|
+
case hashString("unscheduledOrOneClick"): return margelo::nitro::ecr17::TokenizationService::UNSCHEDULEDORONECLICK;
|
|
48
|
+
default: [[unlikely]]
|
|
49
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum TokenizationService - invalid value!");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::ecr17::TokenizationService arg) {
|
|
53
|
+
switch (arg) {
|
|
54
|
+
case margelo::nitro::ecr17::TokenizationService::RECURRING: return JSIConverter<std::string>::toJSI(runtime, "recurring");
|
|
55
|
+
case margelo::nitro::ecr17::TokenizationService::UNSCHEDULEDORONECLICK: return JSIConverter<std::string>::toJSI(runtime, "unscheduledOrOneClick");
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert TokenizationService 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("recurring"):
|
|
68
|
+
case hashString("unscheduledOrOneClick"):
|
|
69
|
+
return true;
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// TotalsResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `TransactionOutcome` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::ecr17 { enum class TransactionOutcome; }
|
|
33
|
+
|
|
34
|
+
#include "TransactionOutcome.hpp"
|
|
35
|
+
#include <string>
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::ecr17 {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (TotalsResult).
|
|
41
|
+
*/
|
|
42
|
+
struct TotalsResult final {
|
|
43
|
+
public:
|
|
44
|
+
TransactionOutcome outcome SWIFT_PRIVATE;
|
|
45
|
+
std::string resultCode SWIFT_PRIVATE;
|
|
46
|
+
double posTotalCents SWIFT_PRIVATE;
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
TotalsResult() = default;
|
|
50
|
+
explicit TotalsResult(TransactionOutcome outcome, std::string resultCode, double posTotalCents): outcome(outcome), resultCode(resultCode), posTotalCents(posTotalCents) {}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
friend bool operator==(const TotalsResult& lhs, const TotalsResult& rhs) = default;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
} // namespace margelo::nitro::ecr17
|
|
57
|
+
|
|
58
|
+
namespace margelo::nitro {
|
|
59
|
+
|
|
60
|
+
// C++ TotalsResult <> JS TotalsResult (object)
|
|
61
|
+
template <>
|
|
62
|
+
struct JSIConverter<margelo::nitro::ecr17::TotalsResult> final {
|
|
63
|
+
static inline margelo::nitro::ecr17::TotalsResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
64
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
65
|
+
return margelo::nitro::ecr17::TotalsResult(
|
|
66
|
+
JSIConverter<margelo::nitro::ecr17::TransactionOutcome>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outcome"))),
|
|
67
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resultCode"))),
|
|
68
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "posTotalCents")))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ecr17::TotalsResult& arg) {
|
|
72
|
+
jsi::Object obj(runtime);
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "outcome"), JSIConverter<margelo::nitro::ecr17::TransactionOutcome>::toJSI(runtime, arg.outcome));
|
|
74
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "resultCode"), JSIConverter<std::string>::toJSI(runtime, arg.resultCode));
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "posTotalCents"), JSIConverter<double>::toJSI(runtime, arg.posTotalCents));
|
|
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<margelo::nitro::ecr17::TransactionOutcome>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outcome")))) return false;
|
|
87
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resultCode")))) return false;
|
|
88
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "posTotalCents")))) return false;
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// TransactionEntryMode.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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::ecr17 {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (TransactionEntryMode).
|
|
30
|
+
*/
|
|
31
|
+
enum class TransactionEntryMode {
|
|
32
|
+
UNKNOWN SWIFT_NAME(unknown) = 0,
|
|
33
|
+
ICC SWIFT_NAME(icc) = 1,
|
|
34
|
+
MAG SWIFT_NAME(mag) = 2,
|
|
35
|
+
MANUAL SWIFT_NAME(manual) = 3,
|
|
36
|
+
CLESSMAG SWIFT_NAME(clessmag) = 4,
|
|
37
|
+
CLESSICC SWIFT_NAME(clessicc) = 5,
|
|
38
|
+
} CLOSED_ENUM;
|
|
39
|
+
|
|
40
|
+
} // namespace margelo::nitro::ecr17
|
|
41
|
+
|
|
42
|
+
namespace margelo::nitro {
|
|
43
|
+
|
|
44
|
+
// C++ TransactionEntryMode <> JS TransactionEntryMode (union)
|
|
45
|
+
template <>
|
|
46
|
+
struct JSIConverter<margelo::nitro::ecr17::TransactionEntryMode> final {
|
|
47
|
+
static inline margelo::nitro::ecr17::TransactionEntryMode fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
48
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
49
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
50
|
+
case hashString("unknown"): return margelo::nitro::ecr17::TransactionEntryMode::UNKNOWN;
|
|
51
|
+
case hashString("icc"): return margelo::nitro::ecr17::TransactionEntryMode::ICC;
|
|
52
|
+
case hashString("mag"): return margelo::nitro::ecr17::TransactionEntryMode::MAG;
|
|
53
|
+
case hashString("manual"): return margelo::nitro::ecr17::TransactionEntryMode::MANUAL;
|
|
54
|
+
case hashString("clessMag"): return margelo::nitro::ecr17::TransactionEntryMode::CLESSMAG;
|
|
55
|
+
case hashString("clessIcc"): return margelo::nitro::ecr17::TransactionEntryMode::CLESSICC;
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum TransactionEntryMode - invalid value!");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::ecr17::TransactionEntryMode arg) {
|
|
61
|
+
switch (arg) {
|
|
62
|
+
case margelo::nitro::ecr17::TransactionEntryMode::UNKNOWN: return JSIConverter<std::string>::toJSI(runtime, "unknown");
|
|
63
|
+
case margelo::nitro::ecr17::TransactionEntryMode::ICC: return JSIConverter<std::string>::toJSI(runtime, "icc");
|
|
64
|
+
case margelo::nitro::ecr17::TransactionEntryMode::MAG: return JSIConverter<std::string>::toJSI(runtime, "mag");
|
|
65
|
+
case margelo::nitro::ecr17::TransactionEntryMode::MANUAL: return JSIConverter<std::string>::toJSI(runtime, "manual");
|
|
66
|
+
case margelo::nitro::ecr17::TransactionEntryMode::CLESSMAG: return JSIConverter<std::string>::toJSI(runtime, "clessMag");
|
|
67
|
+
case margelo::nitro::ecr17::TransactionEntryMode::CLESSICC: return JSIConverter<std::string>::toJSI(runtime, "clessIcc");
|
|
68
|
+
default: [[unlikely]]
|
|
69
|
+
throw std::invalid_argument("Cannot convert TransactionEntryMode to JS - invalid value: "
|
|
70
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isString()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
78
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
79
|
+
case hashString("unknown"):
|
|
80
|
+
case hashString("icc"):
|
|
81
|
+
case hashString("mag"):
|
|
82
|
+
case hashString("manual"):
|
|
83
|
+
case hashString("clessMag"):
|
|
84
|
+
case hashString("clessIcc"):
|
|
85
|
+
return true;
|
|
86
|
+
default:
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// TransactionOutcome.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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::ecr17 {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (TransactionOutcome).
|
|
30
|
+
*/
|
|
31
|
+
enum class TransactionOutcome {
|
|
32
|
+
OK SWIFT_NAME(ok) = 0,
|
|
33
|
+
KO SWIFT_NAME(ko) = 1,
|
|
34
|
+
CARDNOTPRESENT SWIFT_NAME(cardnotpresent) = 2,
|
|
35
|
+
UNKNOWNTAG SWIFT_NAME(unknowntag) = 3,
|
|
36
|
+
UNKNOWN SWIFT_NAME(unknown) = 4,
|
|
37
|
+
} CLOSED_ENUM;
|
|
38
|
+
|
|
39
|
+
} // namespace margelo::nitro::ecr17
|
|
40
|
+
|
|
41
|
+
namespace margelo::nitro {
|
|
42
|
+
|
|
43
|
+
// C++ TransactionOutcome <> JS TransactionOutcome (union)
|
|
44
|
+
template <>
|
|
45
|
+
struct JSIConverter<margelo::nitro::ecr17::TransactionOutcome> final {
|
|
46
|
+
static inline margelo::nitro::ecr17::TransactionOutcome fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
47
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
48
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
49
|
+
case hashString("ok"): return margelo::nitro::ecr17::TransactionOutcome::OK;
|
|
50
|
+
case hashString("ko"): return margelo::nitro::ecr17::TransactionOutcome::KO;
|
|
51
|
+
case hashString("cardNotPresent"): return margelo::nitro::ecr17::TransactionOutcome::CARDNOTPRESENT;
|
|
52
|
+
case hashString("unknownTag"): return margelo::nitro::ecr17::TransactionOutcome::UNKNOWNTAG;
|
|
53
|
+
case hashString("unknown"): return margelo::nitro::ecr17::TransactionOutcome::UNKNOWN;
|
|
54
|
+
default: [[unlikely]]
|
|
55
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum TransactionOutcome - invalid value!");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::ecr17::TransactionOutcome arg) {
|
|
59
|
+
switch (arg) {
|
|
60
|
+
case margelo::nitro::ecr17::TransactionOutcome::OK: return JSIConverter<std::string>::toJSI(runtime, "ok");
|
|
61
|
+
case margelo::nitro::ecr17::TransactionOutcome::KO: return JSIConverter<std::string>::toJSI(runtime, "ko");
|
|
62
|
+
case margelo::nitro::ecr17::TransactionOutcome::CARDNOTPRESENT: return JSIConverter<std::string>::toJSI(runtime, "cardNotPresent");
|
|
63
|
+
case margelo::nitro::ecr17::TransactionOutcome::UNKNOWNTAG: return JSIConverter<std::string>::toJSI(runtime, "unknownTag");
|
|
64
|
+
case margelo::nitro::ecr17::TransactionOutcome::UNKNOWN: return JSIConverter<std::string>::toJSI(runtime, "unknown");
|
|
65
|
+
default: [[unlikely]]
|
|
66
|
+
throw std::invalid_argument("Cannot convert TransactionOutcome to JS - invalid value: "
|
|
67
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
71
|
+
if (!value.isString()) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
75
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
76
|
+
case hashString("ok"):
|
|
77
|
+
case hashString("ko"):
|
|
78
|
+
case hashString("cardNotPresent"):
|
|
79
|
+
case hashString("unknownTag"):
|
|
80
|
+
case hashString("unknown"):
|
|
81
|
+
return true;
|
|
82
|
+
default:
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// VasResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
#include <optional>
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::ecr17 {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (VasResult).
|
|
40
|
+
*/
|
|
41
|
+
struct VasResult final {
|
|
42
|
+
public:
|
|
43
|
+
std::string responseId SWIFT_PRIVATE;
|
|
44
|
+
std::string responseMessage SWIFT_PRIVATE;
|
|
45
|
+
std::optional<std::string> orderId SWIFT_PRIVATE;
|
|
46
|
+
std::string rawXml SWIFT_PRIVATE;
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
VasResult() = default;
|
|
50
|
+
explicit VasResult(std::string responseId, std::string responseMessage, std::optional<std::string> orderId, std::string rawXml): responseId(responseId), responseMessage(responseMessage), orderId(orderId), rawXml(rawXml) {}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
friend bool operator==(const VasResult& lhs, const VasResult& rhs) = default;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
} // namespace margelo::nitro::ecr17
|
|
57
|
+
|
|
58
|
+
namespace margelo::nitro {
|
|
59
|
+
|
|
60
|
+
// C++ VasResult <> JS VasResult (object)
|
|
61
|
+
template <>
|
|
62
|
+
struct JSIConverter<margelo::nitro::ecr17::VasResult> final {
|
|
63
|
+
static inline margelo::nitro::ecr17::VasResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
64
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
65
|
+
return margelo::nitro::ecr17::VasResult(
|
|
66
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "responseId"))),
|
|
67
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "responseMessage"))),
|
|
68
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "orderId"))),
|
|
69
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawXml")))
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ecr17::VasResult& arg) {
|
|
73
|
+
jsi::Object obj(runtime);
|
|
74
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "responseId"), JSIConverter<std::string>::toJSI(runtime, arg.responseId));
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "responseMessage"), JSIConverter<std::string>::toJSI(runtime, arg.responseMessage));
|
|
76
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "orderId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.orderId));
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rawXml"), JSIConverter<std::string>::toJSI(runtime, arg.rawXml));
|
|
78
|
+
return obj;
|
|
79
|
+
}
|
|
80
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
81
|
+
if (!value.isObject()) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
jsi::Object obj = value.getObject(runtime);
|
|
85
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "responseId")))) return false;
|
|
89
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "responseMessage")))) return false;
|
|
90
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "orderId")))) return false;
|
|
91
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawXml")))) return false;
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
} // namespace margelo::nitro
|