Browse Source

added exchange rate model

pull/1/head
gme_2 6 years ago
parent
commit
5948d069b2
  1. 69
      GMERemittance/Module/ResendExchange/User Interface/View/ResendExchangeViewController.swift

69
GMERemittance/Module/ResendExchange/User Interface/View/ResendExchangeViewController.swift

@ -10,6 +10,23 @@ import UIKit
class ResendExchangeViewController: UIViewController {
struct ApiConstants {
static let senderAmount = "cAmount"
static let senderCurrency = "sCurrency"
static let recieverAmount = "pAmount"
static let recieverCurrency = "pCurrency"
static let recieverCountryId = "pCountry"
static let paymentMethod = "paymentType"
static let paymentMethodId = "serviceType"
static let calcBy = "calcBy"
static let recieverCountryName = "pCountryName"
static let senderCountryId = "sCountry"
static let bankId = "pAgent"
static let payOutPartner = "payOutPartner"
static let userId = "userId"
}
// MARK: IBOutlets
@IBOutlet weak var exchangeBackground1: UIView!
@ -150,9 +167,54 @@ class ResendExchangeViewController: UIViewController {
func calculate(senderAmt: String?, senderCurrency: String? = "KRW", recieverAmt: String?, recieverCurrency: String?, recieverCountryName: String?, recieverCountryId: String?, paymentMethod: String?, paymentMethodId: String? ,calcBy: String?, senderCountryId: String? = "118", payoutPartner: String?, userId: String?, bankId: String?) {
// self.presenter?.calculate(senderAmt: senderAmt, senderCurrency: senderCurrency, recieverAmt: recieverAmt, recieverCurrency: recieverCurrency, recieverCountryName: recieverCountryName, recieverCountryId: recieverCountryId, paymentMethod: paymentMethod, paymentMethodId: paymentMethodId, calcBy: calcBy, senderCountryId: senderCountryId, payoutPartner: payoutPartner, userId: userId, bankId: bankId)
let param: [String: String] =
[
ApiConstants.senderAmount : senderAmt ?? "",
ApiConstants.senderCurrency : senderCurrency ?? "",
ApiConstants.recieverAmount : recieverAmt ?? "",
ApiConstants.recieverCurrency : recieverCurrency ?? "",
ApiConstants.recieverCountryName: recieverCountryName ?? "",
ApiConstants.recieverCountryId : recieverCountryId ?? "",
ApiConstants.paymentMethod: paymentMethod ?? "",
ApiConstants.paymentMethodId: paymentMethodId ?? "",
ApiConstants.calcBy : calcBy ?? "",
ApiConstants.senderCountryId : senderCountryId ?? "",
ApiConstants.payOutPartner : payoutPartner ?? "",
ApiConstants.userId : userId ?? "",
ApiConstants.bankId : bankId ?? ""
]
self.calculate(params: param, success: { (model) in
if let model = model {
// self.output?.show(model: model)
self.exchangeRateModel = model
}else {
let error = NSError.init(domain: "SendMoneyExchangeRateInteractor", code: 0, userInfo: [NSLocalizedDescriptionKey : "Failed to map exchange rate from server"])
self.show(error: error.localizedDescription)
}
}) { (error) in
self.show(error: error.localizedDescription)
}
}
// func calculate(senderAmt: String?, senderCurrency: String?, recieverAmt: String?, recieverCurrency: String?, recieverCountryName: String?, recieverCountryId: String?, paymentMethod: String?, paymentMethodId: String?, calcBy: String?, senderCountryId: String?, payoutPartner: String?, userId: String?, bankId: String?) {
// let _senderAmt = senderAmt ?? ""
// let _recieverAmt = recieverAmt ?? ""
// if _senderAmt.isEmpty && _recieverAmt.isEmpty {
// let message = "please provide amount to calculate"
// self.view?.show(error: message)
// return
// }
// self.view?.showLoading()
//
//
// self.interactor?.calculate(params: param)
// }
@objc private func textChanged(sender: UITextField) {
self.action = .calculate
switch sender {
@ -175,6 +237,10 @@ extension ResendExchangeViewController: ResendExchangeViewInterface {
}
extension ResendExchangeViewController: FetchSendMoneyExchangeRateService {
}
extension ResendExchangeViewController {
@ -190,3 +256,6 @@ extension ResendExchangeViewController {
self.hideProgressHud()
}
}
Loading…
Cancel
Save