@jimrising/easymerchantsdk-react-native 2.5.1 → 2.5.2

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 (29) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/ios/Pods/Storyboard/EasyPaySdk.storyboard +9089 -0
  3. package/ios/Pods/UserDefaults/UserStoreSingleton.swift +424 -0
  4. package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +2894 -0
  5. package/ios/Pods/ViewControllers/BaseVC.swift +142 -0
  6. package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +3686 -0
  7. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CityListTVC.swift +46 -0
  8. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CountryListTVC.swift +47 -0
  9. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/StateListTVC.swift +46 -0
  10. package/ios/Pods/ViewControllers/Clean Runner_2025-07-23T14-58-05.txt +13 -0
  11. package/ios/Pods/ViewControllers/CountryListVC.swift +435 -0
  12. package/ios/Pods/ViewControllers/EmailVerificationVC.swift +286 -0
  13. package/ios/Pods/ViewControllers/GrailPayVC.swift +483 -0
  14. package/ios/Pods/ViewControllers/OTPVerificationVC.swift +2193 -0
  15. package/ios/Pods/ViewControllers/PaymentDoneVC.swift +284 -0
  16. package/ios/Pods/ViewControllers/PaymentErrorVC.swift +85 -0
  17. package/ios/Pods/ViewControllers/PaymentInformation/AccountTypeTVC.swift +41 -0
  18. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +12875 -0
  19. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInformationCVC.swift +35 -0
  20. package/ios/Pods/ViewControllers/PaymentInformation/RecurringTVC.swift +40 -0
  21. package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +80 -0
  22. package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.xib +163 -0
  23. package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.swift +81 -0
  24. package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.xib +188 -0
  25. package/ios/Pods/ViewControllers/PaymentStatusWebViewVC.swift +158 -0
  26. package/ios/Pods/ViewControllers/TermAndConditionsVC.swift +63 -0
  27. package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +1216 -0
  28. package/ios/easymerchantsdk.podspec +1 -1
  29. package/package.json +1 -1
