@jimrising/easymerchantsdk-react-native 2.4.8 → 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/android/build/generated/source/buildConfig/debug/com/reactlibrary/BuildConfig.java +0 -10
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +0 -7
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +0 -18
- package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +0 -6
- package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +0 -1
- 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 +0 -1
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
- 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$1.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$3.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 +0 -2
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +0 -7
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +0 -7
- package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +0 -1
- package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +0 -1
- 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$1.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$3.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 +0 -1
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -16
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/ios/Pods/UserDefaults/UserStoreSingleton.swift +0 -425
- package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +0 -2996
- package/ios/Pods/ViewControllers/BaseVC.swift +0 -142
- package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +0 -3807
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CityListTVC.swift +0 -46
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CountryListTVC.swift +0 -47
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/StateListTVC.swift +0 -46
- package/ios/Pods/ViewControllers/Clean Runner_2025-07-23T14-58-05.txt +0 -13
- package/ios/Pods/ViewControllers/CountryListVC.swift +0 -435
- package/ios/Pods/ViewControllers/EmailVerificationVC.swift +0 -300
- package/ios/Pods/ViewControllers/GrailPayVC.swift +0 -492
- package/ios/Pods/ViewControllers/OTPVerificationVC.swift +0 -2278
- package/ios/Pods/ViewControllers/PaymentDoneVC.swift +0 -287
- package/ios/Pods/ViewControllers/PaymentErrorVC.swift +0 -85
- package/ios/Pods/ViewControllers/PaymentInformation/AccountTypeTVC.swift +0 -41
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +0 -13115
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInformationCVC.swift +0 -35
- package/ios/Pods/ViewControllers/PaymentInformation/RecurringTVC.swift +0 -40
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +0 -80
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.xib +0 -163
- package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.swift +0 -81
- package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.xib +0 -188
- package/ios/Pods/ViewControllers/PaymentStatusWebViewVC.swift +0 -167
- package/ios/Pods/ViewControllers/TermAndConditionsVC.swift +0 -63
- package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +0 -1254
- package/ios/easymerchantsdk.storyboard +0 -9089
package/ios/Models/Request.swift
CHANGED
|
@@ -354,7 +354,6 @@ public final class Request: NSObject {
|
|
|
354
354
|
savedIsRecurring == "1" {
|
|
355
355
|
|
|
356
356
|
self.is_recurring = true
|
|
357
|
-
// print("Recurring enabled (clientToken flow) → is_recurring = \(self.is_recurring ?? false)")
|
|
358
357
|
|
|
359
358
|
if let cycles = UserStoreSingleton.shared.allowCycles,
|
|
360
359
|
let num = Int(cycles) {
|
|
@@ -379,7 +378,6 @@ public final class Request: NSObject {
|
|
|
379
378
|
} else {
|
|
380
379
|
// --- API Keys Flow ---
|
|
381
380
|
// Keep whatever was passed from outside (don’t override)
|
|
382
|
-
print("Recurring setup (API keys flow) → is_recurring = \(self.is_recurring ?? false)")
|
|
383
381
|
}
|
|
384
382
|
|
|
385
383
|
if is_recurring == true {
|
|
@@ -429,8 +427,6 @@ public final class Request: NSObject {
|
|
|
429
427
|
|
|
430
428
|
// Validate recurring intervals and required recurring params
|
|
431
429
|
if is_recurring == true {
|
|
432
|
-
// if numOfCycle == nil { self.initializationErrorMessage = "numOfCycle object not defined"; Request.notifyValidationError(self.initializationErrorMessage!); return }
|
|
433
|
-
|
|
434
430
|
// ✅ Skip numOfCycle validation if clientToken is provided and not empty
|
|
435
431
|
if (clientToken == nil || clientToken?.isEmpty == true) {
|
|
436
432
|
if numOfCycle == nil {
|
|
@@ -451,12 +447,7 @@ public final class Request: NSObject {
|
|
|
451
447
|
}
|
|
452
448
|
|
|
453
449
|
let intervals = recurringIntervals ?? []
|
|
454
|
-
|
|
455
|
-
// self.initializationErrorMessage = "Please add minimum two intervals for recurring."
|
|
456
|
-
// Request.notifyValidationError(self.initializationErrorMessage!)
|
|
457
|
-
// return
|
|
458
|
-
// }
|
|
459
|
-
|
|
450
|
+
|
|
460
451
|
let uniqueIntervals = Set(intervals)
|
|
461
452
|
if uniqueIntervals.count < intervals.count {
|
|
462
453
|
self.initializationErrorMessage = "Duplicate interval values"
|
|
@@ -489,11 +480,8 @@ public final class Request: NSObject {
|
|
|
489
480
|
// // Proceed with normal payment flow for API key/secret case
|
|
490
481
|
// self.paymentIntentApi { success in
|
|
491
482
|
// if success {
|
|
492
|
-
// print("Payment Intent API call succeeded")
|
|
493
483
|
// UserStoreSingleton.shared.price = String(self.amount ?? 0)
|
|
494
|
-
// print("Saved amount: \(UserStoreSingleton.shared.price ?? "No amount")")
|
|
495
484
|
// } else {
|
|
496
|
-
// print("Payment Intent API call failed")
|
|
497
485
|
// }
|
|
498
486
|
// }
|
|
499
487
|
// } else {
|
|
@@ -501,10 +489,8 @@ public final class Request: NSObject {
|
|
|
501
489
|
// UserStoreSingleton.shared.clientToken = clientToken
|
|
502
490
|
// self.hostedCheckoutsApi { success in
|
|
503
491
|
// if success {
|
|
504
|
-
// print("Hosted Checkout API call succeeded")
|
|
505
492
|
// UserStoreSingleton.shared.price = String(self.amount ?? 0)
|
|
506
493
|
// } else {
|
|
507
|
-
// print("Hosted Checkout API call failed")
|
|
508
494
|
// }
|
|
509
495
|
// }
|
|
510
496
|
// }
|
|
@@ -519,141 +505,10 @@ public final class Request: NSObject {
|
|
|
519
505
|
}
|
|
520
506
|
}
|
|
521
507
|
|
|
522
|
-
//MARK: - Payment Intent Api
|
|
523
|
-
// func paymentIntentApi(completion: @escaping (Bool) -> Void) {
|
|
524
|
-
// guard let serviceURL = URL(string: EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.paymentIntent.path()) else {
|
|
525
|
-
// Request.notifyValidationError("Invalid payment URL.")
|
|
526
|
-
// print("Invalid payment URL for Payment Intent API")
|
|
527
|
-
// completion(false)
|
|
528
|
-
// return
|
|
529
|
-
// }
|
|
530
|
-
//
|
|
531
|
-
// var request = URLRequest(url: serviceURL)
|
|
532
|
-
// request.httpMethod = "POST"
|
|
533
|
-
// request.addValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
534
|
-
// request.addValue(EnvironmentConfig.apiKey ?? "", forHTTPHeaderField: "X-Api-Key")
|
|
535
|
-
// request.addValue(EnvironmentConfig.apiSecret ?? "", forHTTPHeaderField: "X-Api-Secret")
|
|
536
|
-
//
|
|
537
|
-
// // Recurring date validation
|
|
538
|
-
// if let startDateString = recurringStartDate,
|
|
539
|
-
// let startDate = DateFormatter.recurringDateFormatter.date(from: startDateString) {
|
|
540
|
-
// let today = Calendar.current.startOfDay(for: Date())
|
|
541
|
-
// let startDay = Calendar.current.startOfDay(for: startDate)
|
|
542
|
-
//
|
|
543
|
-
// if startDay < today {
|
|
544
|
-
// Request.notifyValidationError("The recurring start date cannot be in the past. Please select today or a future date.")
|
|
545
|
-
// print("Recurring start date validation failed")
|
|
546
|
-
// completion(false)
|
|
547
|
-
// return
|
|
548
|
-
// }
|
|
549
|
-
// } else if recurringStartDate != nil {
|
|
550
|
-
// Request.notifyValidationError("Recurring date format should be dd/MM/yyyy")
|
|
551
|
-
// print("Invalid recurring date format")
|
|
552
|
-
// completion(false)
|
|
553
|
-
// return
|
|
554
|
-
// }
|
|
555
|
-
//
|
|
556
|
-
// let params: [String: Any] = [
|
|
557
|
-
// "amount": ((amount ?? 0) * 100).rounded() / 100,
|
|
558
|
-
// "allowed_cycles": numOfCycle ?? 0,
|
|
559
|
-
// "intervals": recurringIntervals?.map { $0.rawValue } ?? [],
|
|
560
|
-
// "is_recurring": self.is_recurring ?? false,
|
|
561
|
-
// "recurring_start_date": recurringStartDate ?? "",
|
|
562
|
-
// "recurring_start_date_type": recurringStartDateType?.rawValue ?? ""
|
|
563
|
-
// ]
|
|
564
|
-
//
|
|
565
|
-
// print("Payment Intent API Request Params: \(params)")
|
|
566
|
-
//
|
|
567
|
-
// do {
|
|
568
|
-
// request.httpBody = try JSONSerialization.data(withJSONObject: params, options: .prettyPrinted)
|
|
569
|
-
// } catch {
|
|
570
|
-
// Request.notifyValidationError("Failed to encode Payment Intent API data: \(error.localizedDescription)")
|
|
571
|
-
// print("Error encoding Payment Intent API data: \(error)")
|
|
572
|
-
// completion(false)
|
|
573
|
-
// return
|
|
574
|
-
// }
|
|
575
|
-
//
|
|
576
|
-
// let task = URLSession.shared.dataTask(with: request) { data, response, error in
|
|
577
|
-
// if let error = error {
|
|
578
|
-
// Request.notifyValidationError("Payment Intent API error: \(error.localizedDescription)")
|
|
579
|
-
// print("Payment Intent API error: \(error)")
|
|
580
|
-
// completion(false)
|
|
581
|
-
// return
|
|
582
|
-
// }
|
|
583
|
-
//
|
|
584
|
-
// guard let httpResponse = response as? HTTPURLResponse else {
|
|
585
|
-
// Request.notifyValidationError("Invalid response from Payment Intent API")
|
|
586
|
-
// print("Invalid response from Payment Intent API")
|
|
587
|
-
// completion(false)
|
|
588
|
-
// return
|
|
589
|
-
// }
|
|
590
|
-
//
|
|
591
|
-
// print("Payment Intent API Response Status Code: \(httpResponse.statusCode)")
|
|
592
|
-
//
|
|
593
|
-
// if httpResponse.statusCode == 200 || httpResponse.statusCode == 201 {
|
|
594
|
-
// if let data = data {
|
|
595
|
-
// do {
|
|
596
|
-
// if let responseObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
|
|
597
|
-
// print("Payment Intent API Response: \(responseObject)")
|
|
598
|
-
// if let clientToken = responseObject["client_token"] as? String {
|
|
599
|
-
// UserStoreSingleton.shared.clientToken = clientToken
|
|
600
|
-
// print("Received clientToken: \(clientToken)")
|
|
601
|
-
// } else {
|
|
602
|
-
// Request.notifyValidationError("No client_token in Payment Intent API response")
|
|
603
|
-
// print("No client_token in Payment Intent API response")
|
|
604
|
-
// completion(false)
|
|
605
|
-
// return
|
|
606
|
-
// }
|
|
607
|
-
// if let paymentIntent = responseObject["payment_intent"] as? String {
|
|
608
|
-
// UserStoreSingleton.shared.paymentIntent = paymentIntent
|
|
609
|
-
// print("Received paymentIntent: \(paymentIntent)")
|
|
610
|
-
// }
|
|
611
|
-
// self.hostedCheckoutsApi { success in
|
|
612
|
-
// completion(success)
|
|
613
|
-
// }
|
|
614
|
-
// return
|
|
615
|
-
// } else {
|
|
616
|
-
// Request.notifyValidationError("Invalid response format from Payment Intent API")
|
|
617
|
-
// print("Invalid response format from Payment Intent API")
|
|
618
|
-
// completion(false)
|
|
619
|
-
// }
|
|
620
|
-
// } catch {
|
|
621
|
-
// Request.notifyValidationError("Failed to parse Payment Intent API response: \(error.localizedDescription)")
|
|
622
|
-
// print("Error parsing Payment Intent API response: \(error)")
|
|
623
|
-
// completion(false)
|
|
624
|
-
// }
|
|
625
|
-
// } else {
|
|
626
|
-
// Request.notifyValidationError("No response data received from Payment Intent API")
|
|
627
|
-
// print("No response data received from Payment Intent API")
|
|
628
|
-
// completion(false)
|
|
629
|
-
// }
|
|
630
|
-
// } else {
|
|
631
|
-
// // Default error message
|
|
632
|
-
// var message = "Payment Intent API failed with status code: \(httpResponse.statusCode)"
|
|
633
|
-
//
|
|
634
|
-
// if let data = data,
|
|
635
|
-
// let responseObj = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
|
|
636
|
-
//
|
|
637
|
-
// // Prefer the "message" key from API response
|
|
638
|
-
// if let msg = responseObj["message"] as? String, !msg.isEmpty {
|
|
639
|
-
// message = "Payment Intent API error: \(msg)"
|
|
640
|
-
// }
|
|
641
|
-
// }
|
|
642
|
-
//
|
|
643
|
-
// // Send back the exact server error
|
|
644
|
-
// Request.notifyValidationError(message)
|
|
645
|
-
// print(message)
|
|
646
|
-
// completion(false)
|
|
647
|
-
// }
|
|
648
|
-
// }
|
|
649
|
-
// task.resume()
|
|
650
|
-
// }
|
|
651
|
-
|
|
652
508
|
// MARK: - Payment Intent Api
|
|
653
509
|
func paymentIntentApi(completion: @escaping (Bool) -> Void) {
|
|
654
510
|
guard let serviceURL = URL(string: EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.paymentIntent.path()) else {
|
|
655
511
|
Request.notifyValidationError("Invalid payment URL.")
|
|
656
|
-
print("Invalid payment URL for Payment Intent API")
|
|
657
512
|
completion(false)
|
|
658
513
|
return
|
|
659
514
|
}
|
|
@@ -674,7 +529,6 @@ public final class Request: NSObject {
|
|
|
674
529
|
|
|
675
530
|
if startDay < today {
|
|
676
531
|
Request.notifyValidationError("The recurring start date cannot be in the past. Please select today or a future date.")
|
|
677
|
-
print("Recurring start date validation failed")
|
|
678
532
|
completion(false)
|
|
679
533
|
return
|
|
680
534
|
}
|
|
@@ -686,7 +540,6 @@ public final class Request: NSObject {
|
|
|
686
540
|
|
|
687
541
|
} else if recurringStartDate != nil {
|
|
688
542
|
Request.notifyValidationError("Recurring date format should be dd/MM/yyyy")
|
|
689
|
-
print("Invalid recurring date format")
|
|
690
543
|
completion(false)
|
|
691
544
|
return
|
|
692
545
|
}
|
|
@@ -700,13 +553,11 @@ public final class Request: NSObject {
|
|
|
700
553
|
"recurring_start_date_type": recurringStartDateType?.rawValue ?? ""
|
|
701
554
|
]
|
|
702
555
|
|
|
703
|
-
print("Payment Intent API Request Params: \(params)")
|
|
704
556
|
|
|
705
557
|
do {
|
|
706
558
|
request.httpBody = try JSONSerialization.data(withJSONObject: params, options: .prettyPrinted)
|
|
707
559
|
} catch {
|
|
708
560
|
Request.notifyValidationError("Failed to encode Payment Intent API data: \(error.localizedDescription)")
|
|
709
|
-
print("Error encoding Payment Intent API data: \(error)")
|
|
710
561
|
completion(false)
|
|
711
562
|
return
|
|
712
563
|
}
|
|
@@ -714,39 +565,32 @@ public final class Request: NSObject {
|
|
|
714
565
|
let task = URLSession.shared.dataTask(with: request) { data, response, error in
|
|
715
566
|
if let error = error {
|
|
716
567
|
Request.notifyValidationError("Payment Intent API error: \(error.localizedDescription)")
|
|
717
|
-
print("Payment Intent API error: \(error)")
|
|
718
568
|
completion(false)
|
|
719
569
|
return
|
|
720
570
|
}
|
|
721
571
|
|
|
722
572
|
guard let httpResponse = response as? HTTPURLResponse else {
|
|
723
573
|
Request.notifyValidationError("Invalid response from Payment Intent API")
|
|
724
|
-
print("Invalid response from Payment Intent API")
|
|
725
574
|
completion(false)
|
|
726
575
|
return
|
|
727
576
|
}
|
|
728
577
|
|
|
729
|
-
print("Payment Intent API Response Status Code: \(httpResponse.statusCode)")
|
|
730
578
|
|
|
731
579
|
if httpResponse.statusCode == 200 || httpResponse.statusCode == 201 {
|
|
732
580
|
if let data = data {
|
|
733
581
|
do {
|
|
734
582
|
if let responseObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
|
|
735
|
-
print("Payment Intent API Response: \(responseObject)")
|
|
736
583
|
|
|
737
584
|
if let clientToken = responseObject["client_token"] as? String {
|
|
738
585
|
UserStoreSingleton.shared.clientToken = clientToken
|
|
739
|
-
print("Received clientToken: \(clientToken)")
|
|
740
586
|
} else {
|
|
741
587
|
Request.notifyValidationError("No client_token in Payment Intent API response")
|
|
742
|
-
print("No client_token in Payment Intent API response")
|
|
743
588
|
completion(false)
|
|
744
589
|
return
|
|
745
590
|
}
|
|
746
591
|
|
|
747
592
|
if let paymentIntent = responseObject["payment_intent"] as? String {
|
|
748
593
|
UserStoreSingleton.shared.paymentIntent = paymentIntent
|
|
749
|
-
print("Received paymentIntent: \(paymentIntent)")
|
|
750
594
|
}
|
|
751
595
|
|
|
752
596
|
self.hostedCheckoutsApi { success in
|
|
@@ -755,17 +599,14 @@ public final class Request: NSObject {
|
|
|
755
599
|
return
|
|
756
600
|
} else {
|
|
757
601
|
Request.notifyValidationError("Invalid response format from Payment Intent API")
|
|
758
|
-
print("Invalid response format from Payment Intent API")
|
|
759
602
|
completion(false)
|
|
760
603
|
}
|
|
761
604
|
} catch {
|
|
762
605
|
Request.notifyValidationError("Failed to parse Payment Intent API response: \(error.localizedDescription)")
|
|
763
|
-
print("Error parsing Payment Intent API response: \(error)")
|
|
764
606
|
completion(false)
|
|
765
607
|
}
|
|
766
608
|
} else {
|
|
767
609
|
Request.notifyValidationError("No response data received from Payment Intent API")
|
|
768
|
-
print("No response data received from Payment Intent API")
|
|
769
610
|
completion(false)
|
|
770
611
|
}
|
|
771
612
|
} else {
|
|
@@ -779,7 +620,6 @@ public final class Request: NSObject {
|
|
|
779
620
|
}
|
|
780
621
|
|
|
781
622
|
Request.notifyValidationError(message)
|
|
782
|
-
print(message)
|
|
783
623
|
completion(false)
|
|
784
624
|
}
|
|
785
625
|
}
|
|
@@ -821,7 +661,6 @@ public final class Request: NSObject {
|
|
|
821
661
|
// Build the URL using EnvironmentConfig
|
|
822
662
|
guard let baseURL = URL(string: EnvironmentConfig.baseURL) else {
|
|
823
663
|
Request.notifyValidationError("Invalid base URL for Hosted Checkout API")
|
|
824
|
-
print("Invalid base URL for Hosted Checkout API")
|
|
825
664
|
completion(false)
|
|
826
665
|
return
|
|
827
666
|
}
|
|
@@ -836,39 +675,30 @@ public final class Request: NSObject {
|
|
|
836
675
|
let token = clientToken ?? UserStoreSingleton.shared.clientToken ?? ""
|
|
837
676
|
if token.isEmpty {
|
|
838
677
|
Request.notifyValidationError("No valid client token provided for Hosted Checkout API")
|
|
839
|
-
print("No valid client token provided for Hosted Checkout API")
|
|
840
678
|
completion(false)
|
|
841
679
|
return
|
|
842
680
|
}
|
|
843
681
|
request.addValue(token, forHTTPHeaderField: "clientToken")
|
|
844
682
|
|
|
845
|
-
// print("➡️ Hosted Checkout API Request URL: \(serviceURL.absoluteString)")
|
|
846
|
-
// print("➡️ Hosted Checkout API clientToken: \(token)")
|
|
847
|
-
// print("➡️ Headers: \(request.allHTTPHeaderFields ?? [:])")
|
|
848
|
-
|
|
849
683
|
let task = URLSession.shared.dataTask(with: request) { data, response, error in
|
|
850
684
|
if let error = error {
|
|
851
685
|
Request.notifyValidationError("Hosted Checkout API error: \(error.localizedDescription)")
|
|
852
|
-
print("Hosted Checkout API error: \(error)")
|
|
853
686
|
completion(false)
|
|
854
687
|
return
|
|
855
688
|
}
|
|
856
689
|
|
|
857
690
|
guard let httpResponse = response as? HTTPURLResponse else {
|
|
858
691
|
Request.notifyValidationError("Invalid response from Hosted Checkout API")
|
|
859
|
-
print("Invalid response from Hosted Checkout API")
|
|
860
692
|
completion(false)
|
|
861
693
|
return
|
|
862
694
|
}
|
|
863
695
|
|
|
864
|
-
print("Hosted Checkout API Response Status Code: \(httpResponse.statusCode)")
|
|
865
696
|
|
|
866
697
|
if httpResponse.statusCode == 200 || httpResponse.statusCode == 201 {
|
|
867
698
|
if let data = data {
|
|
868
699
|
do {
|
|
869
700
|
if let responseObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any],
|
|
870
701
|
let dataObject = responseObject["data"] as? [String: Any] {
|
|
871
|
-
print("Hosted Checkout API Response: \(dataObject)")
|
|
872
702
|
|
|
873
703
|
if let paymentAmount = dataObject["payment_intent_amount"] as? Double {
|
|
874
704
|
// ✅ Update Request + Singleton with fresh value
|
|
@@ -889,28 +719,23 @@ public final class Request: NSObject {
|
|
|
889
719
|
// Save merchant details
|
|
890
720
|
if let merchantEmail = dataObject["merchant_email"] as? String {
|
|
891
721
|
UserStoreSingleton.shared.merchantEmail = merchantEmail
|
|
892
|
-
print("Saved merchantEmail: \(merchantEmail)")
|
|
893
722
|
}
|
|
894
723
|
|
|
895
724
|
if let merchantName = dataObject["merchant_name"] as? String {
|
|
896
725
|
UserStoreSingleton.shared.merchantName = merchantName
|
|
897
|
-
print("Saved merchantName: \(merchantName)")
|
|
898
726
|
}
|
|
899
727
|
|
|
900
728
|
if let companyName = dataObject["company_name"] as? String {
|
|
901
729
|
UserStoreSingleton.shared.companyName = companyName
|
|
902
|
-
print("Saved company name: \(companyName)")
|
|
903
730
|
}
|
|
904
731
|
|
|
905
732
|
if let bankWidgetKey = dataObject["bank_widget_key"] as? String {
|
|
906
733
|
UserStoreSingleton.shared.bankWidgetKey = bankWidgetKey
|
|
907
|
-
print("Saved bank_widget_key: \(bankWidgetKey)")
|
|
908
734
|
|
|
909
735
|
// Extract vendor ID from bankWidgetKey
|
|
910
736
|
let components = bankWidgetKey.components(separatedBy: "|")
|
|
911
737
|
if let vendorID = components.first {
|
|
912
738
|
UserStoreSingleton.shared.vendorID = vendorID
|
|
913
|
-
print("Extracted and saved vendor_id: \(vendorID)")
|
|
914
739
|
}
|
|
915
740
|
}
|
|
916
741
|
|
|
@@ -919,7 +744,6 @@ public final class Request: NSObject {
|
|
|
919
744
|
let cryptoSection = paymentMethods["crypto"] as? [String: Any],
|
|
920
745
|
let paymentAccount = cryptoSection["payment_account"] as? String {
|
|
921
746
|
UserStoreSingleton.shared.paymentAccount = paymentAccount
|
|
922
|
-
print("Saved paymentAccount (Crypto): \(paymentAccount)")
|
|
923
747
|
}
|
|
924
748
|
|
|
925
749
|
// Save payment methods
|
|
@@ -943,71 +767,104 @@ public final class Request: NSObject {
|
|
|
943
767
|
}
|
|
944
768
|
|
|
945
769
|
UserStoreSingleton.shared.paymentMethods = paymentMethodNames
|
|
946
|
-
print("Saved payment methods: \(paymentMethodNames)")
|
|
947
770
|
}
|
|
948
771
|
|
|
949
772
|
// Save payment intent amount
|
|
950
773
|
if let paymentAmount = dataObject["payment_intent_amount"] {
|
|
951
774
|
UserStoreSingleton.shared.amount = "\(paymentAmount)"
|
|
952
|
-
print("Saved payment_intent_amount: \(paymentAmount)")
|
|
953
775
|
}
|
|
954
776
|
|
|
955
777
|
// Save recurring details
|
|
956
778
|
if let recurringDetails = dataObject["recurring_details"] as? [String: Any] {
|
|
957
779
|
if let allowedCycles = recurringDetails["allowed_cycles"] {
|
|
958
780
|
UserStoreSingleton.shared.allowCycles = "\(allowedCycles)"
|
|
959
|
-
print("Saved allowed_cycles: \(allowedCycles)")
|
|
960
781
|
}
|
|
961
782
|
if let interval = recurringDetails["interval"] {
|
|
962
783
|
UserStoreSingleton.shared.interval = "\(interval)"
|
|
963
|
-
print("Saved interval: \(interval)")
|
|
964
784
|
}
|
|
965
785
|
if let isRecurring = recurringDetails["is_recurring"] {
|
|
966
786
|
UserStoreSingleton.shared.isRecurring = "\(isRecurring)"
|
|
967
|
-
print("Saved is_recurring: \(isRecurring)")
|
|
968
787
|
self.is_recurring = (UserStoreSingleton.shared.isRecurring == "1")
|
|
969
788
|
} else {
|
|
970
789
|
self.is_recurring = false
|
|
971
790
|
}
|
|
972
|
-
|
|
791
|
+
|
|
973
792
|
if let paymentIntentId = recurringDetails["payment_intent_id"] {
|
|
974
793
|
UserStoreSingleton.shared.paymentIntentId = "\(paymentIntentId)"
|
|
975
|
-
print("Saved payment_intent_id: \(paymentIntentId)")
|
|
976
794
|
}
|
|
977
795
|
if let startDate = recurringDetails["start_date"] {
|
|
978
796
|
UserStoreSingleton.shared.startDate = "\(startDate)"
|
|
979
|
-
print("Saved start_date: \(startDate)")
|
|
980
797
|
}
|
|
981
798
|
if let startDateType = recurringDetails["start_date_type"] {
|
|
982
799
|
UserStoreSingleton.shared.startDateType = "\(startDateType)"
|
|
983
|
-
print("Saved start_date_type: \(startDateType)")
|
|
984
800
|
}
|
|
985
801
|
} else {
|
|
986
802
|
self.is_recurring = false
|
|
987
803
|
UserStoreSingleton.shared.isRecurring = "0"
|
|
988
804
|
}
|
|
989
|
-
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
// // Save recurring details only if dictionary & is_recurring = 1
|
|
811
|
+
// if let recurringDetails = dataObject["recurring_details"] as? [String: Any] {
|
|
812
|
+
// var isRecurringFlag = false
|
|
813
|
+
//
|
|
814
|
+
// if let isRecurringInt = recurringDetails["is_recurring"] as? Int {
|
|
815
|
+
// isRecurringFlag = (isRecurringInt == 1)
|
|
816
|
+
// } else if let isRecurringStr = recurringDetails["is_recurring"] as? String {
|
|
817
|
+
// isRecurringFlag = (isRecurringStr == "1")
|
|
818
|
+
// }
|
|
819
|
+
//
|
|
820
|
+
// if isRecurringFlag {
|
|
821
|
+
// UserStoreSingleton.shared.isRecurring = "1"
|
|
822
|
+
// self.is_recurring = true
|
|
823
|
+
//
|
|
824
|
+
// if let allowedCycles = recurringDetails["allowed_cycles"] {
|
|
825
|
+
// UserStoreSingleton.shared.allowCycles = "\(allowedCycles)"
|
|
826
|
+
// }
|
|
827
|
+
// if let interval = recurringDetails["interval"] {
|
|
828
|
+
// UserStoreSingleton.shared.interval = "\(interval)"
|
|
829
|
+
// }
|
|
830
|
+
// if let paymentIntentId = recurringDetails["payment_intent_id"] {
|
|
831
|
+
// UserStoreSingleton.shared.paymentIntentId = "\(paymentIntentId)"
|
|
832
|
+
// }
|
|
833
|
+
// if let startDate = recurringDetails["start_date"] {
|
|
834
|
+
// UserStoreSingleton.shared.startDate = "\(startDate)"
|
|
835
|
+
// }
|
|
836
|
+
// if let startDateType = recurringDetails["start_date_type"] {
|
|
837
|
+
// UserStoreSingleton.shared.startDateType = "\(startDateType)"
|
|
838
|
+
// }
|
|
839
|
+
// } else {
|
|
840
|
+
// self.is_recurring = false
|
|
841
|
+
// UserStoreSingleton.shared.isRecurring = "0"
|
|
842
|
+
// }
|
|
843
|
+
// } else {
|
|
844
|
+
// // Not a dictionary, could be array [] or null
|
|
845
|
+
// self.is_recurring = false
|
|
846
|
+
// UserStoreSingleton.shared.isRecurring = "0"
|
|
847
|
+
// }
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
990
851
|
// Save customer details
|
|
991
852
|
if let customer = dataObject["customer"] as? [String: Any] {
|
|
992
853
|
if let customerId = customer["customer_id"] as? String {
|
|
993
854
|
UserStoreSingleton.shared.customerId = customerId
|
|
994
|
-
print("Saved customer_id: \(customerId)")
|
|
995
855
|
}
|
|
996
856
|
|
|
997
857
|
if let customerToken = customer["customer_token"] as? String {
|
|
998
858
|
UserStoreSingleton.shared.customerToken = customerToken
|
|
999
|
-
print("Saved customer_token: \(customerToken)")
|
|
1000
859
|
}
|
|
1001
860
|
|
|
1002
861
|
if let customerEmail = customer["email_address"] as? String {
|
|
1003
862
|
UserStoreSingleton.shared.customerEmail = customerEmail
|
|
1004
|
-
print("Saved customer email: \(customerEmail)")
|
|
1005
863
|
self.email = customerEmail
|
|
1006
864
|
}
|
|
1007
865
|
|
|
1008
866
|
if let customerName = customer["name"] as? String {
|
|
1009
867
|
UserStoreSingleton.shared.customerName = customerName
|
|
1010
|
-
print("Saved customer name: \(customerName)")
|
|
1011
868
|
self.name = customerName
|
|
1012
869
|
}
|
|
1013
870
|
}
|
|
@@ -1016,10 +873,8 @@ public final class Request: NSObject {
|
|
|
1016
873
|
if let id = UserStoreSingleton.shared.customerId, !id.isEmpty ||
|
|
1017
874
|
(UserStoreSingleton.shared.customerToken != nil && !(UserStoreSingleton.shared.customerToken?.isEmpty ?? true)) {
|
|
1018
875
|
UserStoreSingleton.shared.isLoggedIn = true
|
|
1019
|
-
print("User is logged in")
|
|
1020
876
|
} else {
|
|
1021
877
|
UserStoreSingleton.shared.isLoggedIn = false
|
|
1022
|
-
print("User is not logged in")
|
|
1023
878
|
}
|
|
1024
879
|
|
|
1025
880
|
if self.appearanceSettings == nil, let appearanceSettings = dataObject["apperance_settings"] as? [String: Any] {
|
|
@@ -1041,17 +896,14 @@ public final class Request: NSObject {
|
|
|
1041
896
|
completion(true)
|
|
1042
897
|
} else {
|
|
1043
898
|
Request.notifyValidationError("Invalid JSON format or 'data' key missing in Hosted Checkout API response")
|
|
1044
|
-
print("Invalid JSON format or 'data' key missing in Hosted Checkout API response")
|
|
1045
899
|
completion(false)
|
|
1046
900
|
}
|
|
1047
901
|
} catch {
|
|
1048
902
|
Request.notifyValidationError("Failed to parse Hosted Checkout API response: \(error.localizedDescription)")
|
|
1049
|
-
print("Error parsing Hosted Checkout API response: \(error)")
|
|
1050
903
|
completion(false)
|
|
1051
904
|
}
|
|
1052
905
|
} else {
|
|
1053
906
|
Request.notifyValidationError("No response data received from Hosted Checkout API")
|
|
1054
|
-
print("No response data received from Hosted Checkout API")
|
|
1055
907
|
completion(false)
|
|
1056
908
|
}
|
|
1057
909
|
} else {
|
|
@@ -1062,7 +914,6 @@ public final class Request: NSObject {
|
|
|
1062
914
|
message = msg
|
|
1063
915
|
}
|
|
1064
916
|
Request.notifyValidationError(message)
|
|
1065
|
-
print("Hosted Checkout API error: \(message)")
|
|
1066
917
|
completion(false)
|
|
1067
918
|
}
|
|
1068
919
|
}
|
|
@@ -1072,10 +923,8 @@ public final class Request: NSObject {
|
|
|
1072
923
|
// MARK: - GET Transaction Status API
|
|
1073
924
|
private func fetchReferenceData(completion: @escaping ([String: Any]?) -> Void) {
|
|
1074
925
|
let urlString = EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.threeDSecureStatus(referenceToken ?? "").path()
|
|
1075
|
-
print("Final 3DS status URL: \(urlString)")
|
|
1076
926
|
|
|
1077
927
|
guard let url = URL(string: urlString) else {
|
|
1078
|
-
print("Invalid URL")
|
|
1079
928
|
completion(nil)
|
|
1080
929
|
return
|
|
1081
930
|
}
|
|
@@ -1085,7 +934,6 @@ public final class Request: NSObject {
|
|
|
1085
934
|
uRLRequest.addValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
1086
935
|
|
|
1087
936
|
// let tokenn = UserStoreSingleton.shared.customerToken
|
|
1088
|
-
// print("Setting customerToken header: \(tokenn ?? "None")")
|
|
1089
937
|
// uRLRequest.addValue(tokenn ?? "", forHTTPHeaderField: "Customer-Token")
|
|
1090
938
|
|
|
1091
939
|
let token = clientToken ?? UserStoreSingleton.shared.clientToken ?? ""
|
|
@@ -1100,26 +948,22 @@ public final class Request: NSObject {
|
|
|
1100
948
|
|
|
1101
949
|
let task = URLSession.shared.dataTask(with: uRLRequest) { data, response, error in
|
|
1102
950
|
if let error = error {
|
|
1103
|
-
print("3DS status check error:", error.localizedDescription)
|
|
1104
951
|
completion(nil)
|
|
1105
952
|
return
|
|
1106
953
|
}
|
|
1107
954
|
|
|
1108
955
|
guard let data = data else {
|
|
1109
|
-
print("No data in response")
|
|
1110
956
|
completion(nil)
|
|
1111
957
|
return
|
|
1112
958
|
}
|
|
1113
959
|
|
|
1114
960
|
do {
|
|
1115
961
|
if let json = try JSONSerialization.jsonObject(with: data) as? [String: Any] {
|
|
1116
|
-
print("3DS status response:", json)
|
|
1117
962
|
completion(json) // pass result
|
|
1118
963
|
} else {
|
|
1119
964
|
completion(nil)
|
|
1120
965
|
}
|
|
1121
966
|
} catch {
|
|
1122
|
-
print("Error parsing JSON:", error.localizedDescription)
|
|
1123
967
|
completion(nil)
|
|
1124
968
|
}
|
|
1125
969
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Pod::Spec.new do |s|
|
|
2
2
|
s.name = 'easymerchantsdk'
|
|
3
|
-
s.version = '2.
|
|
3
|
+
s.version = '2.3.9'
|
|
4
4
|
s.summary = 'A React Native SDK for Easy Merchant.'
|
|
5
5
|
s.description = <<-DESC
|
|
6
6
|
A React Native SDK to enable Easy Merchant functionality in mobile applications.
|
|
@@ -68,7 +68,7 @@ Pod::Spec.new do |s|
|
|
|
68
68
|
s.vendored_frameworks = "*.xcframework"
|
|
69
69
|
|
|
70
70
|
# Frameworks required for the SDK
|
|
71
|
-
s.frameworks = ['UIKit', 'Foundation']
|
|
71
|
+
s.frameworks = ['UIKit', 'Foundation', 'SafariServices', 'WebKit']
|
|
72
72
|
|
|
73
73
|
# Set ARC for the module
|
|
74
74
|
s.requires_arc = true
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Automatically generated file. DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
package com.reactlibrary;
|
|
5
|
-
|
|
6
|
-
public final class BuildConfig {
|
|
7
|
-
public static final boolean DEBUG = Boolean.parseBoolean("true");
|
|
8
|
-
public static final String LIBRARY_PACKAGE_NAME = "com.reactlibrary";
|
|
9
|
-
public static final String BUILD_TYPE = "debug";
|
|
10
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"artifactType": {
|
|
4
|
-
"type": "AAPT_FRIENDLY_MERGED_MANIFESTS",
|
|
5
|
-
"kind": "Directory"
|
|
6
|
-
},
|
|
7
|
-
"applicationId": "com.reactlibrary",
|
|
8
|
-
"variantName": "debug",
|
|
9
|
-
"elements": [
|
|
10
|
-
{
|
|
11
|
-
"type": "SINGLE",
|
|
12
|
-
"filters": [],
|
|
13
|
-
"attributes": [],
|
|
14
|
-
"outputFile": "AndroidManifest.xml"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"elementType": "File"
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|