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.

50 lines
1.2 KiB

  1. //
  2. // WalletStatementInteractor.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 03/10/2018.
  6. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class WalletStatementInteractor {
  10. // MARK: Properties
  11. weak var output: WalletStatementInteractorOutput?
  12. private let service: WalletStatementServiceType
  13. // MARK: Initialization
  14. init(service: WalletStatementServiceType) {
  15. self.service = service
  16. }
  17. // MARK: Converting entities
  18. }
  19. // MARK: WalletStatement interactor input interface
  20. extension WalletStatementInteractor: WalletStatementInteractorInput {
  21. func fetchWalletSatement(fromDate: String?, toDate: String?) {
  22. let userName = Utility.getMyUserName()
  23. var param: [String: String] = [:]
  24. if let from = fromDate {
  25. param["FromDate"] = from
  26. }
  27. if let to = toDate {
  28. param["ToDate"] = to
  29. }
  30. let parameters = (param.isEmpty) ? nil : param
  31. self.service.fetchWalletStatement(user: userName, param: parameters, success: { (model) in
  32. self.output?.show(models: model)
  33. }) { (error) in
  34. self.output?.show(error: error)
  35. }
  36. }
  37. }