|
|
@ -31,6 +31,17 @@ enum ActionBehaviour { |
|
|
|
|
|
|
|
class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
|
|
|
|
struct StringConstants { |
|
|
|
let selectPaymentModeText = "select_payment_mode_text".localized() |
|
|
|
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() |
|
|
|
let defaultCurrency = "default_currency_text".localized() |
|
|
|
} |
|
|
|
|
|
|
|
private enum DiscountType: String { |
|
|
|
case percent = "1" |
|
|
|
case value = "2" |
|
|
@ -42,36 +53,34 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
@IBOutlet weak var cardView: UIView! |
|
|
|
@IBOutlet private weak var exchangeBackground1: UIView! |
|
|
|
@IBOutlet private weak var exchangeBackground2: UIView! |
|
|
|
@IBOutlet private weak var dropDownImageView: UIImageView! |
|
|
|
@IBOutlet private weak var backgroundViewCountryLabel1: UIView! |
|
|
|
@IBOutlet private weak var backgroundViewCountryLabel2: UIView! |
|
|
|
@IBOutlet private weak var countryListStackView: UIStackView! |
|
|
|
// @IBOutlet private weak var countryListStackView: UIStackView! |
|
|
|
@IBOutlet private weak var countryCodeLabel: UILabel! |
|
|
|
@IBOutlet private weak var countryFlagImage: UIImageView! |
|
|
|
@IBOutlet private weak var continueButton: UIButton! |
|
|
|
@IBOutlet private weak var senderTextField: GMENumberTextField! |
|
|
|
@IBOutlet private weak var reciepientTextField: GMENumberTextField! |
|
|
|
@IBOutlet private weak var transferFeeInfoLabel: UILabel! |
|
|
|
|
|
|
|
@IBOutlet weak var transferFeeIconView: UIImageView! |
|
|
|
|
|
|
|
@IBOutlet weak var transferFeeLabel: UILabel! |
|
|
|
@IBOutlet weak var exchangeRateIconView: UIImageView! |
|
|
|
|
|
|
|
|
|
|
|
@IBOutlet private weak var exchangeRateLabel: UILabel! |
|
|
|
@IBOutlet private weak var youSendTitleLabel: UILabel! |
|
|
|
@IBOutlet private weak var recipientGetsTitleLabel: UILabel! |
|
|
|
|
|
|
|
|
|
|
|
@IBOutlet weak var calculatedInfoView: UIView! |
|
|
|
@IBOutlet weak var serviceChargeView: UIStackView! |
|
|
|
@IBOutlet weak var exchangeRateView: UIStackView! |
|
|
|
@IBOutlet weak var backgroundView: UIView!{ |
|
|
|
didSet{ |
|
|
|
backgroundView.layer.cornerRadius = 12 |
|
|
|
backgroundView.layer.borderWidth = 0.2 |
|
|
|
backgroundView.layer.borderColor = UIColor.themeSeparate.cgColor |
|
|
|
backgroundView.layer.addShadow(with: UIColor.themeShadow) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@IBOutlet weak var couponListFetch: UIView! |
|
|
|
@IBOutlet weak var couponListShow: UIStackView! |
|
|
|
@IBOutlet weak var rewardView: UIView! |
|
|
|
// @IBOutlet weak var backgroundView: UIView!{ |
|
|
|
// didSet{ |
|
|
|
// backgroundView.layer.cornerRadius = 12 |
|
|
|
// backgroundView.layer.borderWidth = 0.2 |
|
|
|
// backgroundView.layer.borderColor = UIColor.themeSeparate.cgColor |
|
|
|
// backgroundView.layer.addShadow(with: UIColor.themeShadow) |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
@IBOutlet weak var rewardView: UIStackView! |
|
|
|
@IBOutlet weak var rewardTitle: UILabel! |
|
|
|
@IBOutlet weak var rewardTextField: UITextField! |
|
|
|
|
|
|
@ -135,15 +144,42 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
numberString: model.senderAmount ?? "" |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
transferFeeIconView.image = UIImage(named: "exchange_rate_transfer_fee") |
|
|
|
|
|
|
|
exchangeRateIconView.image = UIImage(named: "exchange_rate_transfer_fee") |
|
|
|
|
|
|
|
let serviceCharge = model.transferFee?.likeCommaMoney() ?? |
|
|
|
model.transferFee ?? |
|
|
|
"0.00" |
|
|
|
|
|
|
|
let transferFee = serviceCharge != "0.00" ? "-\(serviceCharge)" : "\(serviceCharge)" |
|
|
|
let transferInfo = "exchange_rate_guranteed".localized().attributedText(color: .theme2E89FF, font: .sanfrancisco(.semibold, size: 14)) |
|
|
|
|
|
|
|
let transferFee = (serviceCharge != "0.00" ? "-\(serviceCharge)" : "\(serviceCharge)").attributedText(color: .themeBlack, font: .sanfrancisco(.semibold, size: 14)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let transfer = NSMutableAttributedString() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
transfer.append(transferFee) |
|
|
|
transfer.append(transferInfo) |
|
|
|
|
|
|
|
transferFeeLabel.attributedText = transfer |
|
|
|
|
|
|
|
let exchangeRate = model.exchangeRate ?? "" |
|
|
|
|
|
|
|
let exchangeRateAttributed = ("1000 JPY = \(exchangeRate) \(exchangeRateModel?.senderCurrency ?? "") ").attributedText(color: .themeBlack, font: .sanfrancisco(.semibold, size: 14)) |
|
|
|
|
|
|
|
let exchangeRateInfo = ("".localized()).attributedText(color: .theme2E89FF, font: .sanfrancisco(.semibold, size: 14)) |
|
|
|
|
|
|
|
transferFeeInfoLabel.text = "\(transferFee)\n(\("transfer_fee_included_text".localized()))" |
|
|
|
exchangeRateLabel.text = |
|
|
|
"\(model.exchangeRate ?? "")\n(\("current_exchange_rate_text".localized()))" |
|
|
|
|
|
|
|
exchangeRateAttributed.append(exchangeRateAttributed) |
|
|
|
exchangeRateAttributed.append(exchangeRateInfo) |
|
|
|
|
|
|
|
exchangeRateLabel.attributedText = exchangeRateAttributed |
|
|
|
|
|
|
|
self.showExchangeRateInfomation(isHidden: false) |
|
|
|
|
|
|
@ -182,6 +218,7 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
// MARK: VC's Life cycle |
|
|
|
override func viewDidLoad() { |
|
|
|
super.viewDidLoad() |
|
|
|
|
|
|
|
setup() |
|
|
|
self.cardView.isHidden = true |
|
|
|
cardView.layer.cornerRadius = 10 |
|
|
@ -235,29 +272,24 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
// MARK: Other Functions |
|
|
|
private func setup() { |
|
|
|
// all setup should be done here |
|
|
|
// backgroundViewCountryLabel2.hero.id = reciepient?.receiverID |
|
|
|
// backgroundViewCountryLabel2.hero.modifiers = [.translate()] |
|
|
|
|
|
|
|
|
|
|
|
uiPropertySetup() |
|
|
|
setupTargets() |
|
|
|
action = .calculate |
|
|
|
senderTextField.delegate = self |
|
|
|
reciepientTextField.delegate = self |
|
|
|
|
|
|
|
calcBy = "c" |
|
|
|
// [backgroundViewCountryLabel1, backgroundViewCountryLabel2].forEach { $0?.layer.cornerRadius = 5 } |
|
|
|
[exchangeBackground1, exchangeBackground2].forEach { |
|
|
|
$0?.layer.borderWidth = 1 |
|
|
|
$0?.layer.borderColor = UIColor.themeSeparate.cgColor |
|
|
|
$0?.layer.borderWidth = 2 |
|
|
|
$0?.layer.borderColor = UIColor.init(hex: "#00001F").cgColor |
|
|
|
// UIColor.init(hex: "#E0E0E0").cgColor |
|
|
|
$0?.layer.cornerRadius = 5 |
|
|
|
$0?.layer.cornerRadius = 16 |
|
|
|
} |
|
|
|
|
|
|
|
configureLanguage() |
|
|
|
|
|
|
|
continueButton.layer.cornerRadius = 5 |
|
|
|
continueButton.backgroundColor = .themeRed |
|
|
|
continueButton.titleLabel?.font = .sanfrancisco(.medium, size: 18) |
|
|
|
|
|
|
|
senderTextField.textColor = .black |
|
|
|
reciepientTextField.textColor = .black |
|
|
|
// backgroundViewCountryLabel1.backgroundColor = .themeRed |
|
|
@ -266,9 +298,21 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
rewardTextField.placeholder = "rewards_point_placeholder_text".localized() |
|
|
|
} |
|
|
|
|
|
|
|
private func uiPropertySetup() { |
|
|
|
|
|
|
|
countryCodeLabel.textColor = .themeBlack |
|
|
|
countryCodeLabel.font = .sanfrancisco(.semibold, size: 16) |
|
|
|
|
|
|
|
continueButton.setTitle("continue_text".localized(), for: .normal) |
|
|
|
continueButton.backgroundColor = .theme2E89FF |
|
|
|
continueButton.titleLabel?.font = .sanfrancisco(.semibold, size: 20) |
|
|
|
continueButton.set(cornerRadius: 10) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private func showExchangeRateInfomation(isHidden flag: Bool) { |
|
|
|
// calculatedInfoView.isHidden = flag |
|
|
|
// calculatedInfoView.alpha = flag ? 0.0 : 1.0 |
|
|
|
|
|
|
|
|
|
|
|
if !flag { |
|
|
|
self.serviceChargeView.isHidden = false |
|
|
@ -299,7 +343,7 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
private func configureLanguage() { |
|
|
|
// youSendTitleLabel.text = "you_send_text".localized() |
|
|
|
// recipientGetsTitleLabel.text = "receipient_gets_text".localized() |
|
|
|
continueButton.setTitle("calculate_text".localized(), for: .normal) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private func setCountryFlag(countryCode: String) { |
|
|
@ -314,7 +358,7 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
private func setupTargets() { |
|
|
|
let tapGuesture = UITapGestureRecognizer(target: self, action: #selector(showCountryList(_:))) |
|
|
|
countryListTapGuesture = tapGuesture |
|
|
|
// countryListStackView.addGestureRecognizer(countryListTapGuesture) |
|
|
|
countryFlagImage.addGestureRecognizer(countryListTapGuesture) |
|
|
|
|
|
|
|
|
|
|
|
reciepientTextField.addTarget( |
|
|
@ -340,10 +384,7 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
private func configureViews() { |
|
|
|
exchangeRateModel = nil |
|
|
|
|
|
|
|
let dropDownImage = UIImage(named: "dropdown_grey") |
|
|
|
let image = dropDownImage |
|
|
|
|
|
|
|
// dropDownImageView.image = image |
|
|
|
|
|
|
|
setCountryFlag(countryCode: reciepient?.countryCode ?? "") |
|
|
|
let deliveryMethod = requestModel?.paymemtMode |
|
|
|
if (deliveryMethod?.bankRequired ?? "false").lowercased() == "true" { |
|
|
@ -434,10 +475,10 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
let reciepientCountryName = reciepient?.country |
|
|
|
let reciepientCountryId = reciepient?.countryID |
|
|
|
let paymentMode = "wallet" |
|
|
|
let paymentMethodId = paymentModel?.id |
|
|
|
let paymentMethodId = paymentModel?.receiverId |
|
|
|
let payoutPartner = requestModel?.paymemtMode?.payoutPartner |
|
|
|
let myUsername = Utility.getMyUserName() |
|
|
|
let bankId = requestModel?.bank?.id |
|
|
|
let bankId = paymentModel?.receiverId |
|
|
|
let discountedFee = rewardTextField.text |
|
|
|
// let discountedFee |
|
|
|
//bank id if selected bank |
|
|
|