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

  1. //
  2. // ExchangeRatesInteractor.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 24/08/2018.
  6. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class ExchangeRatesInteractor {
  10. // MARK: Properties
  11. weak var output: ExchangeRatesInteractorOutput?
  12. private let service: ExchangeRatesServiceType
  13. // MARK: Initialization
  14. init(service: ExchangeRatesServiceType) {
  15. self.service = service
  16. }
  17. // MARK: Converting entities
  18. }
  19. // MARK: ExchangeRates interactor input interface
  20. extension ExchangeRatesInteractor: ExchangeRatesInteractorInput {
  21. func fetchExchangeRate() {
  22. service.fetchCountryCurrencyInfo(
  23. isAuth: false,
  24. success: { self.output?.setModel(with: $0) },
  25. failure: { self.output?.setError(with: $0) }
  26. )
  27. }
  28. func exchangeCalculate(use model: ExchangeRateRequestModel) {
  29. service.getExchangeRateInformation(
  30. isAuth: false,
  31. model: model,
  32. success: { self.output?.setModel(with: $0) },
  33. failure: { self.output?.setError(with: $0) }
  34. )
  35. }
  36. }