@jimrising/easymerchantsdk-react-native 1.0.0
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 +340 -0
- package/.idea/em-MobileCheckoutSDK-ReactNative.iml +9 -0
- package/.idea/misc.xml +5 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +230 -0
- package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/results.bin +1 -0
- package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/BuildConfig.dex +0 -0
- package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
- package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
- package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkPackage.dex +0 -0
- package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/.transforms/41cd2635778c1bb5c18af2c46eb9196e/results.bin +1 -0
- package/android/build/.transforms/41cd2635778c1bb5c18af2c46eb9196e/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/results.bin +1 -0
- package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/BuildConfig.dex +0 -0
- package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
- package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
- package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkPackage.dex +0 -0
- package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/.transforms/7eb7ceaa43c9e8323ac65b4f785987b6/results.bin +1 -0
- package/android/build/.transforms/7eb7ceaa43c9e8323ac65b4f785987b6/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/results.bin +1 -0
- package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/BuildConfig.dex +0 -0
- package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
- package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
- package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkPackage.dex +0 -0
- package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/.transforms/f1a160720415bc76d8d6c6734c5acf3e/results.bin +1 -0
- package/android/build/.transforms/f1a160720415bc76d8d6c6734c5acf3e/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/generated/source/buildConfig/debug/com/reactlibrary/BuildConfig.java +10 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +7 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
- package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
- package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
- 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 +1 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
- 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.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 +2 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +7 -0
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +7 -0
- package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
- package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
- 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.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 +1 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +17 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1.class.uniqueId2 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule.class.uniqueId1 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkPackage.class.uniqueId0 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +55 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkModule.java +72 -0
- package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkPackage.java +28 -0
- package/index.js +5 -0
- package/ios/Bundle/EasyPayBundle.swift +22 -0
- package/ios/Classes/EasyMerchantSdk.h +4 -0
- package/ios/Classes/EasyMerchantSdk.m +43 -0
- package/ios/Classes/EasyMerchantSdk.swift +124 -0
- package/ios/Classes/EasyPayViewController.swift +90 -0
- package/ios/CustomComponents/CheckboxButton.swift +20 -0
- package/ios/CustomComponents/FilledButton.swift +17 -0
- package/ios/CustomComponents/OutlineButton.swift +26 -0
- package/ios/CustomComponents/TextFieldStackView.swift +96 -0
- package/ios/EnvironmentConfig.swift +63 -0
- package/ios/Example/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/ios/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
- package/ios/Example/Assets.xcassets/Contents.json +6 -0
- package/ios/Example/Base.lproj/LaunchScreen.storyboard +25 -0
- package/ios/Example/Base.lproj/Main.storyboard +65 -0
- package/ios/Example/SceneDelegate.swift +52 -0
- package/ios/Example/ViewController.swift +84 -0
- package/ios/Extensions/UIColor.swift +22 -0
- package/ios/Extensions/UIFont.swift +80 -0
- package/ios/Extensions/UIViewController+Extension.swift +42 -0
- package/ios/Models/AdditionalInfo.swift +16 -0
- package/ios/Models/BankAccountModel.swift +23 -0
- package/ios/Models/BillingInfo.swift +16 -0
- package/ios/Models/CardModel.swift +19 -0
- package/ios/Models/Country.swift +19 -0
- package/ios/Models/PaymentInfo.swift +46 -0
- package/ios/Models/Request.swift +245 -0
- package/ios/Models/Result.swift +69 -0
- package/ios/Pods/UserDefaults/UserStoreSingleton.swift +200 -0
- package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +1073 -0
- package/ios/Pods/ViewControllers/BaseVC.swift +117 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +616 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CityListTVC.swift +19 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CountryListTVC.swift +19 -0
- package/ios/Pods/ViewControllers/BillingInfoVC/Cells/StateListTVC.swift +19 -0
- package/ios/Pods/ViewControllers/CountryListVC.swift +367 -0
- package/ios/Pods/ViewControllers/EmailVerificationVC.swift +192 -0
- package/ios/Pods/ViewControllers/OTPVerificationVC.swift +1009 -0
- package/ios/Pods/ViewControllers/PaymentDoneVC.swift +94 -0
- package/ios/Pods/ViewControllers/PaymentErrorVC.swift +43 -0
- package/ios/Pods/ViewControllers/PaymentInformation/AccountTypeTVC.swift +19 -0
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +4269 -0
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInformationCVC.swift +20 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +37 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.xib +163 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.swift +40 -0
- package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.xib +184 -0
- package/ios/Pods/ViewControllers/TermAndConditionsVC.swift +21 -0
- package/ios/Resources/Assets.xcassets/Card/Amex.imageset/206682_american_express_method_card_payment_icon.svg +1 -0
- package/ios/Resources/Assets.xcassets/Card/Amex.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/Contents.json +6 -0
- package/ios/Resources/Assets.xcassets/Card/DinersClub.imageset/472318_card_club_diners_dinner_payment_icon.svg +1 -0
- package/ios/Resources/Assets.xcassets/Card/DinersClub.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/Discover.imageset/206686_network_payment_discover_card_method_icon.svg +1 -0
- package/ios/Resources/Assets.xcassets/Card/Discover.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/JCB.imageset/358102_card_jcb_payment_icon.svg +1 -0
- package/ios/Resources/Assets.xcassets/Card/JCB.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/MasterCard.imageset/206680_master_method_card_payment_icon.svg +1 -0
- package/ios/Resources/Assets.xcassets/Card/MasterCard.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/UnionPay.imageset/1468976_card_payment_unionpay_icon.svg +1 -0
- package/ios/Resources/Assets.xcassets/Card/UnionPay.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/Visa.imageset/206684_visa_method_card_payment_icon.svg +1 -0
- package/ios/Resources/Assets.xcassets/Card/Visa.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/maestro.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/maestro.imageset/maestro.svg +1 -0
- package/ios/Resources/Assets.xcassets/Card/paypal.imageset/206675_paypal_method_payment_icon.svg +1 -0
- package/ios/Resources/Assets.xcassets/Card/paypal.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/rupay.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/rupay.imageset/rupay.svg +1 -0
- package/ios/Resources/Assets.xcassets/Card/unknown_card.imageset/4635000_card_credit_digital_money_icon.svg +1 -0
- package/ios/Resources/Assets.xcassets/Card/unknown_card.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/worldpay.imageset/Contents.json +12 -0
- package/ios/Resources/Assets.xcassets/Card/worldpay.imageset/worldpay.svg +1 -0
- package/ios/Resources/Assets.xcassets/Contents.json +6 -0
- package/ios/Resources/Assets.xcassets/Ellipsis.imageset/Contents.json +23 -0
- package/ios/Resources/Assets.xcassets/Ellipsis.imageset/icons8-menu-30.png +0 -0
- package/ios/Resources/Assets.xcassets/Ellipsis.imageset/icons8-menu-60.png +0 -0
- package/ios/Resources/Assets.xcassets/Ellipsis.imageset/icons8-menu-90.png +0 -0
- package/ios/Resources/Assets.xcassets/Rotate.imageset/Contents.json +23 -0
- package/ios/Resources/Assets.xcassets/Rotate.imageset/refresh-cw-2.png +0 -0
- package/ios/Resources/Assets.xcassets/Rotate.imageset/refresh-cw-3.png +0 -0
- package/ios/Resources/Assets.xcassets/Rotate.imageset/refresh-cw.png +0 -0
- package/ios/Resources/Assets.xcassets/amexCvc.imageset/Contents.json +22 -0
- package/ios/Resources/Assets.xcassets/amexCvc.imageset/Group-1.png +0 -0
- package/ios/Resources/Assets.xcassets/amexCvc.imageset/Group.png +0 -0
- package/ios/Resources/Assets.xcassets/check.imageset/Contents.json +23 -0
- package/ios/Resources/Assets.xcassets/check.imageset/check-circle-4.png +0 -0
- package/ios/Resources/Assets.xcassets/check.imageset/check-circle-5.png +0 -0
- package/ios/Resources/Assets.xcassets/check.imageset/check-circle-6.png +0 -0
- package/ios/Resources/Assets.xcassets/chip.imageset/Contents.json +21 -0
- package/ios/Resources/Assets.xcassets/chip.imageset/chip.png +0 -0
- package/ios/Resources/Assets.xcassets/loaderImage.imageset/Contents.json +23 -0
- package/ios/Resources/Assets.xcassets/loaderImage.imageset/check-circle-2.png +0 -0
- package/ios/Resources/Assets.xcassets/loaderImage.imageset/check-circle-3.png +0 -0
- package/ios/Resources/Assets.xcassets/loaderImage.imageset/check-circle.png +0 -0
- package/ios/Resources/Assets.xcassets/payment_done_icon.imageset/Contents.json +23 -0
- package/ios/Resources/Assets.xcassets/payment_done_icon.imageset/payment_done_icon 1.png +0 -0
- package/ios/Resources/Assets.xcassets/payment_done_icon.imageset/payment_done_icon 2.png +0 -0
- package/ios/Resources/Assets.xcassets/payment_done_icon.imageset/payment_done_icon.png +0 -0
- package/ios/Resources/Assets.xcassets/payment_error_icon.imageset/Contents.json +23 -0
- package/ios/Resources/Assets.xcassets/payment_error_icon.imageset/payment_error_icon 1.png +0 -0
- package/ios/Resources/Assets.xcassets/payment_error_icon.imageset/payment_error_icon 2.png +0 -0
- package/ios/Resources/Assets.xcassets/payment_error_icon.imageset/payment_error_icon.png +0 -0
- package/ios/Resources/Assets.xcassets/wallet.imageset/Contents.json +23 -0
- package/ios/Resources/Assets.xcassets/wallet.imageset/icons8-wallet-24(@1/303/227).png +0 -0
- package/ios/Resources/Assets.xcassets/wallet.imageset/icons8-wallet-48(@2/303/227).png +0 -0
- package/ios/Resources/Assets.xcassets/wallet.imageset/icons8-wallet-72(@3/303/227).png +0 -0
- package/ios/Resources/Colors.xcassets/00000008.colorset/Contents.json +20 -0
- package/ios/Resources/Colors.xcassets/00000016.colorset/Contents.json +20 -0
- package/ios/Resources/Colors.xcassets/00000038.colorset/Contents.json +20 -0
- package/ios/Resources/Colors.xcassets/00000060.colorset/Contents.json +20 -0
- package/ios/Resources/Colors.xcassets/1757D9.colorset/Contents.json +20 -0
- package/ios/Resources/Colors.xcassets/Contents.json +6 -0
- package/ios/Resources/Colors.xcassets/E93939.colorset/Contents.json +20 -0
- package/ios/Resources/PrivacyInfo.xcprivacy +10 -0
- package/ios/ThirdParty/Keyboad Handling/KeyboardObserver.swift +74 -0
- package/ios/easymerchantsdk.podspec +80 -0
- package/ios/easymerchantsdk.storyboard +5885 -0
- package/package.json +27 -0
- package/src/index.js +44 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CountryListVC.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by Mony's Mac on 26/11/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
protocol CountryListVCDelegate: AnyObject {
|
|
11
|
+
func didSelectCountry(_ country: Country)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class CountryListVC: UIViewController {
|
|
15
|
+
|
|
16
|
+
@IBOutlet weak var searchBarCountry: UISearchBar!
|
|
17
|
+
@IBOutlet weak var tblViewCountry: UITableView!
|
|
18
|
+
|
|
19
|
+
var list: [Country] = [Country]()
|
|
20
|
+
var searchList: [Country] = [Country]()
|
|
21
|
+
|
|
22
|
+
weak var delegate: CountryListVCDelegate?
|
|
23
|
+
|
|
24
|
+
override func viewDidLoad() {
|
|
25
|
+
super.viewDidLoad()
|
|
26
|
+
|
|
27
|
+
tblViewCountry.delegate = self
|
|
28
|
+
tblViewCountry.dataSource = self
|
|
29
|
+
|
|
30
|
+
searchBarCountry.delegate = self
|
|
31
|
+
|
|
32
|
+
self.navigationItem.title = "Select Country"
|
|
33
|
+
self.tblViewCountry.separatorStyle = .none
|
|
34
|
+
configuration()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
func configuration() {
|
|
38
|
+
for code in NSLocale.isoCountryCodes {
|
|
39
|
+
let id = NSLocale.localeIdentifier(fromComponents: [NSLocale.Key.countryCode.rawValue: code])
|
|
40
|
+
let name = NSLocale(localeIdentifier: "en_US").displayName(forKey: NSLocale.Key.identifier, value: id)
|
|
41
|
+
let locale = NSLocale.init(localeIdentifier: id)
|
|
42
|
+
|
|
43
|
+
let countryCode = locale.object(forKey: NSLocale.Key.countryCode)
|
|
44
|
+
let currencyCode = locale.object(forKey: NSLocale.Key.currencyCode)
|
|
45
|
+
let currencySymbol = locale.object(forKey: NSLocale.Key.currencySymbol)
|
|
46
|
+
|
|
47
|
+
if name != nil {
|
|
48
|
+
let model = Country()
|
|
49
|
+
model.name = name
|
|
50
|
+
model.countryCode = countryCode as? String
|
|
51
|
+
model.currencyCode = currencyCode as? String
|
|
52
|
+
model.currencySymbol = currencySymbol as? String
|
|
53
|
+
model.flag = String.flag(for: code)
|
|
54
|
+
model.extensionCode = NSLocale().extensionCode(countryCode: model.countryCode)
|
|
55
|
+
list.append(model)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
self.searchList = self.list
|
|
59
|
+
self.tblViewCountry.reloadData()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
extension String {
|
|
65
|
+
|
|
66
|
+
static func flag(for code: String) -> String? {
|
|
67
|
+
func isLowercaseASCIIScalar(_ scalar: Unicode.Scalar) -> Bool {
|
|
68
|
+
return scalar.value >= 0x61 && scalar.value <= 0x7A
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
func regionalIndicatorSymbol(for scalar: Unicode.Scalar) -> Unicode.Scalar {
|
|
72
|
+
precondition(isLowercaseASCIIScalar(scalar))
|
|
73
|
+
return Unicode.Scalar(scalar.value + (0x1F1E6 - 0x61))!
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let lowercaseCode = code.lowercased()
|
|
77
|
+
guard lowercaseCode.count == 2 else { return nil }
|
|
78
|
+
guard lowercaseCode.unicodeScalars.reduce(true, { accum, scalar in accum && isLowercaseASCIIScalar(scalar)}) else { return nil }
|
|
79
|
+
let indicatorSymbol = lowercaseCode.unicodeScalars.map({regionalIndicatorSymbol(for: $0)})
|
|
80
|
+
return String(indicatorSymbol.map({ Character($0)}))
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
extension NSLocale {
|
|
85
|
+
func extensionCode(countryCode: String?) -> String? {
|
|
86
|
+
let prefixCodes = [
|
|
87
|
+
"AF":"93",
|
|
88
|
+
"AL":"355",
|
|
89
|
+
"DZ":"213",
|
|
90
|
+
"AS":"1",
|
|
91
|
+
"AD":"376",
|
|
92
|
+
"AO":"244",
|
|
93
|
+
"AI":"1",
|
|
94
|
+
"AG":"1",
|
|
95
|
+
"AR":"54",
|
|
96
|
+
"AM":"374",
|
|
97
|
+
"AW":"297",
|
|
98
|
+
"AU":"61",
|
|
99
|
+
"AT":"43",
|
|
100
|
+
"AZ":"994",
|
|
101
|
+
"BS":"1",
|
|
102
|
+
"BH":"973",
|
|
103
|
+
"BD":"880",
|
|
104
|
+
"BB":"1",
|
|
105
|
+
"BY":"375",
|
|
106
|
+
"BE":"32",
|
|
107
|
+
"BZ":"501",
|
|
108
|
+
"BJ":"229",
|
|
109
|
+
"BM":"1",
|
|
110
|
+
"BT":"975",
|
|
111
|
+
"BA":"387",
|
|
112
|
+
"BW":"267",
|
|
113
|
+
"BR":"55",
|
|
114
|
+
"IO":"246",
|
|
115
|
+
"BG":"359",
|
|
116
|
+
"BF":"226",
|
|
117
|
+
"BI":"257",
|
|
118
|
+
"KH":"855",
|
|
119
|
+
"CM":"237",
|
|
120
|
+
"CA":"1",
|
|
121
|
+
"CV":"238",
|
|
122
|
+
"KY":"345",
|
|
123
|
+
"CF":"236",
|
|
124
|
+
"TD":"235",
|
|
125
|
+
"CL":"56",
|
|
126
|
+
"CN":"86",
|
|
127
|
+
"CX":"61",
|
|
128
|
+
"CO":"57",
|
|
129
|
+
"KM":"269",
|
|
130
|
+
"CG":"242",
|
|
131
|
+
"CK":"682",
|
|
132
|
+
"CR":"506",
|
|
133
|
+
"HR":"385",
|
|
134
|
+
"CU":"53",
|
|
135
|
+
"CY":"537",
|
|
136
|
+
"CZ":"420",
|
|
137
|
+
"DK":"45",
|
|
138
|
+
"DJ":"253",
|
|
139
|
+
"DM":"1",
|
|
140
|
+
"DO":"1",
|
|
141
|
+
"EC":"593",
|
|
142
|
+
"EG":"20",
|
|
143
|
+
"SV":"503",
|
|
144
|
+
"GQ":"240",
|
|
145
|
+
"ER":"291",
|
|
146
|
+
"EE":"372",
|
|
147
|
+
"ET":"251",
|
|
148
|
+
"FO":"298",
|
|
149
|
+
"FJ":"679",
|
|
150
|
+
"FI":"358",
|
|
151
|
+
"FR":"33",
|
|
152
|
+
"GF":"594",
|
|
153
|
+
"PF":"689",
|
|
154
|
+
"GA":"241",
|
|
155
|
+
"GM":"220",
|
|
156
|
+
"GE":"995",
|
|
157
|
+
"DE":"49",
|
|
158
|
+
"GH":"233",
|
|
159
|
+
"GI":"350",
|
|
160
|
+
"GR":"30",
|
|
161
|
+
"GL":"299",
|
|
162
|
+
"GD":"1",
|
|
163
|
+
"GP":"590",
|
|
164
|
+
"GU":"1",
|
|
165
|
+
"GT":"502",
|
|
166
|
+
"GN":"224",
|
|
167
|
+
"GW":"245",
|
|
168
|
+
"GY":"595",
|
|
169
|
+
"HT":"509",
|
|
170
|
+
"HN":"504",
|
|
171
|
+
"HU":"36",
|
|
172
|
+
"IS":"354",
|
|
173
|
+
"IN":"91",
|
|
174
|
+
"ID":"62",
|
|
175
|
+
"IQ":"964",
|
|
176
|
+
"IE":"353",
|
|
177
|
+
"IL":"972",
|
|
178
|
+
"IT":"39",
|
|
179
|
+
"JM":"1",
|
|
180
|
+
"JP":"81",
|
|
181
|
+
"JO":"962",
|
|
182
|
+
"KZ":"77",
|
|
183
|
+
"KE":"254",
|
|
184
|
+
"KI":"686",
|
|
185
|
+
"KW":"965",
|
|
186
|
+
"KG":"996",
|
|
187
|
+
"LV":"371",
|
|
188
|
+
"LB":"961",
|
|
189
|
+
"LS":"266",
|
|
190
|
+
"LR":"231",
|
|
191
|
+
"LI":"423",
|
|
192
|
+
"LT":"370",
|
|
193
|
+
"LU":"352",
|
|
194
|
+
"MG":"261",
|
|
195
|
+
"MW":"265",
|
|
196
|
+
"MY":"60",
|
|
197
|
+
"MV":"960",
|
|
198
|
+
"ML":"223",
|
|
199
|
+
"MT":"356",
|
|
200
|
+
"MH":"692",
|
|
201
|
+
"MQ":"596",
|
|
202
|
+
"MR":"222",
|
|
203
|
+
"MU":"230",
|
|
204
|
+
"YT":"262",
|
|
205
|
+
"MX":"52",
|
|
206
|
+
"MC":"377",
|
|
207
|
+
"MN":"976",
|
|
208
|
+
"ME":"382",
|
|
209
|
+
"MS":"1",
|
|
210
|
+
"MA":"212",
|
|
211
|
+
"MM":"95",
|
|
212
|
+
"NA":"264",
|
|
213
|
+
"NR":"674",
|
|
214
|
+
"NP":"977",
|
|
215
|
+
"NL":"31",
|
|
216
|
+
"AN":"599",
|
|
217
|
+
"NC":"687",
|
|
218
|
+
"NZ":"64",
|
|
219
|
+
"NI":"505",
|
|
220
|
+
"NE":"227",
|
|
221
|
+
"NG":"234",
|
|
222
|
+
"NU":"683",
|
|
223
|
+
"NF":"672",
|
|
224
|
+
"MP":"1",
|
|
225
|
+
"NO":"47",
|
|
226
|
+
"OM":"968",
|
|
227
|
+
"PK":"92",
|
|
228
|
+
"PW":"680",
|
|
229
|
+
"PA":"507",
|
|
230
|
+
"PG":"675",
|
|
231
|
+
"PY":"595",
|
|
232
|
+
"PE":"51",
|
|
233
|
+
"PH":"63",
|
|
234
|
+
"PL":"48",
|
|
235
|
+
"PT":"351",
|
|
236
|
+
"PR":"1",
|
|
237
|
+
"QA":"974",
|
|
238
|
+
"RO":"40",
|
|
239
|
+
"RW":"250",
|
|
240
|
+
"WS":"685",
|
|
241
|
+
"SM":"378",
|
|
242
|
+
"SA":"966",
|
|
243
|
+
"SN":"221",
|
|
244
|
+
"RS":"381",
|
|
245
|
+
"SC":"248",
|
|
246
|
+
"SL":"232",
|
|
247
|
+
"SG":"65",
|
|
248
|
+
"SK":"421",
|
|
249
|
+
"SI":"386",
|
|
250
|
+
"SB":"677",
|
|
251
|
+
"ZA":"27",
|
|
252
|
+
"GS":"500",
|
|
253
|
+
"ES":"34",
|
|
254
|
+
"LK":"94",
|
|
255
|
+
"SD":"249",
|
|
256
|
+
"SR":"597",
|
|
257
|
+
"SZ":"268",
|
|
258
|
+
"SE":"46",
|
|
259
|
+
"CH":"41",
|
|
260
|
+
"TJ":"992",
|
|
261
|
+
"TH":"66",
|
|
262
|
+
"TG":"228",
|
|
263
|
+
"TK":"690",
|
|
264
|
+
"TO":"676",
|
|
265
|
+
"TT":"1",
|
|
266
|
+
"TN":"216",
|
|
267
|
+
"TR":"90",
|
|
268
|
+
"TM":"993",
|
|
269
|
+
"TC":"1",
|
|
270
|
+
"TV":"688",
|
|
271
|
+
"UG":"256",
|
|
272
|
+
"UA":"380",
|
|
273
|
+
"AE":"971",
|
|
274
|
+
"GB":"44",
|
|
275
|
+
"US":"1",
|
|
276
|
+
"UY":"598",
|
|
277
|
+
"UZ":"998",
|
|
278
|
+
"VU":"678",
|
|
279
|
+
"WF":"681",
|
|
280
|
+
"YE":"967",
|
|
281
|
+
"ZM":"260",
|
|
282
|
+
"ZW":"263",
|
|
283
|
+
"BO":"591",
|
|
284
|
+
"BN":"673",
|
|
285
|
+
"CC":"61",
|
|
286
|
+
"CD":"243",
|
|
287
|
+
"CI":"225",
|
|
288
|
+
"FK":"500",
|
|
289
|
+
"GG":"44",
|
|
290
|
+
"VA":"379",
|
|
291
|
+
"HK":"852",
|
|
292
|
+
"IR":"98",
|
|
293
|
+
"IM":"44",
|
|
294
|
+
"JE":"44",
|
|
295
|
+
"KP":"850",
|
|
296
|
+
"KR":"82",
|
|
297
|
+
"LA":"856",
|
|
298
|
+
"LY":"218",
|
|
299
|
+
"MO":"853",
|
|
300
|
+
"MK":"389",
|
|
301
|
+
"FM":"691",
|
|
302
|
+
"MD":"373",
|
|
303
|
+
"MZ":"258",
|
|
304
|
+
"PS":"970",
|
|
305
|
+
"PN":"872",
|
|
306
|
+
"RE":"262",
|
|
307
|
+
"RU":"7",
|
|
308
|
+
"BL":"590",
|
|
309
|
+
"SH":"290",
|
|
310
|
+
"KN":"1",
|
|
311
|
+
"LC":"1",
|
|
312
|
+
"MF":"590",
|
|
313
|
+
"PM":"508",
|
|
314
|
+
"VC":"1",
|
|
315
|
+
"ST":"239",
|
|
316
|
+
"SO":"252",
|
|
317
|
+
"SJ":"47",
|
|
318
|
+
"SY":"963",
|
|
319
|
+
"TW":"886",
|
|
320
|
+
"TZ":"255",
|
|
321
|
+
"TL":"670",
|
|
322
|
+
"VE":"58",
|
|
323
|
+
"VN":"84",
|
|
324
|
+
"VG":"284",
|
|
325
|
+
"VI":"340"
|
|
326
|
+
]
|
|
327
|
+
|
|
328
|
+
let countryDialingCode = prefixCodes[countryCode ?? "IN"] ?? nil
|
|
329
|
+
return countryDialingCode
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
extension CountryListVC: UITableViewDelegate, UITableViewDataSource {
|
|
334
|
+
|
|
335
|
+
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
336
|
+
return self.searchList.count
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
340
|
+
let cell = tableView.dequeueReusableCell(withIdentifier: "cell")
|
|
341
|
+
cell?.textLabel?.text = "\(self.searchList[indexPath.row].flag!) \(self.searchList[indexPath.row].name!)"
|
|
342
|
+
return cell!
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
346
|
+
let selectedCountry = self.searchList[indexPath.row]
|
|
347
|
+
delegate?.didSelectCountry(selectedCountry)
|
|
348
|
+
self.navigationController?.popViewController(animated: true)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
extension CountryListVC: UISearchBarDelegate {
|
|
354
|
+
|
|
355
|
+
func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
|
|
356
|
+
self.searchList = self.list
|
|
357
|
+
self.tblViewCountry.reloadData()
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
|
|
361
|
+
self.searchList = searchText.isEmpty ? list: list.filter({ (model) -> Bool in
|
|
362
|
+
return model.name!.range(of: searchText, options: .caseInsensitive, range: nil, locale: nil) != nil
|
|
363
|
+
})
|
|
364
|
+
self.tblViewCountry.reloadData()
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
@@ -0,0 +1,192 @@
|
|
|
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 txtFieldEmail: UITextField!
|
|
13
|
+
|
|
14
|
+
var cardNumber: String?
|
|
15
|
+
var expiryDate: String?
|
|
16
|
+
var cvv: String?
|
|
17
|
+
var nameOnCard: String?
|
|
18
|
+
var billingInfoData: [String: Any]?
|
|
19
|
+
|
|
20
|
+
var selectedPaymentMethod: String?
|
|
21
|
+
|
|
22
|
+
//Banking Params
|
|
23
|
+
var accountName: String?
|
|
24
|
+
var routingNumber: String?
|
|
25
|
+
var accountType: String?
|
|
26
|
+
var accountNumber: String?
|
|
27
|
+
|
|
28
|
+
var easyPayDelegate: EasyPayViewControllerDelegate?
|
|
29
|
+
|
|
30
|
+
var isSavedForFuture: Bool = false
|
|
31
|
+
|
|
32
|
+
override func viewDidLoad() {
|
|
33
|
+
super.viewDidLoad()
|
|
34
|
+
|
|
35
|
+
// Add tap gesture recognizer to dismiss the keyboard
|
|
36
|
+
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
|
|
37
|
+
view.addGestureRecognizer(tapGesture)
|
|
38
|
+
|
|
39
|
+
print(isSavedForFuture)
|
|
40
|
+
print(cardNumber ?? "")
|
|
41
|
+
print(expiryDate ?? "")
|
|
42
|
+
print(cvv ?? "")
|
|
43
|
+
print(nameOnCard ?? "")
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Method to dismiss the keyboard
|
|
47
|
+
@objc func dismissKeyboard() {
|
|
48
|
+
view.endEditing(true)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// MARK: - Send OTP Email Verification Api
|
|
52
|
+
func emailVerificationApi() {
|
|
53
|
+
showLoadingIndicator()
|
|
54
|
+
// var components = URLComponents()
|
|
55
|
+
// components.scheme = "https"
|
|
56
|
+
// components.host = "stage-api.stage-easymerchant.io"
|
|
57
|
+
// components.path = "/api/v1/customer/send_otp"
|
|
58
|
+
//
|
|
59
|
+
// guard let serviceURL = components.url else {
|
|
60
|
+
// print("Invalid URL")
|
|
61
|
+
// hideLoadingIndicator()
|
|
62
|
+
// return
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
// Construct the full URL using baseURL from EnvironmentConfig and path from the endpoint
|
|
66
|
+
let fullURL = EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.emailVerification.path()
|
|
67
|
+
|
|
68
|
+
guard let serviceURL = URL(string: fullURL) else {
|
|
69
|
+
print("Invalid URL")
|
|
70
|
+
hideLoadingIndicator()
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
var request = URLRequest(url: serviceURL)
|
|
75
|
+
request.httpMethod = "POST"
|
|
76
|
+
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
77
|
+
|
|
78
|
+
let token = UserStoreSingleton.shared.clientToken
|
|
79
|
+
print("Setting clientToken header: \(token ?? "None")")
|
|
80
|
+
request.addValue(token ?? "", forHTTPHeaderField: "Client-Token")
|
|
81
|
+
|
|
82
|
+
let params: [String: Any] = [
|
|
83
|
+
"card_search_value": txtFieldEmail.text ?? "",
|
|
84
|
+
"card_search_key": "email"
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
do {
|
|
88
|
+
let jsonData = try JSONSerialization.data(withJSONObject: params, options: .prettyPrinted)
|
|
89
|
+
request.httpBody = jsonData
|
|
90
|
+
if let jsonString = String(data: jsonData, encoding: .utf8) {
|
|
91
|
+
print("JSON Payload: \(jsonString)")
|
|
92
|
+
}
|
|
93
|
+
} catch let error {
|
|
94
|
+
print("Error creating JSON data: \(error)")
|
|
95
|
+
hideLoadingIndicator()
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let session = URLSession.shared
|
|
100
|
+
let task = session.dataTask(with: request) { (serviceData, serviceResponse, error) in
|
|
101
|
+
|
|
102
|
+
DispatchQueue.main.async {
|
|
103
|
+
self.hideLoadingIndicator() // Stop loader when response is received
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if let error = error {
|
|
107
|
+
print("Error: \(error.localizedDescription)")
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
guard let httpResponse = serviceResponse as? HTTPURLResponse else {
|
|
112
|
+
print("Invalid response")
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if httpResponse.statusCode == 200 || httpResponse.statusCode == 201 {
|
|
117
|
+
if let data = serviceData {
|
|
118
|
+
do {
|
|
119
|
+
if let responseObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
|
|
120
|
+
print("Response Data: \(responseObject)")
|
|
121
|
+
|
|
122
|
+
// Navigate to PaymentDoneVC and pass the response data
|
|
123
|
+
DispatchQueue.main.async {
|
|
124
|
+
if self.selectedPaymentMethod == "Card" {
|
|
125
|
+
if let vc = self.storyboard?.instantiateViewController(withIdentifier: "OTPVerificationVC") as? OTPVerificationVC {
|
|
126
|
+
// Pass any necessary data to OTP VerfificationVC
|
|
127
|
+
vc.cardNumber = self.cardNumber
|
|
128
|
+
vc.expiryDate = self.expiryDate
|
|
129
|
+
vc.cvv = self.cvv
|
|
130
|
+
vc.nameOnCard = self.nameOnCard
|
|
131
|
+
vc.billingInfoData = self.billingInfoData
|
|
132
|
+
vc.selectedPaymentMethod = self.selectedPaymentMethod
|
|
133
|
+
vc.easyPayDelegate = self.easyPayDelegate
|
|
134
|
+
vc.email = self.txtFieldEmail.text
|
|
135
|
+
vc.isSavedForFuture = self.isSavedForFuture
|
|
136
|
+
self.navigationController?.pushViewController(vc, animated: true)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else if self.selectedPaymentMethod == "Bank" {
|
|
140
|
+
if let vc = self.storyboard?.instantiateViewController(withIdentifier: "OTPVerificationVC") as? OTPVerificationVC {
|
|
141
|
+
vc.accountName = self.accountName
|
|
142
|
+
vc.routingNumber = self.routingNumber
|
|
143
|
+
vc.accountType = self.accountType
|
|
144
|
+
vc.accountNumber = self.accountNumber
|
|
145
|
+
vc.billingInfoData = self.billingInfoData
|
|
146
|
+
vc.selectedPaymentMethod = self.selectedPaymentMethod
|
|
147
|
+
vc.easyPayDelegate = self.easyPayDelegate
|
|
148
|
+
vc.email = self.txtFieldEmail.text
|
|
149
|
+
self.navigationController?.pushViewController(vc, animated: true)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
print("Invalid JSON format")
|
|
155
|
+
}
|
|
156
|
+
} catch let jsonError {
|
|
157
|
+
print("Error parsing JSON: \(jsonError)")
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
print("No data received")
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
print("HTTP Status Code: \(httpResponse.statusCode)")
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
task.resume()
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@IBAction func actionBtnCancel(_ sender: UIButton) {
|
|
170
|
+
for viewController in self.navigationController?.viewControllers ?? [] {
|
|
171
|
+
if viewController is PaymentInfoVC {
|
|
172
|
+
self.navigationController?.popToViewController(viewController, animated: true)
|
|
173
|
+
break
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
@IBAction func actionBtnGetOTP(_ sender: UIButton) {
|
|
179
|
+
guard let email = txtFieldEmail.text, !email.isEmpty else {
|
|
180
|
+
// Show an alert if the email field is empty
|
|
181
|
+
showAlert(message: "Please enter an email address.")
|
|
182
|
+
return
|
|
183
|
+
}
|
|
184
|
+
// Validate email format before calling the API
|
|
185
|
+
if isValidEmail(email) {
|
|
186
|
+
emailVerificationApi()
|
|
187
|
+
} else {
|
|
188
|
+
showAlert(message: "Please enter a valid email address.")
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
}
|