edfapay-softpos-sdk-rn 1.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 (160) hide show
  1. package/EdfapaySoftposSdkRn.podspec +20 -0
  2. package/LICENSE +20 -0
  3. package/README.md +37 -0
  4. package/android/build.gradle +82 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/java/com/edfapaysoftpossdkrn/EdfapaySoftposSdkRnModule.kt +185 -0
  7. package/android/src/main/java/com/edfapaysoftpossdkrn/EdfapaySoftposSdkRnPackage.kt +14 -0
  8. package/ios/EdfapaySoftposSdkRn.h +6 -0
  9. package/ios/EdfapaySoftposSdkRn.mm +21 -0
  10. package/lib/module/EdfaPayPlugin.js +324 -0
  11. package/lib/module/EdfaPayPlugin.js.map +1 -0
  12. package/lib/module/NativeEdfapaySoftposSdkRn.js +5 -0
  13. package/lib/module/NativeEdfapaySoftposSdkRn.js.map +1 -0
  14. package/lib/module/bridge.js +91 -0
  15. package/lib/module/bridge.js.map +1 -0
  16. package/lib/module/enums/Env.js +11 -0
  17. package/lib/module/enums/Env.js.map +1 -0
  18. package/lib/module/enums/FlowType.js +9 -0
  19. package/lib/module/enums/FlowType.js.map +1 -0
  20. package/lib/module/enums/FunctionCode.js +12 -0
  21. package/lib/module/enums/FunctionCode.js.map +1 -0
  22. package/lib/module/enums/PaymentMethod.js +8 -0
  23. package/lib/module/enums/PaymentMethod.js.map +1 -0
  24. package/lib/module/enums/Presentation.js +16 -0
  25. package/lib/module/enums/Presentation.js.map +1 -0
  26. package/lib/module/enums/PurchaseSecondaryAction.js +9 -0
  27. package/lib/module/enums/PurchaseSecondaryAction.js.map +1 -0
  28. package/lib/module/enums/TransactionType.js +15 -0
  29. package/lib/module/enums/TransactionType.js.map +1 -0
  30. package/lib/module/globals.d.js +2 -0
  31. package/lib/module/globals.d.js.map +1 -0
  32. package/lib/module/index.js +41 -0
  33. package/lib/module/index.js.map +1 -0
  34. package/lib/module/models/BnplResponse.js +26 -0
  35. package/lib/module/models/BnplResponse.js.map +1 -0
  36. package/lib/module/models/EdfaPayCredentials.js +32 -0
  37. package/lib/module/models/EdfaPayCredentials.js.map +1 -0
  38. package/lib/module/models/InvoiceRequest.js +92 -0
  39. package/lib/module/models/InvoiceRequest.js.map +1 -0
  40. package/lib/module/models/Location.js +16 -0
  41. package/lib/module/models/Location.js.map +1 -0
  42. package/lib/module/models/Pagination.js +33 -0
  43. package/lib/module/models/Pagination.js.map +1 -0
  44. package/lib/module/models/PresentationConfig.js +93 -0
  45. package/lib/module/models/PresentationConfig.js.map +1 -0
  46. package/lib/module/models/SdkTheme.js +76 -0
  47. package/lib/module/models/SdkTheme.js.map +1 -0
  48. package/lib/module/models/Terminal.js +39 -0
  49. package/lib/module/models/Terminal.js.map +1 -0
  50. package/lib/module/models/TerminalBindingTask.js +31 -0
  51. package/lib/module/models/TerminalBindingTask.js.map +1 -0
  52. package/lib/module/models/Transaction.js +33 -0
  53. package/lib/module/models/Transaction.js.map +1 -0
  54. package/lib/module/models/TxnParams.js +21 -0
  55. package/lib/module/models/TxnParams.js.map +1 -0
  56. package/lib/module/models/UserInfo.js +39 -0
  57. package/lib/module/models/UserInfo.js.map +1 -0
  58. package/lib/module/multiply.js +6 -0
  59. package/lib/module/multiply.js.map +1 -0
  60. package/lib/module/multiply.native.js +7 -0
  61. package/lib/module/multiply.native.js.map +1 -0
  62. package/lib/module/namespaces/Extension.js +112 -0
  63. package/lib/module/namespaces/Extension.js.map +1 -0
  64. package/lib/module/namespaces/RemoteChannel.js +43 -0
  65. package/lib/module/namespaces/RemoteChannel.js.map +1 -0
  66. package/lib/module/namespaces/Utils.js +78 -0
  67. package/lib/module/namespaces/Utils.js.map +1 -0
  68. package/lib/module/package.json +1 -0
  69. package/lib/module/types.js +4 -0
  70. package/lib/module/types.js.map +1 -0
  71. package/lib/typescript/package.json +1 -0
  72. package/lib/typescript/src/EdfaPayPlugin.d.ts +171 -0
  73. package/lib/typescript/src/EdfaPayPlugin.d.ts.map +1 -0
  74. package/lib/typescript/src/NativeEdfapaySoftposSdkRn.d.ts +7 -0
  75. package/lib/typescript/src/NativeEdfapaySoftposSdkRn.d.ts.map +1 -0
  76. package/lib/typescript/src/bridge.d.ts +13 -0
  77. package/lib/typescript/src/bridge.d.ts.map +1 -0
  78. package/lib/typescript/src/enums/Env.d.ts +8 -0
  79. package/lib/typescript/src/enums/Env.d.ts.map +1 -0
  80. package/lib/typescript/src/enums/FlowType.d.ts +6 -0
  81. package/lib/typescript/src/enums/FlowType.d.ts.map +1 -0
  82. package/lib/typescript/src/enums/FunctionCode.d.ts +9 -0
  83. package/lib/typescript/src/enums/FunctionCode.d.ts.map +1 -0
  84. package/lib/typescript/src/enums/PaymentMethod.d.ts +5 -0
  85. package/lib/typescript/src/enums/PaymentMethod.d.ts.map +1 -0
  86. package/lib/typescript/src/enums/Presentation.d.ts +13 -0
  87. package/lib/typescript/src/enums/Presentation.d.ts.map +1 -0
  88. package/lib/typescript/src/enums/PurchaseSecondaryAction.d.ts +6 -0
  89. package/lib/typescript/src/enums/PurchaseSecondaryAction.d.ts.map +1 -0
  90. package/lib/typescript/src/enums/TransactionType.d.ts +12 -0
  91. package/lib/typescript/src/enums/TransactionType.d.ts.map +1 -0
  92. package/lib/typescript/src/index.d.ts +26 -0
  93. package/lib/typescript/src/index.d.ts.map +1 -0
  94. package/lib/typescript/src/models/BnplResponse.d.ts +11 -0
  95. package/lib/typescript/src/models/BnplResponse.d.ts.map +1 -0
  96. package/lib/typescript/src/models/EdfaPayCredentials.d.ts +14 -0
  97. package/lib/typescript/src/models/EdfaPayCredentials.d.ts.map +1 -0
  98. package/lib/typescript/src/models/InvoiceRequest.d.ts +43 -0
  99. package/lib/typescript/src/models/InvoiceRequest.d.ts.map +1 -0
  100. package/lib/typescript/src/models/Location.d.ts +7 -0
  101. package/lib/typescript/src/models/Location.d.ts.map +1 -0
  102. package/lib/typescript/src/models/Pagination.d.ts +16 -0
  103. package/lib/typescript/src/models/Pagination.d.ts.map +1 -0
  104. package/lib/typescript/src/models/PresentationConfig.d.ts +33 -0
  105. package/lib/typescript/src/models/PresentationConfig.d.ts.map +1 -0
  106. package/lib/typescript/src/models/SdkTheme.d.ts +20 -0
  107. package/lib/typescript/src/models/SdkTheme.d.ts.map +1 -0
  108. package/lib/typescript/src/models/Terminal.d.ts +15 -0
  109. package/lib/typescript/src/models/Terminal.d.ts.map +1 -0
  110. package/lib/typescript/src/models/TerminalBindingTask.d.ts +13 -0
  111. package/lib/typescript/src/models/TerminalBindingTask.d.ts.map +1 -0
  112. package/lib/typescript/src/models/Transaction.d.ts +12 -0
  113. package/lib/typescript/src/models/Transaction.d.ts.map +1 -0
  114. package/lib/typescript/src/models/TxnParams.d.ts +10 -0
  115. package/lib/typescript/src/models/TxnParams.d.ts.map +1 -0
  116. package/lib/typescript/src/models/UserInfo.d.ts +17 -0
  117. package/lib/typescript/src/models/UserInfo.d.ts.map +1 -0
  118. package/lib/typescript/src/multiply.d.ts +2 -0
  119. package/lib/typescript/src/multiply.d.ts.map +1 -0
  120. package/lib/typescript/src/multiply.native.d.ts +2 -0
  121. package/lib/typescript/src/multiply.native.d.ts.map +1 -0
  122. package/lib/typescript/src/namespaces/Extension.d.ts +74 -0
  123. package/lib/typescript/src/namespaces/Extension.d.ts.map +1 -0
  124. package/lib/typescript/src/namespaces/RemoteChannel.d.ts +25 -0
  125. package/lib/typescript/src/namespaces/RemoteChannel.d.ts.map +1 -0
  126. package/lib/typescript/src/namespaces/Utils.d.ts +28 -0
  127. package/lib/typescript/src/namespaces/Utils.d.ts.map +1 -0
  128. package/lib/typescript/src/types.d.ts +12 -0
  129. package/lib/typescript/src/types.d.ts.map +1 -0
  130. package/package.json +171 -0
  131. package/src/EdfaPayPlugin.ts +551 -0
  132. package/src/NativeEdfapaySoftposSdkRn.ts +7 -0
  133. package/src/bridge.ts +106 -0
  134. package/src/enums/Env.ts +7 -0
  135. package/src/enums/FlowType.ts +5 -0
  136. package/src/enums/FunctionCode.ts +8 -0
  137. package/src/enums/PaymentMethod.ts +4 -0
  138. package/src/enums/Presentation.ts +12 -0
  139. package/src/enums/PurchaseSecondaryAction.ts +5 -0
  140. package/src/enums/TransactionType.ts +11 -0
  141. package/src/globals.d.ts +1 -0
  142. package/src/index.tsx +52 -0
  143. package/src/models/BnplResponse.ts +31 -0
  144. package/src/models/EdfaPayCredentials.ts +36 -0
  145. package/src/models/InvoiceRequest.ts +93 -0
  146. package/src/models/Location.ts +14 -0
  147. package/src/models/Pagination.ts +29 -0
  148. package/src/models/PresentationConfig.ts +105 -0
  149. package/src/models/SdkTheme.ts +64 -0
  150. package/src/models/Terminal.ts +41 -0
  151. package/src/models/TerminalBindingTask.ts +32 -0
  152. package/src/models/Transaction.ts +39 -0
  153. package/src/models/TxnParams.ts +26 -0
  154. package/src/models/UserInfo.ts +50 -0
  155. package/src/multiply.native.tsx +5 -0
  156. package/src/multiply.tsx +5 -0
  157. package/src/namespaces/Extension.ts +194 -0
  158. package/src/namespaces/RemoteChannel.ts +43 -0
  159. package/src/namespaces/Utils.ts +91 -0
  160. package/src/types.ts +30 -0
