@jimrising/easymerchantsdk-react-native 2.2.2 → 2.2.3

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.
Files changed (28) hide show
  1. package/README.md +1 -1
  2. package/ios/Pods/UserDefaults/UserStoreSingleton.swift +304 -0
  3. package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +2636 -0
  4. package/ios/Pods/ViewControllers/BaseVC.swift +141 -0
  5. package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +3347 -0
  6. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CityListTVC.swift +46 -0
  7. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CountryListTVC.swift +47 -0
  8. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/StateListTVC.swift +46 -0
  9. package/ios/Pods/ViewControllers/CountryListVC.swift +435 -0
  10. package/ios/Pods/ViewControllers/CustomOverlay.swift +199 -0
  11. package/ios/Pods/ViewControllers/EmailVerificationVC.swift +307 -0
  12. package/ios/Pods/ViewControllers/GrailPayVC.swift +244 -0
  13. package/ios/Pods/ViewControllers/OTPVerificationVC.swift +2066 -0
  14. package/ios/Pods/ViewControllers/PaymentDoneVC.swift +272 -0
  15. package/ios/Pods/ViewControllers/PaymentErrorVC.swift +85 -0
  16. package/ios/Pods/ViewControllers/PaymentInformation/AccountTypeTVC.swift +41 -0
  17. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +11025 -0
  18. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInformationCVC.swift +35 -0
  19. package/ios/Pods/ViewControllers/PaymentInformation/RecurringTVC.swift +40 -0
  20. package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +81 -0
  21. package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.xib +163 -0
  22. package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.swift +81 -0
  23. package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.xib +188 -0
  24. package/ios/Pods/ViewControllers/PaymentStatusWebViewVC.swift +167 -0
  25. package/ios/Pods/ViewControllers/TermAndConditionsVC.swift +63 -0
  26. package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +629 -0
  27. package/ios/easymerchantsdk.podspec +1 -1
  28. package/package.json +1 -1
