@jimrising/easymerchantsdk-react-native 1.3.9 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/caches/deviceStreaming.xml +77 -0
- package/README.md +140 -81
- package/android/.gradle/8.10/checksums/checksums.lock +0 -0
- package/android/.gradle/8.10/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.10/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.10/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/results.bin +1 -0
- package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/BuildConfig.dex +0 -0
- package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
- package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$2.dex +0 -0
- package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
- package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkPackage.dex +0 -0
- package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/.transforms/e9a664a11ce12edf79cd87b1e07aa243/results.bin +1 -0
- package/android/build/.transforms/e9a664a11ce12edf79cd87b1e07aa243/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/generated/source/buildConfig/debug/com/reactlibrary/BuildConfig.java +10 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +7 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
- package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
- package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkPackage.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +2 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +7 -0
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +7 -0
- package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
- package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/BuildConfig.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkPackage.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +17 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1.class.uniqueId2 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$2.class.uniqueId0 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule.class.uniqueId3 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkPackage.class.uniqueId1 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +4 -1
- package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkModule.java +158 -36
- package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkPackage.java +45 -13
- package/ios/Classes/EasyMerchantSdk.m +106 -55
- package/ios/Classes/EasyMerchantSdk.swift +199 -77
- package/ios/Classes/EasyPayViewController.swift +1 -1
- package/ios/CustomComponents/DatePickerHandler.swift +15 -4
- package/ios/EnvironmentConfig.swift +32 -30
- package/ios/Models/Request.swift +176 -14
- package/ios/Models/Result.swift +12 -5
- package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +855 -366
- package/ios/Pods/ViewControllers/BaseVC.swift +51 -36
- package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +1985 -178
- package/ios/Pods/ViewControllers/CountryListVC.swift +20 -1
- package/ios/Pods/ViewControllers/CustomOverlay.swift +199 -0
- package/ios/Pods/ViewControllers/EmailVerificationVC.swift +74 -5
- package/ios/Pods/ViewControllers/GrailPayVC.swift +131 -107
- package/ios/Pods/ViewControllers/OTPVerificationVC.swift +296 -106
- package/ios/Pods/ViewControllers/PaymentDoneVC.swift +35 -26
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +1276 -545
- package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +607 -24
- package/ios/easymerchantsdk.podspec +1 -1
- package/ios/easymerchantsdk.storyboard +1388 -1165
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- Merging decision tree log ---
|
|
2
|
+
manifest
|
|
3
|
+
ADDED from /Users/appdev/Documents/GitHub/lyfecycle-sample-RN-sdk/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:2:1-4:12
|
|
4
|
+
INJECTED from /Users/appdev/Documents/GitHub/lyfecycle-sample-RN-sdk/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:2:1-4:12
|
|
5
|
+
package
|
|
6
|
+
ADDED from /Users/appdev/Documents/GitHub/lyfecycle-sample-RN-sdk/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:3:11-37
|
|
7
|
+
INJECTED from /Users/appdev/Documents/GitHub/lyfecycle-sample-RN-sdk/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
|
|
8
|
+
xmlns:android
|
|
9
|
+
ADDED from /Users/appdev/Documents/GitHub/lyfecycle-sample-RN-sdk/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:2:11-69
|
|
10
|
+
uses-sdk
|
|
11
|
+
INJECTED from /Users/appdev/Documents/GitHub/lyfecycle-sample-RN-sdk/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
|
|
12
|
+
INJECTED from /Users/appdev/Documents/GitHub/lyfecycle-sample-RN-sdk/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
|
|
13
|
+
INJECTED from /Users/appdev/Documents/GitHub/lyfecycle-sample-RN-sdk/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
|
|
14
|
+
android:targetSdkVersion
|
|
15
|
+
INJECTED from /Users/appdev/Documents/GitHub/lyfecycle-sample-RN-sdk/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
|
|
16
|
+
android:minSdkVersion
|
|
17
|
+
INJECTED from /Users/appdev/Documents/GitHub/lyfecycle-sample-RN-sdk/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -39,11 +39,14 @@ repositories {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
dependencies {
|
|
42
|
-
implementation 'com.app:paysdk:1.
|
|
42
|
+
implementation 'com.app:paysdk:1.2.2'
|
|
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"
|
|
46
46
|
implementation 'com.github.androidmads:QRGenerator:1.0.1'
|
|
47
|
+
implementation('com.microblink:blinkcard:2.10.0@aar') {
|
|
48
|
+
transitive = true
|
|
49
|
+
}
|
|
47
50
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
48
51
|
implementation 'com.google.android.material:material:1.8.0'
|
|
49
52
|
implementation 'com.facebook.react:react-native:+'
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
package com.reactlibrary;
|
|
2
2
|
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import androidx.annotation.NonNull;
|
|
5
|
+
import com.app.paysdk.init.EasyPaymentFactory;
|
|
6
|
+
import com.app.paysdk.service.EasyPaymentService;
|
|
3
7
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
4
8
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
5
9
|
import com.facebook.react.bridge.ReactMethod;
|
|
6
10
|
import com.facebook.react.bridge.Promise;
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
import android.app.Activity;
|
|
12
|
-
|
|
13
|
-
import com.facebook.react.bridge.Callback;
|
|
14
|
-
|
|
11
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
12
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
13
|
+
import com.facebook.react.bridge.WritableMap;
|
|
14
|
+
import com.facebook.react.bridge.Arguments;
|
|
15
15
|
import org.json.JSONObject;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
import
|
|
16
|
+
import org.json.JSONArray;
|
|
17
|
+
import org.json.JSONException;
|
|
18
|
+
import java.util.HashMap;
|
|
19
|
+
import java.util.ArrayList;
|
|
20
|
+
import java.util.List;
|
|
20
21
|
|
|
21
22
|
public class RNEasymerchantsdkModule extends ReactContextBaseJavaModule {
|
|
22
|
-
|
|
23
|
+
private final ReactApplicationContext reactContext;
|
|
24
|
+
|
|
25
|
+
public RNEasymerchantsdkModule(ReactApplicationContext context) {
|
|
23
26
|
super(context);
|
|
27
|
+
this.reactContext = context;
|
|
24
28
|
}
|
|
25
29
|
|
|
30
|
+
@NonNull
|
|
26
31
|
@Override
|
|
27
32
|
public String getName() {
|
|
28
33
|
return "RNEasymerchantsdk";
|
|
@@ -34,40 +39,157 @@ public class RNEasymerchantsdkModule extends ReactContextBaseJavaModule {
|
|
|
34
39
|
String platformVersion = "Android " + android.os.Build.VERSION.RELEASE;
|
|
35
40
|
promise.resolve(platformVersion);
|
|
36
41
|
} catch (Exception e) {
|
|
37
|
-
promise.reject("ERROR", e.getMessage());
|
|
42
|
+
promise.reject("ERROR", "Failed to get platform version: " + e.getMessage());
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
@ReactMethod
|
|
42
|
-
public void
|
|
47
|
+
public void makePayment(ReadableMap configMap, Promise promise) {
|
|
43
48
|
Activity currentActivity = getCurrentActivity();
|
|
44
49
|
if (currentActivity == null) {
|
|
45
|
-
promise.reject("ERROR", "Activity is not initialized");
|
|
50
|
+
promise.reject("ERROR", "Activity is not initialized.");
|
|
46
51
|
return;
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
try {
|
|
55
|
+
// Validate required fields
|
|
56
|
+
if (!configMap.hasKey("amount") || configMap.getString("amount").isEmpty() || Float.parseFloat(configMap.getString("amount")) <= 0) {
|
|
57
|
+
promise.reject("ERROR", "Invalid or missing amount.");
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
50
60
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
if (!configMap.hasKey("apiKey") || !configMap.hasKey("secretKey")) {
|
|
62
|
+
promise.reject("ERROR", "Missing apiKey or secretKey.");
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Extract configurations
|
|
67
|
+
String amountStr = configMap.getString("amount");
|
|
68
|
+
String apiKey = configMap.getString("apiKey");
|
|
69
|
+
String secretKey = configMap.getString("secretKey");
|
|
70
|
+
JSONObject jsonConfig = new JSONObject(configMap.getMap("jsonConfig").toHashMap());
|
|
71
|
+
ReadableMap hashMapConfig = configMap.getMap("hashMapConfig");
|
|
72
|
+
|
|
73
|
+
// Build hashMap configuration
|
|
74
|
+
HashMap<String, Object> hashMap = new HashMap<>();
|
|
75
|
+
hashMap.put("amount", hashMapConfig.getString("amount"));
|
|
76
|
+
hashMap.put("currency", hashMapConfig.getString("currency"));
|
|
77
|
+
hashMap.put("tokenOnly", hashMapConfig.getBoolean("tokenOnly"));
|
|
78
|
+
hashMap.put("saveCard", hashMapConfig.getBoolean("saveCard"));
|
|
79
|
+
hashMap.put("saveAccount", hashMapConfig.getBoolean("saveAccount"));
|
|
80
|
+
|
|
81
|
+
// Handle payment methods
|
|
82
|
+
ReadableArray paymentMethodsArray = hashMapConfig.getArray("paymentMethods");
|
|
83
|
+
List<String> paymentMethods = new ArrayList<>();
|
|
84
|
+
for (int i = 0; i < paymentMethodsArray.size(); i++) {
|
|
85
|
+
paymentMethods.add(paymentMethodsArray.getString(i));
|
|
86
|
+
}
|
|
87
|
+
hashMap.put("paymentMethods", paymentMethods);
|
|
88
|
+
|
|
89
|
+
hashMap.put("fontSize", (float) hashMapConfig.getDouble("fontSize"));
|
|
90
|
+
hashMap.put("showDonate", hashMapConfig.getBoolean("showDonate"));
|
|
91
|
+
hashMap.put("enableRecurring", hashMapConfig.getBoolean("enableRecurring"));
|
|
92
|
+
|
|
93
|
+
// Handle recurring data
|
|
94
|
+
ReadableMap recurringDataMap = hashMapConfig.getMap("recurringData");
|
|
95
|
+
JSONObject recurringInfo = new JSONObject();
|
|
96
|
+
recurringInfo.put("allowCycles", recurringDataMap.getInt("allowCycles"));
|
|
97
|
+
ReadableArray intervalsArray = recurringDataMap.getArray("intervals");
|
|
98
|
+
JSONArray intervals = new JSONArray();
|
|
99
|
+
for (int i = 0; i < intervalsArray.size(); i++) {
|
|
100
|
+
intervals.put(intervalsArray.getString(i));
|
|
101
|
+
}
|
|
102
|
+
recurringInfo.put("intervals", intervals);
|
|
103
|
+
recurringInfo.put("recurringStartType", recurringDataMap.getString("recurringStartType"));
|
|
104
|
+
hashMap.put("recurringData", recurringInfo);
|
|
105
|
+
|
|
106
|
+
hashMap.put("authenticateBank", hashMapConfig.getBoolean("authenticateBank"));
|
|
107
|
+
|
|
108
|
+
// Handle GrailPayParams
|
|
109
|
+
ReadableMap grailPayParamsMap = hashMapConfig.getMap("grailPayParams");
|
|
110
|
+
JSONObject grailPayParamsJson = new JSONObject();
|
|
111
|
+
grailPayParamsJson.put("accessToken", grailPayParamsMap.getString("accessToken"));
|
|
112
|
+
grailPayParamsJson.put("vendorId", grailPayParamsMap.getString("vendorId"));
|
|
113
|
+
grailPayParamsJson.put("role", grailPayParamsMap.getString("role"));
|
|
114
|
+
grailPayParamsJson.put("timeout", grailPayParamsMap.getInt("timeout"));
|
|
115
|
+
grailPayParamsJson.put("isSandbox", grailPayParamsMap.getBoolean("isSandbox"));
|
|
116
|
+
grailPayParamsJson.put("brandingName", grailPayParamsMap.getString("brandingName"));
|
|
117
|
+
grailPayParamsJson.put("finderSubtitle", grailPayParamsMap.getString("finderSubtitle"));
|
|
118
|
+
grailPayParamsJson.put("searchPlaceholder", grailPayParamsMap.getString("searchPlaceholder"));
|
|
119
|
+
hashMap.put("grailPayParams", grailPayParamsJson);
|
|
120
|
+
|
|
121
|
+
hashMap.put("is3DSecureEnable", hashMapConfig.getBoolean("is3DSecureEnable"));
|
|
122
|
+
hashMap.put("showPrice", hashMapConfig.getBoolean("showPrice"));
|
|
123
|
+
|
|
124
|
+
// Handle billing info
|
|
125
|
+
if (hashMapConfig.hasKey("billingInfo")) {
|
|
126
|
+
JSONObject billingInfo = new JSONObject(hashMapConfig.getMap("billingInfo").toHashMap());
|
|
127
|
+
hashMap.put("billingInfo", billingInfo);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
EasyPaymentFactory easyPaymentFactory = EasyPaymentFactory.INSTANCE;
|
|
133
|
+
EasyPaymentService easyPaymentService = easyPaymentFactory.create(
|
|
134
|
+
currentActivity,
|
|
135
|
+
jsonConfig.getString("environment"),
|
|
136
|
+
apiKey,
|
|
137
|
+
secretKey);
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
// Make payment
|
|
141
|
+
easyPaymentService.makePayment(
|
|
142
|
+
jsonConfig,
|
|
143
|
+
hashMap,
|
|
144
|
+
new EasyPaymentFactory.OnTransactionListener() {
|
|
145
|
+
@Override
|
|
146
|
+
public void onSuccess(String response) {
|
|
147
|
+
WritableMap result = Arguments.createMap();
|
|
148
|
+
result.putString("response", response);
|
|
149
|
+
promise.resolve(result);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@Override
|
|
153
|
+
public void onError(String error) {
|
|
154
|
+
promise.reject("PAYMENT_ERROR", error);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
} catch (JSONException ex) {
|
|
159
|
+
promise.reject("JSON_ERROR", "Invalid JSON configuration: " + ex.getMessage());
|
|
160
|
+
} catch (Exception ex) {
|
|
161
|
+
promise.reject("ERROR", "Payment failed: " + ex.getMessage());
|
|
65
162
|
}
|
|
163
|
+
}
|
|
66
164
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
165
|
+
@ReactMethod
|
|
166
|
+
public void checkPaymentStatus(Promise promise) {
|
|
167
|
+
Activity currentActivity = getCurrentActivity();
|
|
168
|
+
if (currentActivity == null) {
|
|
169
|
+
promise.reject("ERROR", "Activity is not initialized.");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
try {
|
|
174
|
+
EasyPaymentFactory easyPaymentFactory = EasyPaymentFactory.INSTANCE;
|
|
175
|
+
easyPaymentFactory.checkPaymentStatus(
|
|
176
|
+
currentActivity,
|
|
177
|
+
new EasyPaymentFactory.OnPaymentStatusCheckListener() {
|
|
178
|
+
@Override
|
|
179
|
+
public void onSuccess(JSONObject response) {
|
|
180
|
+
WritableMap result = Arguments.createMap();
|
|
181
|
+
result.putString("response", response.toString());
|
|
182
|
+
promise.resolve(result);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@Override
|
|
186
|
+
public void onFailure(JSONObject error) {
|
|
187
|
+
promise.reject("STATUS_CHECK_ERROR", error.toString());
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
} catch (Exception ex) {
|
|
192
|
+
promise.reject("ERROR", "Failed to check payment status: " + ex.getMessage());
|
|
193
|
+
}
|
|
72
194
|
}
|
|
73
|
-
}
|
|
195
|
+
}
|
|
@@ -1,28 +1,60 @@
|
|
|
1
|
-
package com.reactlibrary;
|
|
1
|
+
//package com.reactlibrary;
|
|
2
|
+
//
|
|
3
|
+
//import java.util.Arrays;
|
|
4
|
+
//import java.util.Collections;
|
|
5
|
+
//import java.util.List;
|
|
6
|
+
//
|
|
7
|
+
//import com.facebook.react.ReactPackage;
|
|
8
|
+
//import com.facebook.react.bridge.NativeModule;
|
|
9
|
+
//import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
|
+
//import com.facebook.react.uimanager.ViewManager;
|
|
11
|
+
//import com.facebook.react.bridge.JavaScriptModule;
|
|
12
|
+
//
|
|
13
|
+
//public class RNEasymerchantsdkPackage implements ReactPackage {
|
|
14
|
+
// @Override
|
|
15
|
+
// public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
16
|
+
// return Arrays.<NativeModule>asList(new RNEasymerchantsdkModule(reactContext));
|
|
17
|
+
// }
|
|
18
|
+
//
|
|
19
|
+
// // Deprecated from RN 0.47
|
|
20
|
+
// public List<Class<? extends JavaScriptModule>> createJSModules() {
|
|
21
|
+
// return Collections.emptyList();
|
|
22
|
+
// }
|
|
23
|
+
//
|
|
24
|
+
// @Override
|
|
25
|
+
// public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
26
|
+
// return Collections.emptyList();
|
|
27
|
+
// }
|
|
28
|
+
//}
|
|
2
29
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
package com.reactlibrary;
|
|
6
35
|
|
|
7
36
|
import com.facebook.react.ReactPackage;
|
|
8
37
|
import com.facebook.react.bridge.NativeModule;
|
|
9
38
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
39
|
import com.facebook.react.uimanager.ViewManager;
|
|
11
|
-
|
|
40
|
+
|
|
41
|
+
import java.util.ArrayList;
|
|
42
|
+
import java.util.Collections;
|
|
43
|
+
import java.util.List;
|
|
12
44
|
|
|
13
45
|
public class RNEasymerchantsdkPackage implements ReactPackage {
|
|
14
46
|
@Override
|
|
15
47
|
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// Deprecated from RN 0.47
|
|
20
|
-
public List<Class<? extends JavaScriptModule>> createJSModules() {
|
|
21
|
-
return Collections.emptyList();
|
|
48
|
+
List<NativeModule> modules = new ArrayList<>();
|
|
49
|
+
modules.add(new RNEasymerchantsdkModule(reactContext));
|
|
50
|
+
return modules;
|
|
22
51
|
}
|
|
23
52
|
|
|
24
53
|
@Override
|
|
25
54
|
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
26
|
-
|
|
55
|
+
return Collections.emptyList();
|
|
27
56
|
}
|
|
28
|
-
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#import "EasyMerchantSdk.h"
|
|
2
2
|
#import <React/RCTLog.h>
|
|
3
3
|
#import <React/RCTBridgeModule.h>
|
|
4
|
-
#import <easymerchantsdk/easymerchantsdk-Swift.h>
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
#import <easymerchantsdk-Swift.h>
|
|
6
|
+
//#import <easymerchantsdk/easymerchantsdk-Swift.h>
|
|
7
7
|
|
|
8
|
-
@interface EasyMerchantSdk()
|
|
8
|
+
@interface EasyMerchantSdk ()
|
|
9
9
|
@property (nonatomic, strong) EasyMerchantSdkPlugin *sdkPluginInstance;
|
|
10
10
|
@end
|
|
11
11
|
|
|
@@ -20,78 +20,129 @@ RCT_EXPORT_METHOD(configureEnvironment:(NSString *)env
|
|
|
20
20
|
if (!self.sdkPluginInstance) {
|
|
21
21
|
self.sdkPluginInstance = [[EasyMerchantSdkPlugin alloc] init];
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
@try {
|
|
24
|
+
[self.sdkPluginInstance configureEnvironment:env apiKey:apiKey apiSecret:apiSecret];
|
|
25
|
+
} @catch (NSException *exception) {
|
|
26
|
+
RCTLogError(@"Failed to call configureEnvironment: %@", exception.reason);
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
RCT_EXPORT_METHOD(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
billing:(NSString *)amount
|
|
32
|
+
currency:(NSString *)currency
|
|
33
|
+
billingInfo:(NSDictionary *)billingInfo
|
|
34
|
+
paymentMethods:(NSArray *)paymentMethods
|
|
35
|
+
themeConfiguration:(NSDictionary *)themeConfiguration
|
|
36
|
+
tokenOnly:(BOOL)tokenOnly
|
|
37
|
+
saveCard:(BOOL)saveCard
|
|
38
|
+
saveAccount:(BOOL)saveAccount
|
|
39
|
+
authenticatedACH:(BOOL)authenticatedACH
|
|
40
|
+
grailPayParams:(NSDictionary *)grailPayParams
|
|
41
|
+
submitButtonText:(NSString *)submitButtonText
|
|
42
|
+
isRecurring:(BOOL)isRecurring
|
|
43
|
+
recurringIntervals:(NSArray *)recurringIntervals
|
|
44
|
+
recurringStartDateType:(NSString *)recurringStartDateType
|
|
45
|
+
recurringStartDate:(NSString *)recurringStartDate
|
|
46
|
+
secureAuthentication:(BOOL)secureAuthentication
|
|
47
|
+
showReceipt:(BOOL)showReceipt
|
|
48
|
+
showTotal:(BOOL)showTotal
|
|
49
|
+
showSubmitButton:(BOOL)showSubmitButton
|
|
50
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
51
|
+
rejecter:(RCTPromiseRejectBlock)reject
|
|
44
52
|
)
|
|
45
53
|
{
|
|
46
54
|
if (!self.sdkPluginInstance) {
|
|
47
55
|
self.sdkPluginInstance = [[EasyMerchantSdkPlugin alloc] init];
|
|
48
56
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
57
|
+
@try {
|
|
58
|
+
[self.sdkPluginInstance billing:amount
|
|
59
|
+
currency:currency
|
|
60
|
+
billingInfo:billingInfo
|
|
61
|
+
paymentMethods:paymentMethods
|
|
62
|
+
themeConfiguration:themeConfiguration
|
|
63
|
+
tokenOnly:tokenOnly
|
|
64
|
+
saveCard:saveCard
|
|
65
|
+
saveAccount:saveAccount
|
|
66
|
+
authenticatedACH:authenticatedACH
|
|
67
|
+
grailPayParams:grailPayParams
|
|
68
|
+
submitButtonText:submitButtonText
|
|
69
|
+
isRecurring:isRecurring
|
|
70
|
+
recurringIntervals:recurringIntervals
|
|
71
|
+
recurringStartDateType:recurringStartDateType
|
|
72
|
+
recurringStartDate:recurringStartDate
|
|
73
|
+
secureAuthentication:secureAuthentication
|
|
74
|
+
showReceipt:showReceipt
|
|
75
|
+
showTotal:showTotal
|
|
76
|
+
showSubmitButton:showSubmitButton
|
|
77
|
+
enable3DS:secureAuthentication
|
|
78
|
+
resolver:^(id result) {
|
|
79
|
+
resolve(result);
|
|
80
|
+
self.sdkPluginInstance = nil;
|
|
81
|
+
}
|
|
82
|
+
rejecter:^(NSString *code, NSString *message, NSError *error) {
|
|
83
|
+
reject(code, message, error);
|
|
84
|
+
self.sdkPluginInstance = nil;
|
|
85
|
+
}];
|
|
86
|
+
} @catch (NSException *exception) {
|
|
87
|
+
reject(@"BRIDGE_ERROR", [NSString stringWithFormat:@"Failed to call billing: %@", exception.reason], nil);
|
|
88
|
+
}
|
|
73
89
|
}
|
|
74
90
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
91
|
+
RCT_EXPORT_METHOD(
|
|
92
|
+
paymentReference:(NSString *)referenceToken
|
|
93
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
94
|
+
rejecter:(RCTPromiseRejectBlock)reject
|
|
95
|
+
)
|
|
96
|
+
{
|
|
97
|
+
if (!self.sdkPluginInstance) {
|
|
98
|
+
self.sdkPluginInstance = [[EasyMerchantSdkPlugin alloc] init];
|
|
99
|
+
}
|
|
100
|
+
@try {
|
|
101
|
+
[self.sdkPluginInstance paymentReference:referenceToken
|
|
102
|
+
resolver:^(id result) {
|
|
103
|
+
resolve(result);
|
|
104
|
+
self.sdkPluginInstance = nil;
|
|
105
|
+
}
|
|
106
|
+
rejecter:^(NSString *code, NSString *message, NSError *error) {
|
|
107
|
+
reject(code, message, error);
|
|
108
|
+
self.sdkPluginInstance = nil;
|
|
109
|
+
}];
|
|
110
|
+
} @catch (NSException *exception) {
|
|
111
|
+
reject(@"BRIDGE_ERROR", [NSString stringWithFormat:@"Failed to call paymentReference: %@", exception.reason], nil);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
78
114
|
|
|
79
115
|
RCT_REMAP_METHOD(setViewController,
|
|
80
116
|
setViewControllerWithResolver:(RCTPromiseResolveBlock)resolve
|
|
81
117
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
82
118
|
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
119
|
+
@try {
|
|
120
|
+
UIViewController *rootVC = [UIApplication sharedApplication].delegate.window.rootViewController;
|
|
121
|
+
if (!rootVC) {
|
|
122
|
+
reject(@"NO_ROOT_VC", @"No root view controller found", nil);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
EasyMerchantSdkPlugin *sdkPlugin = [[EasyMerchantSdkPlugin alloc] init];
|
|
126
|
+
[sdkPlugin setViewController:rootVC];
|
|
127
|
+
resolve(@"ViewController set");
|
|
128
|
+
} @catch (NSException *exception) {
|
|
129
|
+
reject(@"BRIDGE_ERROR", [NSString stringWithFormat:@"Failed to set view controller: %@", exception.reason], nil);
|
|
130
|
+
}
|
|
87
131
|
}
|
|
88
132
|
|
|
89
|
-
|
|
90
133
|
RCT_EXPORT_METHOD(getPlatformVersion:(RCTPromiseResolveBlock)resolve
|
|
91
134
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
92
135
|
{
|
|
93
|
-
|
|
94
|
-
|
|
136
|
+
@try {
|
|
137
|
+
EasyMerchantSdkPlugin *sdkPlugin = [[EasyMerchantSdkPlugin alloc] init];
|
|
138
|
+
[sdkPlugin getPlatformVersion:^(id result) {
|
|
139
|
+
resolve(result);
|
|
140
|
+
} rejecter:^(NSString *code, NSString *message, NSError *error) {
|
|
141
|
+
reject(code, message, error);
|
|
142
|
+
}];
|
|
143
|
+
} @catch (NSException *exception) {
|
|
144
|
+
reject(@"BRIDGE_ERROR", [NSString stringWithFormat:@"Failed to get platform version: %@", exception.reason], nil);
|
|
145
|
+
}
|
|
95
146
|
}
|
|
96
147
|
|
|
97
148
|
@end
|