@jimrising/easymerchantsdk-react-native 2.4.7 → 2.4.9
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/README.md +1 -1
- package/android/.settings/org.eclipse.buildship.core.prefs +2 -2
- package/android/build.gradle +3 -4
- package/android/config.properties +5 -0
- package/android/config.properties.example +5 -0
- package/ios/ApiManager/APIRequest.swift +0 -3
- package/ios/ApiManager/APIService.swift +0 -2
- package/ios/Classes/EasyMerchantSdk.h +0 -1
- package/ios/Classes/EasyMerchantSdk.m +54 -5
- package/ios/Classes/EasyMerchantSdk.swift +1 -15
- package/ios/Classes/EasyPayViewController.swift +1 -1
- package/ios/EnvironmentConfig.swift +0 -1
- package/ios/Example/SceneDelegate.swift +23 -1
- package/ios/Example/ViewController.swift +0 -8
- package/ios/Extensions/UIFont.swift +0 -1
- package/ios/Extensions/UIViewController+Extension.swift +0 -1
- package/ios/Helper/GrailPayHelper.swift +146 -58
- package/ios/Helper/GrailPayWebViewController.swift +416 -0
- package/ios/Helper/JavaScriptBridge.swift +312 -0
- package/ios/Helper/WebViewConfig.swift +159 -0
- package/ios/Models/Request.swift +48 -204
- package/ios/easymerchantsdk.podspec +2 -2
- package/package.json +1 -1
- package/ios/easymerchantsdk.storyboard +0 -9089
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
arguments=--init-script /var/folders/
|
|
1
|
+
arguments=--init-script /var/folders/7t/r_0xdprj4qqdnkmccbx458sr0000gn/T/db3b08fc4a9ef609cb16b96b200fa13e563f396e9bb1ed0905fdab7bc3bc513b.gradle --init-script /var/folders/7t/r_0xdprj4qqdnkmccbx458sr0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
|
|
2
2
|
auto.sync=false
|
|
3
3
|
build.scans.enabled=false
|
|
4
4
|
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(8.9))
|
|
5
5
|
connection.project.dir=
|
|
6
6
|
eclipse.preferences.version=1
|
|
7
7
|
gradle.user.home=
|
|
8
|
-
java.home=/opt/homebrew/Cellar/openjdk@17/17.0.
|
|
8
|
+
java.home=/opt/homebrew/Cellar/openjdk@17/17.0.16/libexec/openjdk.jdk/Contents/Home
|
|
9
9
|
jvm.arguments=
|
|
10
10
|
offline.mode=false
|
|
11
11
|
override.workspace.settings=true
|
package/android/build.gradle
CHANGED
|
@@ -64,8 +64,8 @@ repositories {
|
|
|
64
64
|
maven {
|
|
65
65
|
url = uri("https://maven.pkg.github.com/EasyMerchant/em-MobileCheckoutSDK-Android")
|
|
66
66
|
credentials {
|
|
67
|
-
username = "
|
|
68
|
-
password = "
|
|
67
|
+
username = project.findProperty("GITHUB_USERNAME") ?: System.getenv("GITHUB_USERNAME") ?: ""
|
|
68
|
+
password = project.findProperty("GITHUB_PASSWORD") ?: System.getenv("GITHUB_PASSWORD") ?: ""
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -88,8 +88,7 @@ dependencies {
|
|
|
88
88
|
implementation 'com.google.android.material:material:1.13.0'
|
|
89
89
|
|
|
90
90
|
// Third-party libs
|
|
91
|
-
implementation '
|
|
92
|
-
implementation 'com.app:paysdk:1.6.3.6'
|
|
91
|
+
implementation 'com.app:paysdk:1.6.6.3'
|
|
93
92
|
implementation 'com.hbb20:ccp:2.7.3'
|
|
94
93
|
implementation 'com.github.bumptech.glide:glide:5.0.4'
|
|
95
94
|
implementation 'com.github.androidmads:QRGenerator:1.0.5'
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# GitHub Packages credentials (only needed if resolving the Android SDK from GitHub Packages)
|
|
2
|
+
# Set your own values. Do not commit real credentials.
|
|
3
|
+
GITHUB_USERNAME=
|
|
4
|
+
GITHUB_PASSWORD=
|
|
5
|
+
GITHUB_URL=https://maven.pkg.github.com/EasyMerchant/em-MobileCheckoutSDK-Android
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# GitHub Packages credentials (only needed if resolving the Android SDK from GitHub Packages)
|
|
2
|
+
# Copy to config.properties and set your values. Do not commit config.properties with real credentials.
|
|
3
|
+
GITHUB_USERNAME=your_github_username
|
|
4
|
+
GITHUB_PASSWORD=your_github_token
|
|
5
|
+
GITHUB_URL=https://maven.pkg.github.com/EasyMerchant/em-MobileCheckoutSDK-Android
|
|
@@ -21,7 +21,6 @@ struct APIRequest {
|
|
|
21
21
|
func buildURLRequest() -> URLRequest? {
|
|
22
22
|
let fullURL = EnvironmentConfig.baseURL + endpoint.path()
|
|
23
23
|
guard let url = URL(string: fullURL) else {
|
|
24
|
-
print("Invalid URL: \(fullURL)")
|
|
25
24
|
return nil
|
|
26
25
|
}
|
|
27
26
|
|
|
@@ -47,10 +46,8 @@ struct APIRequest {
|
|
|
47
46
|
request.httpBody = jsonData
|
|
48
47
|
// Debug
|
|
49
48
|
if let jsonString = String(data: jsonData, encoding: .utf8) {
|
|
50
|
-
print("JSON Payload Sent:\n\(jsonString)")
|
|
51
49
|
}
|
|
52
50
|
} catch {
|
|
53
|
-
print("Failed to serialize request body: \(error)")
|
|
54
51
|
return nil
|
|
55
52
|
}
|
|
56
53
|
}
|
|
@@ -28,7 +28,6 @@ class APIService {
|
|
|
28
28
|
|
|
29
29
|
// Debug print
|
|
30
30
|
if let data = data, let rawString = String(data: data, encoding: .utf8) {
|
|
31
|
-
print("🧾 Raw Response:\n\(rawString)")
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
if let error = error {
|
|
@@ -87,7 +86,6 @@ class APIService {
|
|
|
87
86
|
|
|
88
87
|
// Debug: optional - print raw response
|
|
89
88
|
if let rawString = String(data: data, encoding: .utf8) {
|
|
90
|
-
print("🧾 Raw Response:\n\(rawString)")
|
|
91
89
|
}
|
|
92
90
|
|
|
93
91
|
// Attempt decoding
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
#import <React/RCTLog.h>
|
|
3
3
|
#import <React/RCTBridgeModule.h>
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
#import "easymerchantsdk-Swift.h"
|
|
6
|
+
//#import <easymerchantsdk/easymerchantsdk-Swift.h>
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
@interface EasyMerchantSdk ()
|
|
@@ -123,6 +123,27 @@ RCT_EXPORT_METHOD(getPlatformVersion:(RCTPromiseResolveBlock)resolve
|
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
RCT_EXPORT_METHOD(handleDeepLink:(NSString *)url
|
|
127
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
128
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
129
|
+
{
|
|
130
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
131
|
+
if (!url || [url length] == 0) {
|
|
132
|
+
reject(@"INVALID_URL", @"URL is required", nil);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
NSURL *deepLinkURL = [NSURL URLWithString:url];
|
|
137
|
+
if (!deepLinkURL) {
|
|
138
|
+
reject(@"INVALID_URL", @"Invalid URL format", nil);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
[GrailPayHelper handleDeepLinkCallbackWithUrl:deepLinkURL];
|
|
143
|
+
resolve(@"Deep link handled successfully");
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
126
147
|
// Helper method to find the top-most view controller
|
|
127
148
|
- (UIViewController *)topMostViewController {
|
|
128
149
|
UIWindow *keyWindow = nil;
|
|
@@ -164,10 +185,38 @@ RCT_EXPORT_METHOD(getPlatformVersion:(RCTPromiseResolveBlock)resolve
|
|
|
164
185
|
return base;
|
|
165
186
|
}
|
|
166
187
|
|
|
167
|
-
// MARK: - Deep Link Handling
|
|
168
|
-
|
|
169
188
|
+ (BOOL)handleDeepLink:(NSURL *)url {
|
|
170
|
-
|
|
189
|
+
if (!url || !url.scheme) {
|
|
190
|
+
return NO;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
NSString *scheme = url.scheme.lowercaseString;
|
|
194
|
+
NSString *host = url.host ? url.host.lowercaseString : @"";
|
|
195
|
+
NSString *urlString = url.absoluteString;
|
|
196
|
+
|
|
197
|
+
// GrailPay backend OAuth callback (intercepted from bank app)
|
|
198
|
+
if (([scheme isEqualToString:@"https"] || [scheme isEqualToString:@"http"]) &&
|
|
199
|
+
[host isEqualToString:@"bank-link-sdk-api.grailpay.com"]) {
|
|
200
|
+
[GrailPayHelper handleGrailPayOAuthCallbackWithUrl:url];
|
|
201
|
+
return YES;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Expediter/expeditor schemes
|
|
205
|
+
if ([scheme isEqualToString:@"expediter"] || [scheme isEqualToString:@"expeditor"]) {
|
|
206
|
+
[GrailPayHelper handleDeepLinkCallbackWithUrl:url];
|
|
207
|
+
return YES;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// grailpay deep link or app-specific scheme
|
|
211
|
+
if ([scheme isEqualToString:@"grailpay"] ||
|
|
212
|
+
[scheme hasPrefix:@"com."] ||
|
|
213
|
+
[scheme hasPrefix:@"org."] ||
|
|
214
|
+
[urlString containsString:@"callback"]) {
|
|
215
|
+
[GrailPayHelper handleDeepLinkCallbackWithUrl:url];
|
|
216
|
+
return YES;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return NO;
|
|
171
220
|
}
|
|
172
221
|
|
|
173
222
|
@end
|
|
@@ -143,20 +143,6 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
143
143
|
resolve("iOS \(UIDevice.current.systemVersion)")
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
// MARK: - Deep Link Handling for GrailPay
|
|
147
|
-
|
|
148
|
-
@objc public static func handleDeepLink(url: URL) -> Bool {
|
|
149
|
-
print("🔗 SDK: Deep link received: \(url)")
|
|
150
|
-
|
|
151
|
-
if url.scheme == "grailpay" && url.host == "callback" {
|
|
152
|
-
print("✅ SDK: GrailPay callback detected")
|
|
153
|
-
GrailPayHelper.handleDeepLinkCallback(url: url)
|
|
154
|
-
return true
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return false
|
|
158
|
-
}
|
|
159
|
-
|
|
160
146
|
// MARK: - Helpers
|
|
161
147
|
|
|
162
148
|
private func getTopViewController() -> UIViewController? {
|
|
@@ -230,7 +216,7 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
230
216
|
let grailPay = (json["grailPayParams"] as? [String: Any]).flatMap {
|
|
231
217
|
GrailPayRequest(
|
|
232
218
|
role: $0["role"] as? String ?? "",
|
|
233
|
-
timeout: $0["timeout"] as? Int ??
|
|
219
|
+
timeout: max($0["timeout"] as? Int ?? 11, 11),
|
|
234
220
|
brandingName: $0["brandingName"] as? String ?? "",
|
|
235
221
|
finderSubtitle: $0["finderSubtitle"] as? String ?? "",
|
|
236
222
|
searchPlaceholder: $0["searchPlaceholder"] as? String ?? ""
|
|
@@ -58,7 +58,7 @@ public final class EasyPayViewController: UINavigationController {
|
|
|
58
58
|
// Disable interactive pop gesture to prevent dismissal by sliding from left
|
|
59
59
|
self.interactivePopGestureRecognizer?.isEnabled = false
|
|
60
60
|
|
|
61
|
-
let vc = UIStoryboard(name: "
|
|
61
|
+
let vc = UIStoryboard(name: "EasyPaySdk", bundle: Bundle.easyPayBundle).instantiateViewController(withIdentifier: "PaymentInfoVC") as! PaymentInfoVC
|
|
62
62
|
vc.modalPresentationStyle = .overFullScreen
|
|
63
63
|
vc.configureWith(request: request, delegate: easyPayDelegate)
|
|
64
64
|
// For API key/secret flow, pass amount immediately. For clientToken flow,
|
|
@@ -75,7 +75,6 @@ public class EnvironmentConfig {
|
|
|
75
75
|
case .hostedCheckouts: return "/api/v1/hostedcheckouts"
|
|
76
76
|
case .emailVerification: return "/api/v1/customer/send_otp"
|
|
77
77
|
case .verifyOtp: return "/api/v1/customer/verify_otp"
|
|
78
|
-
// case .getCards: return "/api/v1/customer/card"
|
|
79
78
|
case .getCards: return "/api/v1/card"
|
|
80
79
|
case .creditCharges: return "/api/v1/customer/charges"
|
|
81
80
|
case .account: return "/api/v1/ach/account"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
2
|
// SceneDelegate.swift
|
|
3
|
-
//
|
|
3
|
+
// EasyPaySDKDemo
|
|
4
4
|
//
|
|
5
5
|
// Created by iftekhar on 13/07/24.
|
|
6
6
|
//
|
|
@@ -17,6 +17,28 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
|
17
17
|
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
|
|
18
18
|
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
|
19
19
|
guard let _ = (scene as? UIWindowScene) else { return }
|
|
20
|
+
|
|
21
|
+
// Handle deep links on app launch
|
|
22
|
+
if let urlContext = connectionOptions.urlContexts.first {
|
|
23
|
+
handleDeepLink(url: urlContext.url)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// MARK: - Deep Link Handling for GrailPay
|
|
28
|
+
|
|
29
|
+
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
|
30
|
+
if let url = URLContexts.first?.url {
|
|
31
|
+
handleDeepLink(url: url)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private func handleDeepLink(url: URL) {
|
|
36
|
+
|
|
37
|
+
if url.scheme == "grailpay" && url.host == "callback" {
|
|
38
|
+
|
|
39
|
+
// Handle deep link via GrailPayHelper (no more GrailPayVC lookup)
|
|
40
|
+
//GrailPayHelper.handleDeepLinkCallback(url: url)
|
|
41
|
+
}
|
|
20
42
|
}
|
|
21
43
|
|
|
22
44
|
func sceneDidDisconnect(_ scene: UIScene) {
|
|
@@ -85,7 +85,6 @@
|
|
|
85
85
|
// )
|
|
86
86
|
//
|
|
87
87
|
// guard let billingData = try? JSONEncoder().encode(fields) else {
|
|
88
|
-
// print("Failed to encode fields")
|
|
89
88
|
// return
|
|
90
89
|
// }
|
|
91
90
|
//
|
|
@@ -192,7 +191,6 @@
|
|
|
192
191
|
// )
|
|
193
192
|
//
|
|
194
193
|
// guard let billingData = try? JSONEncoder().encode(fields) else {
|
|
195
|
-
// print("Failed to encode fields")
|
|
196
194
|
// return
|
|
197
195
|
// }
|
|
198
196
|
//
|
|
@@ -304,7 +302,6 @@
|
|
|
304
302
|
// // Combine into one string for the label
|
|
305
303
|
// lblResponseShow.text = "Status: \(status), Message: \(message)"
|
|
306
304
|
//
|
|
307
|
-
// print("Cancel Data:", chargeData) // Debug print
|
|
308
305
|
// }
|
|
309
306
|
//
|
|
310
307
|
// case .success:
|
|
@@ -336,7 +333,6 @@
|
|
|
336
333
|
// do {
|
|
337
334
|
// let jsonData = try JSONSerialization.data(withJSONObject: fullResponse, options: .prettyPrinted)
|
|
338
335
|
// if let jsonString = String(data: jsonData, encoding: .utf8) {
|
|
339
|
-
// print(jsonString)
|
|
340
336
|
// lblResponseShow.text = jsonString
|
|
341
337
|
// }
|
|
342
338
|
// } catch {
|
|
@@ -351,7 +347,6 @@
|
|
|
351
347
|
// lblResponseShow.isHidden = false
|
|
352
348
|
// lblResponseShow.text = "Status: \(status), Message: \(message)"
|
|
353
349
|
//
|
|
354
|
-
// print("Error Data:", chargeData) // Debugging
|
|
355
350
|
// } else {
|
|
356
351
|
// lblResponseShow.isHidden = false
|
|
357
352
|
// lblResponseShow.text = "An unknown error occurred."
|
|
@@ -446,7 +441,6 @@
|
|
|
446
441
|
//// )
|
|
447
442
|
////
|
|
448
443
|
//// guard let billingData = try? JSONEncoder().encode(fields) else {
|
|
449
|
-
//// print("Failed to encode fields")
|
|
450
444
|
//// return
|
|
451
445
|
//// }
|
|
452
446
|
////
|
|
@@ -606,10 +600,8 @@
|
|
|
606
600
|
////
|
|
607
601
|
//// let jsonData = try JSONSerialization.data(withJSONObject: requestDict, options: [.prettyPrinted])
|
|
608
602
|
//// if let jsonString = String(data: jsonData, encoding: .utf8) {
|
|
609
|
-
//// print("Request Configuration JSON:\n\(jsonString)")
|
|
610
603
|
//// }
|
|
611
604
|
//// } catch {
|
|
612
|
-
//// print("Failed to serialize request to JSON: \(error)")
|
|
613
605
|
//// }
|
|
614
606
|
////
|
|
615
607
|
//// if request.initializationErrorMessage == nil {
|
|
@@ -21,7 +21,6 @@ extension UIFont {
|
|
|
21
21
|
var error: Unmanaged<CFError>?
|
|
22
22
|
let success = CTFontManagerRegisterGraphicsFont(font, &error)
|
|
23
23
|
if !success {
|
|
24
|
-
print("Error registering font: maybe it was already registered.")
|
|
25
24
|
}
|
|
26
25
|
} else {
|
|
27
26
|
fatalError("Couldn't find font \(fontPath)")
|