@@ -0,0 +1,167 @@
1
+ //
2
+ // PaymentStatusWebViewVC.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 17/07/25.
6
+ //
7
+
8
+ //import UIKit
9
+ //import WebKit
10
+ //
11
+ //class PaymentStatusWebViewVC: UIViewController {
12
+ //
13
+ // var urlString: String?
14
+ // private var webView: WKWebView!
15
+ //
16
+ // override func viewDidLoad() {
17
+ // super.viewDidLoad()
18
+ // setupWebView()
19
+ // loadRequestedURL()
20
+ // }
21
+ //
22
+ // private func setupWebView() {
23
+ // webView = WKWebView(frame: self.view.bounds)
24
+ // webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
25
+ // self.view.addSubview(webView)
26
+ // }
27
+ //
28
+ // private func loadRequestedURL() {
29
+ // guard let urlString = urlString, let url = URL(string: urlString) else {
30
+ // print("Invalid URL string: \(String(describing: urlString))")
31
+ // return
32
+ // }
33
+ // let request = URLRequest(url: url)
34
+ // webView.load(request)
35
+ // }
36
+ //
37
+ //}
38
+
39
+
40
+ import UIKit
41
+ import WebKit
42
+
43
+ class PaymentStatusWebViewVC: UIViewController, WKNavigationDelegate {
44
+
45
+ var urlString: String?
46
+ private var webView: WKWebView!
47
+ private var closeButton: UIButton!
48
+ private var activityIndicator: UIActivityIndicatorView!
49
+ private var didShowCloseButton = false // 👈 Flag
50
+
51
+ override func viewDidLoad() {
52
+ super.viewDidLoad()
53
+ setupWebView()
54
+ setupCloseButton()
55
+ setupActivityIndicator()
56
+ loadRequestedURL()
57
+ }
58
+
59
+ private func setupWebView() {
60
+ webView = WKWebView(frame: self.view.bounds)
61
+ webView.navigationDelegate = self
62
+ webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
63
+ self.view.addSubview(webView)
64
+ }
65
+
66
+ private func setupCloseButton() {
67
+ closeButton = UIButton(type: .system)
68
+ if let closeImage = UIImage(systemName: "xmark.circle.fill") {
69
+ closeButton.setImage(closeImage, for: .normal)
70
+ closeButton.tintColor = .systemGray
71
+ } else {
72
+ closeButton.setTitle("✕", for: .normal)
73
+ closeButton.setTitleColor(.systemGray, for: .normal)
74
+ closeButton.titleLabel?.font = UIFont.systemFont(ofSize: 24, weight: .bold)
75
+ }
76
+ closeButton.frame = CGRect(x: self.view.bounds.width - 50, y: 50, width: 40, height: 40)
77
+ closeButton.autoresizingMask = [.flexibleLeftMargin, .flexibleBottomMargin]
78
+ closeButton.addTarget(self, action: #selector(closeButtonTapped), for: .touchUpInside)
79
+ closeButton.isHidden = true
80
+ self.view.addSubview(closeButton)
81
+ }
82
+
83
+ private func setupActivityIndicator() {
84
+ activityIndicator = UIActivityIndicatorView(style: .large)
85
+ activityIndicator.center = self.view.center
86
+ activityIndicator.hidesWhenStopped = true
87
+ self.view.addSubview(activityIndicator)
88
+ }
89
+
90
+ private func loadRequestedURL() {
91
+ guard let urlString = urlString, let url = URL(string: urlString) else {
92
+ print("Invalid URL string: \(String(describing: urlString))")
93
+ return
94
+ }
95
+ let request = URLRequest(url: url)
96
+ webView.load(request)
97
+ }
98
+
99
+ @objc private func closeButtonTapped() {
100
+ self.navigationController?.popViewController(animated: true)
101
+ }
102
+
103
+ // MARK: - WKNavigationDelegate
104
+ func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
105
+ print("WebView didStartProvisionalNavigation called")
106
+ activityIndicator.startAnimating()
107
+ closeButton.isHidden = true
108
+ didShowCloseButton = false // 👈 Reset the flag
109
+ }
110
+
111
+ func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
112
+ print("WebView didFinish called")
113
+ if !didShowCloseButton {
114
+ waitForPageToBeReady()
115
+ } else {
116
+ print("Close button already shown, skipping waitForPageToBeReady")
117
+ }
118
+ }
119
+
120
+ func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
121
+ activityIndicator.stopAnimating()
122
+ closeButton.isHidden = false
123
+ print("WebView failed with error: \(error.localizedDescription)")
124
+ }
125
+
126
+ func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
127
+ activityIndicator.stopAnimating()
128
+ closeButton.isHidden = false
129
+ print("WebView failed provisional navigation: \(error.localizedDescription)")
130
+ }
131
+
132
+ private func waitForPageToBeReady() {
133
+ webView.evaluateJavaScript("document.readyState") { [weak self] result, error in
134
+ guard let self = self else { return }
135
+ if let state = result as? String {
136
+ print("Page readyState:", state)
137
+ if state == "complete" {
138
+ self.checkIfPaymentUILoaded()
139
+ } else {
140
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
141
+ self.waitForPageToBeReady()
142
+ }
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ private func checkIfPaymentUILoaded() {
149
+ guard !didShowCloseButton else { return }
150
+
151
+ // Replace '.loader' with your actual loader class or ID
152
+ let js = "document.querySelector('.loader') == null"
153
+ webView.evaluateJavaScript(js) { [weak self] result, error in
154
+ guard let self = self else { return }
155
+ if let loaded = result as? Bool, loaded == true {
156
+ print("Payment UI fully loaded")
157
+ self.activityIndicator.stopAnimating()
158
+ self.closeButton.isHidden = false
159
+ self.didShowCloseButton = true // 👈 Mark as shown
160
+ } else {
161
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
162
+ self.checkIfPaymentUILoaded()
163
+ }
164
+ }
165
+ }
166
+ }
167
+ }
@@ -0,0 +1,63 @@
1
+ //
2
+ // TermAndConditionsVC.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 02/09/24.
6
+ //
7
+
8
+ import UIKit
9
+
10
+ class TermAndConditionsVC: UIViewController {
11
+
12
+ @IBOutlet weak var lblTermAndConditions: UILabel!
13
+ @IBOutlet weak var lblSubHead1: UILabel!
14
+ @IBOutlet weak var lblInfo1: UILabel!
15
+ @IBOutlet weak var lblSubHead2: UILabel!
16
+ @IBOutlet weak var lblInfo2: UILabel!
17
+ @IBOutlet weak var lblSubHead3: UILabel!
18
+ @IBOutlet weak var lblInfo3: UILabel!
19
+ @IBOutlet weak var lblInfo4: UILabel!
20
+
21
+ override func viewDidLoad() {
22
+ super.viewDidLoad()
23
+
24
+ uiFinishingTouchElements()
25
+ }
26
+
27
+ func uiFinishingTouchElements() {
28
+ if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
29
+ let uiColor = UIColor(hex: primaryFontColor) {
30
+ lblTermAndConditions.textColor = uiColor
31
+ lblInfo1.textColor = uiColor
32
+ lblInfo2.textColor = uiColor
33
+ lblInfo3.textColor = uiColor
34
+ lblInfo4.textColor = uiColor
35
+ }
36
+
37
+ if let primaryFontColor = UserStoreSingleton.shared.secondary_font_col,
38
+ let uiColor = UIColor(hex: primaryFontColor) {
39
+ lblSubHead1.textColor = uiColor
40
+ lblSubHead2.textColor = uiColor
41
+ lblSubHead3.textColor = uiColor
42
+ }
43
+
44
+ if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
45
+ let uiColor = UIColor(hex: containerBGcolor) {
46
+ self.view.backgroundColor = uiColor
47
+ }
48
+
49
+ if let fontSizeString = UserStoreSingleton.shared.fontSize,
50
+ let fontSizeDouble = Double(fontSizeString) { // Convert String to Double
51
+ let fontSize = CGFloat(fontSizeDouble) // Convert Double to CGFloat
52
+ lblInfo1.font = UIFont.systemFont(ofSize: fontSize)
53
+ lblInfo2.font = UIFont.systemFont(ofSize: fontSize)
54
+ lblInfo3.font = UIFont.systemFont(ofSize: fontSize)
55
+ lblInfo4.font = UIFont.systemFont(ofSize: fontSize)
56
+ }
57
+ }
58
+
59
+ @IBAction func actionBtnClose(_ sender: UIButton) {
60
+ self.dismiss(animated: true)
61
+ }
62
+
63
+ }