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.
56 lines
1.2 KiB
56 lines
1.2 KiB
//
|
|
// ManageAgreementInteractor.swift
|
|
// GME Remit
|
|
//
|
|
// Created by InKwon James Kim on 2019/12/23.
|
|
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class ManageAgreementInteractor {
|
|
|
|
// MARK: Properties
|
|
|
|
weak var output: ManageAgreementInteractorOutput?
|
|
private let service: ManageAgreementServiceType
|
|
private var documents: [AgreePDFDocument]?
|
|
|
|
// MARK: Initialization
|
|
|
|
init(service: ManageAgreementServiceType) {
|
|
self.service = service
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: ManageAgreement interactor input interface
|
|
|
|
extension ManageAgreementInteractor: ManageAgreementInteractorInput {
|
|
func fetchDocuments() {
|
|
guard let documents = documents else {
|
|
service.fetchDocuments(
|
|
success: {[weak self] in
|
|
self?.documents = $0
|
|
self?.output?.setDocuments(with: $0)
|
|
},
|
|
failure: {[weak self] in self?.output?.setError(with: $0)}
|
|
)
|
|
return
|
|
}
|
|
|
|
output?.setDocuments(with: documents)
|
|
}
|
|
|
|
func agreement(_ flag: Bool) {
|
|
service.agreement(
|
|
flag,
|
|
success: {[weak self] in
|
|
self?.output?.resultAgreement()
|
|
},
|
|
failure: {[weak self] in
|
|
self?.output?.setError(with: $0)
|
|
}
|
|
)
|
|
}
|
|
}
|