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.

51 lines
1.1 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. //
  2. // InboundAccountsInteractor.swift
  3. // GME Remit
  4. //
  5. // Created by InKwon James Kim on 2019/11/12.
  6. //Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class InboundAccountsInteractor {
  10. // MARK: Properties
  11. weak var output: InboundAccountsInteractorOutput?
  12. private let service: InboundAccountsServiceType
  13. // MARK: Initialization
  14. init(service: InboundAccountsServiceType) {
  15. self.service = service
  16. }
  17. }
  18. // MARK: InboundAccounts interactor input interface
  19. extension InboundAccountsInteractor: InboundAccountsInteractorInput {
  20. func fetchAccounts() {
  21. service.fetchAccounts(
  22. success: {[weak self] in
  23. self?.output?.setAccounts($0)
  24. },
  25. failure: {[weak self] in
  26. self?.output?.setError(with: $0)
  27. }
  28. )
  29. }
  30. func delete(with account: InboundAccount) {
  31. service.delete(
  32. with: account,
  33. success: {[weak self] in
  34. self?.output?.deleteSuccess(message: $0.message ?? "")
  35. },
  36. failure: {[weak self] in
  37. self?.output?.setError(with: $0)
  38. }
  39. )
  40. }
  41. }