// // SendMoneyExchangeRateInteractor.swift // GMERemittance // // Created by gme_2 on 28/08/2018. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. // import Foundation class SendMoneyExchangeRateInteractor { // MARK: Properties weak var output: SendMoneyExchangeRateInteractorOutput? private let service: SendMoneyExchangeRateServiceType // MARK: Initialization init(service: SendMoneyExchangeRateServiceType) { self.service = service } // MARK: Converting entities } // MARK: SendMoneyExchangeRate interactor input interface extension SendMoneyExchangeRateInteractor: SendMoneyExchangeRateInteractorInput { func calculate(params: [String : String]) { self.service.calculate(params: params, success: { (model) in if let model = model { self.output?.show(model: model) }else { let error = NSError.init(domain: "SendMoneyExchangeRateInteractor", code: 0, userInfo: [NSLocalizedDescriptionKey : "Failed to map exchange rate from server"]) self.output?.show(error: error) } }) { (error) in self.output?.show(error: error) } } }