diff --git a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractor.swift b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractor.swift index 6f06fa89..7f3aca38 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractor.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractor.swift @@ -16,7 +16,6 @@ class RecipientsInteractor { private let service: RecipientsServiceType private var recipients: [Recipient]? - private var accounts: [Account]? // MARK: Initialization @@ -36,15 +35,13 @@ extension RecipientsInteractor: RecipientsInteractorInput { } guard - let recipients = self.recipients, - let accounts = self.accounts + let recipients = self.recipients else { fetchRecipients() return } output?.setRecipients(using: recipients) - output?.setAccounts(using: accounts) } func deleteRecipient(who recipient: Recipient) { @@ -61,10 +58,8 @@ extension RecipientsInteractor: RecipientsInteractorInput { service.fetchRecipients( success: { self.recipients = $0.recipients - self.accounts = $0.accounts self.output?.setRecipients(using: $0.recipients ?? []) - self.output?.setAccounts(using: $0.accounts ?? []) }, failure: { self.output?.setError(with:$0) } ) diff --git a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractorIO.swift b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractorIO.swift index 3b0cdfab..34daff36 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractorIO.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractorIO.swift @@ -13,6 +13,5 @@ protocol RecipientsInteractorInput: class { protocol RecipientsInteractorOutput: class { func setRecipients(using model: [Recipient]) - func setAccounts(using model: [Account]) func setError(with error: Error) } diff --git a/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift b/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift index 311a9558..f81054e5 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift @@ -8,12 +8,9 @@ protocol RecipientsModuleInterface: class { func fetchRecipients(isRefresh: Bool) - func openSelectAccount(with accounts: [Account]) - func setSelectedAccount(_ account: Account) + func openSendMoneyCalculate(who recipient: Recipient) func openAddRecipient(with delegate: SetupRecipientDelegate) func openEditRecipient(who recipient: Recipient, with delegate: SetupRecipientDelegate) func deleteRecipient(who recipient: Recipient) - - func goNextStep(who recipient: Recipient, with account: Account) } diff --git a/GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift b/GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift index 8bdb1070..1e2d0be4 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift @@ -21,9 +21,9 @@ class RecipientsPresenter { // MARK: Recipients module interface extension RecipientsPresenter: RecipientsModuleInterface { - func openSelectAccount(with accounts: [Account]) { - wireframe?.openSelectAccount(with: accounts) - } + func openSendMoneyCalculate(who recipient: Recipient) { + wireframe?.goNextStep(who: recipient) + } func openAddRecipient(with delegate: SetupRecipientDelegate) { wireframe?.openAddRecipient(with: delegate) @@ -42,10 +42,6 @@ extension RecipientsPresenter: RecipientsModuleInterface { viewModel?.progress(isShow: true) interactor?.fetchRecipients(isRefresh: isRefresh) } - - func goNextStep(who recipient: Recipient, with account: Account) { - wireframe?.goNextStep(who: recipient, with: account) - } } // MARK: Recipients interactor output interface @@ -56,10 +52,6 @@ extension RecipientsPresenter: RecipientsInteractorOutput { viewModel?.setRecipients(using: model) } - func setAccounts(using model: [Account]) { - viewModel?.setAccounts(using: model) - } - func setError(with error: Error) { viewModel?.progress(isShow: false) viewModel?.setError(with: error) @@ -68,10 +60,6 @@ extension RecipientsPresenter: RecipientsInteractorOutput { } extension RecipientsPresenter: RecipientsWireframeOutput { - func setSelectedAccount(_ account: Account) { - viewModel?.setSelectedAccount(account) - } - func openedSetupRecipient() { viewModel?.progress(isShow: false) } diff --git a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift index bc06ee12..a0240b14 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift @@ -95,9 +95,9 @@ class RecipientsViewModel: ViewModelType { self.isPartnerChanged.onNext(()) return } - - let accounts = try? self.accountsLinker.value() - self.presenter?.openSelectAccount(with: accounts ?? []) + if let receipnt = self.selectedRecipient{ + self.presenter?.openSendMoneyCalculate(who: receipnt) + } }) .disposed(by: disposeBag) @@ -138,11 +138,6 @@ class RecipientsViewModel: ViewModelType { // MARK: - RecipientsViewModelInterface extension RecipientsViewModel: RecipientsViewModelInterface { - func setSelectedAccount(_ account: Account) { - guard let recipient = selectedRecipient else { return } - - presenter?.goNextStep(who: recipient, with: account) - } func setRecipients(using model: [Recipient]) { recipientsLinker.onNext(model) @@ -153,16 +148,13 @@ extension RecipientsViewModel: RecipientsViewModelInterface { selectedRecipient = model.filter({$0.receiverID == selectedID}).first - let accounts = try? self.accountsLinker.value() - presenter?.openSelectAccount(with: accounts ?? []) + if let receipnt = selectedRecipient{ + presenter?.openSendMoneyCalculate(who: receipnt) + } selectedRecipientID = nil } - func setAccounts(using model: [Account]) { - accountsLinker.onNext(model) - } - func setError(with error: Error) { errorLinker.onNext(error) } diff --git a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModelInterface.swift b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModelInterface.swift index a78693a1..e6f6ceca 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModelInterface.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModelInterface.swift @@ -8,8 +8,6 @@ protocol RecipientsViewModelInterface: class { func setRecipients(using model: [Recipient]) - func setAccounts(using model: [Account]) - func setSelectedAccount(_ account: Account) func setError(with error: Error) func progress(isShow: Bool) diff --git a/GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframe.swift b/GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframe.swift index c015f061..aef462a1 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframe.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframe.swift @@ -38,10 +38,6 @@ extension RecipientsWireframe: RecipientsWireframeInput { return viewController } - func openSelectAccount(with accounts: [Account]) { - self.output?.setSelectedAccount(Account(JSON: [:])!) - } - func openAddRecipient(with delegate: SetupRecipientDelegate) { SetupRecipientWireframe().openNew(with: delegate, on: view) { self.output?.openedSetupRecipient() @@ -54,12 +50,11 @@ extension RecipientsWireframe: RecipientsWireframeInput { } } - func goNextStep(who recipient: Recipient, with account: Account) { + func goNextStep(who recipient: Recipient) { guard let navigationVC = view.navigationController else { return } - let wireframe = SendMoneyParentWireframe() - wireframe.open(for: recipient, with: account, in: navigationVC) + wireframe.open(for: recipient, in: navigationVC) } } diff --git a/GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframeInputOutput.swift b/GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframeInputOutput.swift index a617e3b1..78894c45 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframeInputOutput.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframeInputOutput.swift @@ -9,14 +9,12 @@ import Foundation protocol RecipientsWireframeInput: WireframeInput { - func openSelectAccount(with accounts: [Account]) func openAddRecipient(with delegate: SetupRecipientDelegate) func openEditRecipient(who recipient: Recipient, with delegate: SetupRecipientDelegate) - func goNextStep(who recipient: Recipient, with account: Account) + func goNextStep(who recipient: Recipient) } protocol RecipientsWireframeOutput: class { - func setSelectedAccount(_ account: Account) func openedSetupRecipient() func setSelectAccountError(with error: Error) } diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractor.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractor.swift index 7a50b7f2..08e08a03 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractor.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractor.swift @@ -15,14 +15,12 @@ class SendMoneyParentInteractor { weak var output: SendMoneyParentInteractorOutput? private let service: SendMoneyParentServiceType var reciepient: Recipient? - var account: Account? // MARK: Initialization - init(service: SendMoneyParentServiceType, reciepient: Recipient?, account: Account?) { + init(service: SendMoneyParentServiceType, reciepient: Recipient?) { self.service = service self.reciepient = reciepient - self.account = account } // MARK: Converting entities @@ -32,9 +30,8 @@ class SendMoneyParentInteractor { extension SendMoneyParentInteractor: SendMoneyParentInteractorInput { func viewIsReady() { - if let reciepient = self.reciepient, let acunt = self.account { + if let reciepient = self.reciepient{ self.output?.show(model: reciepient) - self.output?.show(model: acunt) } } } diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractorIO.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractorIO.swift index 0cc67b5e..ac351a6a 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractorIO.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractorIO.swift @@ -12,5 +12,4 @@ protocol SendMoneyParentInteractorInput: class { protocol SendMoneyParentInteractorOutput: class { func show(model: Recipient) - func show(model: Account) } diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Presenter/SendMoneyParentPresenter.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Presenter/SendMoneyParentPresenter.swift index 03325b5c..9e07dd1b 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Presenter/SendMoneyParentPresenter.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Presenter/SendMoneyParentPresenter.swift @@ -34,8 +34,4 @@ extension SendMoneyParentPresenter: SendMoneyParentInteractorOutput { func show(model: Recipient) { self.view?.show(model: model) } - - func show(model: Account) { - self.view?.show(model: model) - } } diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift index 5a59baa2..6d024a40 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift @@ -110,12 +110,6 @@ class SendMoneyParentViewController: UIViewController { } } - var account: Account? { - didSet { - self.requestModel.autoDebitAccount = account - } - } - // MARK: VC's Life cycle override func viewDidLoad() { @@ -272,10 +266,6 @@ extension SendMoneyParentViewController: SendMoneyParentViewInterface { func show(model: Recipient) { self.receipient = model } - - func show(model: Account) { - self.account = model - } } extension SendMoneyParentViewController: HUDStatusDelegate { diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewInterface.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewInterface.swift index a67269dc..8b644fb0 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewInterface.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewInterface.swift @@ -8,5 +8,4 @@ protocol SendMoneyParentViewInterface: class { func show(model: Recipient) - func show(model: Account) } diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Wireframe/SendMoneyParentWireframe.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Wireframe/SendMoneyParentWireframe.swift index 039da63a..38bd54b2 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Wireframe/SendMoneyParentWireframe.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Wireframe/SendMoneyParentWireframe.swift @@ -11,7 +11,6 @@ import UIKit class SendMoneyParentWireframe { weak var view: UIViewController! var reciepient: Recipient? - var account: Account? } extension SendMoneyParentWireframe: SendMoneyParentWireframeInput { @@ -22,8 +21,7 @@ extension SendMoneyParentWireframe: SendMoneyParentWireframeInput { let service = SendMoneyParentService() let interactor = SendMoneyParentInteractor( service: service, - reciepient: reciepient, - account: self.account + reciepient: reciepient ) let presenter = SendMoneyParentPresenter() @@ -39,9 +37,8 @@ extension SendMoneyParentWireframe: SendMoneyParentWireframeInput { return viewController } - func open(for reciepient: Recipient, with account: Account, in source: UINavigationController) { + func open(for reciepient: Recipient, in source: UINavigationController) { self.reciepient = reciepient - self.account = account self.pushMainView(in: source) } }