@jimrising/easymerchantsdk-react-native 1.4.5 → 1.4.7

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 (30) hide show
  1. package/README.md +217 -140
  2. package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
  3. package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$2.dex +0 -0
  4. package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
  5. package/android/build/.transforms/e9a664a11ce12edf79cd87b1e07aa243/transformed/classes/classes_dex/classes.dex +0 -0
  6. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  7. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  8. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  9. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  10. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  11. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  12. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  13. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  14. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1.class.uniqueId2 +0 -0
  15. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$2.class.uniqueId0 +0 -0
  16. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule.class.uniqueId3 +0 -0
  17. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  18. package/android/build.gradle +1 -1
  19. package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkModule.java +26 -79
  20. package/ios/Classes/EasyMerchantSdk.m +4 -0
  21. package/ios/Classes/EasyMerchantSdk.swift +8 -3
  22. package/ios/Models/Request.swift +31 -8
  23. package/ios/Pods/UserDefaults/UserStoreSingleton.swift +41 -15
  24. package/ios/Pods/ViewControllers/GrailPayVC.swift +2 -2
  25. package/ios/Pods/ViewControllers/OTPVerificationVC.swift +151 -111
  26. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +861 -671
  27. package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +2 -2
  28. package/ios/easymerchantsdk.podspec +1 -1
  29. package/ios/easymerchantsdk.storyboard +124 -3
  30. package/package.json +1 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@ To add the path of sdk in your project. Open your `package.json` file and inside
7
7
 
8
8
  ```json
9
9
  "dependencies": {
10
- "@jimrising/easymerchantsdk-react-native": "^1.4.5"
10
+ "@jimrising/easymerchantsdk-react-native": "^1.4.7"
11
11
  },
12
12
  ```
13
13
 
@@ -22,20 +22,23 @@ Now open your `android` folder and there is a `build.gradle` file. Open it and a
22
22
  ```gradle
23
23
  allprojects {
24
24
  repositories {
25
- google()
26
- mavenCentral()
27
- maven { url 'https://jitpack.io' }
28
- maven {
29
- url = uri("https://maven.pkg.github.com/EasyMerchant/em-MobileCheckoutSDK-Android")
30
- credentials {
31
- username = "EasyMerchant"
32
- password = "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"
33
- }
34
- }
25
+ google()
26
+ mavenCentral()
27
+ maven { url 'https://jitpack.io' }
28
+ maven { url 'https://maven.microblink.com' }
29
+ maven {
30
+ url = uri("https://maven.pkg.github.com/EasyMerchant/em-MobileCheckoutSDK-Android")
31
+ credentials {
32
+ username = "EasyMerchant"
33
+ password = "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"
35
34
  }
35
+ }
36
36
  }
37
+ }
37
38
  ```
38
39
 
40
+
41
+
39
42
  ## Changes in IOS side.
40
43
  Add below content inside the AppDelegate.swift File :-
41
44
 
@@ -112,42 +115,44 @@ you can call the sdk using below example:
112
115
 