@@ -0,0 +1,284 @@
1
+ //
2
+ // PaymentDoneVC.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 13/08/24.
6
+ //
7
+
8
+ import UIKit
9
+
10
+ class PaymentDoneVC: UIViewController {
11
+
12
+ @IBOutlet weak var viewMain: UIView!
13
+ @IBOutlet weak var lblDate: UILabel!
14
+ @IBOutlet weak var lblTransactionId: UILabel!
15
+ @IBOutlet weak var lblPaymentSource: UILabel!
16
+ @IBOutlet weak var lblTotal: UILabel!
17
+ @IBOutlet weak var btnDone: UIButton!
18
+
19
+ @IBOutlet weak var lblHeadingDate: UILabel!
20
+ @IBOutlet weak var lblHeadingTransactionID: UILabel!
21
+ @IBOutlet weak var lbHeadingPaymentMethod: UILabel!
22
+ @IBOutlet weak var lblHeadingTotal: UILabel!
23
+
24
+ @IBOutlet weak var viewSubscriptionId: UIStackView!
25
+ @IBOutlet weak var lblHeadingSubscriptionId: UILabel!
26
+ @IBOutlet weak var lblSubscriptionId: UILabel!
27
+ @IBOutlet weak var lblBillingInfo: UILabel!
28
+
29
+ var chargeData: [String: Any]?
30
+ var selectedPaymentMethod: String?
31
+ var easyPayDelegate: EasyPayViewControllerDelegate?
32
+
33
+ //Crypto
34
+ var amount: String?
35
+ var dateCreated: String?
36
+ var transactionId: String?
37
+ var isFrom = String()
38
+
39
+ // Add these two properties:
40
+ var billingInfo: [String: Any]?
41
+ var additionalInfo: [String: Any]?
42
+
43
+ var additionalInfoData: [FieldItem]?
44
+ var billingInfoData: [FieldItem]?
45
+ var visibility: FieldsVisibility?
46
+
47
+ var bankPaymentParams: [String: Any]?
48
+
49
+ var request: Request!
50
+
51
+ override func viewDidLoad() {
52
+ super.viewDidLoad()
53
+
54
+ uiFinishingTouchElements()
55
+
56
+ if isFrom == "Crypto" {
57
+ // Display the crypto data if available
58
+ lblTotal.text = "$\(amount ?? "0.00")"
59
+ lblTransactionId.text = transactionId ?? "Transaction ID not available"
60
+
61
+ // Validate and format the date
62
+ if let dateCreated = dateCreated, isValidDate(dateCreated) {
63
+ lblDate.text = dateCreated
64
+ } else {
65
+ lblDate.text = "Date not available"
66
+ }
67
+
68
+ }
69
+ else {
70
+ // Default behavior for non-crypto payment methods
71
+ if let chargeData = chargeData {
72
+
73
+ if let chargeId = chargeData["charge_id"] as? String {
74
+ lblTransactionId.text = chargeId
75
+ } else {
76
+ lblTransactionId.text = "Charge ID not available"
77
+ }
78
+
79
+ // Handle subscription_id visibility
80
+ if let subscriptionId = chargeData["subscription_id"] as? String, !subscriptionId.isEmpty {
81
+ viewSubscriptionId.isHidden = false
82
+ lblSubscriptionId.text = subscriptionId
83
+ } else {
84
+ viewSubscriptionId.isHidden = true
85
+ }
86
+ }
87
+
88
+ lblPaymentSource.text = selectedPaymentMethod
89
+ let rawAmount = Double(request?.amount ?? 0)
90
+ let amountText = String(format: "$%.2f", rawAmount)
91
+ lblTotal.text = "\(amountText)"
92
+ showDateAndTime()
93
+ }
94
+
95
+ // showBillingInfo()
96
+
97
+ // if let paymentParams = bankPaymentParams {
98
+ // if let jsonData = try? JSONSerialization.data(withJSONObject: paymentParams, options: .prettyPrinted),
99
+ // let jsonString = String(data: jsonData, encoding: .utf8) {
100
+ // }
101
+ // }
102
+ }
103
+
104
+ override func viewWillAppear(_ animated: Bool) {
105
+ uiFinishingTouchElements()
106
+ }
107
+
108
+ func uiFinishingTouchElements() {
109
+ // Set background color for the main view
110
+ if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
111
+ let uiColor = UIColor(hex: containerBGcolor) {
112
+ self.view.backgroundColor = uiColor
113
+ self.viewMain.backgroundColor = uiColor
114
+ }
115
+
116
+ if let primaryBtnBackGroundColor = UserStoreSingleton.shared.primary_btn_bg_col,
117
+ let uiColor = UIColor(hex: primaryBtnBackGroundColor) {
118
+ btnDone.backgroundColor = uiColor
119
+ }
120
+
121
+ if let primaryBtnFontColor = UserStoreSingleton.shared.primary_btn_font_col,
122
+ let secondaryUIColor = UIColor(hex: primaryBtnFontColor) {
123
+ btnDone.setTitleColor(secondaryUIColor, for: .normal)
124
+ }
125
+
126
+ if let borderRadiusString = UserStoreSingleton.shared.border_radious,
127
+ let borderRadius = Double(borderRadiusString) { // Convert String to Double
128
+ btnDone.layer.cornerRadius = CGFloat(borderRadius) // Set corner radius
129
+ } else {
130
+ btnDone.layer.cornerRadius = 8 // Default value
131
+ }
132
+ btnDone.layer.masksToBounds = true // Ensure the corners are clipped properly
133
+
134
+ if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
135
+ let uiColor = UIColor(hex: primaryFontColor) {
136
+ lblHeadingDate.textColor = uiColor
137
+ lblHeadingTransactionID.textColor = uiColor
138
+ lbHeadingPaymentMethod.textColor = uiColor
139
+ lblHeadingTotal.textColor = uiColor
140
+ lblDate.textColor = uiColor
141
+ lblTransactionId.textColor = uiColor
142
+ lblPaymentSource.textColor = uiColor
143
+ lblTotal.textColor = uiColor
144
+ lblHeadingSubscriptionId.textColor = uiColor
145
+ lblSubscriptionId.textColor = uiColor
146
+ lblBillingInfo.textColor = uiColor
147
+ }
148
+
149
+ if let fontSizeString = UserStoreSingleton.shared.fontSize,
150
+ let fontSizeDouble = Double(fontSizeString) { // Convert String to Double
151
+ let fontSize = CGFloat(fontSizeDouble) // Convert Double to CGFloat
152
+ lblDate.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
153
+ lblTransactionId.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
154
+ lblPaymentSource.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
155
+ lblTotal.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
156
+ lblHeadingDate.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
157
+ lblHeadingTransactionID.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
158
+ lbHeadingPaymentMethod.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
159
+ lblHeadingTotal.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
160
+ btnDone.titleLabel?.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
161
+ lblHeadingSubscriptionId.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
162
+ lblSubscriptionId.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
163
+ lblBillingInfo.font = UIFont.systemFont(ofSize: fontSize, weight: .medium)
164
+ }
165
+
166
+ }
167
+
168
+ // func showBillingInfo() {
169
+ // var displayText = ""
170
+ //
171
+ // if let visibility = visibility {
172
+ // if visibility.billing, let billing = billingInfo {
173
+ // displayText += "Billing Info:-\n"
174
+ // for (key, value) in billing {
175
+ // displayText += "\(key.capitalized): \(value)\n"
176
+ // }
177
+ // }
178
+ //
179
+ // if visibility.additional, let additional = additionalInfo {
180
+ // if !displayText.isEmpty {
181
+ // displayText += "\n"
182
+ // }
183
+ // displayText += "Additional Info:-\n"
184
+ // for (key, value) in additional {
185
+ // displayText += "\(key.capitalized): \(value)\n"
186
+ // }
187
+ // }
188
+ // }
189
+ //
190
+ // if displayText.isEmpty {
191
+ // lblBillingInfo.isHidden = true
192
+ // } else {
193
+ // lblBillingInfo.text = displayText.trimmingCharacters(in: .whitespacesAndNewlines)
194
+ // lblBillingInfo.isHidden = false
195
+ // }
196
+ // }
197
+
198
+ // Helper method to check if the date string is valid
199
+ func isValidDate(_ dateString: String) -> Bool {
200
+ let dateFormatter = DateFormatter()
201
+ dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
202
+ return dateFormatter.date(from: dateString) != nil
203
+ }
204
+
205
+ func showDateAndTime() {
206
+ // Get the current date and time
207
+ let currentDate = Date()
208
+ // Format the date and time as "dd/MM/yyyy, HH:mm:ss"
209
+ let dateFormatter = DateFormatter()
210
+ dateFormatter.dateFormat = "dd/MM/yyyy, HH:mm:ss"
211
+ let formattedDate = dateFormatter.string(from: currentDate)
212
+ // Set the formatted date and time to the lblDate
213
+ lblDate.text = formattedDate
214
+ }
215
+
216
+ // @IBAction func actionBtnDone(_ sender: UIButton) {
217
+ // let result = SDKResult(type: .success,
218
+ // chargeData: chargeData,
219
+ // billingInfo: billingInfo,
220
+ // additionalInfo: additionalInfo)
221
+ //
222
+ // easyPayDelegate?.easyPayController(self.navigationController as! EasyPayViewController, didFinishWith: result)
223
+ //
224
+ // if let easyPayVC = self.navigationController as? EasyPayViewController {
225
+ // easyPayVC.dismiss(animated: true, completion: {
226
+ // if let delegate = easyPayVC.easyPayDelegate {
227
+ // UserStoreSingleton.shared.isLoggedIn = false
228
+ // delegate.easyPayController(easyPayVC, didFinishWith: result)
229
+ // }
230
+ // })
231
+ // }
232
+ // }
233
+
234
+ @IBAction func actionBtnDone(_ sender: UIButton) {
235
+ var finalChargeData = chargeData ?? [:]
236
+
237
+ // Add selected fields from bankPaymentParams
238
+ if let paymentParams = bankPaymentParams {
239
+ if let accountType = paymentParams["account_type"] {
240
+ finalChargeData["account_type"] = accountType
241
+ }
242
+ if let name = paymentParams["name"] {
243
+ finalChargeData["name"] = name
244
+ }
245
+ if let email = paymentParams["email"] {
246
+ finalChargeData["email"] = email
247
+ }
248
+ }
249
+
250
+ // Create response dictionary with all data
251
+ var response: [String: Any] = [:]
252
+
253
+ // Add charge data
254
+ for (key, value) in finalChargeData {
255
+ response[key] = value
256
+ }
257
+
258
+ // Add billing info if available
259
+ if let billing = billingInfo {
260
+ response["billingInfo"] = billing
261
+ }
262
+
263
+ // Add additional info if available
264
+ if let additional = additionalInfo {
265
+ response["additionalInfo"] = additional
266
+ }
267
+
268
+ // Create SDK result with combined data
269
+ let result = SDKResult(type: .success, data: response as NSDictionary)
270
+
271
+ // Notify delegate and dismiss
272
+ easyPayDelegate?.easyPayController(self.navigationController as! EasyPayViewController, didFinishWith: result)
273
+
274
+ if let easyPayVC = self.navigationController as? EasyPayViewController {
275
+ easyPayVC.dismiss(animated: true, completion: {
276
+ if let delegate = easyPayVC.easyPayDelegate {
277
+ UserStoreSingleton.shared.isLoggedIn = false
278
+ delegate.easyPayController(easyPayVC, didFinishWith: result)
279
+ }
280
+ })
281
+ }
282
+ }
283
+
284
+ }
@@ -0,0 +1,85 @@
1
+ ////
2
+ //// PaymentErrorVC.swift
3
+ //// EasyPay
4
+ ////
5
+ //// Created by Mony's Mac on 20/08/24.
6
+
7
+ import UIKit
8
+
9
+ class PaymentErrorVC: UIViewController {
10
+
11
+ @IBOutlet weak var btnDone: UIButton!
12
+ @IBOutlet weak var lblError: UILabel!
13
+
14
+ var errorMessage: String?
15
+ var errorStatus: Bool? // <-- NEW
16
+ var easyPayDelegate: EasyPayViewControllerDelegate?
17
+
18
+ override func viewDidLoad() {
19
+ super.viewDidLoad()
20
+ uiFinishingTouchElements()
21
+ lblError.text = errorMessage
22
+ }
23
+
24
+ override func viewWillAppear(_ animated: Bool) {
25
+ super.viewWillAppear(animated)
26
+ uiFinishingTouchElements()
27
+ }
28
+
29
+ func uiFinishingTouchElements() {
30
+ if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
31
+ let uiColor = UIColor(hex: containerBGcolor) {
32
+ self.view.backgroundColor = uiColor
33
+ }
34
+
35
+ if let primaryBtnBackGroundColor = UserStoreSingleton.shared.primary_btn_bg_col,
36
+ let uiColor = UIColor(hex: primaryBtnBackGroundColor) {
37
+ btnDone.backgroundColor = uiColor
38
+ }
39
+
40
+ if let primaryBtnFontColor = UserStoreSingleton.shared.primary_btn_font_col,
41
+ let secondaryUIColor = UIColor(hex: primaryBtnFontColor) {
42
+ btnDone.setTitleColor(secondaryUIColor, for: .normal)
43
+ }
44
+
45
+ if let borderRadiusString = UserStoreSingleton.shared.border_radious,
46
+ let borderRadius = Double(borderRadiusString) {
47
+ btnDone.layer.cornerRadius = CGFloat(borderRadius)
48
+ } else {
49
+ btnDone.layer.cornerRadius = 8
50
+ }
51
+ btnDone.layer.masksToBounds = true
52
+
53
+ if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
54
+ let uiColor = UIColor(hex: primaryFontColor) {
55
+ lblError.textColor = uiColor
56
+ }
57
+
58
+ if let fontSizeString = UserStoreSingleton.shared.fontSize,
59
+ let fontSizeDouble = Double(fontSizeString) {
60
+ let fontSize = CGFloat(fontSizeDouble)
61
+ lblError.font = UIFont.systemFont(ofSize: fontSize)
62
+ btnDone.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
63
+ }
64
+ }
65
+
66
+ @IBAction func actionBtnDone(_ sender: UIButton) {
67
+ let errorData: [String: Any] = [
68
+ "status": errorStatus ?? false,
69
+ "message": errorMessage ?? "Unknown error"
70
+ ]
71
+
72
+ let result = SDKResult(type: .error, data: errorData as NSDictionary)
73
+ easyPayDelegate?.easyPayController(self.navigationController as! EasyPayViewController, didFinishWith: result)
74
+
75
+ if let easyPayVC = self.navigationController as? EasyPayViewController {
76
+ easyPayVC.dismiss(animated: true) {
77
+ if let delegate = easyPayVC.easyPayDelegate {
78
+ UserStoreSingleton.shared.isLoggedIn = false
79
+ let errorResult = SDKResult(type: .error, data: errorData as NSDictionary)
80
+ delegate.easyPayController(easyPayVC, didFinishWith: errorResult)
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
@@ -0,0 +1,41 @@
1
+ //
2
+ // AccountTypeTVC.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 14/08/24.
6
+ //
7
+
8
+ import UIKit
9
+
10
+ class AccountTypeTVC: UITableViewCell {
11
+
12
+ @IBOutlet weak var lblAccountType: UILabel!
13
+ @IBOutlet weak var viewCell: UIView!
14
+
15
+ override func awakeFromNib() {
16
+ super.awakeFromNib()
17
+
18
+ if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
19
+ let uiColor = UIColor(hex: primaryFontColor) {
20
+ lblAccountType.textColor = uiColor
21
+ }
22
+
23
+ if let fontSizeString = UserStoreSingleton.shared.fontSize,
24
+ let fontSizeDouble = Double(fontSizeString) { // Convert String to Double
25
+ let fontSize = CGFloat(fontSizeDouble) // Convert Double to CGFloat
26
+ lblAccountType.font = UIFont.systemFont(ofSize: fontSize)
27
+ }
28
+
29
+ }
30
+
31
+ override func layoutSubviews() {
32
+ super.layoutSubviews()
33
+
34
+ if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
35
+ let uiColor = UIColor(hex: containerBGcolor) {
36
+ self.contentView.backgroundColor = uiColor
37
+ viewCell?.backgroundColor = uiColor // Prevents crash if viewCell is nil
38
+ }
39
+ }
40
+
41
+ }