@@ -0,0 +1,20 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "EdfapaySoftposSdkRn"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://github.com/edfapay/edfapay-softpos-sdk-rn.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
17
+ s.private_header_files = "ios/**/*.h"
18
+
19
+ install_modules_dependencies(s)
20
+ end
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 EdfaPay
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # edfapay-softpos-sdk-rn
2
+
3
+ SoftPOS
4
+
5
+ ## Installation
6
+
7
+
8
+ ```sh
9
+ npm install edfapay-softpos-sdk-rn
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+
16
+ ```js
17
+ import { multiply } from 'edfapay-softpos-sdk-rn';
18
+
19
+ // ...
20
+
21
+ const result = multiply(3, 7);
22
+ ```
23
+
24
+
25
+ ## Contributing
26
+
27
+ - [Development workflow](CONTRIBUTING.md#development-workflow)
28
+ - [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
29
+ - [Code of conduct](CODE_OF_CONDUCT.md)
30
+
31
+ ## License
32
+
33
+ MIT
34
+
35
+ ---
36
+
37
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -0,0 +1,82 @@
1
+ buildscript {
2
+ ext.EdfapaySoftposSdkRn = [
3
+ kotlinVersion: "2.0.21",
4
+ minSdkVersion: 29,
5
+ compileSdkVersion: 36,
6
+ targetSdkVersion: 36
7
+ ]
8
+
9
+ ext.getExtOrDefault = { prop ->
10
+ if (rootProject.ext.has(prop)) {
11
+ return rootProject.ext.get(prop)
12
+ }
13
+
14
+ return EdfapaySoftposSdkRn[prop]
15
+ }
16
+
17
+ repositories {
18
+ google()
19
+ mavenCentral()
20
+ }
21
+
22
+ dependencies {
23
+ classpath "com.android.tools.build:gradle:8.7.2"
24
+ // noinspection DifferentKotlinGradleVersion
25
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
26
+ }
27
+ }
28
+
29
+
30
+ apply plugin: "com.android.library"
31
+ apply plugin: "kotlin-android"
32
+
33
+ apply plugin: "com.facebook.react"
34
+
35
+ android {
36
+ namespace "com.edfapaysoftpossdkrn"
37
+
38
+ compileSdkVersion getExtOrDefault("compileSdkVersion")
39
+
40
+ defaultConfig {
41
+ minSdkVersion getExtOrDefault("minSdkVersion")
42
+ targetSdkVersion getExtOrDefault("targetSdkVersion")
43
+ }
44
+
45
+ buildFeatures {
46
+ buildConfig true
47
+ }
48
+
49
+ buildTypes {
50
+ release {
51
+ minifyEnabled false
52
+ }
53
+ }
54
+
55
+ lint {
56
+ disable "GradleCompatible"
57
+ }
58
+
59
+ compileOptions {
60
+ sourceCompatibility JavaVersion.VERSION_1_8
61
+ targetCompatibility JavaVersion.VERSION_1_8
62
+ }
63
+ }
64
+
65
+ dependencies {
66
+ implementation "com.facebook.react:react-android"
67
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:${getExtOrDefault('kotlinVersion')}"
68
+ implementation project(":native-sdk")
69
+ }
70
+
71
+ configurations.configureEach {
72
+ exclude group: "com.github.edfapay.emv", module: "mastercard-debug"
73
+ exclude group: "com.github.edfapay.emv", module: "discovery-corec-release"
74
+ exclude group: "com.github.edfapay.emv", module: "discovery-readerc-release"
75
+ }
76
+
77
+ configurations.configureEach {
78
+ exclude group: "com.github.edfapay.emv", module: "mastercard-debug"
79
+ exclude group: "com.github.edfapay.emv", module: "discovery-corec-release"
80
+ exclude group: "com.github.edfapay.emv", module: "discovery-readerc-release"
81
+ }
82
+
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,185 @@
1
+ package com.edfapaysoftpossdkrn
2
+
3
+ import android.os.Handler
4
+ import android.os.Looper
5
+ import androidx.fragment.app.FragmentActivity
6
+ import com.edfapay.paymentcard.bridge.EdfaPayHybridBridge
7
+ import com.facebook.react.bridge.Arguments
8
+ import com.facebook.react.bridge.LifecycleEventListener
9
+ import com.facebook.react.bridge.Promise
10
+ import com.facebook.react.bridge.ReactApplicationContext
11
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
12
+ import com.facebook.react.bridge.ReactMethod
13
+ import com.facebook.react.bridge.ReadableMap
14
+ import com.facebook.react.bridge.UiThreadUtil
15
+ import com.facebook.react.modules.core.DeviceEventManagerModule
16
+
17
+ /**
18
+ * React Native module that bridges JS ↔ EdfaPay native SDK.
19
+ *
20
+ * Equivalent of Flutter's SdkBridge + FlutterEdfapayPlugin combined into one.
21
+ *
22
+ * Channel names stay identical to the Flutter plugin:
23
+ * JS → Native : via @ReactMethod invoke() / invokeAsync()
24
+ * Native → JS : RCTDeviceEventEmitter event "EdfaPayCallback"
25
+ * payload: { method: String, args: Array<Any> }
26
+ *
27
+ * IMPORTANT: The host Activity MUST be a FragmentActivity (or AppCompatActivity).
28
+ * Use FragmentActivity / AppCompatActivity as the base in your MainActivity.
29
+ * If you see "Activity must be a FragmentActivity" at runtime, check your
30
+ * MainActivity base class.
31
+ *
32
+ * Method names passed to sdk.call() must exactly match the Dart/JS EdfaPayPlugin
33
+ * method names — the same EdfaPayHybridBridge.call() dispatch table handles both
34
+ * Flutter and React Native.
35
+ */
36
+ class EdfapaySoftposSdkRnModule(reactContext: ReactApplicationContext) :
37
+ ReactContextBaseJavaModule(reactContext), LifecycleEventListener {
38
+
39
+ companion object {
40
+ const val NAME = "EdfapaySoftposSdkRn"
41
+ }
42
+
43
+ override fun getName() = NAME
44
+
45
+
46
+ private val mainThread = Handler(Looper.getMainLooper())
47
+
48
+
49
+ // Lazily constructed so we have an Activity reference at call time.
50
+ // The Activity must be a FragmentActivity — enforced below.
51
+ private val sdk: EdfaPayHybridBridge by lazy {
52
+ val activity = reactApplicationContext.currentActivity
53
+ ?: throw IllegalStateException(
54
+ "EdfapaySoftposSdkRn: No current Activity. " +
55
+ "Make sure the module is used after the Activity is created."
56
+ )
57
+ val fragmentActivity = activity as? FragmentActivity
58
+ ?: throw IllegalStateException(
59
+ "EdfapaySoftposSdkRn: Activity must be a FragmentActivity. " +
60
+ "Use FragmentActivity or AppCompatActivity as your MainActivity base class."
61
+ )
62
+ EdfaPayHybridBridge(fragmentActivity)
63
+ }
64
+
65
+ init {
66
+ reactContext.addLifecycleEventListener(this)
67
+ }
68
+
69
+ // ── LifecycleEventListener ────────────────────────────────────────────────
70
+ override fun onHostResume() {}
71
+ override fun onHostPause() {}
72
+ override fun onHostDestroy() {}
73
+
74
+ // ── JS → Native: fire-and-forget ─────────────────────────────────────────
75
+
76
+ /**
77
+ * Invoke a SDK method with a params map.
78
+ * Callbacks are delivered via the "EdfaPayCallback" device event.
79
+ */
80
+ @ReactMethod
81
+ fun invoke(method: String, params: ReadableMap) {
82
+ UiThreadUtil.runOnUiThread {
83
+ val args = params.toHashMap()
84
+ try {
85
+ sdk.call(method, args, ::sendCallback)
86
+ } catch (e: Throwable) {
87
+ sendCallback(
88
+ "$method.onError",
89
+ mapOf(
90
+ "code" to -1,
91
+ "message" to (e.message ?: "Not found"),
92
+ "cause" to (e.cause?.message ?: "Not found"),
93
+ "stackTrace" to e.stackTraceToString(),
94
+ ),
95
+ )
96
+ }
97
+ }
98
+ }
99
+
100
+ // ── JS → Native: Promise-based ────────────────────────────────────────────
101
+
102
+ /**
103
+ * Invoke a SDK method and return the result as a Promise.
104
+ * Used for synchronous query methods (getSessionId, getDeviceId, etc.).
105
+ */
106
+ @ReactMethod
107
+ fun invokeAsync(method: String, params: ReadableMap, promise: Promise) {
108
+ val args = params.toHashMap()
109
+ try {
110
+ val result = sdk.call(method, args, ::sendCallback)
111
+ when (result) {
112
+ is Unit -> promise.resolve(true)
113
+ null -> promise.resolve(null)
114
+ else -> promise.resolve(result)
115
+ }
116
+ } catch (e: Throwable) {
117
+ promise.reject("$method.Error", e.message, e)
118
+ }
119
+ }
120
+
121
+ // ── Native → JS ───────────────────────────────────────────────────────────
122
+
123
+ /**
124
+ * Send a callback event from native to JS.
125
+ * Emitted as "EdfaPayCallback" via RCTDeviceEventEmitter with payload:
126
+ * { method: String, args: Array<Any> }
127
+ *
128
+ * The JS bridge (bridge.ts) listens for this event and routes it to the
129
+ * matching stored callback function.
130
+ */
131
+ private fun sendCallback(name: String, arguments: Any?) {
132
+ mainThread.post {
133
+ val argsArray = Arguments.createArray()
134
+
135
+ when (arguments) {
136
+ is List<*> -> {
137
+ arguments.forEach { item ->
138
+ when (item) {
139
+ is Map<*, *> -> {
140
+ @Suppress("UNCHECKED_CAST")
141
+ argsArray.pushMap(Arguments.makeNativeMap(item as Map<String, Any?>))
142
+ }
143
+ is List<*> -> {
144
+ @Suppress("UNCHECKED_CAST")
145
+ argsArray.pushArray(Arguments.makeNativeArray(item as List<Any?>))
146
+ }
147
+ is Boolean -> argsArray.pushBoolean(item)
148
+ is Int -> argsArray.pushInt(item)
149
+ is Double -> argsArray.pushDouble(item)
150
+ is Float -> argsArray.pushDouble(item.toDouble())
151
+ is Long -> argsArray.pushDouble(item.toDouble())
152
+ is String -> argsArray.pushString(item)
153
+ null -> argsArray.pushNull()
154
+ else -> argsArray.pushString(item.toString())
155
+ }
156
+ }
157
+ }
158
+ is Map<*, *> -> {
159
+ @Suppress("UNCHECKED_CAST")
160
+ argsArray.pushMap(Arguments.makeNativeMap(arguments as Map<String, Any?>))
161
+ }
162
+ is Boolean -> argsArray.pushBoolean(arguments)
163
+ is Int -> argsArray.pushInt(arguments)
164
+ is Double -> argsArray.pushDouble(arguments)
165
+ is Float -> argsArray.pushDouble(arguments.toDouble())
166
+ is Long -> argsArray.pushDouble(arguments.toDouble())
167
+ is String -> argsArray.pushString(arguments)
168
+ null -> { /* send empty args array */ }
169
+ else -> argsArray.pushString(arguments.toString())
170
+ }
171
+
172
+ val payload = Arguments.createMap().apply {
173
+ putString("method", name)
174
+ putArray("args", argsArray)
175
+ }
176
+
177
+ reactApplicationContext
178
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
179
+ .emit("EdfaPayCallback", payload)
180
+ }
181
+ }
182
+
183
+ }
184
+
185
+
@@ -0,0 +1,14 @@
1
+ package com.edfapaysoftpossdkrn
2
+
3
+ import com.facebook.react.ReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.uimanager.ViewManager
7
+
8
+ class EdfapaySoftposSdkRnPackage : ReactPackage {
9
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
10
+ listOf(EdfapaySoftposSdkRnModule(reactContext))
11
+
12
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> =
13
+ emptyList()
14
+ }
@@ -0,0 +1,6 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTEventEmitter.h>
3
+
4
+ @interface EdfapaySoftposSdkRn : NSObject <RCTBridgeModule>
5
+
6
+ @end
@@ -0,0 +1,21 @@
1
+ #import "EdfapaySoftposSdkRn.h"
2
+
3
+ @implementation EdfapaySoftposSdkRn
4
+
5
+ RCT_EXPORT_MODULE()
6
+
7
+ RCT_EXPORT_METHOD(invoke:(NSString *)method params:(NSDictionary *)params)
8
+ {
9
+ // TODO: bridge to native iOS SDK
10
+ }
11
+
12
+ RCT_EXPORT_METHOD(invokeAsync:(NSString *)method
13
+ params:(NSDictionary *)params
14
+ resolve:(RCTPromiseResolveBlock)resolve
15
+ reject:(RCTPromiseRejectBlock)reject)
16
+ {
17
+ // TODO: bridge to native iOS SDK
18
+ resolve(nil);
19
+ }
20
+
21
+ @end