@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.
Files changed (107) hide show
  1. package/Ecr17.podspec +39 -0
  2. package/README.md +348 -0
  3. package/android/CMakeLists.txt +41 -0
  4. package/android/build.gradle +149 -0
  5. package/android/fix-prefab.gradle +51 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +2 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +9 -0
  9. package/android/src/main/java/com/margelo/nitro/ecr17/HybridEcr17Transport.kt +233 -0
  10. package/android/src/main/java/com/padosoft/ecr17/Ecr17Package.kt +30 -0
  11. package/cpp/Ecr17.cpp +1 -0
  12. package/cpp/Ecr17.hpp +2 -0
  13. package/cpp/Ecr17Client/HybridEcr17Client.cpp +598 -0
  14. package/cpp/Ecr17Client/HybridEcr17Client.hpp +85 -0
  15. package/cpp/Ecr17Protocol/Ecr17Protocol.cpp +277 -0
  16. package/cpp/Ecr17Protocol/Ecr17Protocol.hpp +103 -0
  17. package/cpp/Ecr17Response/Ecr17Response.cpp +155 -0
  18. package/cpp/Ecr17Response/Ecr17Response.hpp +113 -0
  19. package/cpp/Lcr/Lcr.cpp +42 -0
  20. package/cpp/Lcr/Lcr.hpp +22 -0
  21. package/cpp/PacketCodec/PacketCodec.cpp +146 -0
  22. package/cpp/PacketCodec/PacketCodec.hpp +48 -0
  23. package/cpp/Session/Ecr17Session.cpp +260 -0
  24. package/cpp/Session/Ecr17Session.hpp +97 -0
  25. package/cpp/Session/RetryPolicy.hpp +23 -0
  26. package/cpp/Transport/FakeTransport.hpp +95 -0
  27. package/cpp/Transport/NativeTransportAdapter.cpp +42 -0
  28. package/cpp/Transport/NativeTransportAdapter.hpp +32 -0
  29. package/cpp/Transport/Transport.hpp +31 -0
  30. package/cpp/tests/CMakeLists.txt +55 -0
  31. package/cpp/tests/PosixTcpTransport.hpp +105 -0
  32. package/cpp/tests/stubs/LrcMode.hpp +25 -0
  33. package/cpp/tests/test_flows.cpp +148 -0
  34. package/cpp/tests/test_integration_terminal.cpp +72 -0
  35. package/cpp/tests/test_lrc.cpp +66 -0
  36. package/cpp/tests/test_packet_codec.cpp +164 -0
  37. package/cpp/tests/test_protocol.cpp +102 -0
  38. package/cpp/tests/test_protocol_commands.cpp +190 -0
  39. package/cpp/tests/test_response.cpp +164 -0
  40. package/cpp/tests/test_retry_policy.cpp +28 -0
  41. package/cpp/tests/test_session.cpp +262 -0
  42. package/ios/Bridge.h +1 -0
  43. package/ios/HybridEcr17Transport.swift +103 -0
  44. package/nitro.json +30 -0
  45. package/nitrogen/generated/.gitattributes +1 -0
  46. package/nitrogen/generated/android/Ecr17+autolinking.cmake +82 -0
  47. package/nitrogen/generated/android/Ecr17+autolinking.gradle +27 -0
  48. package/nitrogen/generated/android/Ecr17OnLoad.cpp +68 -0
  49. package/nitrogen/generated/android/Ecr17OnLoad.hpp +34 -0
  50. package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  51. package/nitrogen/generated/android/c++/JFunc_void_std__shared_ptr_ArrayBuffer_.hpp +77 -0
  52. package/nitrogen/generated/android/c++/JHybridEcr17TransportSpec.cpp +93 -0
  53. package/nitrogen/generated/android/c++/JHybridEcr17TransportSpec.hpp +68 -0
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/ecr17/Ecr17OnLoad.kt +35 -0
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/ecr17/Func_void.kt +80 -0
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/ecr17/Func_void_std__shared_ptr_ArrayBuffer_.kt +80 -0
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/ecr17/HybridEcr17TransportSpec.kt +86 -0
  58. package/nitrogen/generated/ios/Ecr17+autolinking.rb +62 -0
  59. package/nitrogen/generated/ios/Ecr17-Swift-Cxx-Bridge.cpp +57 -0
  60. package/nitrogen/generated/ios/Ecr17-Swift-Cxx-Bridge.hpp +154 -0
  61. package/nitrogen/generated/ios/Ecr17-Swift-Cxx-Umbrella.hpp +47 -0
  62. package/nitrogen/generated/ios/Ecr17Autolinking.mm +43 -0
  63. package/nitrogen/generated/ios/Ecr17Autolinking.swift +26 -0
  64. package/nitrogen/generated/ios/c++/HybridEcr17TransportSpecSwift.cpp +11 -0
  65. package/nitrogen/generated/ios/c++/HybridEcr17TransportSpecSwift.hpp +119 -0
  66. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  67. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  68. package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_ArrayBuffer_.swift +46 -0
  69. package/nitrogen/generated/ios/swift/HybridEcr17TransportSpec.swift +60 -0
  70. package/nitrogen/generated/ios/swift/HybridEcr17TransportSpec_cxx.swift +211 -0
  71. package/nitrogen/generated/shared/c++/CardType.hpp +84 -0
  72. package/nitrogen/generated/shared/c++/CardVerificationRequest.hpp +97 -0
  73. package/nitrogen/generated/shared/c++/CardVerificationResult.hpp +136 -0
  74. package/nitrogen/generated/shared/c++/CloseSessionResult.hpp +106 -0
  75. package/nitrogen/generated/shared/c++/ConnectionState.hpp +80 -0
  76. package/nitrogen/generated/shared/c++/CurrencyExchange.hpp +100 -0
  77. package/nitrogen/generated/shared/c++/Ecr17Config.hpp +138 -0
  78. package/nitrogen/generated/shared/c++/HybridEcr17ClientSpec.cpp +42 -0
  79. package/nitrogen/generated/shared/c++/HybridEcr17ClientSpec.hpp +138 -0
  80. package/nitrogen/generated/shared/c++/HybridEcr17TransportSpec.cpp +26 -0
  81. package/nitrogen/generated/shared/c++/HybridEcr17TransportSpec.hpp +70 -0
  82. package/nitrogen/generated/shared/c++/IncrementalAuthRequest.hpp +96 -0
  83. package/nitrogen/generated/shared/c++/LrcMode.hpp +84 -0
  84. package/nitrogen/generated/shared/c++/PaymentCardType.hpp +84 -0
  85. package/nitrogen/generated/shared/c++/PaymentRequest.hpp +109 -0
  86. package/nitrogen/generated/shared/c++/PaymentResult.hpp +139 -0
  87. package/nitrogen/generated/shared/c++/PosStatusResponse.hpp +96 -0
  88. package/nitrogen/generated/shared/c++/PreAuthClosureRequest.hpp +96 -0
  89. package/nitrogen/generated/shared/c++/PreAuthRequest.hpp +109 -0
  90. package/nitrogen/generated/shared/c++/PreAuthResult.hpp +144 -0
  91. package/nitrogen/generated/shared/c++/ProgressEvent.hpp +83 -0
  92. package/nitrogen/generated/shared/c++/ReceiptLine.hpp +83 -0
  93. package/nitrogen/generated/shared/c++/ReversalRequest.hpp +88 -0
  94. package/nitrogen/generated/shared/c++/ReversalResult.hpp +132 -0
  95. package/nitrogen/generated/shared/c++/TokenizationRequest.hpp +89 -0
  96. package/nitrogen/generated/shared/c++/TokenizationService.hpp +76 -0
  97. package/nitrogen/generated/shared/c++/TotalsResult.hpp +93 -0
  98. package/nitrogen/generated/shared/c++/TransactionEntryMode.hpp +92 -0
  99. package/nitrogen/generated/shared/c++/TransactionOutcome.hpp +88 -0
  100. package/nitrogen/generated/shared/c++/VasResult.hpp +96 -0
  101. package/package.json +102 -0
  102. package/react-native.config.js +18 -0
  103. package/src/index.ts +4 -0
  104. package/src/specs/client.nitro.ts +102 -0
  105. package/src/specs/transport.nitro.ts +25 -0
  106. package/src/types/client.ts +196 -0
  107. package/src/utils/client.ts +10 -0