113
116
  ```javascript
114
117
 
115
- import React, { useEffect, useState } from 'react';
118
+ import React, { useState, useEffect } from 'react';
116
119
  import {
117
- View,
120
+ StyleSheet,
118
121
  Text,
122
+ View,
123
+ TextInput,
119
124
  Button,
120
- StyleSheet,
125
+ Alert,
126
+ ScrollView,
121
127
  Platform,
122
128
  NativeModules,
123
- ScrollView,
124
129
  } from 'react-native';
125
130
 
126
131
  const { RNEasymerchantsdk, EasyMerchantSdk } = NativeModules;
127
132
 
128
133
  const App = () => {
134
+ const [amount, setAmount] = useState('');
135
+ const [result, setResult] = useState('');
129
136
  const [version, setVersion] = useState('');
130
- const [response, setResponse] = useState('');
131
137
  const [referenceToken, setReferenceToken] = useState('');
138
+ const [loading, setLoading] = useState(false);
132
139
 
133
140
  useEffect(() => {
134
- const setup = async () => {
135
- try {
136
- if (Platform.OS === 'ios') {
141
+ const setupIOS = async () => {
142
+ if (Platform.OS === 'ios') {
143
+ try {
137
144
  await EasyMerchantSdk.setViewController();
138
145
  await EasyMerchantSdk.configureEnvironment(
139
146
  'staging',
140
- 'mobilesdk1980IUuCzwWl',
141
- 'mobilesdk1980LVHnN0Oh'
147
+ '13bcb1f54b894ddbbd75a86d5',
148
+ '94f7ebd5384f6985f23920c13'
142
149
  );
150
+ } catch (err) {
151
+ console.error('iOS Initialization Error:', err);
143
152
  }
144
- } catch (err) {
145
- console.error('Initialization Error:', err);
146
- setResponse(`❌ Initialization Error: ${err.message || JSON.stringify(err)}`);
147
153
  }
148
154
  };
149
-
150
- setup();
155
+ setupIOS();
151
156
  }, []);
152
157
 
153
158
  const getPlatformVersion = async () => {
@@ -163,15 +168,113 @@ const App = () => {
163
168
  }
164
169
  };
165
170
 
171
+ const handlePayment = async () => {
172
+ if (!amount || isNaN(parseFloat(amount)) || parseFloat(amount) <= 0) {
173
+ return Alert.alert('Error', 'Please enter a valid amount');
174
+ }
175
+
176
+ setLoading(true);
177
+
178
+ if (Platform.OS === 'android') {
179
+ const config = {
180
+ amount,
181
+ apiKey: '13bcb1f54b894ddbbd75a86d5',
182
+ secretKey: '94f7ebd5384f6985f23920c13',
183
+ jsonConfig: {
184
+ environment: 'STAGING',
185
+ amount,
186
+ tokenOnly: false,
187
+ currency: 'USD',
188
+ saveCard: true,
189
+ saveAccount: true,
190
+ authenticatedACH: true,
191
+ secureAuthentication: true,
192
+ showReceipt: true,
193
+ showDonate: false,
194
+ showTotal: true,
195
+ showSubmitButton: true,
196
+ paymentMethods: ['card', 'ach'],
197
+ email: 'pavan@hotmail.com',
198
+ name: 'Pavan',
199
+ fields: {
200
+ visibility: { billing: false, additional: false },
201
+ billing: [
202
+ { name: 'address', required: true, value: '' },
203
+ { name: 'country', required: false, value: 'India' },
204
+ { name: 'state', required: true, value: '' },
205
+ { name: 'city', required: true, value: '' },
206
+ { name: 'postal_code', required: true, value: '' },
207
+ ],
208
+ additional: [
209
+ { name: 'name', required: true, value: '' },
210
+ { name: 'email_address', required: true, value: '' },
211
+ { name: 'phone_number', required: false, value: '' },
212
+ { name: 'description', required: true, value: '' },
213
+ ],
214
+ },
215
+ recurring: {
216
+ enableRecurring: true,
217
+ recurringData: {
218
+ allowCycles: 2,
219
+ intervals: ['Weekly', 'Monthly'],
220
+ recurringStartType: 'Custom',
221
+ recurringStartDate: '2025-12-31',
222
+ },
223
+ },
224
+ grailPayParams: {
225
+ accessToken: '251|uTijpDGfrS88UR2V1cZNMQ8S4hUJA0sVzsnsoUZF',
226
+ vendorId: '251',
227
+ role: 'business',
228
+ timeout: 10,
229
+ isSandbox: true,
230
+ brandingName: 'Lyfecycle Payments',
231
+ finderSubtitle: 'Search for your bank',
232
+ searchPlaceholder: 'Enter bank name',
233
+ },
234
+ appearanceSettings: {
235
+ theme: 'light',
236
+ bodyBackgroundColor: '#eeeff2',
237
+ containerBackgroundColor: '#ffffff',
238
+ primaryFontColor: '#000000',
239
+ secondaryFontColor: '#666666',
240
+ primaryButtonBackgroundColor: '#1757d9',
241
+ primaryButtonHoverColor: '#3a70df',
242
+ primaryButtonFontColor: '#ffffff',
243
+ secondaryButtonBackgroundColor: '#ffffff',
244
+ secondaryButtonHoverColor: '#a3b1cc',
245
+ secondaryButtonFontColor: '#1757d9',
246
+ borderRadius: '8',
247
+ fontSize: '16',
248
+ fontWeight: '500',
249
+ fontFamily: 'Inter, sans-serif',
250
+ },
251
+ },
252
+ };
253
+
254
+ try {
255
+ const response = await RNEasymerchantsdk.makePayment(config);
256
+ setResult(response.response || JSON.stringify(response, null, 2));
257
+ } catch (error) {
258
+ setResult(`Error: ${error.message}`);
259
+ Alert.alert('Payment Error', error.message);
260
+ } finally {
261
+ setLoading(false);
262
+ }
263
+ }
264
+ else {
265
+ handleBilling();
266
+ }
267
+ };
268
+
166
269
  const handleBilling = async () => {
167
270
  const billingInfo = {
168
271
  visibility: { billing: false, additional: false },
169
272
  billing: {
170
- address: 'Mohali, Punjab',
171
- country: 'India',
172
- state: 'Punjab',
173
- city: 'Anandpur Sahib',
174
- postal_code: '140118',
273
+ address: 'San Fran, Punjab',
274
+ country: 'USA',
275
+ state: 'California',
276
+ city: 'Paris',
277
+ postal_code: '234234',
175
278
  },
176
279
  billingRequired: {
177
280
  address: true,
@@ -183,7 +286,7 @@ const App = () => {
183
286
  additional: {
184
287
  name: 'Test User',
185
288
  email_address: 'test@gmail.com',
186
- phone_number: '9465351125',
289
+ phone_number: '21408713290',
187
290
  description: 'Test',
188
291
  },
189
292
  additionalRequired: {
@@ -208,12 +311,10 @@ const App = () => {
208
311
  borderRadius: '8',
209
312
  fontSize: '14',
210
313
  fontWeight: 500,
211
- fontFamily: '"Inter", sans-serif',
314
+ fontFamily: 'Inter, sans-serif',
212
315
  };
213
316
 
214
- const authConfig = {
215
- accessToken: '251|uTijpDGfrS88UR2V1cZNMQ8S4hUJA0sVzsnsoUZF',
216
- vendorId: '251',
317
+ const authConfig = {
217
318
  role: 'business',
218
319
  timeout: 10,
219
320
  isSandbox: true,
@@ -221,84 +322,71 @@ const authConfig = {
221
322
  finderSubtitle: 'Search for your bank',
222
323
  searchPlaceholder: 'Enter bank name',
223
324
  };
224
- try {
225
- if (Platform.OS === 'android') {
226
- const result = await RNEasymerchantsdk.billing('72', null);
227
- setResponse(`✅ Android Payment Success: ${result}`);
228
- } else {
229
- const result = await EasyMerchantSdk.billing(
230
- '99',
231
- 'usd',
232
- billingInfo,
233
- ['card', 'bank'],
234
- themeConfiguration,
235
- false, // tokenOnly
236
- true, // saveCard
237
- true, // saveAccount
238
- true, // authenticatedACH
239
- authConfig, // grailPayParams
240
- 'Submit',
241
- false, // isRecurring
242
- 2, // if isRecurring == true then numOfCycle required
243
- ['weekly', 'monthly'],
244
- 'custom',
245
- '07/07/2025',
246
- true, // secureAuthentication
247
- true, // showReceipt
248
- true, // showTotal
249
- true // showSubmitButton
250
- );
251
-
252
- console.log('Billing success (full response):', JSON.stringify(result, null, 2));
253
325
 
254
- try {
255
- const refToken = result?.additionalInfo?.threeDSecureStatus?.data?.ref_token;
256
- if (refToken) {
257
- setReferenceToken(refToken);
258
- setResponse(`✅ Ref Token: ${refToken}\nFull Response:\n${JSON.stringify(result, null, 2)}`);
259
- } else {
260
- setResponse(`✅ iOS Payment Success (no ref_token):\n${JSON.stringify(result, null, 2)}`);
261
- }
262
- } catch (err) {
263
- console.error('Error parsing ref_token:', err);
264
- setResponse(`✅ iOS Payment Success (error parsing ref_token):\n${JSON.stringify(result, null, 2)}`);
265
- }
266
- }
326
+ try {
327
+ const result = await EasyMerchantSdk.billing(
328
+ amount,
329
+ 'usd',
330
+ billingInfo,
331
+ ['card', 'bank'],
332
+ themeConfiguration,
333
+ false, // tokenOnly
334
+ true, // saveCard
335
+ true, // saveAccount
336
+ true, // authenticatedACH
337
+ authConfig, // grailPayParams
338
+ 'Submit',
339
+ false, // isRecurring
340
+ 2, // if isRecurring == true then numOfCycle required
341
+ ['weekly', 'monthly'],
342
+ 'custom',
343
+ '07/07/2025',
344
+ true, // secureAuthentication
345
+ true, // showReceipt
346
+ true, // showTotal
347
+ true,// showSubmitButton
348
+ "davindersingh@gmail.com",
349
+ "Davinder Singh"
350
+ );
351
+
352
+ const refToken = result?.additionalInfo?.threeDSecureStatus?.data?.ref_token;
353
+ if (refToken) setReferenceToken(refToken);
354
+
355
+ setResult(JSON.stringify(result, null, 2));
267
356
  } catch (error) {
268
357
  console.error('Billing Error:', error);
269
- let errorMessage = 'Unknown error';
270
- if (error.code && error.message) {
271
- errorMessage = `Code: ${error.code}, Message: ${error.message}`;
272
- } else if (error.message) {
273
- errorMessage = error.message;
274
- }
275
- setResponse(`❌ Billing Error: ${errorMessage}`);
358
+ setResult(`❌ Billing Error: ${error.message || JSON.stringify(error)}`);
359
+ }
360
+ };
361
+
362
+ const handleCheckStatus = async () => {
363
+ setLoading(true);
364
+ try {
365
+ const response = await RNEasymerchantsdk.checkPaymentStatus();
366
+ setResult(response.response || JSON.stringify(response, null, 2));
367
+ } catch (error) {
368
+ setResult(`Error: ${error.message}`);
369
+ Alert.alert('Status Check Error', error.message);
370
+ } finally {
371
+ setLoading(false);
276
372
  }
277
373
  };
278
374
 
279
375
  const handlePaymentReference = async () => {
376
+ if (Platform.OS === 'android') {
377
+ setResult('❌ Payment Reference not supported on Android');
378
+ return;
379
+ }
280
380
  if (!referenceToken) {
281
- setResponse('❌ No reference token available from billing');
381
+ setResult('❌ No reference token available from billing');
282
382
  return;
283
383
  }
284
-
285
384
  try {
286
- if (Platform.OS === 'android') {
287
- setResponse('❌ Payment Reference not supported on Android');
288
- } else {
289
- const result = await EasyMerchantSdk.paymentReference(referenceToken);
290
- console.log('Payment Reference success:', JSON.stringify(result, null, 2));
291
- setResponse(`✅ iOS Payment Reference Success:\n${JSON.stringify(result, null, 2)}`);
292
- }
385
+ const result = await EasyMerchantSdk.paymentReference(referenceToken);
386
+ setResult(`✅ Payment Reference:
387
+ ${JSON.stringify(result, null, 2)}`);
293
388
  } catch (error) {
294
- console.error('Payment Reference Error:', error);
295
- let errorMessage = 'Unknown error';
296
- if (error.code && error.message) {
297
- errorMessage = `Code: ${error.code}, Message: ${error.message}`;
298
- } else if (error.message) {
299
- errorMessage = error.message;
300
- }
301
- setResponse(`❌ Payment Reference Error: ${errorMessage}`);
389
+ setResult(`❌ Payment Reference Error: ${error.message || JSON.stringify(error)}`);
302
390
  }
303
391
  };
304
392
 
@@ -307,15 +395,20 @@ const authConfig = {
307
395
  <ScrollView contentContainerStyle={styles.scrollContent}>
308
396
  <Text style={styles.title}>EasyMerchant SDK</Text>
309
397
  <Text style={styles.version}>Platform Version: {version}</Text>
310
-
311
- <Button title="Get Platform Version" onPress={getPlatformVersion} />
312
- <View style={styles.space} />
313
- <Button title="Start Billing" onPress={handleBilling} />
314
- <View style={styles.space} />
315
- <Button title="Start Payment Reference" onPress={handlePaymentReference} />
316
- <View style={styles.space} />
317
-
318
- <Text style={styles.response}>{response}</Text>
398
+ <Button title="Get Platform Version" onPress={getPlatformVersion} disabled={loading} />
399
+ <TextInput
400
+ style={styles.input}
401
+ placeholder="Enter amount (e.g., 10.00)"
402
+ keyboardType="decimal-pad"
403
+ value={amount}
404
+ onChangeText={setAmount}
405
+ />
406
+ <View style={styles.buttonGroup}>
407
+ <Button title="Pay" onPress={handlePayment} disabled={loading} />
408
+ <Button title="Check Status" onPress={handleCheckStatus} disabled={loading} />
409
+ <Button title="Payment Ref" onPress={handlePaymentReference} disabled={loading} />
410
+ </View>
411
+ <Text selectable style={styles.result}>{result}</Text>
319
412
  </ScrollView>
320
413
  </View>
321
414
  );
@@ -324,38 +417,22 @@ const authConfig = {
324
417
  export default App;
325
418
 
326
419
  const styles = StyleSheet.create({
327
- container: {
328
- flex: 1,
329
- backgroundColor: '#F9FAFB',
330
- },
331
- scrollContent: {
332
- flexGrow: 1,
333
- alignItems: 'center',
334
- justifyContent: 'center',
335
- padding: 24,
336
- },
337
- title: {
338
- fontSize: 20,
339
- fontWeight: 'bold',
340
- marginBottom: 16,
341
- },
342
- version: {
343
- fontSize: 14,
344
- marginBottom: 8,
345
- },
346
- response: {
347
- marginTop: 20,
348
- paddingHorizontal: 12,
349
- textAlign: 'center',
350
- fontSize: 14,
351
- color: '#333',
352
- },
353
- space: {
354
- height: 16,
420
+ container: { flex: 1, backgroundColor: '#F9FAFB' },
421
+ scrollContent: { flexGrow: 1, padding: 20 },
422
+ title: { fontSize: 24, fontWeight: 'bold', marginBottom: 16, textAlign: 'center' },
423
+ version: { fontSize: 14, marginBottom: 10, textAlign: 'center' },
424
+ input: {
425
+ height: 40,
426
+ borderColor: '#ccc',
427
+ borderWidth: 1,
428
+ borderRadius: 5,
429
+ paddingHorizontal: 10,
430
+ marginBottom: 20,
355
431
  },
432
+ buttonGroup: { marginBottom: 20, gap: 10 },
433
+ result: { fontSize: 14, fontFamily: 'monospace', color: '#333' },
356
434
  });
357
435
 
358
-
359
436
  ```
360
437
 
361
438
  You can send `null` if billing info not available.
@@ -39,7 +39,7 @@ repositories {
39
39
  }
40
40
 
41
41
  dependencies {
42
- implementation 'com.app:paysdk:1.2.3'
42
+ implementation 'com.app:paysdk:1.2.7'
43
43
  implementation 'com.hbb20:ccp:2.7.3'
44
44
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1"
45
45
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1"