diff --git a/GMERemittance/Module/ExchangeRates/User Interface/View/ExchangeRates.storyboard b/GMERemittance/Module/ExchangeRates/User Interface/View/ExchangeRates.storyboard
index 7fc5bbc7..a091c2aa 100644
--- a/GMERemittance/Module/ExchangeRates/User Interface/View/ExchangeRates.storyboard
+++ b/GMERemittance/Module/ExchangeRates/User Interface/View/ExchangeRates.storyboard
@@ -32,7 +32,7 @@
-
+
@@ -358,10 +358,9 @@
+
+
-
+
+
@@ -393,8 +395,8 @@
+
-
@@ -402,10 +404,8 @@
-
-
diff --git a/GMERemittance/Module/ExchangeRates/User Interface/View/ExchangeRatesViewController.swift b/GMERemittance/Module/ExchangeRates/User Interface/View/ExchangeRatesViewController.swift
index 27469b74..05b51e31 100644
--- a/GMERemittance/Module/ExchangeRates/User Interface/View/ExchangeRatesViewController.swift
+++ b/GMERemittance/Module/ExchangeRates/User Interface/View/ExchangeRatesViewController.swift
@@ -12,589 +12,589 @@ import Hex
enum PaymentMode: String {
- case cashDelivery = "1"
- case bankDeposite = "2"
- case homeDelivery = "12"
- case mobileWallet = "13"
+ case cashDelivery = "1"
+ case bankDeposite = "2"
+ case homeDelivery = "12"
+ case mobileWallet = "13"
}
-
+
class ExchangeRatesViewController: UIViewController {
-
- struct Constants {
- let transferFeeDetailText = StringConstants().transferFeeDetailText
- let currentExchangeRateText = StringConstants().currentExchangeRateText
- let paymentModeHeightConstant: CGFloat = 154
- let title = StringConstants().title
- }
-
- struct StringConstants {
- let selectPaymentModeText = ""
- let youSendText = "you_send_text".localized()
- let recepientGetsText = "receipient_gets_text".localized()
- let calculate = "calculate_text".localized()
- let title = "todays_rate_text".localized()
- let currentExchangeRateText = "current_exchange_rate_text".localized()
- let transferFeeDetailText = "transfer_fee_included_text".localized()
- }
-
- struct ApiConstants {
- static let recieverCountryId = "pCountry"
- static let senderCurrency = "sCurrency"
- static let recieverCurrency = "pCurrency"
- static let senderAmount = "cAmount"
- static let recieverAmount = "pAmount"
- static let paymentMethod = "serviceType"
- static let calcBy = "calcBy"
- static let recieverCountryName = "pCountryName"
- static let senderCountryId = "sCountry"
- }
-
- // MARK: IBOutlets
-
- @IBOutlet weak var scrollView: UIScrollView!
- @IBOutlet weak var collectionView: UICollectionView!
- @IBOutlet weak var exchangeBackground1: UIView!
- @IBOutlet weak var exchangeBackground2: UIView!
- @IBOutlet weak var dropDownImageView: UIImageView!
- @IBOutlet weak var backgroundViewCountryLabel1: UIView!
- @IBOutlet weak var backgroundViewCountryLabel2: UIView!
- @IBOutlet weak var countryListStackView: UIStackView!
- @IBOutlet weak var countryCodeLabel: UILabel!
- @IBOutlet weak var countryFlagImage: UIImageView!
-
- @IBOutlet weak var paymentModeStackViewConstraint: NSLayoutConstraint!
- @IBOutlet weak var paymentModeStackView: UIStackView!
-
- @IBOutlet weak var senderTextField: GMENumberTextField!
- @IBOutlet weak var reciepientTextField: GMENumberTextField!
-
- @IBOutlet weak var transferFeeInfoLabel: UILabel!
- @IBOutlet weak var exchangeRateInfoLabel: UILabel!
-
- @IBOutlet weak var youSendTitleLabel: UILabel!
- @IBOutlet weak var recepientGetsTitleLabel: UILabel!
- @IBOutlet weak var selectPaymentModeTitleLabel: UILabel!
- @IBOutlet weak var calculateTItleLabel: UIButton!
-
- var presenter: ExchangeRatesModuleInterface?
- var countryListTapGuesture: UITapGestureRecognizer?
- var selectedPaymentIndex: IndexPath = IndexPath.init(row: 0, section: 0)
- var translated: Bool = false
- var nativeCountryCode: String? = "np"
-
- var calcBy = ""
-
- var exchangeRateModels: [ExchangeRateModel]? {
- didSet {
-
-
- if let _ = CountryInfo().defaultCountryCodes.filter({$0.lowercased() == (self.nativeCountryCode ?? "").lowercased()}).first {
- if let defaultExchangeRate = self.exchangeRateModels?.filter({
- ($0.countryCode ?? "").lowercased() == (self.nativeCountryCode ?? "").lowercased()
- }).first {
- // there is native country, defaultExchangeRate is the information for that country
- self.setCountryFlag(countryCode: defaultExchangeRate.countryCode ?? "")
- self.setCurrencyLabel(currency: defaultExchangeRate.currency ?? "")
- // set the default amount for this country. there are some default values in CountryInfo
- self.selectedExchageRateModel = defaultExchangeRate
- self.collectionView.reloadData()
- showPaymentModeView()
- self.populateDefaultAmounts()
-
- }
- } else {
- self.setDefaultValuesForCountriesNotHavingDefaultValueFirsttime()
- showPaymentModeView()
- }
- }
- }
-
- var selectedExchageRateModel: ExchangeRateModel? {
- didSet {
- self.setCurrencyLabel(currency: self.selectedExchageRateModel?.currency ?? "")
- self.setCountryFlag(countryCode: self.selectedExchageRateModel?.countryCode ?? "")
- collectionView.reloadData()
- DispatchQueue.main.async {
- self.reciepientTextField.resignFirstResponder()
- self.senderTextField.resignFirstResponder()
- }
- }
- }
-
-
-
- // MARK: VC's Life cycle
- override func viewDidLoad() {
- super.viewDidLoad()
- setup()
- setupDelegates()
- setupTargets()
- setupNavigation()
- setupDefaultCountryFlagandCurrency()
- // todo: show default native country and falg
- // Do any additional setup after loading the view.
- // populateDefaultAmounts()
- self.nativeCountryCode = GMEDB.shared.user.string(.countryCode)
- fetchExchangeRateInformation()
- }
-
- func setupDefaultCountryFlagandCurrency() {
+
+ struct Constants {
+ let transferFeeDetailText = StringConstants().transferFeeDetailText
+ let currentExchangeRateText = StringConstants().currentExchangeRateText
+ let paymentModeHeightConstant: CGFloat = 154
+ let title = StringConstants().title
+ }
+
+ struct StringConstants {
+ let selectPaymentModeText = ""
+ let youSendText = "you_send_text".localized()
+ let recepientGetsText = "receipient_gets_text".localized()
+ let calculate = "calculate_text".localized()
+ let title = "todays_rate_text".localized()
+ let currentExchangeRateText = "current_exchange_rate_text".localized()
+ let transferFeeDetailText = "transfer_fee_included_text".localized()
+ }
+
+ struct ApiConstants {
+ static let recieverCountryId = "pCountry"
+ static let senderCurrency = "sCurrency"
+ static let recieverCurrency = "pCurrency"
+ static let senderAmount = "cAmount"
+ static let recieverAmount = "pAmount"
+ static let paymentMethod = "serviceType"
+ static let calcBy = "calcBy"
+ static let recieverCountryName = "pCountryName"
+ static let senderCountryId = "sCountry"
+ }
+
+ // MARK: IBOutlets
+
+ @IBOutlet weak var scrollView: UIScrollView!
+ @IBOutlet weak var collectionView: UICollectionView!
+ @IBOutlet weak var exchangeBackground1: UIView!
+ @IBOutlet weak var exchangeBackground2: UIView!
+ @IBOutlet weak var dropDownImageView: UIImageView!
+ @IBOutlet weak var backgroundViewCountryLabel1: UIView!
+ @IBOutlet weak var backgroundViewCountryLabel2: UIView!
+ @IBOutlet weak var countryListStackView: UIStackView!
+ @IBOutlet weak var countryCodeLabel: UILabel!
+ @IBOutlet weak var countryFlagImage: UIImageView!
+
+ @IBOutlet weak var paymentModeStackViewConstraint: NSLayoutConstraint!
+ @IBOutlet weak var paymentModeStackView: UIStackView!
+
+ @IBOutlet weak var senderTextField: GMENumberTextField!
+ @IBOutlet weak var reciepientTextField: GMENumberTextField!
+
+ @IBOutlet weak var transferFeeInfoLabel: UILabel!
+ @IBOutlet weak var exchangeRateInfoLabel: UILabel!
+
+ @IBOutlet weak var youSendTitleLabel: UILabel!
+ @IBOutlet weak var recepientGetsTitleLabel: UILabel!
+ @IBOutlet weak var selectPaymentModeTitleLabel: UILabel!
+ @IBOutlet weak var calculateTItleLabel: UIButton!
+
+ var presenter: ExchangeRatesModuleInterface?
+ var countryListTapGuesture: UITapGestureRecognizer?
+ var selectedPaymentIndex: IndexPath = IndexPath.init(row: 0, section: 0)
+ var translated: Bool = false
+ var nativeCountryCode: String? = "np"
+
+ var calcBy = ""
+
+ var exchangeRateModels: [ExchangeRateModel]? {
+ didSet {
+
+
+ if let _ = CountryInfo().defaultCountryCodes.filter({$0.lowercased() == (self.nativeCountryCode ?? "").lowercased()}).first {
if let defaultExchangeRate = self.exchangeRateModels?.filter({
- ($0.country ?? "").lowercased() == (self.nativeCountryCode ?? "").lowercased()
+ ($0.countryCode ?? "").lowercased() == (self.nativeCountryCode ?? "").lowercased()
}).first {
- // there is native country, defaultExchangeRate is the information for that country
- self.setCountryFlag(countryCode: defaultExchangeRate.countryCode ?? "")
- self.setCurrencyLabel(currency: defaultExchangeRate.currency ?? "")
+ // there is native country, defaultExchangeRate is the information for that country
+ self.setCountryFlag(countryCode: defaultExchangeRate.countryCode ?? "")
+ self.setCurrencyLabel(currency: defaultExchangeRate.currency ?? "")
+ // set the default amount for this country. there are some default values in CountryInfo
+ self.selectedExchageRateModel = defaultExchangeRate
+ self.collectionView.reloadData()
+ showPaymentModeView()
+ self.populateDefaultAmounts()
+
}
+ } else {
+ self.setDefaultValuesForCountriesNotHavingDefaultValueFirsttime()
+ showPaymentModeView()
+ }
}
-
-
- override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(animated)
- self.title = Constants().title
- }
-
-
- // IBActions
-
- @IBAction func calculateExchangeRate(_ sender: Any?) {
- let senderAmount = self.senderTextField.text!
- let reciepientAmount = self.reciepientTextField.text!
- let recipientCurrency = self.selectedExchageRateModel?.currency
- let reciepientCountryId = self.selectedExchageRateModel?.countryId
- let paymentMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: selectedPaymentIndex.row)
- let reciepientCountryName = self.selectedExchageRateModel?.country
- self.calculate(senderAmt: senderAmount, recieverAmt: reciepientAmount, recieverCurrency: recipientCurrency, recieverCountryName: reciepientCountryName, recieverCountryId: reciepientCountryId, paymentMethod: paymentMethod?.id, calcBy: self.calcBy)
- // call calculate( ... ) function
- // todo send to api for calculation
-
+ }
+
+ var selectedExchageRateModel: ExchangeRateModel? {
+ didSet {
+ self.setCurrencyLabel(currency: self.selectedExchageRateModel?.currency ?? "")
+ self.setCountryFlag(countryCode: self.selectedExchageRateModel?.countryCode ?? "")
+ collectionView.reloadData()
+ DispatchQueue.main.async {
+ self.reciepientTextField.resignFirstResponder()
+ self.senderTextField.resignFirstResponder()
+ }
}
-
- func calculate(senderAmt: String?, senderCurrency: String? = "KRW", recieverAmt: String?, recieverCurrency: String?, recieverCountryName: String?, recieverCountryId: String?, paymentMethod: String?, calcBy: String?, senderCountryId: String? = "118", shouldShowLoading: Bool = true ) {
-
- let param: [String: String] =
- [
- ApiConstants.senderAmount : (senderAmt ?? "").stringRemovingComma(),
- ApiConstants.senderCurrency : (senderCurrency ?? ""),
- ApiConstants.recieverAmount : (recieverAmt ?? "").stringRemovingComma(),
- ApiConstants.recieverCurrency : recieverCurrency ?? "",
- ApiConstants.recieverCountryId : recieverCountryId ?? "",
- ApiConstants.paymentMethod: paymentMethod ?? "",
- ApiConstants.calcBy : calcBy ?? "",
- ApiConstants.senderCountryId : senderCountryId ?? "",
- ApiConstants.recieverCountryName: recieverCountryName ?? ""
- ]
- // print(param)
- // todo
-
- if shouldShowLoading { self.showProgressHud() }
- self.getExchangeRateInformation(params: param, success: { (exchageRateDetail) in
-
- self.reciepientTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: exchageRateDetail?.recipientAmount ?? "")
- self.senderTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: exchageRateDetail?.senderAmount ?? "")
-// self.calcBy = "c"
- let transferFee = exchageRateDetail?.transferFee ?? ""
- let currency = exchageRateDetail?.senderCurrency ?? ""
-
- self.transferFeeInfoLabel.text = "-\(transferFee) \(currency) (" + "transfer_fee_included_text".localized() + ")"
-
- let exchangeRate = exchageRateDetail?.exchangeRate ?? ""
- self.exchangeRateInfoLabel.text = "\(exchangeRate) " + "(" + "current_exchange_rate_text".localized() + ")"
- self.hideProgressHud()
- }) { (error) in
- self.hideProgressHud()
- self.view.endEditing(true)
- self.alert(type: .error, message: error.localizedDescription)
- }
-
- // call api with these params
+ }
+
+
+
+ // MARK: VC's Life cycle
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ setup()
+ setupDelegates()
+ setupTargets()
+ setupNavigation()
+ setupDefaultCountryFlagandCurrency()
+ // todo: show default native country and falg
+ // Do any additional setup after loading the view.
+ // populateDefaultAmounts()
+ self.nativeCountryCode = GMEDB.shared.user.string(.countryCode)
+ fetchExchangeRateInformation()
+ }
+
+ func setupDefaultCountryFlagandCurrency() {
+ if let defaultExchangeRate = self.exchangeRateModels?.filter({
+ ($0.country ?? "").lowercased() == (self.nativeCountryCode ?? "").lowercased()
+ }).first {
+ // there is native country, defaultExchangeRate is the information for that country
+ self.setCountryFlag(countryCode: defaultExchangeRate.countryCode ?? "")
+ self.setCurrencyLabel(currency: defaultExchangeRate.currency ?? "")
}
+ }
+
+
+ override func viewWillAppear(_ animated: Bool) {
+ super.viewWillAppear(animated)
+ self.title = Constants().title
+ }
+
+
+ // IBActions
+
+ @IBAction func calculateExchangeRate(_ sender: Any?) {
+ let senderAmount = self.senderTextField.text!
+ let reciepientAmount = self.reciepientTextField.text!
+ let recipientCurrency = self.selectedExchageRateModel?.currency
+ let reciepientCountryId = self.selectedExchageRateModel?.countryId
+ let paymentMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: selectedPaymentIndex.row)
+ let reciepientCountryName = self.selectedExchageRateModel?.country
+ self.calculate(senderAmt: senderAmount, recieverAmt: reciepientAmount, recieverCurrency: recipientCurrency, recieverCountryName: reciepientCountryName, recieverCountryId: reciepientCountryId, paymentMethod: paymentMethod?.id, calcBy: self.calcBy)
+ // call calculate( ... ) function
+ // todo send to api for calculation
-
- @objc func showCountryList(_ sender: UITapGestureRecognizer) {
- DispatchQueue.main.async {
- self.reciepientTextField.resignFirstResponder()
- self.senderTextField.resignFirstResponder()
- }
-
- TablePresenterWireframe().openWith(
- delegate: self,
- model: exchangeRateModels,
- source: self
- )
+ }
+
+ func calculate(senderAmt: String?, senderCurrency: String? = "KRW", recieverAmt: String?, recieverCurrency: String?, recieverCountryName: String?, recieverCountryId: String?, paymentMethod: String?, calcBy: String?, senderCountryId: String? = "118", shouldShowLoading: Bool = true ) {
+
+ let param: [String: String] =
+ [
+ ApiConstants.senderAmount : (senderAmt ?? "").stringRemovingComma(),
+ ApiConstants.senderCurrency : (senderCurrency ?? ""),
+ ApiConstants.recieverAmount : (recieverAmt ?? "").stringRemovingComma(),
+ ApiConstants.recieverCurrency : recieverCurrency ?? "",
+ ApiConstants.recieverCountryId : recieverCountryId ?? "",
+ ApiConstants.paymentMethod: paymentMethod ?? "",
+ ApiConstants.calcBy : calcBy ?? "",
+ ApiConstants.senderCountryId : senderCountryId ?? "",
+ ApiConstants.recieverCountryName: recieverCountryName ?? ""
+ ]
+ // print(param)
+ // todo
+
+ if shouldShowLoading { self.showProgressHud() }
+ self.getExchangeRateInformation(params: param, success: { (exchageRateDetail) in
- }
-
-
- // other function
-
- func showPaymentModeView() {
- UIView.animate(withDuration: 0.33) {
- self.paymentModeStackViewConstraint.constant = Constants().paymentModeHeightConstant
- self.paymentModeStackView.alpha = 1
- self.view.layoutIfNeeded()
- }
- }
-
- func countrySelected(model: [ExchangeRateModel]) {
- if model.count == 0 {
- return
- }
+ self.reciepientTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: exchageRateDetail?.recipientAmount ?? "")
+ self.senderTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: exchageRateDetail?.senderAmount ?? "")
+ // self.calcBy = "c"
+ let transferFee = exchageRateDetail?.transferFee ?? ""
+ let currency = exchageRateDetail?.senderCurrency ?? ""
- self.selectedExchageRateModel = model.first
-
- guard let exchangeModel = self.selectedExchageRateModel else {return}
- guard let recievingCountryId = exchangeModel.countryId else {return}
- guard let paymentMethod = exchangeModel.availableServices?.elementAt(index: selectedPaymentIndex.row) else {return}
-
- /*
- if let _ = CountryInfo().defaultCountryCodes.filter({$0.lowercased() == (self.nativeCountryCode ?? "").lowercased()}).first {
- if let defaultExchangeRate = self.exchangeRateModels?.filter({
- ($0.countryCode ?? "").lowercased() == (self.nativeCountryCode ?? "").lowercased()
- }).first {
- // there is native country, defaultExchangeRate is the information for that country
- self.setCountryFlag(countryCode: defaultExchangeRate.countryCode ?? "")
- self.setCurrencyLabel(currency: defaultExchangeRate.currency ?? "")
- // set the default amount for this country. there are some default values in CountryInfo
- self.selectedExchageRateModel = defaultExchangeRate
- self.collectionView.reloadData()
- showPaymentModeView()
- self.populateDefaultAmounts()
-
- }
- } else {
- self.setDefaultValuesForCountriesNotHavingDefaultValue()
- showPaymentModeView()
- }
- */
-
- guard let _ = CountryInfo().defaultCountryCodes.filter({$0.lowercased() == (self.selectedExchageRateModel?.countryCode ?? "").lowercased()}).first else {
- self.setDefaultValuesForCountriesNotHavingDefaultValueAfterCountrySelection()
- return
- }
-
- if let recievingAmount = CountryInfo().getDefaultSendingAmount(for: selectedExchageRateModel?.countryCode ?? "") {
- if CountryInfo().doesCountryCodeHasDefined(country: exchangeModel.countryCode ?? "", currency: exchangeModel.currency ?? "") {
- if let recievingCurrency = CountryInfo().getDefaultSendingCurrency(for: exchangeModel.countryCode ?? "")
- {
- // do something if you have to do
- self.calcBy = "p"
- self.reciepientTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: recievingAmount)
- let reciepientCountryName = exchangeModel.country
- self.calculate(senderAmt: nil, senderCurrency: "KRW", recieverAmt: recievingAmount, recieverCurrency: recievingCurrency, recieverCountryName: reciepientCountryName, recieverCountryId: recievingCountryId, paymentMethod: paymentMethod.id, calcBy: calcBy, shouldShowLoading: false)
- return
- }
- }
-
- }
-
- // for countries having two currency like vn "VND" and "USD", mongolia, mn nad srilanka, lk
- if let recievingAmount = CountryInfo().getSecondarySendingAmount(for: exchangeModel.countryCode ?? "") {
- let recievingCurrency = exchangeModel.currency ?? ""
- if CountryInfo().doesSecondaryOptiopsHasDefined(country: exchangeModel.countryCode ?? "" , currency: recievingCurrency)
- {
- // do something if you have to do
-
- self.calcBy = "p"
- self.reciepientTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: recievingAmount)
- let reciepientCountryName = exchangeModel.country
- self.calculate(senderAmt: nil, senderCurrency: "KRW", recieverAmt: recievingAmount, recieverCurrency: recievingCurrency, recieverCountryName: reciepientCountryName, recieverCountryId: recievingCountryId, paymentMethod: paymentMethod.id, calcBy: calcBy, shouldShowLoading: false)
- return
- }
- }
-
- self.calculateExchangeRate(nil)
- // show country with flag.
+ self.transferFeeInfoLabel.text = "-\(transferFee) \(currency) (" + "transfer_fee_included_text".localized() + ")"
+
+ let exchangeRate = exchageRateDetail?.exchangeRate ?? ""
+ self.exchangeRateInfoLabel.text = "\(exchangeRate) " + "(" + "current_exchange_rate_text".localized() + ")"
+ self.hideProgressHud()
+ }) { (error) in
+ self.hideProgressHud()
+ self.view.endEditing(true)
+ self.alert(type: .error, message: error.localizedDescription)
}
-
- @objc private func textChanged(sender: UITextField) {
- switch sender {
- case senderTextField:
- self.reciepientTextField.text = ""
- self.calcBy = "c"
- senderTextField.text = Utility.getCommaSeperatedString(numberString: senderTextField.text!)
- case reciepientTextField:
-
- self.senderTextField.text = ""
- self.calcBy = "p"
- reciepientTextField.text = Utility.getCommaSeperatedString(numberString: reciepientTextField.text!)
- default:
- break
- }
+ // call api with these params
+ }
+
+
+ @objc func showCountryList(_ sender: UITapGestureRecognizer) {
+ DispatchQueue.main.async {
+ self.reciepientTextField.resignFirstResponder()
+ self.senderTextField.resignFirstResponder()
}
+ TablePresenterWireframe().openWith(
+ delegate: self,
+ model: exchangeRateModels,
+ source: self
+ )
-
- private func setCountryFlag(countryCode: String) {
- let flag = CountryInfo().getFlag(for: countryCode)
- self.countryFlagImage.image = flag
+ }
+
+
+ // other function
+
+ func showPaymentModeView() {
+ UIView.animate(withDuration: 0.33) {
+ self.paymentModeStackViewConstraint.constant = Constants().paymentModeHeightConstant
+ self.paymentModeStackView.alpha = 1
+ self.view.layoutIfNeeded()
}
-
-
- private func setCurrencyLabel(currency: String) {
- self.countryCodeLabel.text = currency.uppercased()
+ }
+
+ func countrySelected(model: [ExchangeRateModel]) {
+ if model.count == 0 {
+ return
}
- private func populateDefaultAmounts() {
- guard let nativeCountry = self.nativeCountryCode else {return}
- // todo: native country cha bhane tesko CountryInfo class ma defaullt value cha ki chaina herne
- // CountryInfo class ma defaullt value cha bhane tyo value rakhera second api hit garna paryo ani aako data dekhaune
- // natra bhane tesko 1000000 kwr ko native ma kati huncha teti populate garaune
-
- guard let exchangeModel = self.exchangeRateModels?.filter({
- $0.countryCode?.lowercased() == nativeCountry.lowercased() // countryCode
- }).first else {return}
-
- // self.selectedExchageRateModel = exchangeModel
-
-
- // if there is no default amount, then we have to calculate from korean won. so guard ma rakhna thik nahola, yo case hereko chaina
-
- if let recievingAmount = CountryInfo().getDefaultSendingAmount(for: exchangeModel.countryCode ?? "") {
- self.setDefaultValuesForCountriesHavingDefaultValue(recievingAmount: recievingAmount, exchangeModel: exchangeModel)
- }
-
-
+ self.selectedExchageRateModel = model.first
+
+ guard let exchangeModel = self.selectedExchageRateModel else {return}
+ guard let recievingCountryId = exchangeModel.countryId else {return}
+ guard let paymentMethod = exchangeModel.availableServices?.elementAt(index: selectedPaymentIndex.row) else {return}
+
+ /*
+ if let _ = CountryInfo().defaultCountryCodes.filter({$0.lowercased() == (self.nativeCountryCode ?? "").lowercased()}).first {
+ if let defaultExchangeRate = self.exchangeRateModels?.filter({
+ ($0.countryCode ?? "").lowercased() == (self.nativeCountryCode ?? "").lowercased()
+ }).first {
+ // there is native country, defaultExchangeRate is the information for that country
+ self.setCountryFlag(countryCode: defaultExchangeRate.countryCode ?? "")
+ self.setCurrencyLabel(currency: defaultExchangeRate.currency ?? "")
+ // set the default amount for this country. there are some default values in CountryInfo
+ self.selectedExchageRateModel = defaultExchangeRate
+ self.collectionView.reloadData()
+ showPaymentModeView()
+ self.populateDefaultAmounts()
+
+ }
+ } else {
+ self.setDefaultValuesForCountriesNotHavingDefaultValue()
+ showPaymentModeView()
+ }
+ */
+
+ guard let _ = CountryInfo().defaultCountryCodes.filter({$0.lowercased() == (self.selectedExchageRateModel?.countryCode ?? "").lowercased()}).first else {
+ self.setDefaultValuesForCountriesNotHavingDefaultValueAfterCountrySelection()
+ return
}
- private func setDefaultValuesForCountriesNotHavingDefaultValueAfterCountrySelection() {
-// self.selectedExchageRateModel = self.exchangeRateModels?.first
- let senderAmount = CountryInfo().getDefaultSendingMoneyInKoreanWon()
- self.senderTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: senderAmount ?? "")
- let senderCurrency = "KWR"
- let recieverCurrency = self.selectedExchageRateModel?.currency
- let recieverCountryId = self.selectedExchageRateModel?.countryId
- let paymentMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: selectedPaymentIndex.row)
- let reciepientCountryName = self.selectedExchageRateModel?.country ?? ""
- let calcBy = "c"
- let senderCountryName = "KOREA"
-
- self.calculate(senderAmt: senderAmount, senderCurrency: senderCurrency, recieverAmt: nil, recieverCurrency: recieverCurrency, recieverCountryName: reciepientCountryName, recieverCountryId: recieverCountryId, paymentMethod: paymentMethod?.id, calcBy: calcBy, shouldShowLoading: true)
+ if let recievingAmount = CountryInfo().getDefaultSendingAmount(for: selectedExchageRateModel?.countryCode ?? "") {
+ if CountryInfo().doesCountryCodeHasDefined(country: exchangeModel.countryCode ?? "", currency: exchangeModel.currency ?? "") {
+ if let recievingCurrency = CountryInfo().getDefaultSendingCurrency(for: exchangeModel.countryCode ?? "")
+ {
+ // do something if you have to do
+ self.calcBy = "p"
+ self.reciepientTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: recievingAmount)
+ let reciepientCountryName = exchangeModel.country
+ self.calculate(senderAmt: nil, senderCurrency: "KRW", recieverAmt: recievingAmount, recieverCurrency: recievingCurrency, recieverCountryName: reciepientCountryName, recieverCountryId: recievingCountryId, paymentMethod: paymentMethod.id, calcBy: calcBy, shouldShowLoading: false)
+ return
+ }
+ }
+
}
- private func setDefaultValuesForCountriesNotHavingDefaultValueFirsttime() {
- self.selectedExchageRateModel = self.exchangeRateModels?.first
- let senderAmount = CountryInfo().getDefaultSendingMoneyInKoreanWon()
- self.senderTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: senderAmount ?? "")
- let senderCurrency = "KWR"
- let recieverCurrency = self.selectedExchageRateModel?.currency
- let recieverCountryId = self.selectedExchageRateModel?.countryId
- let paymentMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: selectedPaymentIndex.row)
- let reciepientCountryName = self.selectedExchageRateModel?.country ?? ""
- let calcBy = "c"
- let senderCountryName = "KOREA"
+ // for countries having two currency like vn "VND" and "USD", mongolia, mn nad srilanka, lk
+ if let recievingAmount = CountryInfo().getSecondarySendingAmount(for: exchangeModel.countryCode ?? "") {
+ let recievingCurrency = exchangeModel.currency ?? ""
+ if CountryInfo().doesSecondaryOptiopsHasDefined(country: exchangeModel.countryCode ?? "" , currency: recievingCurrency)
+ {
+ // do something if you have to do
- self.calculate(senderAmt: senderAmount, senderCurrency: senderCurrency, recieverAmt: nil, recieverCurrency: recieverCurrency, recieverCountryName: reciepientCountryName, recieverCountryId: recieverCountryId, paymentMethod: paymentMethod?.id, calcBy: calcBy, shouldShowLoading: false)
- }
-
- private func setDefaultValuesForCountriesHavingDefaultValue(recievingAmount: String, exchangeModel: ExchangeRateModel) {
- guard let recievingCurrency = CountryInfo().getDefaultSendingCurrency(for: exchangeModel.countryCode ?? ""),
- let recievingCountryId = exchangeModel.countryId,
- let paymentMethod = exchangeModel.availableServices?.elementAt(index: selectedPaymentIndex.row)
- else {
- // do something if you have to do
- return
- }
self.calcBy = "p"
self.reciepientTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: recievingAmount)
let reciepientCountryName = exchangeModel.country
self.calculate(senderAmt: nil, senderCurrency: "KRW", recieverAmt: recievingAmount, recieverCurrency: recievingCurrency, recieverCountryName: reciepientCountryName, recieverCountryId: recievingCountryId, paymentMethod: paymentMethod.id, calcBy: calcBy, shouldShowLoading: false)
+ return
+ }
}
-
- private func fetchExchangeRateInformation() {
- self.showProgressHud()
- self.fetchCountryCurrencyInfo(success: { (models) in
- self.exchangeRateModels = models
- }) { (error) in
- self.hideProgressHud()
- self.view.endEditing(true)
- self.alert(type: .error, message: error.localizedDescription)
- }
+ self.calculateExchangeRate(nil)
+ // show country with flag.
+ }
+
+
+ @objc private func textChanged(sender: UITextField) {
+ switch sender {
+ case senderTextField:
+ self.reciepientTextField.text = ""
+ self.calcBy = "c"
+ senderTextField.text = Utility.getCommaSeperatedString(numberString: senderTextField.text!)
+ case reciepientTextField:
+
+ self.senderTextField.text = ""
+ self.calcBy = "p"
+ reciepientTextField.text = Utility.getCommaSeperatedString(numberString: reciepientTextField.text!)
+ default:
+ break
}
+ }
+
+
+
+ private func setCountryFlag(countryCode: String) {
+ let flag = CountryInfo().getFlag(for: countryCode)
+ self.countryFlagImage.image = flag
+ }
+
+
+ private func setCurrencyLabel(currency: String) {
+ self.countryCodeLabel.text = currency.uppercased()
+ }
+
+ private func populateDefaultAmounts() {
+ guard let nativeCountry = self.nativeCountryCode else {return}
+ // todo: native country cha bhane tesko CountryInfo class ma defaullt value cha ki chaina herne
+ // CountryInfo class ma defaullt value cha bhane tyo value rakhera second api hit garna paryo ani aako data dekhaune
+ // natra bhane tesko 1000000 kwr ko native ma kati huncha teti populate garaune
- private func setupTargets() {
- let tapGuesture = UITapGestureRecognizer(target: self, action: #selector(self.showCountryList(_:)))
- self.countryListTapGuesture = tapGuesture
- self.countryListStackView.addGestureRecognizer(self.countryListTapGuesture!)
- self.reciepientTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControl.Event.editingChanged)
- self.senderTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControl.Event.editingChanged)
-
- self.reciepientTextField.addTarget(self, action: #selector(self.textFieldSelected(sender:)), for: UIControl.Event.editingDidBegin)
- self.senderTextField.addTarget(self, action: #selector(self.textFieldSelected(sender:)), for: UIControl.Event.editingDidBegin)
-
- }
+ guard let exchangeModel = self.exchangeRateModels?.filter({
+ $0.countryCode?.lowercased() == nativeCountry.lowercased() // countryCode
+ }).first else {return}
- @objc private func textFieldSelected(sender: UITextField) {
- switch sender {
- case senderTextField:
- if Utility.getDeviceModel() == .iphone678 {
- let x = self.scrollView.contentOffset.x
- let y = self.scrollView.contentOffset.y
- let newOffset = CGPoint.init(x: x, y: y + 100)
- scrollView.setContentOffset(newOffset, animated: true)
- }
-
- if Utility.getDeviceModel() == .iphone5 {
- let x = self.scrollView.contentOffset.x
- let y = self.scrollView.contentOffset.y
- let newOffset = CGPoint.init(x: x, y: y + 150)
- scrollView.setContentOffset(newOffset, animated: true)
- }
-
- case reciepientTextField:
- break
- default:
- break
- }
- }
+ // self.selectedExchageRateModel = exchangeModel
- private func setupDelegates() {
- self.collectionView.delegate = self
- self.collectionView.dataSource = self
- }
- private func setup() {
- let dropDownImage = #imageLiteral(resourceName: "dropdown_white").withRenderingMode(UIImage.RenderingMode.alwaysTemplate)
- let image = dropDownImage
- self.dropDownImageView.image = image
- self.dropDownImageView.tintColor = UIColor.white
- self.paymentModeStackViewConstraint.constant = 0
- self.paymentModeStackView.alpha = 0
- self.senderTextField.delegate = self
- self.reciepientTextField.delegate = self
- // corner Radius
- [backgroundViewCountryLabel1, backgroundViewCountryLabel2].forEach({
- $0?.layer.cornerRadius = 5
- })
-
- [exchangeBackground1, exchangeBackground2].forEach({
- $0?.layer.borderWidth = 1
- $0?.layer.borderColor = UIColor.init(hex: "#E0E0E0").cgColor
- $0?.layer.cornerRadius = 5
- })
-
- setupLanguage()
- }
+ // if there is no default amount, then we have to calculate from korean won. so guard ma rakhna thik nahola, yo case hereko chaina
- private func setupLanguage() {
- let constant = StringConstants()
- self.youSendTitleLabel.text = constant.youSendText
- self.recepientGetsTitleLabel.text = constant.recepientGetsText
- self.selectPaymentModeTitleLabel.text = "select_payment_mode_text".localized()
- self.calculateTItleLabel.setTitle(constant.calculate, for: UIControl.State.normal)
+ if let recievingAmount = CountryInfo().getDefaultSendingAmount(for: exchangeModel.countryCode ?? "") {
+ self.setDefaultValuesForCountriesHavingDefaultValue(recievingAmount: recievingAmount, exchangeModel: exchangeModel)
}
- func show(error: String) {
- self.view.endEditing(true)
- self.alert(type: .error, message: error)
- }
- func showLoading() {
- self.showProgressHud()
+ }
+
+ private func setDefaultValuesForCountriesNotHavingDefaultValueAfterCountrySelection() {
+ // self.selectedExchageRateModel = self.exchangeRateModels?.first
+ let senderAmount = CountryInfo().getDefaultSendingMoneyInKoreanWon()
+ self.senderTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: senderAmount ?? "")
+ let senderCurrency = "KWR"
+ let recieverCurrency = self.selectedExchageRateModel?.currency
+ let recieverCountryId = self.selectedExchageRateModel?.countryId
+ let paymentMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: selectedPaymentIndex.row)
+ let reciepientCountryName = self.selectedExchageRateModel?.country ?? ""
+ let calcBy = "c"
+ let senderCountryName = "KOREA"
+
+ self.calculate(senderAmt: senderAmount, senderCurrency: senderCurrency, recieverAmt: nil, recieverCurrency: recieverCurrency, recieverCountryName: reciepientCountryName, recieverCountryId: recieverCountryId, paymentMethod: paymentMethod?.id, calcBy: calcBy, shouldShowLoading: true)
+ }
+
+ private func setDefaultValuesForCountriesNotHavingDefaultValueFirsttime() {
+ self.selectedExchageRateModel = self.exchangeRateModels?.first
+ let senderAmount = CountryInfo().getDefaultSendingMoneyInKoreanWon()
+ self.senderTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: senderAmount ?? "")
+ let senderCurrency = "KWR"
+ let recieverCurrency = self.selectedExchageRateModel?.currency
+ let recieverCountryId = self.selectedExchageRateModel?.countryId
+ let paymentMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: selectedPaymentIndex.row)
+ let reciepientCountryName = self.selectedExchageRateModel?.country ?? ""
+ let calcBy = "c"
+ let senderCountryName = "KOREA"
+
+ self.calculate(senderAmt: senderAmount, senderCurrency: senderCurrency, recieverAmt: nil, recieverCurrency: recieverCurrency, recieverCountryName: reciepientCountryName, recieverCountryId: recieverCountryId, paymentMethod: paymentMethod?.id, calcBy: calcBy, shouldShowLoading: false)
+ }
+
+ private func setDefaultValuesForCountriesHavingDefaultValue(recievingAmount: String, exchangeModel: ExchangeRateModel) {
+ guard let recievingCurrency = CountryInfo().getDefaultSendingCurrency(for: exchangeModel.countryCode ?? ""),
+ let recievingCountryId = exchangeModel.countryId,
+ let paymentMethod = exchangeModel.availableServices?.elementAt(index: selectedPaymentIndex.row)
+ else {
+ // do something if you have to do
+ return
}
-
- func hideLoading() {
- self.hideProgressHud()
+ self.calcBy = "p"
+ self.reciepientTextField.text = Utility.getCommaSeperatedStringWithDecimal(numberString: recievingAmount)
+ let reciepientCountryName = exchangeModel.country
+ self.calculate(senderAmt: nil, senderCurrency: "KRW", recieverAmt: recievingAmount, recieverCurrency: recievingCurrency, recieverCountryName: reciepientCountryName, recieverCountryId: recievingCountryId, paymentMethod: paymentMethod.id, calcBy: calcBy, shouldShowLoading: false)
+ }
+
+
+ private func fetchExchangeRateInformation() {
+ self.showProgressHud()
+ self.fetchCountryCurrencyInfo(success: { (models) in
+ self.exchangeRateModels = models
+ }) { (error) in
+ self.hideProgressHud()
+ self.view.endEditing(true)
+ self.alert(type: .error, message: error.localizedDescription)
}
+ }
+
+ private func setupTargets() {
+ let tapGuesture = UITapGestureRecognizer(target: self, action: #selector(self.showCountryList(_:)))
+ self.countryListTapGuesture = tapGuesture
+ self.countryListStackView.addGestureRecognizer(self.countryListTapGuesture!)
+ self.reciepientTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControl.Event.editingChanged)
+ self.senderTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControl.Event.editingChanged)
+ self.reciepientTextField.addTarget(self, action: #selector(self.textFieldSelected(sender:)), for: UIControl.Event.editingDidBegin)
+ self.senderTextField.addTarget(self, action: #selector(self.textFieldSelected(sender:)), for: UIControl.Event.editingDidBegin)
-
- private func setupNavigation() {
- self.setupNormalNavigation()
+ }
+
+ @objc private func textFieldSelected(sender: UITextField) {
+ switch sender {
+ case senderTextField:
+ if Utility.getDeviceModel() == .iphone678 {
+ let x = self.scrollView.contentOffset.x
+ let y = self.scrollView.contentOffset.y
+ let newOffset = CGPoint.init(x: x, y: y + 100)
+ scrollView.setContentOffset(newOffset, animated: true)
+ }
+
+ if Utility.getDeviceModel() == .iphone5 {
+ let x = self.scrollView.contentOffset.x
+ let y = self.scrollView.contentOffset.y
+ let newOffset = CGPoint.init(x: x, y: y + 150)
+ scrollView.setContentOffset(newOffset, animated: true)
+ }
+
+ case reciepientTextField:
+ break
+ default:
+ break
}
+ }
+
+ private func setupDelegates() {
+ self.collectionView.delegate = self
+ self.collectionView.dataSource = self
+ }
+
+ private func setup() {
+ let dropDownImage = #imageLiteral(resourceName: "dropdown_white").withRenderingMode(UIImage.RenderingMode.alwaysTemplate)
+ let image = dropDownImage
+ self.dropDownImageView.image = image
+ self.dropDownImageView.tintColor = UIColor.white
+ self.paymentModeStackViewConstraint.constant = 0
+ self.paymentModeStackView.alpha = 0
+ self.senderTextField.delegate = self
+ self.reciepientTextField.delegate = self
+ // corner Radius
+ [backgroundViewCountryLabel1, backgroundViewCountryLabel2].forEach({
+ $0?.layer.cornerRadius = 5
+ })
+
+ [exchangeBackground1, exchangeBackground2].forEach({
+ $0?.layer.borderWidth = 1
+ $0?.layer.borderColor = UIColor.init(hex: "#E0E0E0").cgColor
+ $0?.layer.cornerRadius = 5
+ })
+
+ setupLanguage()
+ }
+
+ private func setupLanguage() {
+ let constant = StringConstants()
+ self.youSendTitleLabel.text = constant.youSendText
+ self.recepientGetsTitleLabel.text = constant.recepientGetsText
+ self.selectPaymentModeTitleLabel.text = "select_payment_mode_text".localized()
+ self.calculateTItleLabel.setTitle(constant.calculate, for: UIControl.State.normal)
+ }
+
+ func show(error: String) {
+ self.view.endEditing(true)
+ self.alert(type: .error, message: error)
+ }
+
+ func showLoading() {
+ self.showProgressHud()
+ }
+
+ func hideLoading() {
+ self.hideProgressHud()
+ }
+
+
+
+ private func setupNavigation() {
+ self.setupNormalNavigation()
+ }
}
extension ExchangeRatesViewController: UICollectionViewDelegate {
+
+ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
- func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
-
- let cell = collectionView.cellForItem(at: indexPath) as! ExchangeRateCollectionViewCell
- self.selectedPaymentIndex = indexPath
- self.collectionView.reloadData()
- self.calculateExchangeRate(nil)
- }
+ let cell = collectionView.cellForItem(at: indexPath) as! ExchangeRateCollectionViewCell
+ self.selectedPaymentIndex = indexPath
+ self.collectionView.reloadData()
+ self.calculateExchangeRate(nil)
+ }
}
extension ExchangeRatesViewController: UICollectionViewDataSource {
- func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- return self.selectedExchageRateModel?.availableServices?.count ?? 0
- }
-
- func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- let service = self.selectedExchageRateModel?.availableServices?.elementAt(index: indexPath.row)
- guard let index = PaymentMode.init(rawValue: service?.id ?? "") else {
- return UICollectionViewCell()
-
- }
- switch index {
- case .bankDeposite:
- return configureBankDepositeCell(collectionView: collectionView, indexPath: indexPath)
- case .cashDelivery:
- return configureCashDeliveryCell(collectionView: collectionView, indexPath: indexPath)
- case .homeDelivery:
- return configureHomeDeliveryCell(collectionView: collectionView, indexPath: indexPath)
-
- case .mobileWallet:
- return configureWalletDeliveryCell(collectionView: collectionView, indexPath: indexPath)
- }
- }
-
- func configureBankDepositeCell(collectionView: UICollectionView, indexPath: IndexPath) -> UICollectionViewCell {
- let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ExchangeRateCollectionViewCell", for: indexPath) as! ExchangeRateCollectionViewCell
- cell.cellSelected = self.selectedPaymentIndex == indexPath
- cell.paymentServiceMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: indexPath.row)
- cell.image = #imageLiteral(resourceName: "ic_bank")
- cell.setup()
- return cell
- }
-
- func configureWalletDeliveryCell(collectionView: UICollectionView, indexPath: IndexPath) -> UICollectionViewCell {
- let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ExchangeRateCollectionViewCell", for: indexPath) as! ExchangeRateCollectionViewCell
- cell.cellSelected = self.selectedPaymentIndex == indexPath
- cell.paymentServiceMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: indexPath.row)
- cell.image = #imageLiteral(resourceName: "wallet-transfer")
- cell.setup()
- return cell
- }
-
- func configureCashDeliveryCell(collectionView: UICollectionView, indexPath: IndexPath) -> UICollectionViewCell {
- let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ExchangeRateCollectionViewCell", for: indexPath) as! ExchangeRateCollectionViewCell
- cell.cellSelected = self.selectedPaymentIndex == indexPath
- cell.paymentServiceMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: indexPath.row)
- cell.image = #imageLiteral(resourceName: "ic_cash")
- cell.setup()
- return cell
+ func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+ return self.selectedExchageRateModel?.availableServices?.count ?? 0
+ }
+
+ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+ let service = self.selectedExchageRateModel?.availableServices?.elementAt(index: indexPath.row)
+ guard let index = PaymentMode.init(rawValue: service?.id ?? "") else {
+ return UICollectionViewCell()
+
}
-
- func configureHomeDeliveryCell(collectionView: UICollectionView, indexPath: IndexPath) -> UICollectionViewCell {
- let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ExchangeRateCollectionViewCell", for: indexPath) as! ExchangeRateCollectionViewCell
- cell.cellSelected = self.selectedPaymentIndex == indexPath
- cell.paymentServiceMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: indexPath.row)
- cell.image = #imageLiteral(resourceName: "ic_homeDelivery")
- cell.setup()
- return cell
+ switch index {
+ case .bankDeposite:
+ return configureBankDepositeCell(collectionView: collectionView, indexPath: indexPath)
+ case .cashDelivery:
+ return configureCashDeliveryCell(collectionView: collectionView, indexPath: indexPath)
+ case .homeDelivery:
+ return configureHomeDeliveryCell(collectionView: collectionView, indexPath: indexPath)
+
+ case .mobileWallet:
+ return configureWalletDeliveryCell(collectionView: collectionView, indexPath: indexPath)
}
+ }
+
+ func configureBankDepositeCell(collectionView: UICollectionView, indexPath: IndexPath) -> UICollectionViewCell {
+ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ExchangeRateCollectionViewCell", for: indexPath) as! ExchangeRateCollectionViewCell
+ cell.cellSelected = self.selectedPaymentIndex == indexPath
+ cell.paymentServiceMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: indexPath.row)
+ cell.image = #imageLiteral(resourceName: "ic_bank")
+ cell.setup()
+ return cell
+ }
+
+ func configureWalletDeliveryCell(collectionView: UICollectionView, indexPath: IndexPath) -> UICollectionViewCell {
+ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ExchangeRateCollectionViewCell", for: indexPath) as! ExchangeRateCollectionViewCell
+ cell.cellSelected = self.selectedPaymentIndex == indexPath
+ cell.paymentServiceMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: indexPath.row)
+ cell.image = #imageLiteral(resourceName: "wallet-transfer")
+ cell.setup()
+ return cell
+ }
+
+ func configureCashDeliveryCell(collectionView: UICollectionView, indexPath: IndexPath) -> UICollectionViewCell {
+ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ExchangeRateCollectionViewCell", for: indexPath) as! ExchangeRateCollectionViewCell
+ cell.cellSelected = self.selectedPaymentIndex == indexPath
+ cell.paymentServiceMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: indexPath.row)
+ cell.image = #imageLiteral(resourceName: "ic_cash")
+ cell.setup()
+ return cell
+ }
+
+ func configureHomeDeliveryCell(collectionView: UICollectionView, indexPath: IndexPath) -> UICollectionViewCell {
+ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ExchangeRateCollectionViewCell", for: indexPath) as! ExchangeRateCollectionViewCell
+ cell.cellSelected = self.selectedPaymentIndex == indexPath
+ cell.paymentServiceMethod = self.selectedExchageRateModel?.availableServices?.elementAt(index: indexPath.row)
+ cell.image = #imageLiteral(resourceName: "ic_homeDelivery")
+ cell.setup()
+ return cell
+ }
}
extension ExchangeRatesViewController: FetchCountryCurrencyInformation, getExchangeRateInformation {}
extension ExchangeRatesViewController: UITextFieldDelegate {
- func textFieldDidEndEditing(_ textField: UITextField) {
- self.calculateExchangeRate(nil)
- }
+ func textFieldDidEndEditing(_ textField: UITextField) {
+ self.calculateExchangeRate(nil)
+ }
}
// MARK: ExchangeRatesViewInterface
extension ExchangeRatesViewController: ExchangeRatesViewInterface {
-
+
}
// MARK: - TablePresenterDelegate
diff --git a/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPassword.storyboard b/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPassword.storyboard
index 5fbd461e..f11718b6 100644
--- a/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPassword.storyboard
+++ b/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPassword.storyboard
@@ -1,6 +1,6 @@
-
-
+
+
@@ -18,223 +18,121 @@
-
-
+
+
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
+
+
+
+
+
+
-
-
+
-
-
-
-
+
+
+
-
-
-
+
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
-
+
-
+
-
-
-
diff --git a/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPasswordViewController.swift b/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPasswordViewController.swift
index d8378bbe..d9fdeb58 100644
--- a/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPasswordViewController.swift
+++ b/GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPasswordViewController.swift
@@ -7,109 +7,100 @@
//
import UIKit
+import ValidationTextField
class ForgotPasswordViewController: UIViewController {
-
- struct StringConstants {
- let headerTitle = "forgot_password_title_text".localized()
- let subHeaderTitle = "forgot_password_subtitle_text".localized()
- let userIdPlaceholder = "user_Id_placeholder_text".localized()
- let dobPlaceholder = "dob_text".localized()
- let resetText = "reset_text".localized()
- let cancelText = "cancel_text".localized()
- let userIdTitleText = "login_user_id_text".localized()
- let dobTitleText = "dob_text".localized()
- }
-
- // MARK: IBOutlets
- @IBOutlet weak var headerLabel: UILabel!
- @IBOutlet weak var subHeaderLabel: UILabel!
- @IBOutlet weak var userIdTitleLabel: UILabel!
- @IBOutlet weak var dobTitleLabel: UILabel!
-
-
- @IBOutlet weak var userNameTextField: UITextField!
- @IBOutlet weak var dobTextField: UITextField!
- @IBOutlet weak var resetButton: UIButton!
- @IBOutlet weak var cancelButton: UIButton!
-
-
- // MARK: Properties
-
- var presenter: ForgotPasswordModuleInterface?
- let datePicker = UIDatePicker()
-
- // MARK: VC's Life cycle
-
- override func viewDidLoad() {
- super.viewDidLoad()
- self.setup()
- }
-
- // MARK: IBActions
-
- @IBAction func _continue(_ sender: UIButton) {
- let username = self.userNameTextField.text!
-// let dob = self.dobTextField.text!
- let dob = ""
- self.presenter?.reset(username: username, dob: dob)
+
+ struct StringConstants {
+ let headerTitle = "forgot_password_title_text".localized()
+ let subHeaderTitle = "forgot_password_subtitle_text".localized()
+ let userIdPlaceholder = "forgot_password_userId_placeholder_text".localized()
+ let resetText = "reset_text".localized()
+ let userIdTitleText = "login_user_id_text".localized()
+ }
+
+ // MARK: IBOutlets
+ @IBOutlet weak var headerLabel: UILabel!
+ @IBOutlet weak var subHeaderLabel: UILabel!
+
+ @IBOutlet weak var userNameTextField: ValidationTextField!
+ @IBOutlet weak var resetButton: UIButton!
+
+ // MARK: Properties
+
+ var presenter: ForgotPasswordModuleInterface?
+
+ var isValid = false {
+ didSet {
+ resetButton.isEnabled = isValid
+ resetButton.backgroundColor = isValid ? AppConstants.themeRedColor : .lightGray
}
-
- @IBAction func cancel(_ sender: UIButton) {
- self.presenter?.cancel()
+ }
+ // MARK: VC's Life cycle
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ self.setup()
+ }
+
+ // MARK: IBActions
+
+ @IBAction func _continue(_ sender: UIButton) {
+ let username = self.userNameTextField.text!
+ self.presenter?.reset(username: username, dob: "")
+ }
+
+ // MARK: Other Functions
+
+ private func setup() {
+ // all setup should be done here
+ self.setupPicturedNavBar()
+ configureLanguage()
+
+ userNameTextField.statusImageView.isHidden = true
+ userNameTextField.validCondition = {
+ if $0.count > 3 {
+ self.isValid = true
+ return self.isValid
+ } else {
+ self.isValid = false
+ return self.isValid
+ }
}
+ resetButton.layer.cornerRadius = 10
+ }
+
+ func configureLanguage() {
+ let font = UIFont.init(name: "SanFranciscoDisplay-regular", size: 12)!
+ userNameTextField.titleFont = font
+ userNameTextField.placeholder = StringConstants().userIdPlaceholder
+ userNameTextField.titleText = StringConstants().userIdTitleText
- // MARK: Other Functions
-
- private func setup() {
- // all setup should be done here
- self.setupDatePicker()
- self.setupPicturedNavBar()
- configureLanguage()
- }
+ resetButton.setTitle(StringConstants().resetText, for: UIControl.State.normal)
- func configureLanguage() {
- self.userNameTextField.placeholder = StringConstants().userIdPlaceholder
- self.dobTextField.placeholder = StringConstants().dobPlaceholder
- self.resetButton.setTitle(StringConstants().resetText, for: UIControl.State.normal)
- self.cancelButton.setTitle(StringConstants().cancelText, for: UIControl.State.normal)
- self.headerLabel.text = StringConstants().headerTitle
- self.subHeaderLabel.text = StringConstants().subHeaderTitle
- self.userIdTitleLabel.text = "email_text".localized()
- self.dobTitleLabel.text = StringConstants().dobTitleText
- }
+ headerLabel.text = StringConstants().headerTitle
- private func setupDatePicker() {
- self.datePicker.datePickerMode = .date
- self.dobTextField.inputView = datePicker
- datePicker.maximumDate = Date()
- self.datePicker.addTarget(self, action: #selector(handleDatePicker(sender:)), for: .valueChanged)
- }
-
- @objc private func handleDatePicker(sender: UIDatePicker) {
- let dateFormatter = DateFormatter()
- dateFormatter.dateFormat = "yyyy-MM-dd"
- self.dobTextField.text = dateFormatter.string(from: sender.date)
- }
+ subHeaderLabel.text = StringConstants().subHeaderTitle
+ }
}
// MARK: ForgotPasswordViewInterface
extension ForgotPasswordViewController: ForgotPasswordViewInterface {
- func showLoading() {
- self.showProgressHud()
- }
-
- func hideLoading() {
- self.hideProgressHud()
- }
-
- func show(message: String) {
- self.alertWithOk(type: .normal, message: message, title: "Success", okTitle: "Ok") {
- self.presenter?.cancel()
- }
- }
-
- func show(error: String) {
- self.alert(type: .error, message: error)
+ func showLoading() {
+ self.showProgressHud()
+ }
+
+ func hideLoading() {
+ self.hideProgressHud()
+ }
+
+ func show(message: String) {
+ self.alertWithOk(type: .normal, message: message, title: "Success", okTitle: "Ok") {
+ self.presenter?.cancel()
}
+ }
+
+ func show(error: String) {
+ self.alert(type: .error, message: error)
+ }
}
diff --git a/GMERemittance/Module/Login/User Interface/View/Login.storyboard b/GMERemittance/Module/Login/User Interface/View/Login.storyboard
index d8e03c07..18116d96 100644
--- a/GMERemittance/Module/Login/User Interface/View/Login.storyboard
+++ b/GMERemittance/Module/Login/User Interface/View/Login.storyboard
@@ -1,5 +1,5 @@
-
+
@@ -18,296 +18,148 @@
-
-
+
+
-
-
+
+
-
+
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
diff --git a/GMERemittance/Module/Login/User Interface/View/LoginViewController.swift b/GMERemittance/Module/Login/User Interface/View/LoginViewController.swift
index 3dafafee..2f8bce53 100644
--- a/GMERemittance/Module/Login/User Interface/View/LoginViewController.swift
+++ b/GMERemittance/Module/Login/User Interface/View/LoginViewController.swift
@@ -9,6 +9,7 @@
import UIKit
import Localize_Swift
import LocalAuthentication
+import ValidationTextField
class LoginViewController: UIViewController {
struct StringConstants {
@@ -18,6 +19,7 @@ class LoginViewController: UIViewController {
let userIdTitle = "userid_title_text".localized()
let userIdPlaceholder = "userid_placeholder_text".localized()
let passwordTitle = "password_text".localized()
+ let passwordPlaceholder = "enter_login_password_text".localized()
let forgotPasswordText = "forgot_password_text".localized()
let newToGmeText = "new_to_gme_text".localized()
@@ -28,27 +30,15 @@ class LoginViewController: UIViewController {
// MARK: IBOutlets
- @IBOutlet weak var userNameTextField: UITextField!
- @IBOutlet weak var passwordTextField: UITextField!
+ @IBOutlet weak var userNameTextField: ValidationTextField!
+ @IBOutlet weak var passwordTextField: ValidationTextField!
// views
- @IBOutlet weak var backgroundTextfieldsView: UIView!
- @IBOutlet weak var userIdBackgroundView: UIView!
- @IBOutlet weak var passwordBackgroundView: UIView!
-
@IBOutlet weak var headerTitle: UILabel!
@IBOutlet weak var subtitle: UILabel!
- @IBOutlet weak var userIdTitleLabel: UILabel!
-
- @IBOutlet weak var passwordTitleLabel: UILabel!
-
@IBOutlet weak var newToGmeLabel: UILabel!
-
@IBOutlet weak var registerHereButton: UIButton!
-
@IBOutlet weak var forgotPasswordButton: UIButton!
- @IBOutlet weak var forgotPasswordView: UIView!
- @IBOutlet weak var logoImageView: UIImageView!
@IBOutlet weak var loginButton: UIButton!
var encryptedPassword : String? {
@@ -83,8 +73,6 @@ class LoginViewController: UIViewController {
super.viewWillAppear(animated)
}
-
-
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationItem.title = ""
@@ -110,10 +98,22 @@ class LoginViewController: UIViewController {
// all setup should be done here
setupNavBar()
setupColor()
- self.userNameTextField.delegate = self
- self.passwordTextField.delegate = self
- self.userNameTextField.returnKeyType = .next
- // showAnimation()
+ userNameTextField.delegate = self
+ passwordTextField.delegate = self
+ userNameTextField.returnKeyType = .next
+
+ let font = UIFont.init(name: "SanFranciscoDisplay-regular", size: 12)!
+ userNameTextField.titleFont = font
+ userNameTextField.statusImageView.isHidden = true
+ userNameTextField.validCondition = { $0.count > 3 }
+ userNameTextField.errorMessage = "userid_error_text".localized()
+
+ passwordTextField.titleFont = font
+ passwordTextField.statusImageView.isHidden = true
+ passwordTextField.validCondition = { $0.count > 5 }
+ passwordTextField.errorMessage = "password_policy_error".localized()
+
+ loginButton.layer.cornerRadius = 10
}
func authenticateUser() {
@@ -147,89 +147,35 @@ class LoginViewController: UIViewController {
}
private func configureLanguage() {
- self.headerTitle.text = StringConstants().headerTitle
- self.subtitle.text = StringConstants().subHeaderTitle
- self.userIdTitleLabel.text = StringConstants().userIdTitle
- self.userNameTextField.placeholder = StringConstants().userIdPlaceholder
- self.passwordTitleLabel.text = StringConstants().passwordTitle
+ headerTitle.text = StringConstants().headerTitle
+ subtitle.text = StringConstants().subHeaderTitle
+
+ userNameTextField.titleText = StringConstants().userIdTitle
+ userNameTextField.placeholder = StringConstants().userIdPlaceholder
+
+ passwordTextField.titleText = StringConstants().passwordTitle
+ passwordTextField.placeholder = StringConstants().passwordPlaceholder
+
+ forgotPasswordButton.setTitle(StringConstants().forgotPasswordText, for: .normal)
+
+ newToGmeLabel.text = StringConstants().newToGmeText
- self.forgotPasswordButton.setTitle(StringConstants().forgotPasswordText, for: .normal)
- self.newToGmeLabel.text = StringConstants().newToGmeText
- self.registerHereButton.setTitle(StringConstants().registerHereText, for: .normal)
- self.loginButton.setTitle(StringConstants().loginText, for: .normal)
+ registerHereButton.setTitle(StringConstants().registerHereText, for: .normal)
+
+ loginButton.setTitle(StringConstants().loginText, for: .normal)
}
-
func setupColor() {
self.loginButton.backgroundColor = AppConstants.themeRedColor
self.headerTitle.textColor = AppConstants.themeRedColor
}
- func showAnimation() {
- setupInitialPositionsOfviews()
- animateViews()
- }
-
- private func setupInitialPositionsOfviews() {
- self.userIdBackgroundView.center.x -= self.view.bounds.width
- self.passwordBackgroundView.center.x -= self.view.bounds.width
- self.loginButton.transform = CGAffineTransform.init(scaleX: 0, y: 1)
- self.headerTitle.alpha = 0
- self.headerTitle.center.y -= 200
- self.subtitle.alpha = 0
- self.forgotPasswordView.alpha = 0
- self.logoImageView.center.y += (self.logoImageView.bounds.height + 20)
- self.loginButton.setTitle("", for: UIControl.State.normal)
-
- }
-
- private func animateViews() {
- // user id
- UIView.animate(withDuration: 0.5, animations: {
- self.userIdBackgroundView.center.x += self.view.bounds.width
- })
-
- // password
- UIView.animate(withDuration: 0.5, delay: 0.3, options: [], animations: {
- self.passwordBackgroundView.center.x += self.view.bounds.width
- }, completion: nil)
-
- // login button
- UIView.animate(withDuration: 0.5, delay: 0.4, options: [], animations: {
- self.loginButton.transform = CGAffineTransform.identity
- }, completion: { (_) in
- self.loginButton.setTitle("Login", for: UIControl.State.normal)
- })
-
-
- // subtitle
- UIView.animate(withDuration: 0.5, delay: 0.7, options: [], animations: {
- self.subtitle.alpha = 1
- }, completion: nil)
-
- // forgot password
- UIView.animate(withDuration: 0.5, delay: 0.9, options: [], animations: {
- self.forgotPasswordView.alpha = 1
- })
-
-
- // header title
- // logoimageview
- UIView.animate(withDuration: 0.7, delay: 0, options: [], animations: {
- // todo
- self.headerTitle.alpha = 1
- self.headerTitle.center.y += 200
- self.logoImageView.center.y -= (self.logoImageView.bounds.height + 20)
- }, completion: nil)
-
- }
private func setupNavBar() {
self.setupPicturedNavBar()
}
private func authenticate(){
-
guard
let email = KeyChain.shared.get(key: .id),
let typedEmail = self.userNameTextField.text,
@@ -329,7 +275,15 @@ extension LoginViewController: SecureKeypadDelegate {
func didComplete(_ encryptedString: String, length: Int) {
if encryptedString != "" {
self.encryptedPassword = encryptedString
- self.passwordTextField.text = "password"
+
+ var garbagePW = ""
+ for _ in 0.. KycForm1Model {
+ // For use id number field in kycForm2
+ GMEDB.shared.user.set(dobTextField.text, .dateOfBirth)
+
return KycForm1Model(
firstName: firstNameTextField.text ?? "",
middleName: "",
diff --git a/GMERemittance/Module/RegisterModules/KYC/kycForm2/User Interface/View/kycForm2ViewController.swift b/GMERemittance/Module/RegisterModules/KYC/kycForm2/User Interface/View/kycForm2ViewController.swift
index 95f58b60..ee24ae9c 100644
--- a/GMERemittance/Module/RegisterModules/KYC/kycForm2/User Interface/View/kycForm2ViewController.swift
+++ b/GMERemittance/Module/RegisterModules/KYC/kycForm2/User Interface/View/kycForm2ViewController.swift
@@ -578,6 +578,9 @@ extension KycForm2ViewController {
}
private func generateModel() -> KycForm2Model {
+ // For use PenneyTest Submit
+ GMEDB.shared.user.set(accountNumberTextField.text, .primaryAccountNumber)
+
return KycForm2Model(
bank: selectedBank?.id ?? "",
accountNumber: accountNumberTextField.text ?? "",
diff --git a/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmit.storyboard b/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmit.storyboard
index 2323b641..a687d721 100644
--- a/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmit.storyboard
+++ b/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmit.storyboard
@@ -1,6 +1,6 @@
-
-
+
+
@@ -15,177 +15,140 @@
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
+
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
+
diff --git a/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmitViewController.swift b/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmitViewController.swift
index 5a8510e9..4af1fe4b 100644
--- a/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmitViewController.swift
+++ b/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmitViewController.swift
@@ -20,7 +20,6 @@ class PennyTestSubmitViewController: UIViewController {
let viewSampleText = "view_sample_text".localized()
let resendRequestText = "resend_request_text".localized()
let submitText = "submit_text".localized()
- let notNowText = "not_now_text".localized()
}
// MARK: Properties
@@ -28,6 +27,13 @@ class PennyTestSubmitViewController: UIViewController {
var presenter: PennyTestSubmitModuleInterface?
weak var parentViewcontroller: UIViewController?
+ private var isValid = false {
+ didSet {
+ submitButton.isEnabled = isValid
+ submitButton.backgroundColor = isValid ? AppConstants.themeRedColor : .lightGray
+ }
+ }
+
// MARK: IBOutlets
@IBOutlet weak var dipositReferencelabel: UILabel!
@@ -36,7 +42,6 @@ class PennyTestSubmitViewController: UIViewController {
@IBOutlet weak var viewSampleButton: UIButton!
@IBOutlet weak var resendButton: UIButton!
@IBOutlet weak var submitButton: UIButton!
- @IBOutlet weak var notNowButton: UIButton!
// MARK: VC's Life cycle
override func viewDidLoad() {
@@ -62,6 +67,17 @@ class PennyTestSubmitViewController: UIViewController {
self.titleLabel.text = message
configureText()
+
+ submitButton.layer.cornerRadius = 10
+ verificationCodeTextField.addTarget(self, action: #selector(editingChanged(_:)), for: .editingChanged)
+ }
+
+ @objc private func editingChanged(_ textField: UITextField) {
+ guard let text = textField.text else {
+ return
+ }
+
+ isValid = text.count == 4 ? true : false
}
private func configureText() {
@@ -70,7 +86,6 @@ class PennyTestSubmitViewController: UIViewController {
self.viewSampleButton.setTitle(StringConstants().viewSampleText, for: UIControl.State.normal)
self.resendButton.setTitle(StringConstants().resendRequestText, for: UIControl.State.normal)
self.submitButton.setTitle(StringConstants().submitText, for: UIControl.State.normal)
- self.notNowButton.setTitle(StringConstants().notNowText, for: UIControl.State.normal)
}
@IBAction func viewSample(_ sender: Any) {
@@ -157,14 +172,14 @@ class PennyTestSubmitViewController: UIViewController {
}
@IBAction func Verify(_ sender: UIButton) {
- let customerId = Utility.getMyId()
- let certNumber = self.verificationCodeTextField.text!.removeSpacesTrailingPreceding()
- if certNumber.isEmpty || certNumber.count != 4 {
- self.alert(type: .error, message: "valid_verification_code_error".localized())
- return
+ guard let certNumber = self.verificationCodeTextField.text?.removeSpacesTrailingPreceding()
+ else {
+ self.alert(type: .error, message: "valid_verification_code_error".localized())
+ return
}
- let accountNumber = Utility.getMyPrimaryAccountNumber()
+ let customerId = GMEDB.shared.user.string(.senderId) ?? ""
+ let accountNumber = GMEDB.shared.user.string(.primaryAccountNumber) ?? ""
let params =
[
@@ -204,7 +219,7 @@ class PennyTestSubmitViewController: UIViewController {
GMEDB.shared.user.set(PennyTestStatusCode.completed.rawValue, .pennyTestStatusCode)
self.doLogin()
}
- }
+ }
)
}) { (error) in
self.alert(type: .error, message: error.localizedDescription)
@@ -308,6 +323,3 @@ extension PennyTestSubmitViewController: InitiatePennyTestService {
extension PennyTestSubmitViewController: UserInfoService {
}
-
-
-
diff --git a/GMERemittance/Module/RegisterModules/Register/User Interface/View/Register.storyboard b/GMERemittance/Module/RegisterModules/Register/User Interface/View/Register.storyboard
index 5ed4585c..1059e785 100644
--- a/GMERemittance/Module/RegisterModules/Register/User Interface/View/Register.storyboard
+++ b/GMERemittance/Module/RegisterModules/Register/User Interface/View/Register.storyboard
@@ -1,11 +1,12 @@
-
+
+
@@ -21,174 +22,153 @@
-
-
-
-
-
+
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
+
+
+
+
+
diff --git a/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift b/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift
index 835ade25..92820a64 100644
--- a/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift
+++ b/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift
@@ -100,7 +100,7 @@ class SplashScreenViewController: UIViewController {
$0.subtitle
} ?? [""]
- guard let defaultAmount = codeEnum?.defaultRecipientAmount else {
+ guard let defaultAmount = codeEnum?.getDefaultRecipientAcount(currency: selectedExchangeRateModel?.currency ?? "") else {
calcBy = "c"
senderTextField.text = codeEnum?.defaultSenderAmount.likeCommaMoney()
recipientTextField.text = ""
@@ -164,6 +164,8 @@ class SplashScreenViewController: UIViewController {
super.viewWillAppear(animated)
self.navigationItem.title = ""
hideNavBar()
+ setLanguageBackgroundView()
+
timer?.fire()
if selectedLanguage == nil {
@@ -226,7 +228,7 @@ class SplashScreenViewController: UIViewController {
hideNavBar()
setUpButtons()
- setLanguageBackgroundView()
+
appVersionLabel.text = Utility.getAppVersion()
setExchangeRateUI()
diff --git a/GMERemittance/Utility/CountryEnum.swift b/GMERemittance/Utility/CountryEnum.swift
index d30ce374..7b57caf9 100644
--- a/GMERemittance/Utility/CountryEnum.swift
+++ b/GMERemittance/Utility/CountryEnum.swift
@@ -658,32 +658,32 @@ extension CountryEnum {
}
extension CountryEnum {
- var defaultRecipientAmount: String? {
+ func getDefaultRecipientAcount(currency: String) -> String? {
let amount: String?
- switch self{
- case .np: amount = "100000" // nepal
- case .kh: amount = "500" // cambodia
- case .ph: amount = "50000" // philipines
- case .lk: amount = "100000" // sri lanka
- case .vn: amount = "50000000" // Vietnam
- case .in: amount = "50000" // india
- case .pk: amount = "100000" // pakistan
- case .az: amount = "1000" // azerbaijan
- case .bd: amount = "100000" // Bangladesh
- case .by: amount = "1000" // Belarus
- case .ge: amount = "1000" // Georgia
- case .kz: amount = "1000" // Kazakhstan
- case .kg: amount = "1000" // Kyrgyzstan
- case .my: amount = "10000" // Malaysia
- case .md: amount = "1000" // Moldova
- case .mn: amount = "1000" // Mongolia
- case .mm: amount = "1500000" // Myanmar
- case .ru: amount = "1000" // Russian Federation
- case .sg: amount = "2000" // Singapore
- case .tj: amount = "1000" // Tajikistan
- case .th: amount = "30000" // Thailand
- case .uz: amount = "1000" // Uzbekistan
+ switch self {
+ case .np: amount = currency == defaultCurrency ? "100000" : nil // nepal
+ case .kh: amount = currency == defaultCurrency ? "500" : nil // cambodia
+ case .ph: amount = currency == defaultCurrency ? "50000" : nil // philipines
+ case .lk: amount = currency == defaultCurrency ? "100000" : nil // sri lanka
+ case .vn: amount = currency == defaultCurrency ? "50000000" : nil // Vietnam
+ case .in: amount = currency == defaultCurrency ? "50000" : nil // india
+ case .pk: amount = currency == defaultCurrency ? "100000" : nil // pakistan
+ case .az: amount = currency == defaultCurrency ? "1000" : nil // azerbaijan
+ case .bd: amount = currency == defaultCurrency ? "100000" : nil // Bangladesh
+ case .by: amount = currency == defaultCurrency ? "1000" : nil // Belarus
+ case .ge: amount = currency == defaultCurrency ? "1000" : nil // Georgia
+ case .kz: amount = currency == defaultCurrency ? "1000" : nil // Kazakhstan
+ case .kg: amount = currency == defaultCurrency ? "1000" : nil // Kyrgyzstan
+ case .my: amount = currency == defaultCurrency ? "10000" : nil // Malaysia
+ case .md: amount = currency == defaultCurrency ? "1000" : nil // Moldova
+ case .mn: amount = currency == defaultCurrency ? "1000" : nil // Mongolia
+ case .mm: amount = currency == defaultCurrency ? "1500000" : nil // Myanmar
+ case .ru: amount = currency == defaultCurrency ? "1000" : nil // Russian Federation
+ case .sg: amount = currency == defaultCurrency ? "2000" : nil // Singapore
+ case .tj: amount = currency == defaultCurrency ? "1000" : nil // Tajikistan
+ case .th: amount = currency == defaultCurrency ? "30000" : nil // Thailand
+ case .uz: amount = currency == defaultCurrency ? "1000" : nil // Uzbekistan
default: amount = nil
}
@@ -694,4 +694,34 @@ extension CountryEnum {
var defaultSenderAmount: String {
return "1000000"
}
+
+ private var defaultCurrency: String {
+ let currency: String
+ switch self {
+ case .np: currency = "NPR" // nepal
+ case .kh: currency = "USD" // cambodia
+ case .ph: currency = "PHP" // philipines
+ case .lk: currency = "LKR" // sri lanka
+ case .vn: currency = "VND" // Vietnam
+ case .in: currency = "INR" // india
+ case .pk: currency = "PKR" // pakistan
+ case .az: currency = "USD" // azerbaijan
+ case .bd: currency = "USD" // Bangladesh
+ case .by: currency = "USD" // Belarus
+ case .ge: currency = "USD" // Georgia
+ case .kz: currency = "USD" // Kazakhstan
+ case .kg: currency = "USD" // Kyrgyzstan
+ case .my: currency = "MYR" // Malaysia
+ case .md: currency = "USD" // Moldova
+ case .mn: currency = "USD" // Mongolia
+ case .mm: currency = "MMK" // Myanmar
+ case .ru: currency = "USD" // Russian Federation
+ case .sg: currency = "SGD" // Singapore
+ case .tj: currency = "USD" // Tajikistan
+ case .th: currency = "THB" // Thailand
+ case .uz: currency = "USD" // Uzbekistan
+ default: currency = "KRW"
+ }
+ return currency
+ }
}
diff --git a/th.lproj/Localizable.strings b/th.lproj/Localizable.strings
index a23ca4a8..faea215d 100644
--- a/th.lproj/Localizable.strings
+++ b/th.lproj/Localizable.strings
@@ -392,13 +392,7 @@
"otp_empty_error" = "รหัส OTP ต้องไม่ว่างเปล่า";
"requesting_otp_text" = "ร้องขอ OTP";
-
-
-
-
-
-
-"resend_money_text" = "ทำรายการใหม่";
+"resend_money_text" = "ทำรายการอีกครั้ง";
"resend_search_hint_text" = "เลขที่ใบเสร็จ GME No. /ชื่อผู้รับ/ชื่อธนาคาร";