@jimrising/easymerchantsdk-react-native 1.3.7 → 1.3.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/.idea/caches/deviceStreaming.xml +637 -0
- package/.idea/em-MobileCheckoutSDK-ReactNative.iml +9 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +8 -8
- package/android/.gradle/8.10/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/ios/Classes/EasyMerchantSdk.m +2 -2
- package/ios/Classes/EasyMerchantSdk.swift +117 -124
- package/ios/Models/Result.swift +13 -40
- package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +24 -2
- package/ios/Pods/ViewControllers/OTPVerificationVC.swift +17 -9
- package/ios/Pods/ViewControllers/PaymentDoneVC.swift +51 -13
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +18 -2
- package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +41 -2
- package/ios/easymerchantsdk.podspec +1 -1
- package/ios/easymerchantsdk.storyboard +248 -180
- package/package.json +2 -2
package/.idea/misc.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/em-MobileCheckoutSDK-ReactNative.iml" filepath="$PROJECT_DIR$/.idea/em-MobileCheckoutSDK-ReactNative.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
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.3.
|
|
10
|
+
"@jimrising/easymerchantsdk-react-native": "^1.3.9"
|
|
11
11
|
},
|
|
12
12
|
```
|
|
13
13
|
|
|
@@ -217,14 +217,14 @@ const App = () => {
|
|
|
217
217
|
false, // tokenOnly
|
|
218
218
|
false, // saveCard
|
|
219
219
|
false, // saveAccount
|
|
220
|
-
true, // authenticatedACH
|
|
221
|
-
authConfig,
|
|
220
|
+
true, // authenticatedACH if it is true only then pass authConfig params
|
|
221
|
+
authConfig,
|
|
222
222
|
"Submit",
|
|
223
|
-
true,
|
|
224
|
-
['weekly', 'monthly'],
|
|
225
|
-
'custom',
|
|
226
|
-
"05/30/2025",
|
|
227
|
-
true
|
|
223
|
+
true, // is_recurring == true ? must need to send below 4 params
|
|
224
|
+
['weekly', 'monthly'], // recurringIntervals
|
|
225
|
+
'custom', // recurringStartDateType
|
|
226
|
+
"05/30/2025", /// Format MM/dd/yyyy, must be today or future date
|
|
227
|
+
true // enable3DS :- must send it true for 3DS card payment.
|
|
228
228
|
);
|
|
229
229
|
|
|
230
230
|
console.log("Billing success:", result);
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
2
|
-
gradle.version=8.
|
|
1
|
+
#Wed May 28 13:58:36 IST 2025
|
|
2
|
+
gradle.version=8.9
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#import "EasyMerchantSdk.h"
|
|
2
2
|
#import <React/RCTLog.h>
|
|
3
3
|
#import <React/RCTBridgeModule.h>
|
|
4
|
-
|
|
4
|
+
#import <easymerchantsdk/easymerchantsdk-Swift.h>
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// #import <easymerchantsdk-Swift.h>
|
|
7
7
|
|
|
8
8
|
@interface EasyMerchantSdk()
|
|
9
9
|
@property (nonatomic, strong) EasyMerchantSdkPlugin *sdkPluginInstance;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
//
|
|
2
|
+
// EasyMerchantSdkPlugin.swift
|
|
3
|
+
// EasyMerchantSdk
|
|
4
|
+
//
|
|
5
|
+
|
|
1
6
|
import Foundation
|
|
2
7
|
import UIKit
|
|
3
8
|
import React
|
|
@@ -6,41 +11,42 @@ import React
|
|
|
6
11
|
public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
7
12
|
|
|
8
13
|
// MARK: - React Native Module Setup
|
|
9
|
-
public static func moduleName() -> String {
|
|
10
|
-
|
|
14
|
+
public static func moduleName() -> String! {
|
|
15
|
+
return "EasyMerchantSdk"
|
|
16
|
+
}
|
|
17
|
+
public static func requiresMainQueueSetup() -> Bool {
|
|
18
|
+
return true
|
|
19
|
+
}
|
|
11
20
|
|
|
12
21
|
public var bridge: RCTBridge?
|
|
13
22
|
|
|
14
|
-
// MARK: -
|
|
15
|
-
private var viewController: UIViewController?
|
|
16
|
-
private let viewControllerQueue = DispatchQueue(label: "com.easymerchantsdk.viewController")
|
|
17
|
-
|
|
23
|
+
// MARK: - Stored Promise Callbacks
|
|
18
24
|
private var billingResolver: RCTPromiseResolveBlock?
|
|
19
25
|
private var billingRejecter: RCTPromiseRejectBlock?
|
|
20
26
|
|
|
21
|
-
// MARK: -
|
|
27
|
+
// MARK: - View Controller Reference
|
|
28
|
+
private let viewControllerQueue = DispatchQueue(label: "com.easymerchantsdk.viewController")
|
|
29
|
+
private var viewController: UIViewController?
|
|
30
|
+
|
|
31
|
+
// MARK: - Init
|
|
22
32
|
@objc public override init() {
|
|
23
33
|
super.init()
|
|
24
34
|
}
|
|
25
35
|
|
|
26
|
-
// Called when the bridge finishes loading
|
|
27
36
|
public func bridgeDidFinishLoading() {
|
|
28
|
-
if
|
|
29
|
-
print("
|
|
30
|
-
} else {
|
|
31
|
-
print("Bridge initialization failed.")
|
|
37
|
+
if bridge != nil {
|
|
38
|
+
print("✅ EasyMerchantSdkPlugin bridge initialized")
|
|
32
39
|
}
|
|
33
40
|
}
|
|
34
41
|
|
|
35
|
-
//
|
|
36
|
-
@objc public func setViewController(_
|
|
42
|
+
// Expose setter for RN to inject the host view controller
|
|
43
|
+
@objc public func setViewController(_ vc: UIViewController) {
|
|
37
44
|
viewControllerQueue.sync {
|
|
38
|
-
self.viewController =
|
|
45
|
+
self.viewController = vc
|
|
39
46
|
}
|
|
40
|
-
print("ViewController set: \(String(describing: self.viewController))")
|
|
41
47
|
}
|
|
42
48
|
|
|
43
|
-
// MARK: -
|
|
49
|
+
// MARK: - billing(...) Exposed to RN
|
|
44
50
|
@objc public func billing(
|
|
45
51
|
_ amount: String,
|
|
46
52
|
billinginfo: String?,
|
|
@@ -60,183 +66,170 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
60
66
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
61
67
|
rejecter: @escaping RCTPromiseRejectBlock
|
|
62
68
|
) {
|
|
63
|
-
// Validate amount
|
|
69
|
+
// 1) Validate amount
|
|
64
70
|
guard let amountValue = Double(amount), amountValue > 0 else {
|
|
65
71
|
rejecter("INVALID_AMOUNT", "Amount must be a positive number", nil)
|
|
66
72
|
return
|
|
67
73
|
}
|
|
68
74
|
|
|
69
|
-
// Validate billinginfo JSON
|
|
70
|
-
if let
|
|
71
|
-
guard
|
|
72
|
-
|
|
75
|
+
// 2) Validate billinginfo JSON
|
|
76
|
+
if let info = billinginfo {
|
|
77
|
+
guard info.data(using: .utf8)
|
|
78
|
+
.flatMap({ try? JSONSerialization.jsonObject(with: $0) }) != nil
|
|
79
|
+
else {
|
|
73
80
|
rejecter("INVALID_BILLING_INFO", "Billing info must be valid JSON", nil)
|
|
74
81
|
return
|
|
75
82
|
}
|
|
76
83
|
}
|
|
77
84
|
|
|
78
|
-
// Map payment
|
|
85
|
+
// 3) Map payment methods
|
|
79
86
|
let methods: [PaymentMethod] = paymentMethods.compactMap {
|
|
80
87
|
switch $0.lowercased() {
|
|
81
|
-
case "card":
|
|
82
|
-
case "bank":
|
|
88
|
+
case "card": return .Card
|
|
89
|
+
case "bank": return .Bank
|
|
83
90
|
case "crypto": return .Crypto
|
|
84
|
-
default:
|
|
91
|
+
default: return nil
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
|
|
88
|
-
//
|
|
95
|
+
// 4) Prepare GrailPayRequest if needed
|
|
89
96
|
var grailParams: GrailPayRequest? = nil
|
|
90
97
|
if authenticatedACH, let params = grailPayParams {
|
|
91
98
|
grailParams = GrailPayRequest(
|
|
92
|
-
accessToken:
|
|
93
|
-
vendorId:
|
|
94
|
-
role:
|
|
95
|
-
timeout:
|
|
96
|
-
isSandbox:
|
|
97
|
-
brandingName:
|
|
98
|
-
finderSubtitle:
|
|
99
|
-
searchPlaceholder:
|
|
99
|
+
accessToken: params["accessToken"] as? String ?? "",
|
|
100
|
+
vendorId: params["vendorId"] as? String ?? "",
|
|
101
|
+
role: params["role"] as? String ?? "business",
|
|
102
|
+
timeout: params["timeout"] as? Int ?? 10,
|
|
103
|
+
isSandbox: params["isSandbox"] as? Bool ?? true,
|
|
104
|
+
brandingName: params["brandingName"] as? String ?? "Payments",
|
|
105
|
+
finderSubtitle: params["finderSubtitle"] as? String ?? "Find your bank",
|
|
106
|
+
searchPlaceholder: params["searchPlaceholder"] as? String ?? "Search"
|
|
100
107
|
)
|
|
101
108
|
}
|
|
102
109
|
|
|
103
|
-
//
|
|
110
|
+
// 5) Build theme config
|
|
104
111
|
let themeConfig = ThemeConfiguration(
|
|
105
|
-
bodyBackgroundColor:
|
|
106
|
-
containerBackgroundColor:
|
|
107
|
-
primaryFontColor:
|
|
108
|
-
secondaryFontColor:
|
|
109
|
-
primaryButtonBackgroundColor:
|
|
110
|
-
primaryButtonHoverColor:
|
|
111
|
-
primaryButtonFontColor:
|
|
112
|
-
secondaryButtonBackgroundColor:
|
|
113
|
-
secondaryButtonHoverColor:
|
|
114
|
-
secondaryButtonFontColor:
|
|
115
|
-
borderRadius:
|
|
116
|
-
fontSize:
|
|
112
|
+
bodyBackgroundColor: themeConfiguration["bodyBackgroundColor"] as? String ?? "#EBF8FF",
|
|
113
|
+
containerBackgroundColor: themeConfiguration["containerBackgroundColor"] as? String ?? "#FFFFFF",
|
|
114
|
+
primaryFontColor: themeConfiguration["primaryFontColor"] as? String ?? "#1E3A8A",
|
|
115
|
+
secondaryFontColor: themeConfiguration["secondaryFontColor"] as? String ?? "#696969",
|
|
116
|
+
primaryButtonBackgroundColor: themeConfiguration["primaryButtonBackgroundColor"] as? String ?? "#1D4ED8",
|
|
117
|
+
primaryButtonHoverColor: themeConfiguration["primaryButtonHoverColor"] as? String ?? "#2563EB",
|
|
118
|
+
primaryButtonFontColor: themeConfiguration["primaryButtonFontColor"] as? String ?? "#FFFFFF",
|
|
119
|
+
secondaryButtonBackgroundColor:themeConfiguration["secondaryButtonBackgroundColor"]as? String ?? "#FFFFFF",
|
|
120
|
+
secondaryButtonHoverColor: themeConfiguration["secondaryButtonHoverColor"] as? String ?? "#BFDBFE",
|
|
121
|
+
secondaryButtonFontColor: themeConfiguration["secondaryButtonFontColor"] as? String ?? "#1E40AF",
|
|
122
|
+
borderRadius: themeConfiguration["borderRadius"] as? String ?? "8",
|
|
123
|
+
fontSize: themeConfiguration["fontSize"] as? String ?? "14"
|
|
117
124
|
)
|
|
118
125
|
|
|
119
|
-
//
|
|
120
|
-
let
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
print("🔥 recurringIntervals raw from JS:", recurringIntervals as Any)
|
|
124
|
-
|
|
125
|
-
// Updated mapping to strip leading "." if present
|
|
126
|
-
let intervals = (recurringIntervals ?? []).compactMap { raw -> RecurringIntervals? in
|
|
127
|
-
// 1) Trim whitespace, lowercase
|
|
126
|
+
// 6) Map recurring intervals (strip leading dots)
|
|
127
|
+
let intervals: [RecurringIntervals] = (recurringIntervals ?? []).compactMap { raw in
|
|
128
128
|
let cleaned = raw.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
|
|
129
|
-
|
|
130
|
-
let noDot = cleaned.hasPrefix(".") ? String(cleaned.dropFirst()) : cleaned
|
|
131
|
-
// 3) Try to initialize your enum
|
|
129
|
+
let noDot = cleaned.hasPrefix(".") ? String(cleaned.dropFirst()) : cleaned
|
|
132
130
|
return RecurringIntervals(rawValue: noDot)
|
|
133
131
|
}
|
|
134
132
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
guard !intervals.isEmpty else {
|
|
133
|
+
if isRecurring && intervals.isEmpty {
|
|
138
134
|
rejecter("NO_RECURRING_INTERVALS", "No recurring intervals available.", nil)
|
|
139
135
|
return
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
}
|
|
142
137
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
138
|
+
// 7) Map start date type
|
|
139
|
+
let startType: RecurringStartDateType = {
|
|
140
|
+
switch recurringStartDateType?.lowercased() {
|
|
141
|
+
case "custom": return .custom
|
|
142
|
+
case "fixed": return .fixed
|
|
143
|
+
default: return .custom
|
|
144
|
+
}
|
|
145
|
+
}()
|
|
151
146
|
|
|
152
|
-
//
|
|
147
|
+
// 8) Build the request object
|
|
153
148
|
let request = Request(
|
|
154
|
-
amount:
|
|
155
|
-
billingInfoData:
|
|
156
|
-
paymentMethods:
|
|
157
|
-
themeConfiguration:
|
|
158
|
-
tokenOnly:
|
|
159
|
-
saveCard:
|
|
160
|
-
saveAccount:
|
|
161
|
-
submitButtonText:
|
|
162
|
-
authenticatedACH:
|
|
163
|
-
grailPayParams:
|
|
164
|
-
is_recurring:
|
|
165
|
-
recurringIntervals:
|
|
166
|
-
recurringStartDateType:
|
|
167
|
-
recurringStartDate:
|
|
168
|
-
enable3DS:
|
|
149
|
+
amount: amountValue,
|
|
150
|
+
billingInfoData: billinginfo?.data(using: .utf8) ?? Data(),
|
|
151
|
+
paymentMethods: methods,
|
|
152
|
+
themeConfiguration: themeConfig,
|
|
153
|
+
tokenOnly: tokenOnly,
|
|
154
|
+
saveCard: saveCard,
|
|
155
|
+
saveAccount: saveAccount,
|
|
156
|
+
submitButtonText: submitButtonText ?? "Submit",
|
|
157
|
+
authenticatedACH: authenticatedACH,
|
|
158
|
+
grailPayParams: grailParams,
|
|
159
|
+
is_recurring: isRecurring,
|
|
160
|
+
recurringIntervals: intervals,
|
|
161
|
+
recurringStartDateType: startType,
|
|
162
|
+
recurringStartDate: recurringStartDate,
|
|
163
|
+
enable3DS: enable3DS
|
|
169
164
|
)
|
|
170
165
|
|
|
171
|
-
// Store
|
|
166
|
+
// Store resolvers
|
|
172
167
|
self.billingResolver = resolver
|
|
173
|
-
self.billingRejecter
|
|
168
|
+
self.billingRejecter = rejecter
|
|
174
169
|
|
|
170
|
+
// Present your EasyPayViewController
|
|
175
171
|
DispatchQueue.main.async {
|
|
176
|
-
let
|
|
177
|
-
if let
|
|
178
|
-
|
|
179
|
-
} else if let
|
|
180
|
-
|
|
172
|
+
let vc = EasyPayViewController(request: request, delegate: self)
|
|
173
|
+
if let host = self.viewController {
|
|
174
|
+
host.present(vc, animated: true, completion: nil)
|
|
175
|
+
} else if let root = UIApplication.shared.windows.first(where: { $0.isKeyWindow })?.rootViewController {
|
|
176
|
+
root.present(vc, animated: true, completion: nil)
|
|
181
177
|
} else {
|
|
182
|
-
rejecter("NO_VIEW_CONTROLLER", "
|
|
178
|
+
rejecter("NO_VIEW_CONTROLLER", "Cannot find a view controller to present.", nil)
|
|
183
179
|
self.clearResolvers()
|
|
184
180
|
}
|
|
185
181
|
}
|
|
186
182
|
}
|
|
187
183
|
|
|
188
|
-
// MARK: - Environment
|
|
184
|
+
// MARK: - Environment Config & Platform
|
|
189
185
|
@objc public func configureEnvironment(_ env: String, apiKey: String, apiSecret: String) {
|
|
190
186
|
switch env.lowercased() {
|
|
191
|
-
case "production":
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
EnvironmentConfig.setEnvironment(.sandbox)
|
|
195
|
-
default:
|
|
196
|
-
EnvironmentConfig.setEnvironment(.staging)
|
|
187
|
+
case "production": EnvironmentConfig.setEnvironment(.production)
|
|
188
|
+
case "sandbox": EnvironmentConfig.setEnvironment(.sandbox)
|
|
189
|
+
default: EnvironmentConfig.setEnvironment(.staging)
|
|
197
190
|
}
|
|
198
191
|
EnvironmentConfig.configure(apiKey: apiKey, apiSecret: apiSecret)
|
|
199
192
|
}
|
|
200
193
|
|
|
201
|
-
// MARK: - Platform Version
|
|
202
194
|
@objc public func getPlatformVersion(
|
|
203
|
-
_ resolver:
|
|
204
|
-
rejecter:
|
|
195
|
+
_ resolver: RCTPromiseResolveBlock,
|
|
196
|
+
rejecter: RCTPromiseRejectBlock
|
|
205
197
|
) {
|
|
206
198
|
resolver("iOS \(UIDevice.current.systemVersion)")
|
|
207
199
|
}
|
|
208
200
|
|
|
209
|
-
// MARK: - Clear stored callbacks
|
|
210
201
|
private func clearResolvers() {
|
|
211
|
-
|
|
212
|
-
|
|
202
|
+
billingResolver = nil
|
|
203
|
+
billingRejecter = nil
|
|
213
204
|
}
|
|
214
205
|
}
|
|
215
206
|
|
|
216
|
-
// MARK: -
|
|
207
|
+
// MARK: - Delegate Implementation
|
|
217
208
|
extension EasyMerchantSdkPlugin: EasyPayViewControllerDelegate {
|
|
218
209
|
public func easyPayController(_ controller: EasyPayViewController, didFinishWith result: Result) {
|
|
219
210
|
DispatchQueue.main.async {
|
|
220
211
|
switch result.type {
|
|
221
212
|
case .cancelled:
|
|
222
213
|
self.billingResolver?(["status": "cancelled", "message": "User cancelled"])
|
|
214
|
+
|
|
223
215
|
case .success:
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
216
|
+
// Build a single payload for RN
|
|
217
|
+
var payload: [String: Any] = ["status": "success"]
|
|
218
|
+
if let cd = result.chargeData { payload["chargeData"] = cd }
|
|
219
|
+
if let bi = result.billingInfo { payload["billingInfo"] = bi }
|
|
220
|
+
if let ai = result.additionalInfo{ payload["additionalInfo"] = ai }
|
|
221
|
+
|
|
222
|
+
// Resolve promise
|
|
223
|
+
self.billingResolver?(payload)
|
|
224
|
+
|
|
230
225
|
case .error:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
} else {
|
|
234
|
-
self.billingRejecter?("PAYMENT_ERROR", "Unknown error", nil)
|
|
235
|
-
}
|
|
226
|
+
let errMsg = (result.chargeData?["errorMessage"] as? String) ?? "Unknown error"
|
|
227
|
+
self.billingRejecter?("PAYMENT_ERROR", errMsg, nil)
|
|
236
228
|
}
|
|
229
|
+
|
|
230
|
+
// Cleanup & dismiss
|
|
237
231
|
self.clearResolvers()
|
|
238
|
-
controller.dismiss(animated: true)
|
|
232
|
+
controller.dismiss(animated: true, completion: nil)
|
|
239
233
|
}
|
|
240
234
|
}
|
|
241
235
|
}
|
|
242
|
-
|
package/ios/Models/Result.swift
CHANGED
|
@@ -1,39 +1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Result.swift
|
|
3
|
-
// EasyPay
|
|
4
|
-
//
|
|
5
|
-
// Created by iftekhar on 14/07/24.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
//import UIKit
|
|
9
|
-
//
|
|
10
|
-
//@objc
|
|
11
|
-
//public enum ResultType: Int {
|
|
12
|
-
// case cancelled
|
|
13
|
-
// case success
|
|
14
|
-
// case error
|
|
15
|
-
//}
|
|
16
|
-
//
|
|
17
|
-
//@objc
|
|
18
|
-
//public final class Result: NSObject {
|
|
19
|
-
//
|
|
20
|
-
// @objc public let type: ResultType
|
|
21
|
-
//
|
|
22
|
-
// @objc public let error: NSError?
|
|
23
|
-
//
|
|
24
|
-
// internal init(error: NSError) {
|
|
25
|
-
// type = .error
|
|
26
|
-
// self.error = error
|
|
27
|
-
// super.init()
|
|
28
|
-
// }
|
|
29
|
-
//
|
|
30
|
-
// internal init(type: ResultType) {
|
|
31
|
-
// self.type = type
|
|
32
|
-
// self.error = nil
|
|
33
|
-
// super.init()
|
|
34
|
-
// }
|
|
35
|
-
//}
|
|
36
|
-
|
|
37
1
|
import UIKit
|
|
38
2
|
|
|
39
3
|
@objc
|
|
@@ -50,20 +14,29 @@ public final class Result: NSObject {
|
|
|
50
14
|
@objc public let error: NSError?
|
|
51
15
|
@objc public let chargeData: [String: Any]?
|
|
52
16
|
|
|
17
|
+
@objc public let billingInfo: [String: Any]?
|
|
18
|
+
@objc public let additionalInfo: [String: Any]?
|
|
19
|
+
|
|
53
20
|
// Initializer for error type result
|
|
54
21
|
internal init(error: NSError) {
|
|
55
22
|
self.type = .error
|
|
56
23
|
self.error = error
|
|
57
24
|
self.chargeData = nil
|
|
25
|
+
self.billingInfo = nil
|
|
26
|
+
self.additionalInfo = nil
|
|
58
27
|
super.init()
|
|
59
28
|
}
|
|
60
29
|
|
|
61
|
-
// Initializer for
|
|
62
|
-
internal init(type: ResultType,
|
|
30
|
+
// Initializer for success/cancelled result types
|
|
31
|
+
internal init(type: ResultType,
|
|
32
|
+
chargeData: [String: Any]? = nil,
|
|
33
|
+
billingInfo: [String: Any]? = nil,
|
|
34
|
+
additionalInfo: [String: Any]? = nil) {
|
|
63
35
|
self.type = type
|
|
64
36
|
self.error = nil
|
|
65
37
|
self.chargeData = chargeData
|
|
38
|
+
self.billingInfo = billingInfo
|
|
39
|
+
self.additionalInfo = additionalInfo
|
|
66
40
|
super.init()
|
|
67
41
|
}
|
|
68
|
-
}
|
|
69
|
-
|
|
42
|
+
}
|
|
@@ -465,6 +465,9 @@ class AdditionalInfoVC: BaseVC {
|
|
|
465
465
|
paymentDoneVC.chargeData = responseObject
|
|
466
466
|
paymentDoneVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
467
467
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate
|
|
468
|
+
// Pass billing and additional info
|
|
469
|
+
paymentDoneVC.billingInfo = billingInfo
|
|
470
|
+
paymentDoneVC.additionalInfo = additionalInfo
|
|
468
471
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
469
472
|
}
|
|
470
473
|
}
|
|
@@ -624,6 +627,9 @@ class AdditionalInfoVC: BaseVC {
|
|
|
624
627
|
paymentDoneVC.chargeData = responseObject
|
|
625
628
|
paymentDoneVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
626
629
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate
|
|
630
|
+
// Pass billing and additional info
|
|
631
|
+
paymentDoneVC.billingInfo = billingInfo
|
|
632
|
+
paymentDoneVC.additionalInfo = additionalInfo
|
|
627
633
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
628
634
|
}
|
|
629
635
|
}
|
|
@@ -792,6 +798,9 @@ class AdditionalInfoVC: BaseVC {
|
|
|
792
798
|
paymentDoneVC.chargeData = responseObject
|
|
793
799
|
paymentDoneVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
794
800
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate
|
|
801
|
+
// Pass billing and additional info
|
|
802
|
+
paymentDoneVC.billingInfo = billingInfo
|
|
803
|
+
paymentDoneVC.additionalInfo = additionalInfo
|
|
795
804
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
796
805
|
}
|
|
797
806
|
}
|
|
@@ -954,6 +963,9 @@ class AdditionalInfoVC: BaseVC {
|
|
|
954
963
|
// Pass the selected payment method
|
|
955
964
|
paymentDoneVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
956
965
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate // Pass the delegate
|
|
966
|
+
// Pass billing and additional info
|
|
967
|
+
paymentDoneVC.billingInfo = billingInfo
|
|
968
|
+
paymentDoneVC.additionalInfo = additionalInfo
|
|
957
969
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
958
970
|
}
|
|
959
971
|
}
|
|
@@ -1113,6 +1125,9 @@ class AdditionalInfoVC: BaseVC {
|
|
|
1113
1125
|
// Pass the selected payment method
|
|
1114
1126
|
paymentDoneVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
1115
1127
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate // Pass the delegate
|
|
1128
|
+
// Pass billing and additional info
|
|
1129
|
+
paymentDoneVC.billingInfo = billingInfo
|
|
1130
|
+
paymentDoneVC.additionalInfo = additionalInfo
|
|
1116
1131
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
1117
1132
|
}
|
|
1118
1133
|
}
|
|
@@ -1276,6 +1291,9 @@ class AdditionalInfoVC: BaseVC {
|
|
|
1276
1291
|
paymentDoneVC.chargeData = responseObject
|
|
1277
1292
|
paymentDoneVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
1278
1293
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate
|
|
1294
|
+
// Pass billing and additional info
|
|
1295
|
+
paymentDoneVC.billingInfo = billingInfo
|
|
1296
|
+
paymentDoneVC.additionalInfo = additionalInfo
|
|
1279
1297
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
1280
1298
|
}
|
|
1281
1299
|
}
|
|
@@ -1441,7 +1459,9 @@ class AdditionalInfoVC: BaseVC {
|
|
|
1441
1459
|
paymentDoneVC.redirectURL = urlString
|
|
1442
1460
|
paymentDoneVC.chargeData = responseObject
|
|
1443
1461
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate
|
|
1444
|
-
|
|
1462
|
+
// Pass billing and additional info
|
|
1463
|
+
paymentDoneVC.billingInfo = billingInfo
|
|
1464
|
+
paymentDoneVC.additionalInfo = additionalInfo
|
|
1445
1465
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
1446
1466
|
}
|
|
1447
1467
|
}
|
|
@@ -1612,7 +1632,9 @@ class AdditionalInfoVC: BaseVC {
|
|
|
1612
1632
|
paymentDoneVC.redirectURL = urlString
|
|
1613
1633
|
paymentDoneVC.chargeData = responseObject
|
|
1614
1634
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate
|
|
1615
|
-
|
|
1635
|
+
// Pass billing and additional info
|
|
1636
|
+
paymentDoneVC.billingInfo = billingInfo
|
|
1637
|
+
paymentDoneVC.additionalInfo = additionalInfo
|
|
1616
1638
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
1617
1639
|
}
|
|
1618
1640
|
}
|