@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.
- package/.yarn/install-state.gz +0 -0
- package/ios/Pods/Storyboard/EasyPaySdk.storyboard +9089 -0
- package/ios/Pods/UserDefaults/UserStoreSingleton.swift +424 -0
- package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +2894 -0
- package/ios/Pods/ViewControllers/BaseVC.swift +142 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +3686 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CityListTVC.swift +46 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CountryListTVC.swift +47 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/StateListTVC.swift +46 -0
- package/ios/Pods/ViewControllers/Clean Runner_2025-07-23T14-58-05.txt +13 -0
- package/ios/Pods/ViewControllers/CountryListVC.swift +435 -0
- package/ios/Pods/ViewControllers/EmailVerificationVC.swift +286 -0
- package/ios/Pods/ViewControllers/GrailPayVC.swift +483 -0
- package/ios/Pods/ViewControllers/OTPVerificationVC.swift +2193 -0
- package/ios/Pods/ViewControllers/PaymentDoneVC.swift +284 -0
- package/ios/Pods/ViewControllers/PaymentErrorVC.swift +85 -0
- package/ios/Pods/ViewControllers/PaymentInformation/AccountTypeTVC.swift +41 -0
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +12875 -0
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInformationCVC.swift +35 -0
- package/ios/Pods/ViewControllers/PaymentInformation/RecurringTVC.swift +40 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +80 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.xib +163 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.swift +81 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.xib +188 -0
- package/ios/Pods/ViewControllers/PaymentStatusWebViewVC.swift +158 -0
- package/ios/Pods/ViewControllers/TermAndConditionsVC.swift +63 -0
- package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +1216 -0
- package/ios/easymerchantsdk.podspec +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
//
|
|
2
|
+
// EmailVerficationVC.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by Mony's Mac on 14/08/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
class EmailVerificationVC: BaseVC {
|
|
11
|
+
|
|
12
|
+
@IBOutlet weak var lblUsedSavedInfo: UILabel!
|
|
13
|
+
@IBOutlet weak var subLblUsedSavedInfo: UILabel!
|
|
14
|
+
@IBOutlet weak var txtFieldEmail: UITextField!
|
|
15
|
+
@IBOutlet weak var btnGetOTP: UIButton!
|
|
16
|
+
|
|
17
|
+
var cardNumber: String?
|
|
18
|
+
var expiryDate: String?
|
|
19
|
+
var cvv: String?
|
|
20
|
+
var nameOnCard: String?
|
|
21
|
+
var userEmail: String?
|
|
22
|
+
var billingInfoData: Data?
|
|
23
|
+
|
|
24
|
+
var amount: Int?
|
|
25
|
+
|
|
26
|
+
var chosenPlan: String?
|
|
27
|
+
var startDate: String?
|
|
28
|
+
|
|
29
|
+
var selectedPaymentMethod: String?
|
|
30
|
+
|
|
31
|
+
//Banking Params
|
|
32
|
+
var accountName: String?
|
|
33
|
+
var routingNumber: String?
|
|
34
|
+
var accountType: String?
|
|
35
|
+
var accountNumber: String?
|
|
36
|
+
|
|
37
|
+
var easyPayDelegate: EasyPayViewControllerDelegate?
|
|
38
|
+
|
|
39
|
+
var isSavedForFuture: Bool = false
|
|
40
|
+
|
|
41
|
+
//GrailPay Params
|
|
42
|
+
var grailPayAccountID: String?
|
|
43
|
+
var selectedGrailPayAccountType: String?
|
|
44
|
+
var selectedGrailPayAccountName: String?
|
|
45
|
+
|
|
46
|
+
var request: Request!
|
|
47
|
+
|
|
48
|
+
var fieldSection: FieldSection?
|
|
49
|
+
var additionalInfo: [FieldItem]?
|
|
50
|
+
var billingInfo: [FieldItem]?
|
|
51
|
+
var visibility: FieldsVisibility?
|
|
52
|
+
|
|
53
|
+
var isSavedNewAccount: Bool?
|
|
54
|
+
var isFrom = String()
|
|
55
|
+
|
|
56
|
+
var isSavedNewCard: Bool = false
|
|
57
|
+
|
|
58
|
+
override func viewDidLoad() {
|
|
59
|
+
super.viewDidLoad()
|
|
60
|
+
|
|
61
|
+
uiFinishingTouch()
|
|
62
|
+
|
|
63
|
+
// Add tap gesture recognizer to dismiss the keyboard
|
|
64
|
+
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
|
|
65
|
+
view.addGestureRecognizer(tapGesture)
|
|
66
|
+
|
|
67
|
+
if let email = userEmail {
|
|
68
|
+
txtFieldEmail.text = email
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
decodeBillingInfo()
|
|
72
|
+
|
|
73
|
+
/// Email field editable or not editable handling
|
|
74
|
+
DispatchQueue.main.async {
|
|
75
|
+
let isEmailEditable = self.request.isEmail ?? true
|
|
76
|
+
self.txtFieldEmail.isUserInteractionEnabled = isEmailEditable
|
|
77
|
+
|
|
78
|
+
// Get custom primary font color or fallback to .label
|
|
79
|
+
let primaryFontColorHex = UserStoreSingleton.shared.primary_font_col ?? "#000000"
|
|
80
|
+
let primaryFontColor = UIColor(hex: primaryFontColorHex) ?? .label
|
|
81
|
+
|
|
82
|
+
if let text = self.txtFieldEmail.text {
|
|
83
|
+
let attributes: [NSAttributedString.Key: Any] = [
|
|
84
|
+
.foregroundColor: isEmailEditable ? primaryFontColor : UIColor.gray
|
|
85
|
+
]
|
|
86
|
+
self.txtFieldEmail.attributedText = NSAttributedString(string: text, attributes: attributes)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Optional: Hide cursor if not editable
|
|
90
|
+
self.txtFieldEmail.tintColor = isEmailEditable ? primaryFontColor : .clear
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// MARK: - Decode billingInfoData
|
|
95
|
+
private func decodeBillingInfo() {
|
|
96
|
+
guard let data = billingInfoData else {
|
|
97
|
+
return
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
do {
|
|
101
|
+
let decodedSection = try JSONDecoder().decode(FieldSection.self, from: data)
|
|
102
|
+
self.fieldSection = decodedSection
|
|
103
|
+
self.billingInfo = decodedSection.billing
|
|
104
|
+
self.additionalInfo = decodedSection.additional
|
|
105
|
+
self.visibility = decodedSection.visibility
|
|
106
|
+
|
|
107
|
+
} catch {
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
func uiFinishingTouch() {
|
|
112
|
+
if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
|
|
113
|
+
let uiColor = UIColor(hex: containerBGcolor) {
|
|
114
|
+
self.view.backgroundColor = uiColor
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
|
|
118
|
+
let uiColor = UIColor(hex: primaryFontColor) {
|
|
119
|
+
lblUsedSavedInfo.textColor = uiColor
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if let primaryFontColor = UserStoreSingleton.shared.secondary_font_col,
|
|
123
|
+
let uiColor = UIColor(hex: primaryFontColor) {
|
|
124
|
+
subLblUsedSavedInfo.textColor = uiColor
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if let primaryFontColor = UserStoreSingleton.shared.primary_btn_bg_col,
|
|
128
|
+
let uiColor = UIColor(hex: primaryFontColor) {
|
|
129
|
+
btnGetOTP.backgroundColor = uiColor
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if let secondaryBtnBackgroundColor = UserStoreSingleton.shared.primary_btn_font_col,
|
|
133
|
+
let secondaryUIColor = UIColor(hex: secondaryBtnBackgroundColor) {
|
|
134
|
+
btnGetOTP.setTitleColor(secondaryUIColor, for: .normal)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if let borderRadiusString = UserStoreSingleton.shared.border_radious,
|
|
138
|
+
let borderRadius = Double(borderRadiusString) { // Convert String to Double
|
|
139
|
+
btnGetOTP.layer.cornerRadius = CGFloat(borderRadius) // Set corner radius
|
|
140
|
+
} else {
|
|
141
|
+
btnGetOTP.layer.cornerRadius = 8 // Default value
|
|
142
|
+
}
|
|
143
|
+
btnGetOTP.layer.masksToBounds = true // Ensure the corners are clipped properly
|
|
144
|
+
|
|
145
|
+
if let fontSizeString = UserStoreSingleton.shared.fontSize,
|
|
146
|
+
let fontSizeDouble = Double(fontSizeString) { // Convert String to Double
|
|
147
|
+
let fontSize = CGFloat(fontSizeDouble) // Convert Double to CGFloat
|
|
148
|
+
subLblUsedSavedInfo.font = UIFont.systemFont(ofSize: fontSize)
|
|
149
|
+
btnGetOTP.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Method to dismiss the keyboard
|
|
154
|
+
@objc func dismissKeyboard() {
|
|
155
|
+
view.endEditing(true)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// MARK: - Send OTP Email Verification Api
|
|
159
|
+
func emailVerificationApi() {
|
|
160
|
+
showLoadingIndicator()
|
|
161
|
+
|
|
162
|
+
let fullURL = EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.emailVerification.path()
|
|
163
|
+
|
|
164
|
+
guard let serviceURL = URL(string: fullURL) else {
|
|
165
|
+
hideLoadingIndicator()
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
var request = URLRequest(url: serviceURL)
|
|
170
|
+
request.httpMethod = "POST"
|
|
171
|
+
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
172
|
+
|
|
173
|
+
let token = UserStoreSingleton.shared.clientToken
|
|
174
|
+
request.addValue(token ?? "", forHTTPHeaderField: "Client-Token")
|
|
175
|
+
|
|
176
|
+
let params: [String: Any] = [
|
|
177
|
+
"card_search_value": txtFieldEmail.text ?? "",
|
|
178
|
+
"card_search_key": "email"
|
|
179
|
+
]
|
|
180
|
+
|
|
181
|
+
do {
|
|
182
|
+
let jsonData = try JSONSerialization.data(withJSONObject: params, options: .prettyPrinted)
|
|
183
|
+
request.httpBody = jsonData
|
|
184
|
+
if let jsonString = String(data: jsonData, encoding: .utf8) {
|
|
185
|
+
}
|
|
186
|
+
} catch let error {
|
|
187
|
+
hideLoadingIndicator()
|
|
188
|
+
return
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
let session = URLSession.shared
|
|
192
|
+
let task = session.dataTask(with: request) { (serviceData, serviceResponse, error) in
|
|
193
|
+
|
|
194
|
+
DispatchQueue.main.async {
|
|
195
|
+
self.hideLoadingIndicator()
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if let error = error {
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
guard let httpResponse = serviceResponse as? HTTPURLResponse else {
|
|
203
|
+
return
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if httpResponse.statusCode == 200 || httpResponse.statusCode == 201 {
|
|
207
|
+
if let data = serviceData {
|
|
208
|
+
do {
|
|
209
|
+
if let responseObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
|
|
210
|
+
|
|
211
|
+
DispatchQueue.main.async {
|
|
212
|
+
if let vc = self.storyboard?.instantiateViewController(withIdentifier: "OTPVerificationVC") as? OTPVerificationVC {
|
|
213
|
+
vc.selectedPaymentMethod = self.selectedPaymentMethod
|
|
214
|
+
vc.easyPayDelegate = self.easyPayDelegate
|
|
215
|
+
vc.email = self.txtFieldEmail.text
|
|
216
|
+
vc.chosenPlan = self.chosenPlan
|
|
217
|
+
vc.startDate = self.startDate
|
|
218
|
+
vc.request = self.request
|
|
219
|
+
vc.billingInfoData = self.billingInfoData
|
|
220
|
+
vc.userEmail = self.userEmail
|
|
221
|
+
vc.billingInfo = self.fieldSection?.billing
|
|
222
|
+
vc.additionalInfo = self.fieldSection?.additional
|
|
223
|
+
vc.visibility = self.fieldSection?.visibility
|
|
224
|
+
vc.isSavedForFuture = self.isSavedForFuture
|
|
225
|
+
|
|
226
|
+
switch self.selectedPaymentMethod {
|
|
227
|
+
case "Card":
|
|
228
|
+
vc.cardNumber = self.cardNumber
|
|
229
|
+
vc.expiryDate = self.expiryDate
|
|
230
|
+
vc.cvv = self.cvv
|
|
231
|
+
vc.nameOnCard = self.nameOnCard
|
|
232
|
+
|
|
233
|
+
case "Bank":
|
|
234
|
+
vc.accountName = self.accountName
|
|
235
|
+
vc.routingNumber = self.routingNumber
|
|
236
|
+
vc.accountType = self.accountType
|
|
237
|
+
vc.accountNumber = self.accountNumber
|
|
238
|
+
|
|
239
|
+
case "GrailPay":
|
|
240
|
+
vc.grailPayAccountID = self.grailPayAccountID
|
|
241
|
+
vc.selectedGrailPayAccountType = self.selectedGrailPayAccountType
|
|
242
|
+
vc.selectedGrailPayAccountName = self.selectedGrailPayAccountName
|
|
243
|
+
|
|
244
|
+
default:
|
|
245
|
+
break
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
self.navigationController?.pushViewController(vc, animated: true)
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
}
|
|
253
|
+
} catch let jsonError {
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
task.resume()
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
@IBAction func actionBtnCancel(_ sender: UIButton) {
|
|
264
|
+
for viewController in self.navigationController?.viewControllers ?? [] {
|
|
265
|
+
if viewController is PaymentInfoVC {
|
|
266
|
+
self.navigationController?.popToViewController(viewController, animated: true)
|
|
267
|
+
break
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
@IBAction func actionBtnGetOTP(_ sender: UIButton) {
|
|
273
|
+
guard let email = txtFieldEmail.text, !email.isEmpty else {
|
|
274
|
+
// Show an alert if the email field is empty
|
|
275
|
+
showAlert(message: "Please enter an email address.")
|
|
276
|
+
return
|
|
277
|
+
}
|
|
278
|
+
// Validate email format before calling the API
|
|
279
|
+
if isValidEmail(email) {
|
|
280
|
+
emailVerificationApi()
|
|
281
|
+
} else {
|
|
282
|
+
showAlert(message: "Please enter a valid email address.")
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
}
|