@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,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CheckboxButton.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by iftekhar on 14/07/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
final class CheckboxButton: UIButton {
|
|
11
|
+
|
|
12
|
+
override func awakeFromNib() {
|
|
13
|
+
super.awakeFromNib()
|
|
14
|
+
self.addTarget(self, action: #selector(tapAction(_:)), for: .touchUpInside)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@objc private func tapAction(_ sender: UIButton) {
|
|
18
|
+
self.isSelected.toggle()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FilledButton.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by iftekhar on 14/07/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
class FilledButton: UIButton {
|
|
11
|
+
|
|
12
|
+
override var isEnabled: Bool {
|
|
13
|
+
didSet {
|
|
14
|
+
self.tintColor = isEnabled ? self.tintColor.withAlphaComponent(1.0) : self.tintColor.withAlphaComponent(0.5)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// OutlineButton.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by iftekhar on 14/07/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
class OutlineButton: UIButton {
|
|
11
|
+
|
|
12
|
+
override func awakeFromNib() {
|
|
13
|
+
super.awakeFromNib()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override func tintColorDidChange() {
|
|
17
|
+
super.tintColorDidChange()
|
|
18
|
+
self.layer.borderColor = isEnabled ? UIColor._1757D9.cgColor : UIColor._00000016.cgColor
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override var isEnabled: Bool {
|
|
22
|
+
didSet {
|
|
23
|
+
self.tintColor = isEnabled ? self.tintColor.withAlphaComponent(1.0) : self.tintColor.withAlphaComponent(0.5)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//
|
|
2
|
+
// TextFieldStackView.swift
|
|
3
|
+
// Wellify
|
|
4
|
+
//
|
|
5
|
+
// Created on 12/3/23.
|
|
6
|
+
// Copyright © 2023 Awelliz. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
import UIKit
|
|
11
|
+
|
|
12
|
+
//@IBDesignable
|
|
13
|
+
final class TextFieldStackView: UIStackView {
|
|
14
|
+
|
|
15
|
+
@IBOutlet private var titleLabel: UILabel?
|
|
16
|
+
@IBOutlet private var errorLabel: UILabel?
|
|
17
|
+
|
|
18
|
+
@IBOutlet private var containerView: UIView?
|
|
19
|
+
@IBOutlet private(set) var textField: UITextField!
|
|
20
|
+
|
|
21
|
+
var error: String? {
|
|
22
|
+
didSet {
|
|
23
|
+
if isFirstResponder {
|
|
24
|
+
containerView?.layer.borderColor = UIColor._1757D9.withAlphaComponent(0.5).cgColor
|
|
25
|
+
errorLabel?.text = " "
|
|
26
|
+
} else if let error = error {
|
|
27
|
+
containerView?.layer.borderColor = UIColor.E93939.cgColor
|
|
28
|
+
errorLabel?.text = error
|
|
29
|
+
} else {
|
|
30
|
+
containerView?.layer.borderColor = UIColor._00000016.cgColor
|
|
31
|
+
errorLabel?.text = " "
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override func awakeFromNib() {
|
|
37
|
+
super.awakeFromNib()
|
|
38
|
+
|
|
39
|
+
error = nil
|
|
40
|
+
titleLabel?.adjustsFontSizeToFitWidth = true
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@IBInspectable var isEnabled: Bool = true {
|
|
44
|
+
didSet {
|
|
45
|
+
titleLabel?.isEnabled = isEnabled
|
|
46
|
+
textField?.isEnabled = isEnabled
|
|
47
|
+
textField.leftView?.tintColor = isEnabled ? UIColor._00000060 : UIColor._00000038
|
|
48
|
+
textField.rightView?.tintColor = isEnabled ? UIColor._00000060 : UIColor._00000038
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var text: String {
|
|
53
|
+
set {
|
|
54
|
+
textField?.text = newValue
|
|
55
|
+
}
|
|
56
|
+
get {
|
|
57
|
+
textField?.text ?? ""
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var isSecureTextEntry: Bool {
|
|
62
|
+
set {
|
|
63
|
+
textField?.isSecureTextEntry = newValue
|
|
64
|
+
}
|
|
65
|
+
get {
|
|
66
|
+
textField?.isSecureTextEntry ?? false
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
override var isFirstResponder: Bool {
|
|
71
|
+
if let textField = textField {
|
|
72
|
+
return textField.isFirstResponder
|
|
73
|
+
} else {
|
|
74
|
+
return super.isFirstResponder
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@discardableResult
|
|
79
|
+
override func becomeFirstResponder() -> Bool {
|
|
80
|
+
if let textField = textField {
|
|
81
|
+
return textField.becomeFirstResponder()
|
|
82
|
+
} else {
|
|
83
|
+
return super.becomeFirstResponder()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@discardableResult
|
|
88
|
+
override func resignFirstResponder() -> Bool {
|
|
89
|
+
if let textField = textField {
|
|
90
|
+
return textField.resignFirstResponder()
|
|
91
|
+
} else {
|
|
92
|
+
return super.resignFirstResponder()
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import Foundation
|
|
5
|
+
|
|
6
|
+
public class EnvironmentConfig {
|
|
7
|
+
|
|
8
|
+
public enum Environment {
|
|
9
|
+
case staging
|
|
10
|
+
case sandbox
|
|
11
|
+
case production
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public static var currentEnvironment: Environment = .staging
|
|
15
|
+
|
|
16
|
+
public static var apiKey: String?
|
|
17
|
+
public static var apiSecret: String?
|
|
18
|
+
|
|
19
|
+
public static var baseURL: String {
|
|
20
|
+
switch currentEnvironment {
|
|
21
|
+
case .staging: return "https://stage-api.stage-easymerchant.io"
|
|
22
|
+
case .sandbox: return "https://sandbox-api.sandbox-lyfepay.io"
|
|
23
|
+
case .production: return "https://api.lyfepay.io"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// Configure API keys dynamically
|
|
28
|
+
public static func configure(apiKey: String, apiSecret: String) {
|
|
29
|
+
self.apiKey = apiKey
|
|
30
|
+
self.apiSecret = apiSecret
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// Set the environment (staging, sandbox, production)
|
|
34
|
+
public static func setEnvironment(_ environment: Environment) {
|
|
35
|
+
self.currentEnvironment = environment
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public enum Endpoints {
|
|
39
|
+
case paymentIntent
|
|
40
|
+
case hostedCheckouts
|
|
41
|
+
case emailVerification
|
|
42
|
+
case verifyOtp
|
|
43
|
+
case getCards
|
|
44
|
+
case creditCharges
|
|
45
|
+
case account
|
|
46
|
+
case achCharge
|
|
47
|
+
case charges
|
|
48
|
+
|
|
49
|
+
func path() -> String {
|
|
50
|
+
switch self {
|
|
51
|
+
case .paymentIntent: return "/api/v1/paymentintent"
|
|
52
|
+
case .hostedCheckouts: return "/api/v1/hostedcheckouts"
|
|
53
|
+
case .emailVerification: return "/api/v1/customer/send_otp"
|
|
54
|
+
case .verifyOtp: return "/api/v1/customer/verify_otp"
|
|
55
|
+
case .getCards: return "/api/v1/customer/card"
|
|
56
|
+
case .creditCharges: return "/api/v1/customer/charges"
|
|
57
|
+
case .account: return "/api/v1/ach/account"
|
|
58
|
+
case .achCharge: return "/api/v1/ach/charge"
|
|
59
|
+
case .charges: return "/api/v1/charges"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
|
3
|
+
<dependencies>
|
|
4
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
|
5
|
+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
6
|
+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
7
|
+
</dependencies>
|
|
8
|
+
<scenes>
|
|
9
|
+
<!--View Controller-->
|
|
10
|
+
<scene sceneID="EHf-IW-A2E">
|
|
11
|
+
<objects>
|
|
12
|
+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
|
13
|
+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
|
14
|
+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
|
15
|
+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
16
|
+
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
|
17
|
+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
|
18
|
+
</view>
|
|
19
|
+
</viewController>
|
|
20
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
21
|
+
</objects>
|
|
22
|
+
<point key="canvasLocation" x="53" y="375"/>
|
|
23
|
+
</scene>
|
|
24
|
+
</scenes>
|
|
25
|
+
</document>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
|
3
|
+
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
|
4
|
+
<dependencies>
|
|
5
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
|
|
6
|
+
<capability name="Named colors" minToolsVersion="9.0"/>
|
|
7
|
+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
8
|
+
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
|
9
|
+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
10
|
+
</dependencies>
|
|
11
|
+
<scenes>
|
|
12
|
+
<!--View Controller-->
|
|
13
|
+
<scene sceneID="tne-QT-ifu">
|
|
14
|
+
<objects>
|
|
15
|
+
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="EasyPaySDKDemo" customModuleProvider="target" sceneMemberID="viewController">
|
|
16
|
+
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
|
17
|
+
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
|
18
|
+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
19
|
+
<subviews>
|
|
20
|
+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rEn-Oo-ZuO">
|
|
21
|
+
<rect key="frame" x="150.66666666666666" y="408.66666666666669" width="92" height="35"/>
|
|
22
|
+
<color key="tintColor" name="1757D9"/>
|
|
23
|
+
<state key="normal" title="Button"/>
|
|
24
|
+
<buttonConfiguration key="configuration" style="filled" title="Pay: $99"/>
|
|
25
|
+
<connections>
|
|
26
|
+
<action selector="payAction" destination="BYZ-38-t0r" eventType="touchUpInside" id="2Sh-qK-cwd"/>
|
|
27
|
+
</connections>
|
|
28
|
+
</button>
|
|
29
|
+
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="c7w-3s-FyR">
|
|
30
|
+
<rect key="frame" x="16" y="483.66666666666669" width="361" height="15.666666666666686"/>
|
|
31
|
+
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
|
32
|
+
<nil key="textColor"/>
|
|
33
|
+
<nil key="highlightedColor"/>
|
|
34
|
+
</label>
|
|
35
|
+
</subviews>
|
|
36
|
+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
|
37
|
+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
|
38
|
+
<constraints>
|
|
39
|
+
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="c7w-3s-FyR" secondAttribute="trailing" constant="16" id="0jI-6d-C7S"/>
|
|
40
|
+
<constraint firstItem="c7w-3s-FyR" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="16" id="2ev-Ft-Sp6"/>
|
|
41
|
+
<constraint firstItem="rEn-Oo-ZuO" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="Shd-fW-Eut"/>
|
|
42
|
+
<constraint firstItem="c7w-3s-FyR" firstAttribute="top" secondItem="rEn-Oo-ZuO" secondAttribute="bottom" constant="40" id="vzS-hf-pLW"/>
|
|
43
|
+
<constraint firstItem="rEn-Oo-ZuO" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="xtv-co-psI"/>
|
|
44
|
+
</constraints>
|
|
45
|
+
</view>
|
|
46
|
+
<navigationItem key="navigationItem" id="gHK-AH-GZn"/>
|
|
47
|
+
<connections>
|
|
48
|
+
<outlet property="lblResponseShow" destination="c7w-3s-FyR" id="zL0-I2-Plv"/>
|
|
49
|
+
<outlet property="payButton" destination="rEn-Oo-ZuO" id="ZRH-vj-3Mm"/>
|
|
50
|
+
</connections>
|
|
51
|
+
</viewController>
|
|
52
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
|
53
|
+
</objects>
|
|
54
|
+
<point key="canvasLocation" x="1043.5114503816794" y="-27.464788732394368"/>
|
|
55
|
+
</scene>
|
|
56
|
+
</scenes>
|
|
57
|
+
<resources>
|
|
58
|
+
<namedColor name="1757D9">
|
|
59
|
+
<color red="0.090196078431372548" green="0.3411764705882353" blue="0.85098039215686272" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
|
60
|
+
</namedColor>
|
|
61
|
+
<systemColor name="systemBackgroundColor">
|
|
62
|
+
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
|
63
|
+
</systemColor>
|
|
64
|
+
</resources>
|
|
65
|
+
</document>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// SceneDelegate.swift
|
|
3
|
+
// EasyPaySDKDemo
|
|
4
|
+
//
|
|
5
|
+
// Created by iftekhar on 13/07/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
11
|
+
|
|
12
|
+
var window: UIWindow?
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
|
16
|
+
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
|
|
17
|
+
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
|
|
18
|
+
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
|
19
|
+
guard let _ = (scene as? UIWindowScene) else { return }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func sceneDidDisconnect(_ scene: UIScene) {
|
|
23
|
+
// Called as the scene is being released by the system.
|
|
24
|
+
// This occurs shortly after the scene enters the background, or when its session is discarded.
|
|
25
|
+
// Release any resources associated with this scene that can be re-created the next time the scene connects.
|
|
26
|
+
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
func sceneDidBecomeActive(_ scene: UIScene) {
|
|
30
|
+
// Called when the scene has moved from an inactive state to an active state.
|
|
31
|
+
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
func sceneWillResignActive(_ scene: UIScene) {
|
|
35
|
+
// Called when the scene will move from an active state to an inactive state.
|
|
36
|
+
// This may occur due to temporary interruptions (ex. an incoming phone call).
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
func sceneWillEnterForeground(_ scene: UIScene) {
|
|
40
|
+
// Called as the scene transitions from the background to the foreground.
|
|
41
|
+
// Use this method to undo the changes made on entering the background.
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
func sceneDidEnterBackground(_ scene: UIScene) {
|
|
45
|
+
// Called as the scene transitions from the foreground to the background.
|
|
46
|
+
// Use this method to save data, release shared resources, and store enough scene-specific state information
|
|
47
|
+
// to restore the scene back to its current state.
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
|
|
3
|
+
class ViewController: UIViewController {
|
|
4
|
+
|
|
5
|
+
@IBOutlet weak var lblResponseShow: UILabel!
|
|
6
|
+
@IBOutlet private var payButton: UIButton!
|
|
7
|
+
|
|
8
|
+
override func viewDidLoad() {
|
|
9
|
+
super.viewDidLoad()
|
|
10
|
+
|
|
11
|
+
// Developer selects the environment
|
|
12
|
+
EnvironmentConfig.setEnvironment(.staging) // Or .sandbox, .production
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@IBAction private func payAction() {
|
|
16
|
+
//Staging Keys
|
|
17
|
+
let apiKey = "mobilesdk1980IUuCzwWl"
|
|
18
|
+
let apiSecret = "mobilesdk1980LVHnN0Oh"
|
|
19
|
+
|
|
20
|
+
//Sandboxing Keys
|
|
21
|
+
// let apiKey = "f149cf5afc3a67c79e0aa87e7"
|
|
22
|
+
// let apiSecret = "22b9dd1e588146077ca77da82"
|
|
23
|
+
|
|
24
|
+
// Configure the SDK with custom API keys
|
|
25
|
+
EnvironmentConfig.configure(apiKey: apiKey, apiSecret: apiSecret)
|
|
26
|
+
|
|
27
|
+
// Create the payment request
|
|
28
|
+
let additionalInfoRequest = [
|
|
29
|
+
"name": "Test User",
|
|
30
|
+
"email": "test@gmail.com",
|
|
31
|
+
"phone_number": "9465351125",
|
|
32
|
+
"country_code": "91",
|
|
33
|
+
"description": "Test"
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
let json: [String: Any] = [
|
|
37
|
+
"address": "Mohali, Punjab",
|
|
38
|
+
"country": "India",
|
|
39
|
+
"state": "Punjab",
|
|
40
|
+
"city": "Anandpur Sahib",
|
|
41
|
+
"postal_code": "140118",
|
|
42
|
+
"additional_info": additionalInfoRequest
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
guard let jsonData = try? JSONSerialization.data(withJSONObject: json, options: []) else {
|
|
46
|
+
print("Failed to serialize JSON")
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Send the payment request
|
|
51
|
+
let request = Request(amount: 99, billingInfoData: jsonData)
|
|
52
|
+
let controller = EasyPayViewController(request: request, delegate: self)
|
|
53
|
+
self.present(controller, animated: true)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
extension ViewController: EasyPayViewControllerDelegate {
|
|
59
|
+
|
|
60
|
+
func easyPayController(_ controller: EasyPayViewController, didFinishWith result: Result) {
|
|
61
|
+
switch result.type {
|
|
62
|
+
case .cancelled:
|
|
63
|
+
print("Cancelled")
|
|
64
|
+
case .success:
|
|
65
|
+
if let chargeData = result.chargeData {
|
|
66
|
+
handleSuccess(with: chargeData)
|
|
67
|
+
}
|
|
68
|
+
case .error:
|
|
69
|
+
if let chargeData = result.chargeData, let errorMessage = chargeData["errorMessage"] as? String {
|
|
70
|
+
lblResponseShow.isHidden = false
|
|
71
|
+
lblResponseShow.text = "Error: \(errorMessage)"
|
|
72
|
+
} else {
|
|
73
|
+
lblResponseShow.isHidden = false
|
|
74
|
+
lblResponseShow.text = "An unknown error occurred."
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private func handleSuccess(with chargeData: [String: Any]) {
|
|
80
|
+
lblResponseShow.isHidden = false
|
|
81
|
+
lblResponseShow.text = "Received Charge Data: \(chargeData)"
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIColor.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by iftekhar on 14/07/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
extension UIColor {
|
|
11
|
+
// Blue
|
|
12
|
+
static let _1757D9: UIColor = UIColor(named: "1757D9", in: Bundle.easyPayBundle, compatibleWith: nil)!
|
|
13
|
+
|
|
14
|
+
// Red
|
|
15
|
+
static let E93939: UIColor = UIColor(named: "E93939", in: Bundle.easyPayBundle, compatibleWith: nil)!
|
|
16
|
+
|
|
17
|
+
static let _00000008: UIColor = UIColor(named: "00000008", in: Bundle.easyPayBundle, compatibleWith: nil)!
|
|
18
|
+
static let _00000016: UIColor = UIColor(named: "00000016", in: Bundle.easyPayBundle, compatibleWith: nil)!
|
|
19
|
+
static let _00000038: UIColor = UIColor(named: "00000038", in: Bundle.easyPayBundle, compatibleWith: nil)!
|
|
20
|
+
static let _00000060: UIColor = UIColor(named: "00000060", in: Bundle.easyPayBundle, compatibleWith: nil)!
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIFont.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by iftekhar on 14/07/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
extension UIFont {
|
|
11
|
+
|
|
12
|
+
static func registerEasyPayFonts() {
|
|
13
|
+
|
|
14
|
+
guard let fontNames = try? FileManager.default.contentsOfDirectory(atPath: Bundle.easyPayBundle.bundlePath).filter({ $0.hasSuffix("ttf") }) else { return }
|
|
15
|
+
|
|
16
|
+
for fontName in fontNames {
|
|
17
|
+
if let fontPath = Bundle.easyPayBundle.path(forResource: fontName, ofType: nil) {
|
|
18
|
+
let fontURL = URL(fileURLWithPath: fontPath)
|
|
19
|
+
if let fontDataProvider = CGDataProvider(url: fontURL as CFURL),
|
|
20
|
+
let font = CGFont(fontDataProvider) {
|
|
21
|
+
var error: Unmanaged<CFError>?
|
|
22
|
+
let success = CTFontManagerRegisterGraphicsFont(font, &error)
|
|
23
|
+
if !success {
|
|
24
|
+
print("Error registering font: maybe it was already registered.")
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
fatalError("Couldn't find font \(fontPath)")
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//["Inter-Regular",
|
|
35
|
+
// "Inter-ExtraLight",
|
|
36
|
+
// "Inter-Thin",
|
|
37
|
+
// "Inter-Light",
|
|
38
|
+
// "Inter-Medium",
|
|
39
|
+
// "Inter-SemiBold",
|
|
40
|
+
// "Inter-Bold",
|
|
41
|
+
// "Inter-ExtraBold",
|
|
42
|
+
// "Inter-Black"]
|
|
43
|
+
extension UIFont {
|
|
44
|
+
|
|
45
|
+
class func interThin(ofSize fontSize: CGFloat) -> UIFont {
|
|
46
|
+
return UIFont(name: "Inter-Thin", size: fontSize)!
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
class func interExtraLight(ofSize fontSize: CGFloat) -> UIFont {
|
|
50
|
+
return UIFont(name: "Inter-ExtraLight", size: fontSize)!
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
class func interLight(ofSize fontSize: CGFloat) -> UIFont {
|
|
54
|
+
return UIFont(name: "Inter-Light", size: fontSize)!
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
class func interRegular(ofSize fontSize: CGFloat) -> UIFont {
|
|
58
|
+
return UIFont(name: "Inter-Regular", size: fontSize)!
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
class func interMedium(ofSize fontSize: CGFloat) -> UIFont {
|
|
62
|
+
return UIFont(name: "Inter-Medium", size: fontSize)!
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
class func interSemiBold(ofSize fontSize: CGFloat) -> UIFont {
|
|
66
|
+
return UIFont(name: "Inter-SemiBold", size: fontSize)!
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
class func interBold(ofSize fontSize: CGFloat) -> UIFont {
|
|
70
|
+
return UIFont(name: "Inter-Bold", size: fontSize)!
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
class func interExtraBold(ofSize fontSize: CGFloat) -> UIFont {
|
|
74
|
+
return UIFont(name: "Inter-ExtraBold", size: fontSize)!
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
class func interBlack(ofSize fontSize: CGFloat) -> UIFont {
|
|
78
|
+
return UIFont(name: "Inter-Black", size: fontSize)!
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIViewController+Extension.swift
|
|
3
|
+
// EasyPay
|
|
4
|
+
//
|
|
5
|
+
// Created by Mony's Mac on 04/10/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
extension UIViewController {
|
|
11
|
+
|
|
12
|
+
enum Constant {
|
|
13
|
+
static let showOrHideKeyboardTimeDuration = 0.25
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var isDarkMode: Bool {
|
|
17
|
+
UITraitCollection.current.userInterfaceStyle == .dark
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
func warningAlert(_ message: String, title: String = "Warning") {
|
|
21
|
+
DispatchQueue.main.async {
|
|
22
|
+
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
|
23
|
+
let okAction = UIAlertAction.init(title: "OK", style: .cancel) { _ in }
|
|
24
|
+
alert.addAction(okAction)
|
|
25
|
+
self.present(alert, animated: true, completion: nil)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
func debugPrintLog(_ log: String) {
|
|
30
|
+
#if DEBUG
|
|
31
|
+
print("Debug - \(log)")
|
|
32
|
+
#endif
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
func displayMessage(_ msg: String) -> String {
|
|
36
|
+
"[DisplayMsg]: \(msg)"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|