You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.0 KiB
46 lines
1.0 KiB
//
|
|
// ExchangeRatesInteractor.swift
|
|
// GMERemittance
|
|
//
|
|
// Created by gme_2 on 24/08/2018.
|
|
//Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class ExchangeRatesInteractor {
|
|
|
|
// MARK: Properties
|
|
|
|
weak var output: ExchangeRatesInteractorOutput?
|
|
private let service: ExchangeRatesServiceType
|
|
|
|
// MARK: Initialization
|
|
|
|
init(service: ExchangeRatesServiceType) {
|
|
self.service = service
|
|
}
|
|
|
|
// MARK: Converting entities
|
|
}
|
|
|
|
// MARK: ExchangeRates interactor input interface
|
|
|
|
extension ExchangeRatesInteractor: ExchangeRatesInteractorInput {
|
|
func fetchExchangeRate() {
|
|
service.fetchCountryCurrencyInfo(
|
|
isAuth: false,
|
|
success: { self.output?.setModel(with: $0) },
|
|
failure: { self.output?.setError(with: $0) }
|
|
)
|
|
}
|
|
|
|
func exchangeCalculate(use model: ExchangeRateRequestModel) {
|
|
service.getExchangeRateInformation(
|
|
isAuth: false,
|
|
model: model,
|
|
success: { self.output?.setModel(with: $0) },
|
|
failure: { self.output?.setError(with: $0) }
|
|
)
|
|
}
|
|
}
|