diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/Module Interface/TermsAndConditionModuleInterface.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/Module Interface/TermsAndConditionModuleInterface.swift index e78ccde0..bf9bb200 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/Module Interface/TermsAndConditionModuleInterface.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/Module Interface/TermsAndConditionModuleInterface.swift @@ -15,6 +15,8 @@ protocol TermsAndConditionModuleInterface: class { func success() func checkOtp(otp: String, userId: String, receiverID: String) func requestOtp(userId: String, receiverID: String) + func gotoSendMoney(_ reciptent: Recipient?, + _ paymentMethod: PaymentMethodModel?) } protocol TermsAndConditionModuleDelegate: class { func setupRecieient(_ viewController: TermsAndConditionViewController, didSelectRecipientID: String?) diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Presenter/TermsAndConditionPresenter.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Presenter/TermsAndConditionPresenter.swift index 07783e32..c9380834 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Presenter/TermsAndConditionPresenter.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Presenter/TermsAndConditionPresenter.swift @@ -36,6 +36,13 @@ extension TermsAndConditionPresenter: TermsAndConditionModuleInterface { } + func gotoSendMoney(_ reciptent: Recipient?, + _ paymentMethod: PaymentMethodModel?) { + wireframe?.gotoSendMoney(reciptent, + paymentMethod) + + } + func validateAccount(with validateAccountModel: ValidateAccountRequest, recipient: Recipient) { } diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/View/TermsAndConditionViewController.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/View/TermsAndConditionViewController.swift index 67dad1c3..6e609e50 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/View/TermsAndConditionViewController.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/View/TermsAndConditionViewController.swift @@ -147,8 +147,8 @@ class TermsAndConditionViewController: UIViewController { extension TermsAndConditionViewController: OtpDelegate { func getOtp(otp: String, tappedButton: String) { guard let userId = GMEDB.shared.user.string(.userId) else {return} - if tappedButton == "ok_text".localized() { - self.presenter?.checkOtp(otp: otp, userId: userId, receiverID: self.reciepient?.receiverID ?? "") + if tappedButton == "ok_text".localized(), let receiverID = self.paymentModel?.receiverId ?? self.reciepient?.paymentMethod?.receiverId { + self.presenter?.checkOtp(otp: otp, userId: userId, receiverID: receiverID) } } @@ -164,11 +164,17 @@ extension TermsAndConditionViewController: TermsAndConditionViewInterface { cancelTitle: "no_text".localized(), okAction: { [weak self] in guard let `self` = self else { return } self.dismiss(animated: true) { [weak self] in guard let `self` = self else { return } - self.delegate?.setupRecieientForTermsVC( - self, - didSelectRecipientID: self.reciepient?.receiverID ?? "" - ) +// self.delegate?.setupRecieientForTermsVC( +// self, +// didSelectRecipientID: self.reciepient?.receiverID ?? "" +// ) + if let nav = self.navigationController, let recipient = self.reciepient, var paymentMethod = self.reciepient?.paymentMethod { + if paymentMethod.receiverId == "" { + paymentMethod.receiverId = recipient.receiverID + } + self.presenter?.gotoSendMoney(recipient, paymentMethod) + } } }, diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Wireframe/TermsAndConditionWireframe.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Wireframe/TermsAndConditionWireframe.swift index 18ae2d5c..7b7e8b36 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Wireframe/TermsAndConditionWireframe.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Wireframe/TermsAndConditionWireframe.swift @@ -12,6 +12,8 @@ class TermsAndConditionWireframe { weak var view: UIViewController! var reciepient: Recipient? var model: SendMoneyRequestModel? + var presenter: RecipientsPresenter? + var viewModel: RecipientsViewModel? private lazy var reciptWireframe = SendMoneyReceiptWireframe() } @@ -41,4 +43,23 @@ extension TermsAndConditionWireframe: TermsAndConditionWireframeInput { reciptWireframe.openReciept(transactionId: transactionId, source: navigation) } } + + func gotoSendMoney(_ reciptent: Recipient?, + _ paymentMethod: PaymentMethodModel?) { + + guard let navigationVC = view.navigationController else { + return + } + + guard let recipientData = reciptent else { + return + } + + let wireframe = SendMoneyParentWireframe() + wireframe.output = self.presenter + wireframe.viewModel = self.viewModel + wireframe.paymentMethod = paymentMethod + wireframe.open(for: recipientData, in: navigationVC) + + } } diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Wireframe/TermsAndConditionWireframeInput.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Wireframe/TermsAndConditionWireframeInput.swift index 210b300d..e8e54132 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Wireframe/TermsAndConditionWireframeInput.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/TermsAndCondition/User Interface/Wireframe/TermsAndConditionWireframeInput.swift @@ -10,4 +10,6 @@ import Foundation protocol TermsAndConditionWireframeInput: WireframeInput { func openReciept(transactionId: String) + func gotoSendMoney(_ reciptent: Recipient?, + _ paymentMethod: PaymentMethodModel?) }