@@ -0,0 +1,96 @@
1
+ ///
2
+ /// PreAuthClosureRequest.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 (PreAuthClosureRequest).
40
+ */
41
+ struct PreAuthClosureRequest final {
42
+ public:
43
+ double amountCents SWIFT_PRIVATE;
44
+ std::string originalPreAuthCode SWIFT_PRIVATE;
45
+ std::optional<std::string> cashRegisterId SWIFT_PRIVATE;
46
+ std::optional<std::string> receiptText SWIFT_PRIVATE;
47
+
48
+ public:
49
+ PreAuthClosureRequest() = default;
50
+ explicit PreAuthClosureRequest(double amountCents, std::string originalPreAuthCode, std::optional<std::string> cashRegisterId, std::optional<std::string> receiptText): amountCents(amountCents), originalPreAuthCode(originalPreAuthCode), cashRegisterId(cashRegisterId), receiptText(receiptText) {}
51
+
52
+ public:
53
+ friend bool operator==(const PreAuthClosureRequest& lhs, const PreAuthClosureRequest& rhs) = default;
54
+ };
55
+
56
+ } // namespace margelo::nitro::ecr17
57
+
58
+ namespace margelo::nitro {
59
+
60
+ // C++ PreAuthClosureRequest <> JS PreAuthClosureRequest (object)
61
+ template <>
62
+ struct JSIConverter<margelo::nitro::ecr17::PreAuthClosureRequest> final {
63
+ static inline margelo::nitro::ecr17::PreAuthClosureRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
64
+ jsi::Object obj = arg.asObject(runtime);
65
+ return margelo::nitro::ecr17::PreAuthClosureRequest(
66
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amountCents"))),
67
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "originalPreAuthCode"))),
68
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cashRegisterId"))),
69
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "receiptText")))
70
+ );
71
+ }
72
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ecr17::PreAuthClosureRequest& arg) {
73
+ jsi::Object obj(runtime);
74
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "amountCents"), JSIConverter<double>::toJSI(runtime, arg.amountCents));
75
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "originalPreAuthCode"), JSIConverter<std::string>::toJSI(runtime, arg.originalPreAuthCode));
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "cashRegisterId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cashRegisterId));
77
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "receiptText"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.receiptText));
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<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amountCents")))) return false;
89
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "originalPreAuthCode")))) return false;
90
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cashRegisterId")))) return false;
91
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "receiptText")))) return false;
92
+ return true;
93
+ }
94
+ };
95
+
96
+ } // namespace margelo::nitro
@@ -0,0 +1,109 @@
1
+ ///
2
+ /// PreAuthRequest.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 `PaymentCardType` to properly resolve imports.
32
+ namespace margelo::nitro::ecr17 { enum class PaymentCardType; }
33
+ // Forward declaration of `TokenizationRequest` to properly resolve imports.
34
+ namespace margelo::nitro::ecr17 { struct TokenizationRequest; }
35
+
36
+ #include <string>
37
+ #include <optional>
38
+ #include "PaymentCardType.hpp"
39
+ #include "TokenizationRequest.hpp"
40
+
41
+ namespace margelo::nitro::ecr17 {
42
+
43
+ /**
44
+ * A struct which can be represented as a JavaScript object (PreAuthRequest).
45
+ */
46
+ struct PreAuthRequest final {
47
+ public:
48
+ double amountCents SWIFT_PRIVATE;
49
+ std::optional<std::string> cashRegisterId SWIFT_PRIVATE;
50
+ std::optional<PaymentCardType> paymentType SWIFT_PRIVATE;
51
+ std::optional<bool> cardAlreadyPresent SWIFT_PRIVATE;
52
+ std::optional<std::string> receiptText SWIFT_PRIVATE;
53
+ std::optional<TokenizationRequest> tokenization SWIFT_PRIVATE;
54
+
55
+ public:
56
+ PreAuthRequest() = default;
57
+ explicit PreAuthRequest(double amountCents, std::optional<std::string> cashRegisterId, std::optional<PaymentCardType> paymentType, std::optional<bool> cardAlreadyPresent, std::optional<std::string> receiptText, std::optional<TokenizationRequest> tokenization): amountCents(amountCents), cashRegisterId(cashRegisterId), paymentType(paymentType), cardAlreadyPresent(cardAlreadyPresent), receiptText(receiptText), tokenization(tokenization) {}
58
+
59
+ public:
60
+ friend bool operator==(const PreAuthRequest& lhs, const PreAuthRequest& rhs) = default;
61
+ };
62
+
63
+ } // namespace margelo::nitro::ecr17
64
+
65
+ namespace margelo::nitro {
66
+
67
+ // C++ PreAuthRequest <> JS PreAuthRequest (object)
68
+ template <>
69
+ struct JSIConverter<margelo::nitro::ecr17::PreAuthRequest> final {
70
+ static inline margelo::nitro::ecr17::PreAuthRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
71
+ jsi::Object obj = arg.asObject(runtime);
72
+ return margelo::nitro::ecr17::PreAuthRequest(
73
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amountCents"))),
74
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cashRegisterId"))),
75
+ JSIConverter<std::optional<margelo::nitro::ecr17::PaymentCardType>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "paymentType"))),
76
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cardAlreadyPresent"))),
77
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "receiptText"))),
78
+ JSIConverter<std::optional<margelo::nitro::ecr17::TokenizationRequest>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tokenization")))
79
+ );
80
+ }
81
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ecr17::PreAuthRequest& arg) {
82
+ jsi::Object obj(runtime);
83
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "amountCents"), JSIConverter<double>::toJSI(runtime, arg.amountCents));
84
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "cashRegisterId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cashRegisterId));
85
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "paymentType"), JSIConverter<std::optional<margelo::nitro::ecr17::PaymentCardType>>::toJSI(runtime, arg.paymentType));
86
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "cardAlreadyPresent"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.cardAlreadyPresent));
87
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "receiptText"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.receiptText));
88
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "tokenization"), JSIConverter<std::optional<margelo::nitro::ecr17::TokenizationRequest>>::toJSI(runtime, arg.tokenization));
89
+ return obj;
90
+ }
91
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
92
+ if (!value.isObject()) {
93
+ return false;
94
+ }
95
+ jsi::Object obj = value.getObject(runtime);
96
+ if (!nitro::isPlainObject(runtime, obj)) {
97
+ return false;
98
+ }
99
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amountCents")))) return false;
100
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cashRegisterId")))) return false;
101
+ if (!JSIConverter<std::optional<margelo::nitro::ecr17::PaymentCardType>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "paymentType")))) return false;
102
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cardAlreadyPresent")))) return false;
103
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "receiptText")))) return false;
104
+ if (!JSIConverter<std::optional<margelo::nitro::ecr17::TokenizationRequest>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tokenization")))) return false;
105
+ return true;
106
+ }
107
+ };
108
+
109
+ } // namespace margelo::nitro
@@ -0,0 +1,144 @@
1
+ ///
2
+ /// PreAuthResult.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 (PreAuthResult).
48
+ */
49
+ struct PreAuthResult 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> authCode SWIFT_PRIVATE;
56
+ std::optional<double> preAuthorizedAmountCents SWIFT_PRIVATE;
57
+ std::optional<std::string> preAuthCode SWIFT_PRIVATE;
58
+ std::optional<std::string> actionCode SWIFT_PRIVATE;
59
+ std::optional<std::string> hostDateTime SWIFT_PRIVATE;
60
+ std::optional<CardType> cardType SWIFT_PRIVATE;
61
+ std::optional<std::string> acquirerId SWIFT_PRIVATE;
62
+ std::optional<std::string> stan SWIFT_PRIVATE;
63
+ std::optional<std::string> onlineId SWIFT_PRIVATE;
64
+ std::optional<std::string> errorDescription SWIFT_PRIVATE;
65
+
66
+ public:
67
+ PreAuthResult() = default;
68
+ explicit PreAuthResult(TransactionOutcome outcome, std::string resultCode, std::optional<std::string> pan, std::optional<TransactionEntryMode> entryMode, std::optional<std::string> authCode, std::optional<double> preAuthorizedAmountCents, std::optional<std::string> preAuthCode, std::optional<std::string> actionCode, 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> errorDescription): outcome(outcome), resultCode(resultCode), pan(pan), entryMode(entryMode), authCode(authCode), preAuthorizedAmountCents(preAuthorizedAmountCents), preAuthCode(preAuthCode), actionCode(actionCode), hostDateTime(hostDateTime), cardType(cardType), acquirerId(acquirerId), stan(stan), onlineId(onlineId), errorDescription(errorDescription) {}
69
+
70
+ public:
71
+ friend bool operator==(const PreAuthResult& lhs, const PreAuthResult& rhs) = default;
72
+ };
73
+
74
+ } // namespace margelo::nitro::ecr17
75
+
76
+ namespace margelo::nitro {
77
+
78
+ // C++ PreAuthResult <> JS PreAuthResult (object)
79
+ template <>
80
+ struct JSIConverter<margelo::nitro::ecr17::PreAuthResult> final {
81
+ static inline margelo::nitro::ecr17::PreAuthResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
82
+ jsi::Object obj = arg.asObject(runtime);
83
+ return margelo::nitro::ecr17::PreAuthResult(
84
+ JSIConverter<margelo::nitro::ecr17::TransactionOutcome>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outcome"))),
85
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resultCode"))),
86
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pan"))),
87
+ JSIConverter<std::optional<margelo::nitro::ecr17::TransactionEntryMode>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entryMode"))),
88
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "authCode"))),
89
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preAuthorizedAmountCents"))),
90
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preAuthCode"))),
91
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "actionCode"))),
92
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hostDateTime"))),
93
+ JSIConverter<std::optional<margelo::nitro::ecr17::CardType>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cardType"))),
94
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "acquirerId"))),
95
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stan"))),
96
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onlineId"))),
97
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "errorDescription")))
98
+ );
99
+ }
100
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ecr17::PreAuthResult& arg) {
101
+ jsi::Object obj(runtime);
102
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "outcome"), JSIConverter<margelo::nitro::ecr17::TransactionOutcome>::toJSI(runtime, arg.outcome));
103
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "resultCode"), JSIConverter<std::string>::toJSI(runtime, arg.resultCode));
104
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "pan"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.pan));
105
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "entryMode"), JSIConverter<std::optional<margelo::nitro::ecr17::TransactionEntryMode>>::toJSI(runtime, arg.entryMode));
106
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "authCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.authCode));
107
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "preAuthorizedAmountCents"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.preAuthorizedAmountCents));
108
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "preAuthCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.preAuthCode));
109
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "actionCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.actionCode));
110
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "hostDateTime"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.hostDateTime));
111
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "cardType"), JSIConverter<std::optional<margelo::nitro::ecr17::CardType>>::toJSI(runtime, arg.cardType));
112
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "acquirerId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.acquirerId));
113
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "stan"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.stan));
114
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "onlineId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.onlineId));
115
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "errorDescription"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.errorDescription));
116
+ return obj;
117
+ }
118
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
119
+ if (!value.isObject()) {
120
+ return false;
121
+ }
122
+ jsi::Object obj = value.getObject(runtime);
123
+ if (!nitro::isPlainObject(runtime, obj)) {
124
+ return false;
125
+ }
126
+ if (!JSIConverter<margelo::nitro::ecr17::TransactionOutcome>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outcome")))) return false;
127
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resultCode")))) return false;
128
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pan")))) return false;
129
+ if (!JSIConverter<std::optional<margelo::nitro::ecr17::TransactionEntryMode>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entryMode")))) return false;
130
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "authCode")))) return false;
131
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preAuthorizedAmountCents")))) return false;
132
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preAuthCode")))) return false;
133
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "actionCode")))) return false;
134
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hostDateTime")))) return false;
135
+ if (!JSIConverter<std::optional<margelo::nitro::ecr17::CardType>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cardType")))) return false;
136
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "acquirerId")))) return false;
137
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stan")))) return false;
138
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onlineId")))) return false;
139
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "errorDescription")))) return false;
140
+ return true;
141
+ }
142
+ };
143
+
144
+ } // namespace margelo::nitro
@@ -0,0 +1,83 @@
1
+ ///
2
+ /// ProgressEvent.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
+
35
+ namespace margelo::nitro::ecr17 {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (ProgressEvent).
39
+ */
40
+ struct ProgressEvent final {
41
+ public:
42
+ std::string message SWIFT_PRIVATE;
43
+
44
+ public:
45
+ ProgressEvent() = default;
46
+ explicit ProgressEvent(std::string message): message(message) {}
47
+
48
+ public:
49
+ friend bool operator==(const ProgressEvent& lhs, const ProgressEvent& rhs) = default;
50
+ };
51
+
52
+ } // namespace margelo::nitro::ecr17
53
+
54
+ namespace margelo::nitro {
55
+
56
+ // C++ ProgressEvent <> JS ProgressEvent (object)
57
+ template <>
58
+ struct JSIConverter<margelo::nitro::ecr17::ProgressEvent> final {
59
+ static inline margelo::nitro::ecr17::ProgressEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
60
+ jsi::Object obj = arg.asObject(runtime);
61
+ return margelo::nitro::ecr17::ProgressEvent(
62
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message")))
63
+ );
64
+ }
65
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ecr17::ProgressEvent& arg) {
66
+ jsi::Object obj(runtime);
67
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "message"), JSIConverter<std::string>::toJSI(runtime, arg.message));
68
+ return obj;
69
+ }
70
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
71
+ if (!value.isObject()) {
72
+ return false;
73
+ }
74
+ jsi::Object obj = value.getObject(runtime);
75
+ if (!nitro::isPlainObject(runtime, obj)) {
76
+ return false;
77
+ }
78
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message")))) return false;
79
+ return true;
80
+ }
81
+ };
82
+
83
+ } // namespace margelo::nitro
@@ -0,0 +1,83 @@
1
+ ///
2
+ /// ReceiptLine.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
+
35
+ namespace margelo::nitro::ecr17 {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (ReceiptLine).
39
+ */
40
+ struct ReceiptLine final {
41
+ public:
42
+ std::string text SWIFT_PRIVATE;
43
+
44
+ public:
45
+ ReceiptLine() = default;
46
+ explicit ReceiptLine(std::string text): text(text) {}
47
+
48
+ public:
49
+ friend bool operator==(const ReceiptLine& lhs, const ReceiptLine& rhs) = default;
50
+ };
51
+
52
+ } // namespace margelo::nitro::ecr17
53
+
54
+ namespace margelo::nitro {
55
+
56
+ // C++ ReceiptLine <> JS ReceiptLine (object)
57
+ template <>
58
+ struct JSIConverter<margelo::nitro::ecr17::ReceiptLine> final {
59
+ static inline margelo::nitro::ecr17::ReceiptLine fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
60
+ jsi::Object obj = arg.asObject(runtime);
61
+ return margelo::nitro::ecr17::ReceiptLine(
62
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))
63
+ );
64
+ }
65
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ecr17::ReceiptLine& arg) {
66
+ jsi::Object obj(runtime);
67
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter<std::string>::toJSI(runtime, arg.text));
68
+ return obj;
69
+ }
70
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
71
+ if (!value.isObject()) {
72
+ return false;
73
+ }
74
+ jsi::Object obj = value.getObject(runtime);
75
+ if (!nitro::isPlainObject(runtime, obj)) {
76
+ return false;
77
+ }
78
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false;
79
+ return true;
80
+ }
81
+ };
82
+
83
+ } // namespace margelo::nitro
@@ -0,0 +1,88 @@
1
+ ///
2
+ /// ReversalRequest.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 (ReversalRequest).
40
+ */
41
+ struct ReversalRequest final {
42
+ public:
43
+ std::optional<std::string> cashRegisterId SWIFT_PRIVATE;
44
+ std::optional<std::string> stan SWIFT_PRIVATE;
45
+
46
+ public:
47
+ ReversalRequest() = default;
48
+ explicit ReversalRequest(std::optional<std::string> cashRegisterId, std::optional<std::string> stan): cashRegisterId(cashRegisterId), stan(stan) {}
49
+
50
+ public:
51
+ friend bool operator==(const ReversalRequest& lhs, const ReversalRequest& rhs) = default;
52
+ };
53
+
54
+ } // namespace margelo::nitro::ecr17
55
+
56
+ namespace margelo::nitro {
57
+
58
+ // C++ ReversalRequest <> JS ReversalRequest (object)
59
+ template <>
60
+ struct JSIConverter<margelo::nitro::ecr17::ReversalRequest> final {
61
+ static inline margelo::nitro::ecr17::ReversalRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
62
+ jsi::Object obj = arg.asObject(runtime);
63
+ return margelo::nitro::ecr17::ReversalRequest(
64
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cashRegisterId"))),
65
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stan")))
66
+ );
67
+ }
68
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::ecr17::ReversalRequest& arg) {
69
+ jsi::Object obj(runtime);
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "cashRegisterId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cashRegisterId));
71
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "stan"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.stan));
72
+ return obj;
73
+ }
74
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
75
+ if (!value.isObject()) {
76
+ return false;
77
+ }
78
+ jsi::Object obj = value.getObject(runtime);
79
+ if (!nitro::isPlainObject(runtime, obj)) {
80
+ return false;
81
+ }
82
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cashRegisterId")))) return false;
83
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stan")))) return false;
84
+ return true;
85
+ }
86
+ };
87
+
88
+ } // namespace margelo::nitro