@jimrising/easymerchantsdk-react-native 1.2.1 → 1.2.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/.idea/caches/deviceStreaming.xml +209 -0
- package/.idea/workspace.xml +193 -0
- package/README.md +1 -1
- package/ios/Classes/EasyMerchantSdk.m +5 -5
- package/ios/Pods/UserDefaults/UserStoreSingleton.swift +233 -0
- package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +1137 -0
- package/ios/Pods/ViewControllers/BaseVC.swift +126 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +803 -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/CountryListVC.swift +404 -0
- package/ios/Pods/ViewControllers/EmailVerificationVC.swift +239 -0
- package/ios/Pods/ViewControllers/OTPVerificationVC.swift +1134 -0
- package/ios/Pods/ViewControllers/PaymentDoneVC.swift +159 -0
- package/ios/Pods/ViewControllers/PaymentErrorVC.swift +90 -0
- package/ios/Pods/ViewControllers/PaymentInformation/AccountTypeTVC.swift +41 -0
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +5160 -0
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInformationCVC.swift +35 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +77 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.xib +163 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.swift +76 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.xib +184 -0
- package/ios/Pods/ViewControllers/TermAndConditionsVC.swift +63 -0
- package/ios/easymerchantsdk.podspec +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,159 @@
|
|
|
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 lblDate: UILabel!
|
|
13
|
+
@IBOutlet weak var lblTransactionId: UILabel!
|
|
14
|
+
@IBOutlet weak var lblPaymentSource: UILabel!
|
|
15
|
+
@IBOutlet weak var lblTotal: UILabel!
|
|
16
|
+
@IBOutlet weak var btnDone: UIButton!
|
|
17
|
+
|
|
18
|
+
@IBOutlet weak var lblHeadingDate: UILabel!
|
|
19
|
+
@IBOutlet weak var lblHeadingTransactionID: UILabel!
|
|
20
|
+
@IBOutlet weak var lbHeadingPaymentMethod: UILabel!
|
|
21
|
+
@IBOutlet weak var lblHeadingTotal: UILabel!
|
|
22
|
+
|
|
23
|
+
var chargeData: [String: Any]?
|
|
24
|
+
var selectedPaymentMethod: String?
|
|
25
|
+
var easyPayDelegate: EasyPayViewControllerDelegate?
|
|
26
|
+
|
|
27
|
+
//Crypto
|
|
28
|
+
var amount: String?
|
|
29
|
+
var dateCreated: String?
|
|
30
|
+
var transactionId: String?
|
|
31
|
+
var isFrom = String()
|
|
32
|
+
|
|
33
|
+
override func viewDidLoad() {
|
|
34
|
+
super.viewDidLoad()
|
|
35
|
+
|
|
36
|
+
uiFinishingTouchElements()
|
|
37
|
+
|
|
38
|
+
if isFrom == "Crypto" {
|
|
39
|
+
// Display the crypto data if available
|
|
40
|
+
lblTotal.text = "$\(amount ?? "0.00")"
|
|
41
|
+
lblTransactionId.text = transactionId ?? "Transaction ID not available"
|
|
42
|
+
|
|
43
|
+
// Validate and format the date
|
|
44
|
+
if let dateCreated = dateCreated, isValidDate(dateCreated) {
|
|
45
|
+
lblDate.text = dateCreated
|
|
46
|
+
} else {
|
|
47
|
+
lblDate.text = "Date not available"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
} else {
|
|
51
|
+
// Default behavior for non-crypto payment methods
|
|
52
|
+
if let chargeData = chargeData {
|
|
53
|
+
print("Charge Data: \(chargeData)")
|
|
54
|
+
|
|
55
|
+
if let chargeId = chargeData["charge_id"] as? String {
|
|
56
|
+
lblTransactionId.text = chargeId
|
|
57
|
+
} else {
|
|
58
|
+
lblTransactionId.text = "Charge ID not available"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
lblPaymentSource.text = selectedPaymentMethod
|
|
63
|
+
lblTotal.text = "$\(UserStoreSingleton.shared.price ?? "0.00")"
|
|
64
|
+
showDateAndTime()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
override func viewWillAppear(_ animated: Bool) {
|
|
70
|
+
uiFinishingTouchElements()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
func uiFinishingTouchElements() {
|
|
74
|
+
// Set background color for the main view
|
|
75
|
+
if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
|
|
76
|
+
let uiColor = UIColor(hex: containerBGcolor) {
|
|
77
|
+
self.view.backgroundColor = uiColor
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if let primaryBtnBackGroundColor = UserStoreSingleton.shared.primary_btn_bg_col,
|
|
81
|
+
let uiColor = UIColor(hex: primaryBtnBackGroundColor) {
|
|
82
|
+
btnDone.backgroundColor = uiColor
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if let primaryBtnFontColor = UserStoreSingleton.shared.primary_btn_font_col,
|
|
86
|
+
let secondaryUIColor = UIColor(hex: primaryBtnFontColor) {
|
|
87
|
+
btnDone.setTitleColor(secondaryUIColor, for: .normal)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if let borderRadiusString = UserStoreSingleton.shared.border_radious,
|
|
91
|
+
let borderRadius = Double(borderRadiusString) { // Convert String to Double
|
|
92
|
+
btnDone.layer.cornerRadius = CGFloat(borderRadius) // Set corner radius
|
|
93
|
+
} else {
|
|
94
|
+
btnDone.layer.cornerRadius = 8 // Default value
|
|
95
|
+
}
|
|
96
|
+
btnDone.layer.masksToBounds = true // Ensure the corners are clipped properly
|
|
97
|
+
|
|
98
|
+
if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
|
|
99
|
+
let uiColor = UIColor(hex: primaryFontColor) {
|
|
100
|
+
lblHeadingDate.textColor = uiColor
|
|
101
|
+
lblHeadingTransactionID.textColor = uiColor
|
|
102
|
+
lbHeadingPaymentMethod.textColor = uiColor
|
|
103
|
+
lblHeadingTotal.textColor = uiColor
|
|
104
|
+
lblDate.textColor = uiColor
|
|
105
|
+
lblTransactionId.textColor = uiColor
|
|
106
|
+
lblPaymentSource.textColor = uiColor
|
|
107
|
+
lblTotal.textColor = uiColor
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if let fontSizeString = UserStoreSingleton.shared.fontSize,
|
|
111
|
+
let fontSizeDouble = Double(fontSizeString) { // Convert String to Double
|
|
112
|
+
let fontSize = CGFloat(fontSizeDouble) // Convert Double to CGFloat
|
|
113
|
+
lblDate.font = UIFont.systemFont(ofSize: fontSize)
|
|
114
|
+
lblTransactionId.font = UIFont.systemFont(ofSize: fontSize)
|
|
115
|
+
lblPaymentSource.font = UIFont.systemFont(ofSize: fontSize)
|
|
116
|
+
lblTotal.font = UIFont.systemFont(ofSize: fontSize)
|
|
117
|
+
lblHeadingDate.font = UIFont.systemFont(ofSize: fontSize)
|
|
118
|
+
lblHeadingTransactionID.font = UIFont.systemFont(ofSize: fontSize)
|
|
119
|
+
lbHeadingPaymentMethod.font = UIFont.systemFont(ofSize: fontSize)
|
|
120
|
+
lblHeadingTotal.font = UIFont.systemFont(ofSize: fontSize)
|
|
121
|
+
btnDone.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Helper method to check if the date string is valid
|
|
127
|
+
func isValidDate(_ dateString: String) -> Bool {
|
|
128
|
+
let dateFormatter = DateFormatter()
|
|
129
|
+
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
|
|
130
|
+
return dateFormatter.date(from: dateString) != nil
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
func showDateAndTime() {
|
|
134
|
+
// Get the current date and time
|
|
135
|
+
let currentDate = Date()
|
|
136
|
+
// Format the date and time as "dd/MM/yyyy, HH:mm:ss"
|
|
137
|
+
let dateFormatter = DateFormatter()
|
|
138
|
+
dateFormatter.dateFormat = "dd/MM/yyyy, HH:mm:ss"
|
|
139
|
+
let formattedDate = dateFormatter.string(from: currentDate)
|
|
140
|
+
// Set the formatted date and time to the lblDate
|
|
141
|
+
lblDate.text = formattedDate
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@IBAction func actionBtnDone(_ sender: UIButton) {
|
|
145
|
+
let result = Result(type: .success, chargeData: chargeData)
|
|
146
|
+
easyPayDelegate?.easyPayController(self.navigationController as! EasyPayViewController, didFinishWith: result)
|
|
147
|
+
|
|
148
|
+
if let easyPayVC = self.navigationController as? EasyPayViewController {
|
|
149
|
+
easyPayVC.dismiss(animated: true, completion: {
|
|
150
|
+
// Ensure the chargeData is sent back to the starting screen
|
|
151
|
+
if let delegate = easyPayVC.easyPayDelegate {
|
|
152
|
+
UserStoreSingleton.shared.isLoggedIn = false
|
|
153
|
+
delegate.easyPayController(easyPayVC, didFinishWith: result)
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PaymentErrorVC.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by Mony's Mac on 20/08/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
class PaymentErrorVC: UIViewController {
|
|
11
|
+
|
|
12
|
+
@IBOutlet weak var btnDone: UIButton!
|
|
13
|
+
@IBOutlet weak var lblError: UILabel!
|
|
14
|
+
|
|
15
|
+
var errorMessage: String?
|
|
16
|
+
var easyPayDelegate: EasyPayViewControllerDelegate?
|
|
17
|
+
|
|
18
|
+
override func viewDidLoad() {
|
|
19
|
+
super.viewDidLoad()
|
|
20
|
+
|
|
21
|
+
uiFinishingTouchElements()
|
|
22
|
+
|
|
23
|
+
lblError.text = errorMessage
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
override func viewWillAppear(_ animated: Bool) {
|
|
27
|
+
uiFinishingTouchElements()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
func uiFinishingTouchElements() {
|
|
31
|
+
// Set background color for the main view
|
|
32
|
+
if let containerBGcolor = UserStoreSingleton.shared.container_bg_col,
|
|
33
|
+
let uiColor = UIColor(hex: containerBGcolor) {
|
|
34
|
+
self.view.backgroundColor = uiColor
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if let primaryBtnBackGroundColor = UserStoreSingleton.shared.primary_btn_bg_col,
|
|
38
|
+
let uiColor = UIColor(hex: primaryBtnBackGroundColor) {
|
|
39
|
+
btnDone.backgroundColor = uiColor
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if let primaryBtnFontColor = UserStoreSingleton.shared.primary_btn_font_col,
|
|
43
|
+
let secondaryUIColor = UIColor(hex: primaryBtnFontColor) {
|
|
44
|
+
btnDone.setTitleColor(secondaryUIColor, for: .normal)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if let borderRadiusString = UserStoreSingleton.shared.border_radious,
|
|
48
|
+
let borderRadius = Double(borderRadiusString) { // Convert String to Double
|
|
49
|
+
btnDone.layer.cornerRadius = CGFloat(borderRadius) // Set corner radius
|
|
50
|
+
} else {
|
|
51
|
+
btnDone.layer.cornerRadius = 8 // Default value
|
|
52
|
+
}
|
|
53
|
+
btnDone.layer.masksToBounds = true // Ensure the corners are clipped properly
|
|
54
|
+
|
|
55
|
+
if let primaryFontColor = UserStoreSingleton.shared.primary_font_col,
|
|
56
|
+
let uiColor = UIColor(hex: primaryFontColor) {
|
|
57
|
+
lblError.textColor = uiColor
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if let fontSizeString = UserStoreSingleton.shared.fontSize,
|
|
61
|
+
let fontSizeDouble = Double(fontSizeString) { // Convert String to Double
|
|
62
|
+
let fontSize = CGFloat(fontSizeDouble) // Convert Double to CGFloat
|
|
63
|
+
lblError.font = UIFont.systemFont(ofSize: fontSize)
|
|
64
|
+
btnDone.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@IBAction func actionBtnDone(_ sender: UIButton) {
|
|
70
|
+
let result = Result(type: .error, chargeData: nil)
|
|
71
|
+
|
|
72
|
+
// Pass the error message back using the delegate
|
|
73
|
+
easyPayDelegate?.easyPayController(self.navigationController as! EasyPayViewController, didFinishWith: result)
|
|
74
|
+
|
|
75
|
+
if let easyPayVC = self.navigationController as? EasyPayViewController {
|
|
76
|
+
easyPayVC.dismiss(animated: true, completion: {
|
|
77
|
+
// Ensure the error message is sent back to the starting screen
|
|
78
|
+
if let delegate = easyPayVC.easyPayDelegate {
|
|
79
|
+
UserStoreSingleton.shared.isLoggedIn = false
|
|
80
|
+
let errorResult = Result(type: .error, chargeData: ["errorMessage": self.errorMessage ?? "Unknown error"])
|
|
81
|
+
delegate.easyPayController(easyPayVC, didFinishWith: errorResult)
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
@@ -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
|
+
}
|