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
51 lines
1.1 KiB
//
|
|
// InboundAccountsInteractor.swift
|
|
// GME Remit
|
|
//
|
|
// Created by InKwon James Kim on 2019/11/12.
|
|
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class InboundAccountsInteractor {
|
|
|
|
// MARK: Properties
|
|
|
|
weak var output: InboundAccountsInteractorOutput?
|
|
private let service: InboundAccountsServiceType
|
|
|
|
// MARK: Initialization
|
|
|
|
init(service: InboundAccountsServiceType) {
|
|
self.service = service
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: InboundAccounts interactor input interface
|
|
|
|
extension InboundAccountsInteractor: InboundAccountsInteractorInput {
|
|
func fetchAccounts() {
|
|
service.fetchAccounts(
|
|
success: {[weak self] in
|
|
self?.output?.setAccounts($0)
|
|
},
|
|
failure: {[weak self] in
|
|
self?.output?.setError(with: $0)
|
|
}
|
|
)
|
|
}
|
|
|
|
func delete(with account: InboundAccount) {
|
|
service.delete(
|
|
with: account,
|
|
success: {[weak self] in
|
|
self?.output?.deleteSuccess(message: $0.message ?? "")
|
|
},
|
|
failure: {[weak self] in
|
|
self?.output?.setError(with: $0)
|
|
}
|
|
)
|
|
}
|
|
}
|