edfapay-softpos-sdk-rn 1.0.0-dev.1

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 +444 -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,444 @@
1
+ # EdfaPay SoftPOS SDK — React Native
2
+ <h3>Helps developers to easily integrate EdfaPay SoftPOS to React Native mobile applications with a few simple steps.</h3>
3
+
4
+ ### [Wiki & Documentation](https://github.com/edfapay/edfapay-softpos-sdk-examples/wiki)
5
+
6
+
7
+ # EdfaPay SoftPOS SDK
8
+
9
+ > [!IMPORTANT]
10
+ > ### Install edfapay-softpos-sdk-rn
11
+ > - **Add the dependency by running:**
12
+ > ```sh
13
+ > npm install edfapay-softpos-sdk-rn
14
+ > # or
15
+ > yarn add edfapay-softpos-sdk-rn
16
+ > ```
17
+
18
+ > [!IMPORTANT]
19
+ > ### Set Repository Access Credentials
20
+ > - Add the following credentials to your project **`android/gradle.properties`** or **`~/.gradle/gradle.properties`**
21
+ > ```properties
22
+ > PARTNER_REPO_USERNAME=edfapay-sdk-consumer
23
+ > PARTNER_REPO_PASSWORD=Edfapay@123
24
+ > ```
25
+
26
+ > [!IMPORTANT]
27
+ > ### FragmentActivity Requirement
28
+ > - Change the Android **MainActivity** base class from **`ReactActivity`** to **`ReactFragmentActivity`** (or ensure it extends `AppCompatActivity`)
29
+ > - Path: `android/app/src/main/java/<your_package>/MainActivity.kt` (or `.java`)
30
+ >
31
+ > **Example (Kotlin)**
32
+ > ```kotlin
33
+ > package com.yourapp
34
+ >
35
+ > import com.facebook.react.ReactFragmentActivity
36
+ >
37
+ > class MainActivity : ReactFragmentActivity()
38
+ > ```
39
+
40
+
41
+ ## Usage
42
+
43
+ ### 1: Imports
44
+ ```tsx
45
+ import {
46
+ EdfaPayPlugin,
47
+ EdfaPayCredentials,
48
+ Env,
49
+ TxnParams,
50
+ Transaction,
51
+ TransactionType,
52
+ FlowType,
53
+ Presentation,
54
+ PresentationConfig,
55
+ PurchaseSecondaryAction,
56
+ } from 'edfapay-softpos-sdk-rn';
57
+ ```
58
+
59
+ ### 2: Setting Theme (Optional)
60
+
61
+ **2.1: Colors and Logos**
62
+ ```ts
63
+ const logoBase64 = "base64 encoded image string";
64
+
65
+ EdfaPayPlugin.theme()
66
+ .setPrimaryColor('#06E59F')
67
+ .setSecondaryColor('#000000')
68
+ .setPoweredByImage(logoBase64)
69
+ .setHeaderImage(logoBase64);
70
+ ```
71
+
72
+ **2.2: Setting Presentation**
73
+ - `Presentation.FULLSCREEN`
74
+ - `Presentation.DIALOG_CENTER`
75
+ - `Presentation.DIALOG_TOP_FILL`
76
+ - `Presentation.DIALOG_BOTTOM_FILL`
77
+ - `Presentation.DIALOG_TOP_START`
78
+ - `Presentation.DIALOG_TOP_END`
79
+ - `Presentation.DIALOG_TOP_CENTER`
80
+ - `Presentation.DIALOG_BOTTOM_START`
81
+ - `Presentation.DIALOG_BOTTOM_END`
82
+ - `Presentation.DIALOG_BOTTOM_CENTER`
83
+
84
+ ```ts
85
+ EdfaPayPlugin.theme()
86
+ .setPresentation(
87
+ new PresentationConfig(Presentation.DIALOG_CENTER)
88
+ .sizePercent(0.85) // 0.20 to 1.0, aligned to screen smallest axis
89
+ .dismissOnBackPress(true)
90
+ .dismissOnTouchOutside(true)
91
+ .animateExit(true)
92
+ .animateEntry(true)
93
+ .dimBackground(true)
94
+ .dimAmount(1.0) // 0.0 to 1.0
95
+ .marginAll(0)
96
+ .cornerRadius(20)
97
+ .marginHorizontal(10)
98
+ .marginVertical(10)
99
+ .setPurchaseSecondaryAction(PurchaseSecondaryAction.NONE)
100
+ );
101
+ ```
102
+
103
+ **2.3: Secondary / Post-Purchase Action**
104
+ - `PurchaseSecondaryAction.REVERSE`
105
+ - `PurchaseSecondaryAction.REFUND`
106
+ - `PurchaseSecondaryAction.NONE`
107
+
108
+ ```ts
109
+ EdfaPayPlugin.theme()
110
+ .setPresentation(
111
+ new PresentationConfig(Presentation.DIALOG_CENTER)
112
+ .setPurchaseSecondaryAction(PurchaseSecondaryAction.REVERSE)
113
+ );
114
+ ```
115
+
116
+ **2.4: PIN PAD Shuffle**
117
+ ```ts
118
+ EdfaPayPlugin.theme()
119
+ .setPresentation(
120
+ new PresentationConfig(Presentation.DIALOG_CENTER)
121
+ .setShufflePinPad(true) // default false
122
+ );
123
+ ```
124
+
125
+ ### 3: Initialization
126
+
127
+ **3.1: Create Credentials**
128
+
129
+ - Prompt for credentials (email/password or token input):
130
+ ```ts
131
+ const credentials = EdfaPayCredentials.withInput(Env.PRODUCTION);
132
+ ```
133
+
134
+ - Prompt with pre-filled email/password:
135
+ ```ts
136
+ const credentials = EdfaPayCredentials.withEmailPassword(
137
+ Env.DEVELOPMENT,
138
+ 'user@email.com',
139
+ 'Password@123'
140
+ );
141
+ ```
142
+
143
+ - Prompt with pre-filled email only:
144
+ ```ts
145
+ const credentials = EdfaPayCredentials.withEmail(Env.DEVELOPMENT, 'user@email.com');
146
+ ```
147
+
148
+ - Silent initialization with a Terminal Token:
149
+ ```ts
150
+ const credentials = EdfaPayCredentials.withToken(
151
+ Env.DEVELOPMENT, // also: Env.STAGING | Env.SANDBOX | Env.PRODUCTION | Env.REVAMP
152
+ '****Terminal Token Generated at EdfaPay SoftPOS Portal****'
153
+ );
154
+ ```
155
+
156
+ **3.2: Initialize with Credentials**
157
+ ```ts
158
+ EdfaPayPlugin.enableLogs(true);
159
+ EdfaPayPlugin.setAnimationSpeedX(2.5); // Optional: animation speed multiplier
160
+
161
+ EdfaPayPlugin.initiate({
162
+ credentials,
163
+ onSuccess: (sessionId) => {
164
+ console.log('>>> SDK Initialized — Session ID: ' + sessionId);
165
+ },
166
+ onTerminalBindingTask: (task) => {
167
+ console.log('>>> Terminal Binding Required');
168
+
169
+ const terminals = task.terminals;
170
+
171
+ // Option 1: Show SDK's built-in terminal selection UI
172
+ task.bind();
173
+
174
+ // Option 2: Bind the first terminal programmatically
175
+ terminals[0]?.bind();
176
+
177
+ // Option 3: Refresh terminal list from server, then show custom UI
178
+ task.refresh((error, list) => {
179
+ if (error) {
180
+ console.error('>>> Refresh error: ' + JSON.stringify(error));
181
+ } else {
182
+ console.log('>>> Terminals refreshed: ' + list.length);
183
+ }
184
+ });
185
+ },
186
+ onError: (error) => {
187
+ console.error('>>> Init error: ' + JSON.stringify(error));
188
+ },
189
+ });
190
+ ```
191
+
192
+ **3.3: Enable Remote Channel (Optional)**
193
+
194
+ Open after successful initialization to accept transactions from a remote source (e.g. POS terminal on the same local network):
195
+
196
+ ```ts
197
+ // Open local network channel on port 8080 with 30s timeout
198
+ EdfaPayPlugin.RemoteChannel.LocalNetwork({ port: 8080, timeout: 30 }).open();
199
+ ```
200
+
201
+ Send a transaction request from a remote source:
202
+ ```shell
203
+ echo '{"id":"pay.1","data":{"fun":"purchase","flowType":"DETAIL","amount":"12.0"}}' | nc 192.168.1.100 8080
204
+ ```
205
+
206
+ ### 4: Purchase
207
+
208
+ **FlowType options:**
209
+ - `FlowType.IMMEDIATE` — closes card scan UI immediately after server response
210
+ - `FlowType.STATUS` — closes at status animation (check/cross)
211
+ - `FlowType.DETAIL` — flows to transaction detail screen, completes on screen close
212
+
213
+ > **Note:** Observe the 4th `isFlowComplete` parameter of `onPaymentProcessComplete`.
214
+
215
+ ```ts
216
+ const params = new TxnParams('01.010', '12340987');
217
+
218
+ EdfaPayPlugin.purchase({
219
+ txnParams: params,
220
+ flowType: FlowType.DETAIL,
221
+ onPaymentProcessComplete: (status, code, transaction, isFlowComplete) => {
222
+ if (status) {
223
+ console.log('>>> Success: ' + JSON.stringify(transaction));
224
+ } else {
225
+ console.log('>>> Failed: ' + JSON.stringify(transaction));
226
+ }
227
+ },
228
+ onRequestTimerEnd: () => {
229
+ console.log('>>> Server Timeout');
230
+ },
231
+ onCardScanTimerEnd: () => {
232
+ console.log('>>> Scan Card Timeout');
233
+ },
234
+ onCancelByUser: () => {
235
+ console.log('>>> Canceled By User');
236
+ },
237
+ onError: (error) => {
238
+ console.error('>>> Error: ' + JSON.stringify(error));
239
+ },
240
+ });
241
+ ```
242
+
243
+ ### 5: Refund
244
+
245
+ ```ts
246
+ const params = new TxnParams(
247
+ '01.010',
248
+ '',
249
+ Transaction.withRRN('123456789012', '', TransactionType.PURCHASE)
250
+ );
251
+
252
+ EdfaPayPlugin.refund({
253
+ txnParams: params,
254
+ onPaymentProcessComplete: (status, code, transaction, isFlowComplete) => {
255
+ console.log('>>> Refund ' + (status ? 'Success' : 'Failed'));
256
+ },
257
+ onRequestTimerEnd: () => { console.log('>>> Server Timeout'); },
258
+ onCardScanTimerEnd: () => { console.log('>>> Scan Card Timeout'); },
259
+ onCancelByUser: () => { console.log('>>> Canceled By User'); },
260
+ onError: (error) => { console.error('>>> Error: ' + JSON.stringify(error)); },
261
+ });
262
+ ```
263
+
264
+ ### 6: Reverse Last Transaction
265
+
266
+ ```ts
267
+ EdfaPayPlugin.reverseLastTransaction({
268
+ onSuccess: (response) => {
269
+ console.log('>>> Reverse Success: ' + JSON.stringify(response));
270
+ },
271
+ onError: (error) => {
272
+ console.error('>>> Reverse Error: ' + JSON.stringify(error));
273
+ },
274
+ });
275
+ ```
276
+
277
+ ### 7: Reconciliation
278
+
279
+ ```ts
280
+ EdfaPayPlugin.reconcile({
281
+ onSuccess: (response) => {
282
+ console.log('>>> Reconciliation Success: ' + JSON.stringify(response));
283
+ },
284
+ onError: (error) => {
285
+ console.error('>>> Reconciliation Error: ' + JSON.stringify(error));
286
+ },
287
+ });
288
+ ```
289
+
290
+ ### 8: Transaction History
291
+
292
+ ```ts
293
+ EdfaPayPlugin.txnHistory({
294
+ onSuccess: (response) => {
295
+ console.log('>>> Txn History: ' + JSON.stringify(response));
296
+ },
297
+ onError: (error) => {
298
+ console.error('>>> Txn History Error: ' + JSON.stringify(error));
299
+ },
300
+ });
301
+ ```
302
+
303
+
304
+ # Example
305
+
306
+ Full working example — copy and paste into your `App.tsx`:
307
+
308
+ ```tsx
309
+ import * as React from 'react';
310
+ import { View, Button } from 'react-native';
311
+ import {
312
+ EdfaPayPlugin,
313
+ EdfaPayCredentials,
314
+ Env,
315
+ TxnParams,
316
+ Transaction,
317
+ TransactionType,
318
+ } from 'edfapay-softpos-sdk-rn';
319
+
320
+ const TERMINAL_TOKEN = '****Your Terminal Token****';
321
+ const amountToPay = '01.010';
322
+
323
+ export default function App() {
324
+ const [initialized, setInitialized] = React.useState(false);
325
+
326
+ return (
327
+ <View style={{ flex: 1, justifyContent: 'flex-end', padding: 20, gap: 12 }}>
328
+ {!initialized && (
329
+ <Button
330
+ color="#06E59F"
331
+ title="Initialize"
332
+ onPress={() => initiateSdk(setInitialized)}
333
+ />
334
+ )}
335
+ {initialized && (
336
+ <>
337
+ <Button color="#06E59F" title={'Purchase ' + amountToPay} onPress={purchase} />
338
+ <Button color="#FF9800" title={'Refund ' + amountToPay} onPress={refund} />
339
+ <Button color="#F44336" title="Reverse Last Transaction" onPress={reverse} />
340
+ <Button color="#2196F3" title="Reconciliation" onPress={reconcile} />
341
+ <Button color="#9C27B0" title="Txn History" onPress={txnHistory} />
342
+ </>
343
+ )}
344
+ </View>
345
+ );
346
+ }
347
+
348
+ function initiateSdk(onInitialized: (status: boolean) => void) {
349
+ EdfaPayPlugin.enableLogs(true);
350
+ EdfaPayPlugin.setAnimationSpeedX(2.5);
351
+
352
+ const credentials = EdfaPayCredentials.withToken(Env.DEVELOPMENT, TERMINAL_TOKEN);
353
+
354
+ EdfaPayPlugin.initiate({
355
+ credentials,
356
+ onSuccess: (sessionId) => {
357
+ onInitialized(true);
358
+ console.log('>>> SDK Initialized — Session ID: ' + sessionId);
359
+ },
360
+ onTerminalBindingTask: (task) => {
361
+ console.log('>>> Terminal Binding Required');
362
+ // Option 1: Show SDK's built-in terminal selection UI
363
+ task.bind();
364
+ // Option 2: Bind first terminal programmatically
365
+ // task.terminals[0]?.bind();
366
+ },
367
+ onError: (error) => {
368
+ onInitialized(false);
369
+ console.error('>>> Init Error: ' + JSON.stringify(error));
370
+ },
371
+ });
372
+ }
373
+
374
+ function purchase() {
375
+ EdfaPayPlugin.purchase({
376
+ txnParams: new TxnParams(amountToPay),
377
+ onPaymentProcessComplete: (status, code, transaction, isFlowComplete) => {
378
+ console.log('>>> Purchase ' + (status ? 'Success' : 'Failed') + ' | Code: ' + code);
379
+ console.log('>>> Transaction: ' + JSON.stringify(transaction));
380
+ },
381
+ onRequestTimerEnd: () => { console.log('>>> Server Timeout'); },
382
+ onCardScanTimerEnd: () => { console.log('>>> Scan Card Timeout'); },
383
+ onCancelByUser: () => { console.log('>>> Canceled By User'); },
384
+ onError: (error) => { console.error('>>> Error: ' + JSON.stringify(error)); },
385
+ });
386
+ }
387
+
388
+ function refund() {
389
+ const params = new TxnParams(
390
+ amountToPay,
391
+ '',
392
+ Transaction.withRRN('123456789012', '', TransactionType.PURCHASE)
393
+ );
394
+ EdfaPayPlugin.refund({
395
+ txnParams: params,
396
+ onPaymentProcessComplete: (status, code, transaction, isFlowComplete) => {
397
+ console.log('>>> Refund ' + (status ? 'Success' : 'Failed') + ' | Code: ' + code);
398
+ },
399
+ onRequestTimerEnd: () => { console.log('>>> Server Timeout'); },
400
+ onCardScanTimerEnd: () => { console.log('>>> Scan Card Timeout'); },
401
+ onCancelByUser: () => { console.log('>>> Canceled By User'); },
402
+ onError: (error) => { console.error('>>> Error: ' + JSON.stringify(error)); },
403
+ });
404
+ }
405
+
406
+ function reverse() {
407
+ EdfaPayPlugin.reverseLastTransaction({
408
+ onSuccess: (response) => {
409
+ console.log('>>> Reverse Success: ' + JSON.stringify(response));
410
+ },
411
+ onError: (error) => {
412
+ console.error('>>> Reverse Error: ' + JSON.stringify(error));
413
+ },
414
+ });
415
+ }
416
+
417
+ function reconcile() {
418
+ EdfaPayPlugin.reconcile({
419
+ onSuccess: (response) => {
420
+ console.log('>>> Reconciliation Success: ' + JSON.stringify(response));
421
+ },
422
+ onError: (error) => {
423
+ console.error('>>> Reconciliation Error: ' + JSON.stringify(error));
424
+ },
425
+ });
426
+ }
427
+
428
+ function txnHistory() {
429
+ EdfaPayPlugin.txnHistory({
430
+ onSuccess: (response) => {
431
+ console.log('>>> Txn History: ' + JSON.stringify(response));
432
+ },
433
+ onError: (error) => {
434
+ console.error('>>> Txn History Error: ' + JSON.stringify(error));
435
+ },
436
+ });
437
+ }
438
+ ```
439
+
440
+ ## License
441
+
442
+ MIT
443
+
444
+ ---
@@ -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>