@jimrising/easymerchantsdk-react-native 2.3.3 → 2.3.5
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/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
- package/android/build/.transforms/e9a664a11ce12edf79cd87b1e07aa243/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +1 -1
- package/ios/ApiManager/APIRequest.swift +1 -4
- package/ios/Bundle/EasyPayBundle.swift +1 -1
- package/ios/Classes/EasyMerchantSdk.m +2 -2
- package/ios/Classes/EasyMerchantSdk.swift +3 -3
- package/ios/CustomComponents/PlanSelector.swift +1 -1
- package/ios/Example/Base.lproj/Main.storyboard +183 -22
- package/ios/Example/ViewController.swift +208 -182
- package/ios/Helper/GrailPayHelper.swift +0 -1
- package/ios/Models/Request.swift +242 -51
- package/ios/Models/SDKResult.swift +32 -25
- package/ios/Pods/UserDefaults/UserStoreSingleton.swift +59 -60
- package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +360 -150
- package/ios/Pods/ViewControllers/BaseVC.swift +2 -1
- package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +401 -196
- package/ios/Pods/ViewControllers/Clean Runner_2025-07-23T14-58-05.txt +13 -0
- package/ios/Pods/ViewControllers/EmailVerificationVC.swift +0 -7
- package/ios/Pods/ViewControllers/GrailPayVC.swift +11 -3
- package/ios/Pods/ViewControllers/OTPVerificationVC.swift +252 -105
- package/ios/Pods/ViewControllers/PaymentDoneVC.swift +20 -5
- package/ios/Pods/ViewControllers/PaymentErrorVC.swift +2 -2
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +804 -347
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +0 -1
- package/ios/Pods/ViewControllers/PaymentStatusWebViewVC.swift +1 -1
- package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +68 -66
- package/ios/Resources/Assets.xcassets/payment_done_icon.imageset/Contents.json +3 -0
- package/ios/easymerchantsdk.podspec +1 -1
- package/package.json +1 -1
- package/ios/CustomComponents/CheckboxButton.swift +0 -66
- package/ios/Models/AdditionalInfo.swift +0 -53
- package/ios/Models/BillingInfo.swift +0 -60
- package/ios/Pods/ViewControllers/CustomOverlay.swift +0 -199
- package/ios/Resources/Assets.xcassets/Card/Amex.imageset/206682_american_express_method_card_payment_icon.svg +0 -1
- package/ios/Resources/Assets.xcassets/Card/Amex.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/Contents.json +0 -6
- package/ios/Resources/Assets.xcassets/Card/DinersClub.imageset/472318_card_club_diners_dinner_payment_icon.svg +0 -1
- package/ios/Resources/Assets.xcassets/Card/DinersClub.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/Discover.imageset/206686_network_payment_discover_card_method_icon.svg +0 -1
- package/ios/Resources/Assets.xcassets/Card/Discover.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/JCB.imageset/358102_card_jcb_payment_icon.svg +0 -1
- package/ios/Resources/Assets.xcassets/Card/JCB.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/MasterCard.imageset/206680_master_method_card_payment_icon.svg +0 -1
- package/ios/Resources/Assets.xcassets/Card/MasterCard.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/UnionPay.imageset/1468976_card_payment_unionpay_icon.svg +0 -1
- package/ios/Resources/Assets.xcassets/Card/UnionPay.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/Visa.imageset/206684_visa_method_card_payment_icon.svg +0 -1
- package/ios/Resources/Assets.xcassets/Card/Visa.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/maestro.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/maestro.imageset/maestro.svg +0 -1
- package/ios/Resources/Assets.xcassets/Card/paypal.imageset/206675_paypal_method_payment_icon.svg +0 -1
- package/ios/Resources/Assets.xcassets/Card/paypal.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/rupay.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/rupay.imageset/rupay.svg +0 -1
- package/ios/Resources/Assets.xcassets/Card/unknown_card.imageset/4635000_card_credit_digital_money_icon.svg +0 -1
- package/ios/Resources/Assets.xcassets/Card/unknown_card.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/worldpay.imageset/Contents.json +0 -12
- package/ios/Resources/Assets.xcassets/Card/worldpay.imageset/worldpay.svg +0 -1
|
@@ -9,45 +9,46 @@
|
|
|
9
9
|
//import EasyPay
|
|
10
10
|
//
|
|
11
11
|
//class ViewController: UIViewController {
|
|
12
|
-
//
|
|
12
|
+
//
|
|
13
13
|
// @IBOutlet weak var lblResponseShow: UILabel!
|
|
14
14
|
// @IBOutlet private var payButton: UIButton!
|
|
15
|
-
//
|
|
15
|
+
//
|
|
16
|
+
// @IBOutlet weak var txtFieldAmountApiKeyCase: UITextField!
|
|
16
17
|
// @IBOutlet weak var txtFieldClientToken: UITextField!
|
|
17
|
-
//
|
|
18
|
+
//
|
|
18
19
|
// private var referenceToken: String?
|
|
19
|
-
//
|
|
20
|
+
//
|
|
20
21
|
// override func viewDidLoad() {
|
|
21
22
|
// super.viewDidLoad()
|
|
22
|
-
//
|
|
23
|
+
//
|
|
23
24
|
// NotificationCenter.default.addObserver(self, selector: #selector(handleEasyPayResult(_:)), name: NSNotification.Name("EasyPayResult"), object: nil)
|
|
24
|
-
//
|
|
25
|
+
//
|
|
25
26
|
// // Add tap gesture to dismiss keyboard
|
|
26
27
|
// let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
|
|
27
28
|
// tapGesture.cancelsTouchesInView = false
|
|
28
29
|
// view.addGestureRecognizer(tapGesture)
|
|
29
30
|
// }
|
|
30
|
-
//
|
|
31
|
+
//
|
|
31
32
|
// // Method to dismiss keyboard
|
|
32
33
|
// @objc private func dismissKeyboard() {
|
|
33
34
|
// view.endEditing(true)
|
|
34
35
|
// }
|
|
35
|
-
//
|
|
36
|
+
//
|
|
36
37
|
// //MARK: - Open With Payment Intent Api inside SDK.
|
|
37
38
|
// @IBAction private func actionBtnEnvConfigWithApiKeys() {
|
|
38
39
|
// // Select environment
|
|
39
40
|
//// EasyPay.EnvironmentConfig.setEnvironment(.sandbox)
|
|
40
|
-
//
|
|
41
|
+
//
|
|
41
42
|
// /// Staging Keys
|
|
42
43
|
//// let apiKey = "13bcb1f54b894ddbbd75a86d5"
|
|
43
44
|
//// let apiSecret = "94f7ebd5384f6985f23920c13"
|
|
44
|
-
//
|
|
45
|
+
//
|
|
45
46
|
// /// Sandboxing Keys
|
|
46
47
|
// let apiKey = "75e47d32521175e04b4b65234"
|
|
47
48
|
// let apiSecret = "556f980d99f15599adaad1b56"
|
|
48
|
-
//
|
|
49
|
+
//
|
|
49
50
|
// EasyPay.EnvironmentConfig.configure(apiKey: apiKey, apiSecret: apiSecret)
|
|
50
|
-
//
|
|
51
|
+
//
|
|
51
52
|
// ///Dark Theme
|
|
52
53
|
// let themeConfiguration = ThemeConfiguration(
|
|
53
54
|
// bodyBackgroundColor: "#121212",
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
// fontWeight: 500,
|
|
66
67
|
// fontFamily: "\"Inter\", sans-serif"
|
|
67
68
|
// )
|
|
68
|
-
//
|
|
69
|
+
//
|
|
69
70
|
// let fields = FieldSection(
|
|
70
71
|
// visibility: FieldsVisibility(billing: false, additional: false),
|
|
71
72
|
// billing: [
|
|
@@ -82,14 +83,14 @@
|
|
|
82
83
|
// FieldItem(name: .description, required: false, value: "Test")
|
|
83
84
|
// ]
|
|
84
85
|
// )
|
|
85
|
-
//
|
|
86
|
+
//
|
|
86
87
|
// guard let billingData = try? JSONEncoder().encode(fields) else {
|
|
87
88
|
// print("Failed to encode fields")
|
|
88
89
|
// return
|
|
89
90
|
// }
|
|
90
|
-
//
|
|
91
|
+
//
|
|
91
92
|
// let authenticatedACH = false /// For GrailPay
|
|
92
|
-
//
|
|
93
|
+
//
|
|
93
94
|
// let grailPayParams = GrailPayRequest(
|
|
94
95
|
// // accessToken: "251|uTijpDGfrS88UR2V1cZNMQ8S4hUJA0sVzsnsoUZF",
|
|
95
96
|
// // vendorId: "251",
|
|
@@ -100,15 +101,15 @@
|
|
|
100
101
|
// finderSubtitle: "Search for your bank",
|
|
101
102
|
// searchPlaceholder: "Enter bank name"
|
|
102
103
|
// ) /// if authenticatedACH is true
|
|
103
|
-
//
|
|
104
|
+
//
|
|
104
105
|
// let metadata: [String: Any] = [
|
|
105
106
|
// "name": "King",
|
|
106
107
|
// "age": 32,
|
|
107
108
|
// "city": "Manhattan"
|
|
108
109
|
// ]
|
|
109
|
-
//
|
|
110
|
+
//
|
|
110
111
|
// let request = EasyPay.Request(
|
|
111
|
-
// amount:
|
|
112
|
+
// amount: Double(txtFieldAmountApiKeyCase.text ?? "") ?? 0.0,
|
|
112
113
|
// currency: "usd",
|
|
113
114
|
// fields: billingData, /// billingData or nil
|
|
114
115
|
// paymentMethods: [.Card, .Bank],
|
|
@@ -119,15 +120,15 @@
|
|
|
119
120
|
// submitButtonText: "Submit",
|
|
120
121
|
// authenticatedACH: authenticatedACH, /// if authenticatedACH is true
|
|
121
122
|
// grailPayParams: authenticatedACH ? grailPayParams : nil, /// if authenticatedACH is true || false
|
|
122
|
-
//
|
|
123
|
+
//
|
|
123
124
|
// //MARK: Recurring params.
|
|
124
|
-
// is_recurring:
|
|
125
|
+
// is_recurring: false, /// true || false
|
|
125
126
|
// numOfCycle: 2, /// required if is_recurring: true
|
|
126
|
-
// recurringIntervals: [.daily, .weekly], /// required if is_recurring: true
|
|
127
|
+
// recurringIntervals: [.daily, .weekly, .monthly], /// required if is_recurring: true
|
|
127
128
|
// recurringStartDateType: .fixed, /// custom or fixed /// required if is_recurring: true
|
|
128
|
-
// recurringStartDate: "
|
|
129
|
-
//
|
|
130
|
-
// secureAuthentication:
|
|
129
|
+
// recurringStartDate: "04/09/2025", /// Format dd/MM/yyyy, must be today or future date /// required if is_recurring: true
|
|
130
|
+
//
|
|
131
|
+
// secureAuthentication: true, /// For 3DSecure
|
|
131
132
|
// showReceipt: true, /// true || false
|
|
132
133
|
// showTotal: true, /// true || false
|
|
133
134
|
// showSubmitButton: true, /// true || false
|
|
@@ -139,13 +140,13 @@
|
|
|
139
140
|
// apiKey: apiKey, // Pass API key
|
|
140
141
|
// apiSecret: apiSecret // Pass API secret
|
|
141
142
|
// )
|
|
142
|
-
//
|
|
143
|
+
//
|
|
143
144
|
// if request.tokenOnly == true {
|
|
144
145
|
// NotificationCenter.default.addObserver(forName: NSNotification.Name("ClientTokenReceived"), object: nil, queue: .main) { notification in
|
|
145
146
|
// if let clientToken = notification.object as? String {
|
|
146
147
|
// self.lblResponseShow.isHidden = false
|
|
147
148
|
// self.lblResponseShow.text = "Client Token: \(clientToken)"
|
|
148
|
-
//
|
|
149
|
+
//
|
|
149
150
|
// self.txtFieldClientToken.text = clientToken
|
|
150
151
|
// }
|
|
151
152
|
// }
|
|
@@ -154,7 +155,7 @@
|
|
|
154
155
|
// self.present(controller, animated: true)
|
|
155
156
|
// }
|
|
156
157
|
// }
|
|
157
|
-
//
|
|
158
|
+
//
|
|
158
159
|
// //MARK: - Open With Direct Client Token and Payment Intent. Payment Intent Api Outside SDK
|
|
159
160
|
// @IBAction func actionBtnEnvConfigWithClientToken(_ sender: UIButton) {
|
|
160
161
|
// ///Dark Theme
|
|
@@ -174,7 +175,7 @@
|
|
|
174
175
|
// fontWeight: 500,
|
|
175
176
|
// fontFamily: "\"Inter\", sans-serif"
|
|
176
177
|
// )
|
|
177
|
-
//
|
|
178
|
+
//
|
|
178
179
|
// let fields = FieldSection(
|
|
179
180
|
// visibility: FieldsVisibility(billing: false, additional: false),
|
|
180
181
|
// billing: [
|
|
@@ -189,14 +190,14 @@
|
|
|
189
190
|
// FieldItem(name: .description, required: false, value: "Test")
|
|
190
191
|
// ]
|
|
191
192
|
// )
|
|
192
|
-
//
|
|
193
|
+
//
|
|
193
194
|
// guard let billingData = try? JSONEncoder().encode(fields) else {
|
|
194
195
|
// print("Failed to encode fields")
|
|
195
196
|
// return
|
|
196
197
|
// }
|
|
197
|
-
//
|
|
198
|
-
// let authenticatedACH =
|
|
199
|
-
//
|
|
198
|
+
//
|
|
199
|
+
// let authenticatedACH = true /// For GrailPay
|
|
200
|
+
//
|
|
200
201
|
// let grailPayParams = GrailPayRequest(
|
|
201
202
|
// role: "business",
|
|
202
203
|
// timeout: 10,
|
|
@@ -204,13 +205,13 @@
|
|
|
204
205
|
// finderSubtitle: "Search for your bank",
|
|
205
206
|
// searchPlaceholder: "Enter bank name"
|
|
206
207
|
// ) /// if authenticatedACH is true
|
|
207
|
-
//
|
|
208
|
+
//
|
|
208
209
|
// let metadata: [String: Any] = [
|
|
209
210
|
// "name": "King",
|
|
210
211
|
// "age": 32,
|
|
211
212
|
// "city": "Manhattan"
|
|
212
213
|
// ]
|
|
213
|
-
//
|
|
214
|
+
//
|
|
214
215
|
// let request = EasyPay.Request(
|
|
215
216
|
// currency: "usd",
|
|
216
217
|
// fields: billingData, /// billingData or nil
|
|
@@ -221,7 +222,7 @@
|
|
|
221
222
|
// submitButtonText: "Submit",
|
|
222
223
|
// authenticatedACH: authenticatedACH, /// if authenticatedACH is true
|
|
223
224
|
// grailPayParams: authenticatedACH ? grailPayParams : nil, /// if authenticatedACH is true || false
|
|
224
|
-
//
|
|
225
|
+
//
|
|
225
226
|
// secureAuthentication: true, /// For 3DSecure
|
|
226
227
|
// showReceipt: true, /// true || false
|
|
227
228
|
// showTotal: true, /// true || false
|
|
@@ -233,14 +234,183 @@
|
|
|
233
234
|
// metadata: metadata,
|
|
234
235
|
// environment: .sandbox
|
|
235
236
|
// )
|
|
236
|
-
//
|
|
237
|
+
//
|
|
238
|
+
// if request.initializationErrorMessage == nil {
|
|
239
|
+
// let controller = EasyPayViewController(request: request, delegate: self)
|
|
240
|
+
// self.present(controller, animated: true)
|
|
241
|
+
// }
|
|
242
|
+
// }
|
|
243
|
+
//
|
|
244
|
+
// @objc private func handleEasyPayResult(_ notification: Notification) {
|
|
245
|
+
// guard let result = notification.object as? SDKResult else { return }
|
|
246
|
+
// switch result.type {
|
|
247
|
+
// case .error:
|
|
248
|
+
// if let chargeData = result.chargeData,
|
|
249
|
+
// let data = try? JSONSerialization.data(withJSONObject: chargeData, options: .prettyPrinted),
|
|
250
|
+
// let json = String(data: data, encoding: .utf8) {
|
|
251
|
+
// self.lblResponseShow.isHidden = false
|
|
252
|
+
// self.lblResponseShow.text = json
|
|
253
|
+
// } else if let error = result.error {
|
|
254
|
+
// self.lblResponseShow.isHidden = false
|
|
255
|
+
// self.lblResponseShow.text = "{\n \"status\": false,\n \"message\": \"\(error.localizedDescription)\"\n}"
|
|
256
|
+
// }
|
|
257
|
+
// default:
|
|
258
|
+
// break
|
|
259
|
+
// }
|
|
260
|
+
// }
|
|
261
|
+
//
|
|
262
|
+
// @IBAction func actionBtnPaymentRefference(_ sender: UIButton) {
|
|
263
|
+
// guard let token = referenceToken else {
|
|
264
|
+
// lblResponseShow.isHidden = false
|
|
265
|
+
// lblResponseShow.text = "Reference token not available yet."
|
|
266
|
+
// return
|
|
267
|
+
// }
|
|
268
|
+
//
|
|
269
|
+
// // Build request using saved ref_token
|
|
270
|
+
// let request = EasyPay.Request(
|
|
271
|
+
// referenceID: true,
|
|
272
|
+
// referenceToken: token,
|
|
273
|
+
// environment: .sandbox
|
|
274
|
+
// )
|
|
275
|
+
//
|
|
237
276
|
// if request.initializationErrorMessage == nil {
|
|
238
277
|
// let controller = EasyPayViewController(request: request, delegate: self)
|
|
239
278
|
// self.present(controller, animated: true)
|
|
279
|
+
// } else {
|
|
280
|
+
// lblResponseShow.isHidden = false
|
|
281
|
+
// lblResponseShow.text = "Failed to initialize with reference token: \(request.initializationErrorMessage ?? "Unknown error")"
|
|
282
|
+
// }
|
|
283
|
+
// }
|
|
284
|
+
//
|
|
285
|
+
// private func showAlert(message: String) {
|
|
286
|
+
// let alert = UIAlertController(title: "Validation Error", message: message, preferredStyle: .alert)
|
|
287
|
+
// alert.addAction(UIAlertAction(title: "OK", style: .default))
|
|
288
|
+
// self.present(alert, animated: true)
|
|
289
|
+
// }
|
|
290
|
+
//
|
|
291
|
+
//}
|
|
292
|
+
//
|
|
293
|
+
//extension ViewController: EasyPayViewControllerDelegate {
|
|
294
|
+
//
|
|
295
|
+
// func easyPayController(_ controller: EasyPayViewController, didFinishWith result: EasyPay.SDKResult) {
|
|
296
|
+
// switch result.type {
|
|
297
|
+
// case .cancelled:
|
|
298
|
+
// lblResponseShow.isHidden = false
|
|
299
|
+
//
|
|
300
|
+
// if let chargeData = result.chargeData {
|
|
301
|
+
// let status = (chargeData["status"] as? Bool) ?? false
|
|
302
|
+
// let message = (chargeData["message"] as? String) ?? "No message"
|
|
303
|
+
//
|
|
304
|
+
// // Combine into one string for the label
|
|
305
|
+
// lblResponseShow.text = "Status: \(status), Message: \(message)"
|
|
306
|
+
//
|
|
307
|
+
// print("Cancel Data:", chargeData) // Debug print
|
|
308
|
+
// }
|
|
309
|
+
//
|
|
310
|
+
// case .success:
|
|
311
|
+
// lblResponseShow.isHidden = false
|
|
312
|
+
// var fullResponse: [String: Any] = [:]
|
|
313
|
+
//
|
|
314
|
+
// if let chargeData = result.chargeData {
|
|
315
|
+
// // Flatten chargeData
|
|
316
|
+
// for (key, value) in chargeData {
|
|
317
|
+
// fullResponse[key] = value
|
|
318
|
+
// }
|
|
319
|
+
// }
|
|
320
|
+
//
|
|
321
|
+
// if let billing = result.billingInfo {
|
|
322
|
+
// fullResponse["billingInfo"] = billing
|
|
323
|
+
// }
|
|
324
|
+
//
|
|
325
|
+
// if let additional = result.additionalInfo {
|
|
326
|
+
// fullResponse["additionalInfo"] = additional
|
|
327
|
+
//
|
|
328
|
+
// // Extract and save ref_token
|
|
329
|
+
// if let threeDSecureStatus = additional["threeDSecureStatus"] as? [String: Any],
|
|
330
|
+
// let data = threeDSecureStatus["data"] as? [String: Any],
|
|
331
|
+
// let token = data["ref_token"] as? String {
|
|
332
|
+
// self.referenceToken = token
|
|
333
|
+
// }
|
|
334
|
+
// }
|
|
335
|
+
//
|
|
336
|
+
// do {
|
|
337
|
+
// let jsonData = try JSONSerialization.data(withJSONObject: fullResponse, options: .prettyPrinted)
|
|
338
|
+
// if let jsonString = String(data: jsonData, encoding: .utf8) {
|
|
339
|
+
// print(jsonString)
|
|
340
|
+
// lblResponseShow.text = jsonString
|
|
341
|
+
// }
|
|
342
|
+
// } catch {
|
|
343
|
+
// lblResponseShow.text = "Failed to format response: \(error.localizedDescription)"
|
|
344
|
+
// }
|
|
345
|
+
//
|
|
346
|
+
// case .error:
|
|
347
|
+
// if let chargeData = result.chargeData {
|
|
348
|
+
// let status = (chargeData["status"] as? Bool) ?? false
|
|
349
|
+
// let message = (chargeData["message"] as? String) ?? "Unknown error"
|
|
350
|
+
//
|
|
351
|
+
// lblResponseShow.isHidden = false
|
|
352
|
+
// lblResponseShow.text = "Status: \(status), Message: \(message)"
|
|
353
|
+
//
|
|
354
|
+
// print("Error Data:", chargeData) // Debugging
|
|
355
|
+
// } else {
|
|
356
|
+
// lblResponseShow.isHidden = false
|
|
357
|
+
// lblResponseShow.text = "An unknown error occurred."
|
|
358
|
+
// }
|
|
240
359
|
// }
|
|
241
360
|
// }
|
|
361
|
+
//
|
|
362
|
+
// private func handleSuccess(with chargeData: [String: Any]) {
|
|
363
|
+
// lblResponseShow.isHidden = false
|
|
364
|
+
// lblResponseShow.text = "Received Charge Data: \(chargeData)"
|
|
365
|
+
// }
|
|
366
|
+
//
|
|
367
|
+
//}
|
|
368
|
+
//
|
|
369
|
+
//
|
|
370
|
+
//
|
|
371
|
+
//
|
|
372
|
+
//
|
|
373
|
+
//
|
|
374
|
+
//
|
|
375
|
+
//
|
|
376
|
+
//
|
|
377
|
+
//
|
|
378
|
+
//
|
|
379
|
+
//
|
|
380
|
+
//
|
|
381
|
+
//
|
|
382
|
+
//
|
|
383
|
+
//
|
|
384
|
+
//
|
|
385
|
+
//
|
|
386
|
+
//// /// Light Theme
|
|
387
|
+
//// let themeConfiguration = ThemeConfiguration(
|
|
388
|
+
//// bodyBackgroundColor: "#E5E7EB", // Light grey background
|
|
389
|
+
//// containerBackgroundColor: "#F9FAFB", // Light gray container
|
|
390
|
+
//// primaryFontColor: "#111827", // Dark gray/black text
|
|
391
|
+
//// secondaryFontColor: "#6B7280", // Medium gray text
|
|
392
|
+
//// primaryButtonBackgroundColor: "#2563EB", // Blue
|
|
393
|
+
//// primaryButtonHoverColor: "#1D4ED8", // Darker blue on hover
|
|
394
|
+
//// primaryButtonFontColor: "#FFFFFF", // White text on blue button
|
|
395
|
+
//// secondaryButtonBackgroundColor: "#E5E7EB", // Light gray button
|
|
396
|
+
//// secondaryButtonHoverColor: "#D1D5DB", // Slightly darker gray on hover
|
|
397
|
+
//// secondaryButtonFontColor: "#111827", // Dark text on light button
|
|
398
|
+
//// borderRadius: "8",
|
|
399
|
+
//// fontSize: "14",
|
|
400
|
+
//// fontWeight: 500,
|
|
401
|
+
//// fontFamily: "\"Inter\", sans-serif"
|
|
402
|
+
//// )
|
|
403
|
+
//
|
|
242
404
|
//
|
|
243
|
-
//
|
|
405
|
+
//
|
|
406
|
+
//
|
|
407
|
+
//
|
|
408
|
+
//
|
|
409
|
+
//
|
|
410
|
+
//
|
|
411
|
+
//
|
|
412
|
+
//
|
|
413
|
+
//// MARK: - Open With Direct Client Token and Payment Intent. Payment Intent Api Outside SDK
|
|
244
414
|
//// @IBAction func actionBtnEnvConfigWithClientToken(_ sender: UIButton) {
|
|
245
415
|
//// /// Dark Theme
|
|
246
416
|
//// let themeConfiguration = ThemeConfiguration(
|
|
@@ -447,147 +617,3 @@
|
|
|
447
617
|
//// self.present(controller, animated: true)
|
|
448
618
|
//// }
|
|
449
619
|
//// }
|
|
450
|
-
//
|
|
451
|
-
// @objc private func handleEasyPayResult(_ notification: Notification) {
|
|
452
|
-
// guard let result = notification.object as? SDKResult else { return }
|
|
453
|
-
// switch result.type {
|
|
454
|
-
// case .error:
|
|
455
|
-
// if let chargeData = result.chargeData,
|
|
456
|
-
// let data = try? JSONSerialization.data(withJSONObject: chargeData, options: .prettyPrinted),
|
|
457
|
-
// let json = String(data: data, encoding: .utf8) {
|
|
458
|
-
// self.lblResponseShow.isHidden = false
|
|
459
|
-
// self.lblResponseShow.text = json
|
|
460
|
-
// } else if let error = result.error {
|
|
461
|
-
// self.lblResponseShow.isHidden = false
|
|
462
|
-
// self.lblResponseShow.text = "{\n \"status\": false,\n \"message\": \"\(error.localizedDescription)\"\n}"
|
|
463
|
-
// }
|
|
464
|
-
// default:
|
|
465
|
-
// break
|
|
466
|
-
// }
|
|
467
|
-
// }
|
|
468
|
-
//
|
|
469
|
-
// @IBAction func actionBtnPaymentRefference(_ sender: UIButton) {
|
|
470
|
-
// guard let token = referenceToken else {
|
|
471
|
-
// lblResponseShow.isHidden = false
|
|
472
|
-
// lblResponseShow.text = "Reference token not available yet."
|
|
473
|
-
// return
|
|
474
|
-
// }
|
|
475
|
-
//
|
|
476
|
-
// let request = EasyPay.Request(
|
|
477
|
-
// referenceID: true,
|
|
478
|
-
// referenceToken: token
|
|
479
|
-
// )
|
|
480
|
-
//
|
|
481
|
-
// if request.referenceID == true {
|
|
482
|
-
// NotificationCenter.default.addObserver(forName: NSNotification.Name("ReferenceIDResponse"), object: nil, queue: .main) { notification in
|
|
483
|
-
// if let data = notification.object as? [String: Any] {
|
|
484
|
-
// self.lblResponseShow.isHidden = false
|
|
485
|
-
// self.lblResponseShow.text = "Reference Response:\n\(data)"
|
|
486
|
-
// }
|
|
487
|
-
// }
|
|
488
|
-
// }
|
|
489
|
-
// }
|
|
490
|
-
//
|
|
491
|
-
// private func showAlert(message: String) {
|
|
492
|
-
// let alert = UIAlertController(title: "Validation Error", message: message, preferredStyle: .alert)
|
|
493
|
-
// alert.addAction(UIAlertAction(title: "OK", style: .default))
|
|
494
|
-
// self.present(alert, animated: true)
|
|
495
|
-
// }
|
|
496
|
-
//
|
|
497
|
-
//}
|
|
498
|
-
//
|
|
499
|
-
//extension ViewController: EasyPayViewControllerDelegate {
|
|
500
|
-
//
|
|
501
|
-
// func easyPayController(_ controller: EasyPayViewController, didFinishWith result: EasyPay.SDKResult) {
|
|
502
|
-
// switch result.type {
|
|
503
|
-
// case .cancelled:
|
|
504
|
-
// lblResponseShow.isHidden = false
|
|
505
|
-
//
|
|
506
|
-
// if let chargeData = result.chargeData {
|
|
507
|
-
// let status = (chargeData["status"] as? Bool) ?? false
|
|
508
|
-
// let message = (chargeData["message"] as? String) ?? "No message"
|
|
509
|
-
//
|
|
510
|
-
// // Combine into one string for the label
|
|
511
|
-
// lblResponseShow.text = "Status: \(status), Message: \(message)"
|
|
512
|
-
//
|
|
513
|
-
// print("Cancel Data:", chargeData) // Debug print
|
|
514
|
-
// }
|
|
515
|
-
//
|
|
516
|
-
// case .success:
|
|
517
|
-
// lblResponseShow.isHidden = false
|
|
518
|
-
// var fullResponse: [String: Any] = [:]
|
|
519
|
-
//
|
|
520
|
-
// if let chargeData = result.chargeData {
|
|
521
|
-
// fullResponse["chargeData"] = chargeData
|
|
522
|
-
// }
|
|
523
|
-
//
|
|
524
|
-
// if let billing = result.billingInfo {
|
|
525
|
-
// fullResponse["billingInfo"] = billing
|
|
526
|
-
// }
|
|
527
|
-
//
|
|
528
|
-
// if let additional = result.additionalInfo {
|
|
529
|
-
// fullResponse["additionalInfo"] = additional
|
|
530
|
-
//
|
|
531
|
-
// // Extract and save ref_token
|
|
532
|
-
// if let threeDSecureStatus = additional["threeDSecureStatus"] as? [String: Any],
|
|
533
|
-
// let data = threeDSecureStatus["data"] as? [String: Any],
|
|
534
|
-
// let token = data["ref_token"] as? String {
|
|
535
|
-
// self.referenceToken = token
|
|
536
|
-
// }
|
|
537
|
-
// }
|
|
538
|
-
//
|
|
539
|
-
// do {
|
|
540
|
-
// let jsonData = try JSONSerialization.data(withJSONObject: fullResponse, options: .prettyPrinted)
|
|
541
|
-
// if let jsonString = String(data: jsonData, encoding: .utf8) {
|
|
542
|
-
// print(jsonString)
|
|
543
|
-
// lblResponseShow.text = jsonString
|
|
544
|
-
// }
|
|
545
|
-
// } catch {
|
|
546
|
-
// lblResponseShow.text = "Failed to format response: \(error.localizedDescription)"
|
|
547
|
-
// }
|
|
548
|
-
//
|
|
549
|
-
// case .error:
|
|
550
|
-
// if let chargeData = result.chargeData {
|
|
551
|
-
// let status = (chargeData["status"] as? Bool) ?? false
|
|
552
|
-
// let message = (chargeData["message"] as? String) ?? "Unknown error"
|
|
553
|
-
//
|
|
554
|
-
// lblResponseShow.isHidden = false
|
|
555
|
-
// lblResponseShow.text = "Status: \(status), Message: \(message)"
|
|
556
|
-
//
|
|
557
|
-
// print("Error Data:", chargeData) // Debugging
|
|
558
|
-
// } else {
|
|
559
|
-
// lblResponseShow.isHidden = false
|
|
560
|
-
// lblResponseShow.text = "An unknown error occurred."
|
|
561
|
-
// }
|
|
562
|
-
// }
|
|
563
|
-
// }
|
|
564
|
-
//
|
|
565
|
-
// private func handleSuccess(with chargeData: [String: Any]) {
|
|
566
|
-
// lblResponseShow.isHidden = false
|
|
567
|
-
// lblResponseShow.text = "Received Charge Data: \(chargeData)"
|
|
568
|
-
// }
|
|
569
|
-
//
|
|
570
|
-
//}
|
|
571
|
-
//
|
|
572
|
-
//
|
|
573
|
-
//
|
|
574
|
-
//
|
|
575
|
-
//
|
|
576
|
-
//
|
|
577
|
-
//// /// Light Theme
|
|
578
|
-
//// let themeConfiguration = ThemeConfiguration(
|
|
579
|
-
//// bodyBackgroundColor: "#E5E7EB", // Light grey background
|
|
580
|
-
//// containerBackgroundColor: "#F9FAFB", // Light gray container
|
|
581
|
-
//// primaryFontColor: "#111827", // Dark gray/black text
|
|
582
|
-
//// secondaryFontColor: "#6B7280", // Medium gray text
|
|
583
|
-
//// primaryButtonBackgroundColor: "#2563EB", // Blue
|
|
584
|
-
//// primaryButtonHoverColor: "#1D4ED8", // Darker blue on hover
|
|
585
|
-
//// primaryButtonFontColor: "#FFFFFF", // White text on blue button
|
|
586
|
-
//// secondaryButtonBackgroundColor: "#E5E7EB", // Light gray button
|
|
587
|
-
//// secondaryButtonHoverColor: "#D1D5DB", // Slightly darker gray on hover
|
|
588
|
-
//// secondaryButtonFontColor: "#111827", // Dark text on light button
|
|
589
|
-
//// borderRadius: "8",
|
|
590
|
-
//// fontSize: "14",
|
|
591
|
-
//// fontWeight: 500,
|
|
592
|
-
//// fontFamily: "\"Inter\", sans-serif"
|
|
593
|
-
//// )
|