From d1598ca57603f9b183847670e3c919f088c959cc Mon Sep 17 00:00:00 2001 From: Mac Date: Wed, 2 Feb 2022 19:49:22 +0545 Subject: [PATCH 1/3] #500 bug fixing --- GME Remit.xcodeproj/project.pbxproj | 4 +- GME Remit/APIs/Router/APIRouter.swift | 26 +++ .../View/ManageAgreementViewController.swift | 4 +- .../ChangePinAndPasswordViewController.swift | 4 +- .../Service/RecipientsService.swift | 111 +++++------ .../Service/RecipientsServiceType.swift | 34 ++-- .../RecipientsModuleInterface.swift | 3 + .../View/ViewModel/RecipientsViewModel.swift | 7 + .../Interactor/SetupRecipientInteractor.swift | 135 +++++++------ .../SetupRecipientInteractorIO.swift | 30 +-- .../Service/SetupRecipientService.swift | 42 ++++ .../Service/SetupRecipientServiceType.swift | 73 ++++--- .../SetupRecipientModuleInterface.swift | 25 +-- .../Presenter/SetupRecipientPresenter.swift | 180 +++++++++++------- .../View/SetupRecipientViewController.swift | 15 +- .../ViewModel/SetupRecipientViewModel.swift | 8 +- .../View/ExistingUserKycViewController.swift | 4 +- .../View/KYCVerifyStep1ViewController.swift | 4 +- .../View/SendMoneyReceiptViewController.swift | 3 +- .../View/RenewIDViewController.swift | 4 +- 20 files changed, 446 insertions(+), 270 deletions(-) diff --git a/GME Remit.xcodeproj/project.pbxproj b/GME Remit.xcodeproj/project.pbxproj index 483e9c46..aa842ce3 100644 --- a/GME Remit.xcodeproj/project.pbxproj +++ b/GME Remit.xcodeproj/project.pbxproj @@ -7568,7 +7568,7 @@ CODE_SIGN_ENTITLEMENTS = "GME Remit.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 24; + CURRENT_PROJECT_VERSION = 27; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 68KRG7GPAV; ENABLE_BITCODE = NO; @@ -7609,7 +7609,7 @@ CODE_SIGN_ENTITLEMENTS = "GME Remit.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 24; + CURRENT_PROJECT_VERSION = 27; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 68KRG7GPAV; ENABLE_BITCODE = NO; diff --git a/GME Remit/APIs/Router/APIRouter.swift b/GME Remit/APIs/Router/APIRouter.swift index d1d7b724..03c8747c 100644 --- a/GME Remit/APIs/Router/APIRouter.swift +++ b/GME Remit/APIs/Router/APIRouter.swift @@ -55,6 +55,8 @@ enum APIRouter { case submitKYC(model: KYCSaveInformation) case requestRegistrationOTP(userId: String) case requestBeneficiaryOTP(userId: String, receiverID: String) + case requestBeneficiaryEditOTP(userId: String, receiverID: String) + case subitBeneficiaryEditOTP(otp: String, userId: String, receiverID: String) case submitBeneficaryOTP(otp: String, userId: String, receiverID: String) case submitRegisterOTP(otp: String, userId: String) @@ -534,6 +536,10 @@ extension APIRouter { return "\(baseUrlWithoutVersion)v1/mobile/submitOTP" case .submitBeneficaryOTP: return "\(baseUrlWithoutVersion)v1/mobile/submitOTP" + case .subitBeneficiaryEditOTP: + return "\(baseUrlWithoutVersion)v1/mobile/submitOTP" + case .requestBeneficiaryEditOTP: + return "\(baseUrlWithoutVersion)v1/mobile/requestOTP" case .cddiInfo: let userID = GMEDB.shared.user.string(.userId) ?? "" return "\(baseUrl)/mobile/sendmoney/getcddi/\(userID)" @@ -555,6 +561,8 @@ extension APIRouter { return .post case .submitOTP: return .post + case .subitBeneficiaryEditOTP: + return .post case .customerRegister: return .post case .passwordReset: @@ -637,6 +645,8 @@ extension APIRouter { return .post case .requestBeneficiaryOTP: return .post + case .requestBeneficiaryEditOTP: + return .post case .submitRegisterOTP: return .post case .submitBeneficaryOTP: @@ -762,6 +772,14 @@ extension APIRouter { "requestFor": "RECEIVER", "receiverId": receiverID ] + case .requestBeneficiaryEditOTP(let userId, let receiverID): + return [ + "userId": userId, + "OTP": "", + "requestFor": " *RECEIVER_EDIT* ", + "receiverId": receiverID, + "FcmId": "" + ] case .submitRegisterOTP(let otp, let userId): return [ "userId": userId, @@ -769,6 +787,14 @@ extension APIRouter { "requestFor": "REGISTER", "receiverId": "" ] + case .subitBeneficiaryEditOTP(let otp, let userId, let receiverID): + return [ + "userId": userId, + "OTP": otp, + "requestFor": " *RECEIVER_EDIT* ", + "receiverId": receiverID, + "FcmId": "" + ] case .submitBeneficaryOTP(let otp, let userId, let receiverID): return [ "userId": userId, diff --git a/GME Remit/Modules/ManageAgreement/User Interface/View/ManageAgreementViewController.swift b/GME Remit/Modules/ManageAgreement/User Interface/View/ManageAgreementViewController.swift index 54a670dd..c656f00e 100644 --- a/GME Remit/Modules/ManageAgreement/User Interface/View/ManageAgreementViewController.swift +++ b/GME Remit/Modules/ManageAgreement/User Interface/View/ManageAgreementViewController.swift @@ -149,8 +149,8 @@ extension ManageAgreementViewController { checkBox6.rx.isSelected ]).map { $0.allSatisfy { $0 } } .asDriverOnErrorJustComplete().drive(onNext: {[weak self] isEnable in - self?.agreeButton.isEnabled = isEnable - self?.agreeButton.backgroundColor = isEnable ? .themeRed : .lightGray + self?.agreeButton.isEnabled = true + self?.agreeButton.backgroundColor = isEnable ? .themeRed : .themeRed }).disposed(by: disposeBag) } diff --git a/GME Remit/Modules/Profile/ChangePinAndPasswordViewController.swift b/GME Remit/Modules/Profile/ChangePinAndPasswordViewController.swift index 43bb13f9..b8fbf68b 100644 --- a/GME Remit/Modules/Profile/ChangePinAndPasswordViewController.swift +++ b/GME Remit/Modules/Profile/ChangePinAndPasswordViewController.swift @@ -66,8 +66,8 @@ class ChangePinAndPasswordViewController: UIViewController { private var isValid = false { didSet { - saveButton.isEnabled = isValid - saveButton.backgroundColor = isValid ? .themeRed : .themeText + saveButton.isEnabled = true + saveButton.backgroundColor = isValid ? .themeRed : .themeRed } } diff --git a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift index 9bc07e70..f2cb8df6 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift @@ -10,60 +10,61 @@ import Foundation import Alamofire class RecipientsService: RecipientsServiceType { - func fetchRecipients( - success: @escaping (FetchRecipientsModel) -> Void, - failure: @escaping (Error) -> Void - ) { - let senderID = GMEDB.shared.user.string(.senderId) ?? "" - APIRouter - .fetchRecipients(senderID: senderID) - .json(success: success, failure: failure) - } - - func fetchReciepientList( - username: String, - success: @escaping (RecipientListWrapperContainer?) -> Void, - failure: @escaping (Error) -> Void + func fetchRecipients( + success: @escaping (FetchRecipientsModel) -> Void, + failure: @escaping (Error) -> Void ) { - let url = baseUrl + "/mobile/" + username + "/receivers" - let params = ["search": ""] - auth.request( - method: .get, - url: url, - params: params, - encoding: URLEncoding.default, - success: { (response: RecipientListContainer) in - if (response.errorCode ?? "") == "1" { - let error = NSError(domain: "Network", code: 0, message: response.message ?? "") - failure(error) - } else { - let model = response.data - success(model) - } - }, - failure: {failure($0)} - ) - } - - func deleteRecipient( - username: String, - reciepient: Recipient, - success: @escaping () -> Void, - failure: @escaping (Error) -> Void - ) { - let id = GMEDB.shared.user.string(.senderId) ?? "" - let recipientID = reciepient.receiverID ?? "" - APIRouter.deleteRecipient(senderID: id, recipientID: recipientID) - .request( - success: { (response: ResponseContainer) in - if response.errorCode != "0" { - let error = NSError(domain: "Network", code: 0, message: "Failed Delete Recipient") - failure(error) - } - - success() - }, - failure: failure - ) - } + let senderID = GMEDB.shared.user.string(.senderId) ?? "" + APIRouter + .fetchRecipients(senderID: senderID) + .json(success: success, failure: failure) + } + + func fetchReciepientList( + username: String, + success: @escaping (RecipientListWrapperContainer?) -> Void, + failure: @escaping (Error) -> Void + ) { + let url = baseUrl + "/mobile/" + username + "/receivers" + let params = ["search": ""] + auth.request( + method: .get, + url: url, + params: params, + encoding: URLEncoding.default, + success: { (response: RecipientListContainer) in + if (response.errorCode ?? "") == "1" { + let error = NSError(domain: "Network", code: 0, message: response.message ?? "") + failure(error) + } else { + let model = response.data + success(model) + } + }, + failure: {failure($0)} + ) + } + + func deleteRecipient( + username: String, + reciepient: Recipient, + success: @escaping () -> Void, + failure: @escaping (Error) -> Void + ) { + let id = GMEDB.shared.user.string(.senderId) ?? "" + let recipientID = reciepient.receiverID ?? "" + APIRouter.deleteRecipient(senderID: id, recipientID: recipientID) + .request( + success: { (response: ResponseContainer) in + if response.errorCode != "0" { + let error = NSError(domain: "Network", code: 0, message: "Failed Delete Recipient") + failure(error) + } + + success() + }, + failure: failure + ) + } + } diff --git a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsServiceType.swift b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsServiceType.swift index 93f250bb..d2d7c33d 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsServiceType.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsServiceType.swift @@ -7,21 +7,21 @@ // protocol RecipientsServiceType: class, ApiServiceType { - func fetchRecipients( - success: @escaping (FetchRecipientsModel) -> Void, - failure: @escaping (Error) -> Void - ) - - func fetchReciepientList( - username: String, - success: @escaping (RecipientListWrapperContainer?) -> Void, - failure: @escaping (Error) -> Void - ) - - func deleteRecipient( - username: String, - reciepient: Recipient, - success: @escaping () -> Void, - failure: @escaping (Error) -> Void - ) + func fetchRecipients( + success: @escaping (FetchRecipientsModel) -> Void, + failure: @escaping (Error) -> Void + ) + + func fetchReciepientList( + username: String, + success: @escaping (RecipientListWrapperContainer?) -> Void, + failure: @escaping (Error) -> Void + ) + + func deleteRecipient( + username: String, + reciepient: Recipient, + success: @escaping () -> Void, + failure: @escaping (Error) -> Void + ) } diff --git a/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift b/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift index f81054e5..41ea094e 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift @@ -13,4 +13,7 @@ protocol RecipientsModuleInterface: class { func openAddRecipient(with delegate: SetupRecipientDelegate) func openEditRecipient(who recipient: Recipient, with delegate: SetupRecipientDelegate) func deleteRecipient(who recipient: Recipient) +// func checkOtp(otp: String, userId: String, receiverID: String) +// +// func requestOtp(viewController: SetupRecipientViewController, userId: String, receiverID: String) } 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 98b8d962..ae6919a7 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 @@ -185,4 +185,11 @@ extension RecipientsViewModel: SetupRecipientDelegate { presenter?.fetchRecipients(isRefresh: true) } + func checkOtp(otp: String, userId: String, receiverID: String) { + + } + + func requestOtp(viewController: SetupRecipientViewController, userId: String, receiverID: String) { + + } } diff --git a/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Interactor/SetupRecipientInteractor.swift b/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Interactor/SetupRecipientInteractor.swift index 2d571e62..4075e6e6 100644 --- a/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Interactor/SetupRecipientInteractor.swift +++ b/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Interactor/SetupRecipientInteractor.swift @@ -9,68 +9,87 @@ import Foundation class SetupRecipientInteractor { - - // MARK: Properties - - weak var output: SetupRecipientInteractorOutput? - private let service: SetupRecipientServiceType - private let recipient: Recipient? - private lazy var nativeCountries = StaticModels().nativeCountries - // MARK: Initialization - - init(service: SetupRecipientServiceType, _ recipient: Recipient?) { - self.service = service - self.recipient = recipient - } - + + // MARK: Properties + + weak var output: SetupRecipientInteractorOutput? + private let service: SetupRecipientServiceType + private let recipient: Recipient? + private lazy var nativeCountries = StaticModels().nativeCountries + // MARK: Initialization + + init(service: SetupRecipientServiceType, _ recipient: Recipient?) { + self.service = service + self.recipient = recipient + } + } // MARK: SetupRecipient interactor input interface extension SetupRecipientInteractor: SetupRecipientInteractorInput { - func fetchCountriesAndServiceTypes() { - service.fetchCountriesAndServiceTypes( - success: {self.output?.setCoutryServices(with: $0, recipient: self.recipient)}, - failure: {self.output?.setError(with: $0)} - ) - } - - func fetchDynamicRecipientFields(country: String, paymentMode: String) { - service.fetchDynamicReceiverFields( - of: country, - paymentModeID: paymentMode, - success: {self.output?.setDynamicFields(with: $0, nativeCountires: self.nativeCountries)}, - failure: {self.output?.setError(with: $0)} - ) - } - - func addRecipient(at recipient: Recipient) { - service.addRecipient( - at: recipient, - success: {self.output?.success(with: $0)}, - failure: {self.output?.setError(with: $0)} - ) - } - - func editRecipient(at recipient: Recipient) { - service.editRecipient( - at: recipient, - success: {self.output?.success(with: $0)}, - failure: {self.output?.setError(with: $0)} - ) - } - - func validateAccount(with model: ValidateAccountRequest, recipient: Recipient) { - service.validateAccount( - of: model, - success: { - if recipient.receiverID == nil { - self.addRecipient(at: recipient) - } else { - self.editRecipient(at: recipient) + func fetchCountriesAndServiceTypes() { + service.fetchCountriesAndServiceTypes( + success: {self.output?.setCoutryServices(with: $0, recipient: self.recipient)}, + failure: {self.output?.setError(with: $0)} + ) + } + + func fetchDynamicRecipientFields(country: String, paymentMode: String) { + service.fetchDynamicReceiverFields( + of: country, + paymentModeID: paymentMode, + success: {self.output?.setDynamicFields(with: $0, nativeCountires: self.nativeCountries)}, + failure: {self.output?.setError(with: $0)} + ) + } + + func addRecipient(at recipient: Recipient) { + service.addRecipient( + at: recipient, + success: {self.output?.success(with: $0)}, + failure: {self.output?.setError(with: $0)} + ) + } + + func editRecipient(at recipient: Recipient) { + service.editRecipient( + at: recipient, + success: {self.output?.success(with: $0)}, + failure: {self.output?.setError(with: $0)} + ) + } + + func validateAccount(with model: ValidateAccountRequest, recipient: Recipient) { + service.validateAccount( + of: model, + success: { + if recipient.receiverID == nil { + self.addRecipient(at: recipient) + } else { + self.editRecipient(at: recipient) + } + }, + failure: {self.output?.setError(with:$0)} + ) + } + func checkOtp(otp: String, userId: String, receiverID: String) { + + GMEDB.shared.getFcmToken { (token, error) in + self.service.checkOTP( + otp: otp, + userId: userId, receiverID: receiverID, + success: {_ in self.output?.success()}, + failure: {self.output?.checkOtpError(error: $0)} + ) } - }, - failure: {self.output?.setError(with:$0)} - ) - } + } + + func requestOTP(viewController: SetupRecipientViewController, userId: String, receiverID: String) { + self.service.requestOTP(userId: userId, receiverID: receiverID) { (message) in + self.output?.showOTPView(viewController: viewController) + } failure: { + self.output?.show(error: $0) + } + } } diff --git a/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Interactor/SetupRecipientInteractorIO.swift b/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Interactor/SetupRecipientInteractorIO.swift index 3fd500f1..491920d1 100644 --- a/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Interactor/SetupRecipientInteractorIO.swift +++ b/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Interactor/SetupRecipientInteractorIO.swift @@ -7,19 +7,25 @@ // protocol SetupRecipientInteractorInput: class { - func fetchCountriesAndServiceTypes() - func fetchDynamicRecipientFields(country: String, paymentMode: String) - - func addRecipient(at recipient: Recipient) - func editRecipient(at recipient: Recipient) - - func validateAccount(with validateAccountModel: ValidateAccountRequest, recipient: Recipient) + func fetchCountriesAndServiceTypes() + func fetchDynamicRecipientFields(country: String, paymentMode: String) + + func addRecipient(at recipient: Recipient) + func editRecipient(at recipient: Recipient) + + func validateAccount(with validateAccountModel: ValidateAccountRequest, recipient: Recipient) + func requestOTP(viewController: SetupRecipientViewController, userId: String, receiverID: String) + func checkOtp(otp: String, userId: String, receiverID: String) } protocol SetupRecipientInteractorOutput: class { - func setCoutryServices(with model: [CountryAndServiceModel], recipient: Recipient?) - func setDynamicFields(with model: DynamicFieldModel, nativeCountires: [NativeCountryModel]) - func setError(with error: Error) - - func success(with model: ResponseContainerObject) + func setCoutryServices(with model: [CountryAndServiceModel], recipient: Recipient?) + func setDynamicFields(with model: DynamicFieldModel, nativeCountires: [NativeCountryModel]) + func setError(with error: Error) + + func success(with model: ResponseContainerObject) + func success() + func show(error: Error) + func checkOtpError(error: Error) + func showOTPView(viewController: SetupRecipientViewController) } diff --git a/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Service/SetupRecipientService.swift b/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Service/SetupRecipientService.swift index 9899daf4..9a399aa5 100644 --- a/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Service/SetupRecipientService.swift +++ b/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Service/SetupRecipientService.swift @@ -89,4 +89,46 @@ class SetupRecipientService: SetupRecipientServiceType { APIRouter.validateAccount(validateModel: model) .json(success: success, failure: failure) } + func requestOTP( + userId: String, + receiverID: String, + success: @escaping (String?) -> Void, + failure: @escaping (Error) -> Void + ) { + APIRouter + .requestBeneficiaryEditOTP(userId: userId, receiverID: receiverID) + .request( + needsAuthorization: false, + success: { (response: ResponseMessage) in + if (response.errorCode ?? "") == "1" { + let error = NSError(domain: "Network", code: 0, message: response.message ?? "") + failure(error) + } else { + success(response.message) + } + }, + failure: {failure($0)}) + } + + func checkOTP( + otp: String, + userId: String, + receiverID: String, + success: @escaping (String?) -> Void, + failure: @escaping (Error) -> Void + ) { + APIRouter + .subitBeneficiaryEditOTP(otp: otp, userId: userId, receiverID: receiverID) + .request( + needsAuthorization: false, + success: { (response: ResponseMessage) in + if (response.errorCode ?? "") == "1" { + let error = NSError(domain: "Network", code: 0, message: response.message ?? "") + failure(error) + } else { + success(response.message) + } + }, + failure: {failure($0)}) + } } diff --git a/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Service/SetupRecipientServiceType.swift b/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Service/SetupRecipientServiceType.swift index b71cc63d..29c573f1 100644 --- a/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Service/SetupRecipientServiceType.swift +++ b/GME Remit/Modules/RecipientModules/SetupRecipient/Application Logic/Service/SetupRecipientServiceType.swift @@ -7,33 +7,48 @@ // protocol SetupRecipientServiceType: class { - func fetchCountriesAndServiceTypes( - success: @escaping ([CountryAndServiceModel]) -> Void, - failure: @escaping (Error) -> Void - ) - - func fetchDynamicReceiverFields( - of countryID: String, - paymentModeID: String, - success: @escaping (DynamicFieldModel) -> Void, - failure: @escaping (Error) -> Void - ) - - func addRecipient( - at recipient: Recipient, - success: @escaping (ResponseContainerObject) -> Void, - failure: @escaping (Error) -> Void - ) - - func editRecipient( - at recipient: Recipient, - success: @escaping (ResponseContainerObject) -> Void, - failure: @escaping (Error) -> Void - ) - - func validateAccount( - of model: ValidateAccountRequest, - success: @escaping () -> Void, - failure: @escaping (Error) -> Void - ) + func fetchCountriesAndServiceTypes( + success: @escaping ([CountryAndServiceModel]) -> Void, + failure: @escaping (Error) -> Void + ) + + func fetchDynamicReceiverFields( + of countryID: String, + paymentModeID: String, + success: @escaping (DynamicFieldModel) -> Void, + failure: @escaping (Error) -> Void + ) + + func addRecipient( + at recipient: Recipient, + success: @escaping (ResponseContainerObject) -> Void, + failure: @escaping (Error) -> Void + ) + + func editRecipient( + at recipient: Recipient, + success: @escaping (ResponseContainerObject) -> Void, + failure: @escaping (Error) -> Void + ) + + func validateAccount( + of model: ValidateAccountRequest, + success: @escaping () -> Void, + failure: @escaping (Error) -> Void + ) + + func requestOTP( + userId: String, + receiverID: String, + success: @escaping (String?) -> Void, + failure: @escaping (Error) -> Void + ) + + func checkOTP( + otp: String, + userId: String, + receiverID: String, + success: @escaping (String?) -> Void, + failure: @escaping (Error) -> Void + ) } diff --git a/GME Remit/Modules/RecipientModules/SetupRecipient/Module Interface/SetupRecipientModuleInterface.swift b/GME Remit/Modules/RecipientModules/SetupRecipient/Module Interface/SetupRecipientModuleInterface.swift index df8bace4..b030e9cb 100644 --- a/GME Remit/Modules/RecipientModules/SetupRecipient/Module Interface/SetupRecipientModuleInterface.swift +++ b/GME Remit/Modules/RecipientModules/SetupRecipient/Module Interface/SetupRecipientModuleInterface.swift @@ -7,19 +7,22 @@ // protocol SetupRecipientModuleInterface: class { - func fetchCountriesAndServiceTypes() - func openSelectMode(with model: [TablePresenterProtocol], type: SetupOpenType) - func openBranches(countryCode: String, bankID: String) - - func fetchDynamicRecipientFields(country: CountryAndServiceModel?, paymentMode: PaymentServiceType?) - - func saveRecipient(at recipient: Recipient) - func validateAccount(with validateAccountModel: ValidateAccountRequest, recipient: Recipient) - func moveToTermsAndConditionView(at recipient: Recipient, _ viewController: SetupRecipientViewController) + func fetchCountriesAndServiceTypes() + func openSelectMode(with model: [TablePresenterProtocol], type: SetupOpenType) + func openBranches(countryCode: String, bankID: String) + + func fetchDynamicRecipientFields(country: CountryAndServiceModel?, paymentMode: PaymentServiceType?) + + func saveRecipient(at recipient: Recipient, parentType: RecipientParentType, viewcontroller: SetupRecipientViewController) + func validateAccount(with validateAccountModel: ValidateAccountRequest, recipient: Recipient) + func moveToTermsAndConditionView(at recipient: Recipient, _ viewController: SetupRecipientViewController) + func checkOtp(otp: String, userId: String, receiverID: String) + func requestOtp(viewController: SetupRecipientViewController, userId: String, receiverID: String) } protocol SetupRecipientDelegate: class { - func setupRecieient(_ viewController: SetupRecipientViewController, didSelectRecipientID: String?) - func setupRecieientForTermsVC(_ viewController: TermsAndConditionViewController, didSelectRecipientID: String?) + func setupRecieient(_ viewController: SetupRecipientViewController, didSelectRecipientID: String?) + func setupRecieientForTermsVC(_ viewController: TermsAndConditionViewController, didSelectRecipientID: String?) func moveToTermsAndConditionView(at recipient: Recipient, _ viewController: SetupRecipientViewController, delegate: SetupRecipientDelegate) + } diff --git a/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/Presenter/SetupRecipientPresenter.swift b/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/Presenter/SetupRecipientPresenter.swift index 83869ad5..7511c0f1 100644 --- a/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/Presenter/SetupRecipientPresenter.swift +++ b/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/Presenter/SetupRecipientPresenter.swift @@ -7,92 +7,132 @@ // import Foundation - +import UIKit class SetupRecipientPresenter { - - // MARK: Properties - weak var viewModel: SetupRecipientViewModelInterface? - var interactor: SetupRecipientInteractorInput? - var wireframe: SetupRecipientWireframeInput? - + + // MARK: Properties + weak var viewModel: SetupRecipientViewModelInterface? + var interactor: SetupRecipientInteractorInput? + var wireframe: SetupRecipientWireframeInput? + var recipient: Recipient? = nil + } // MARK: SetupRecipient module interface extension SetupRecipientPresenter: SetupRecipientModuleInterface { func moveToTermsAndConditionView(at recipient: Recipient, _ viewController: SetupRecipientViewController) { - let termsViewController = TermsAndConditionWireframe().getMainView() as? TermsAndConditionViewController + let termsViewController = TermsAndConditionWireframe().getMainView() as? TermsAndConditionViewController termsViewController?.reciepient = recipient termsViewController?.fromBeneficiary = true if let termsViewController = termsViewController { - viewController.push(termsViewController, animated: true) + viewController.push(termsViewController, animated: true) + } + } + + func checkOtp(otp: String, userId: String, receiverID: String) { + viewModel?.progress(isShow: true) + self.interactor?.checkOtp(otp: otp, userId: userId, receiverID: receiverID) + } + + func requestOtp(viewController: SetupRecipientViewController, userId: String, receiverID: String) { + viewModel?.progress(isShow: true) + self.interactor?.requestOTP(viewController: viewController, userId: userId, receiverID: receiverID) + } + + func fetchCountriesAndServiceTypes() { + viewModel?.progress(isShow: true) + interactor?.fetchCountriesAndServiceTypes() + } + + func openSelectMode(with model: [TablePresenterProtocol], type: SetupOpenType) { + wireframe?.openSelectMode(with: model, type: type) + } + + func openBranches(countryCode: String, bankID: String) { + wireframe?.openBranches(countryCode: countryCode, bankID: bankID) + } + + func fetchDynamicRecipientFields(country: CountryAndServiceModel?, paymentMode: PaymentServiceType?) { + viewModel?.progress(isShow: true) + interactor?.fetchDynamicRecipientFields( + country: country?.countryId ?? "", + paymentMode: paymentMode?.id ?? "" + ) + } + + func saveRecipient(at recipient: Recipient, parentType: RecipientParentType, viewcontroller: SetupRecipientViewController) { + viewModel?.progress(isShow: true) + if recipient.receiverID == nil { + interactor?.addRecipient(at: recipient) + } else { + self.recipient = recipient + let userId = GMEDB.shared.user.string(.userId) ?? "" + interactor?.requestOTP(viewController: viewcontroller, userId: userId, receiverID: recipient.receiverID ?? "") + //interactor?.editRecipient(at: recipient) } -// termsViewController?.requestModel = self.requestModel -// termsViewController?.hudDelegate = self - } - - - func fetchCountriesAndServiceTypes() { - viewModel?.progress(isShow: true) - interactor?.fetchCountriesAndServiceTypes() - } - - func openSelectMode(with model: [TablePresenterProtocol], type: SetupOpenType) { - wireframe?.openSelectMode(with: model, type: type) - } - - func openBranches(countryCode: String, bankID: String) { - wireframe?.openBranches(countryCode: countryCode, bankID: bankID) - } - - func fetchDynamicRecipientFields(country: CountryAndServiceModel?, paymentMode: PaymentServiceType?) { - viewModel?.progress(isShow: true) - interactor?.fetchDynamicRecipientFields( - country: country?.countryId ?? "", - paymentMode: paymentMode?.id ?? "" - ) - } - - func saveRecipient(at recipient: Recipient) { - viewModel?.progress(isShow: true) - if recipient.receiverID == nil { - interactor?.addRecipient(at: recipient) - } else { - interactor?.editRecipient(at: recipient) - } - } - - func validateAccount(with validateAccountModel: ValidateAccountRequest, recipient: Recipient) { - viewModel?.progress(isShow: true) - interactor?.validateAccount(with: validateAccountModel, recipient: recipient) - } + } + + func validateAccount(with validateAccountModel: ValidateAccountRequest, recipient: Recipient) { + viewModel?.progress(isShow: true) + interactor?.validateAccount(with: validateAccountModel, recipient: recipient) + } } // MARK: SetupRecipient interactor output interface extension SetupRecipientPresenter: SetupRecipientInteractorOutput { - func setCoutryServices(with model: [CountryAndServiceModel], recipient: Recipient?) { - viewModel?.progress(isShow: false) - viewModel?.setCoutryServices(with: model, recipient: recipient) - } - - func setDynamicFields(with model: DynamicFieldModel, nativeCountires: [NativeCountryModel]) { - viewModel?.progress(isShow: false) - viewModel?.setDynamicFields(with: model, nativeCountires: nativeCountires) - } - - func setError(with error: Error) { - viewModel?.progress(isShow: false) - viewModel?.setError(with: error) - } - - func success(with model: ResponseContainerObject) { - viewModel?.progress(isShow: false) - viewModel?.success(with: model) - } + func setCoutryServices(with model: [CountryAndServiceModel], recipient: Recipient?) { + viewModel?.progress(isShow: false) + viewModel?.setCoutryServices(with: model, recipient: recipient) + } + + func setDynamicFields(with model: DynamicFieldModel, nativeCountires: [NativeCountryModel]) { + viewModel?.progress(isShow: false) + viewModel?.setDynamicFields(with: model, nativeCountires: nativeCountires) + } + + func setError(with error: Error) { + viewModel?.progress(isShow: false) + viewModel?.setError(with: error) + } + + func success(with model: ResponseContainerObject) { + viewModel?.progress(isShow: false) + viewModel?.success(with: model) + } + + func success() { + viewModel?.progress(isShow: true) + if let recipent = self.recipient { + interactor?.editRecipient(at: recipent) + } + } + + func show(error: Error) { + viewModel?.progress(isShow: false) + viewModel?.setError(with: error) + } + + func checkOtpError(error: Error) { + viewModel?.progress(isShow: false) + viewModel?.setError(with: error) + } + + func showOTPView(viewController: SetupRecipientViewController) { + guard let otpviewController = UIStoryboard(name: "OtpVerification", bundle: nil) + .instantiateViewController(withIdentifier: "OtpVerificationViewController") as? OtpVerificationViewController else { + return + } + + otpviewController.delegate = viewController + viewController.present(otpviewController, animated: true, completion: nil) + + } + } // MARK: SetupRecipient wireframe output interface extension SetupRecipientPresenter: SetupRecipientWireframeOutput { - func setSelectedData(with model: TablePresenterProtocol?, type: SetupOpenType) { - viewModel?.setSelectedData(with: model, type: type) - } + func setSelectedData(with model: TablePresenterProtocol?, type: SetupOpenType) { + viewModel?.setSelectedData(with: model, type: type) + } } diff --git a/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/View/SetupRecipientViewController.swift b/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/View/SetupRecipientViewController.swift index ee0d7a20..c0d8240e 100644 --- a/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/View/SetupRecipientViewController.swift +++ b/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/View/SetupRecipientViewController.swift @@ -85,6 +85,7 @@ class SetupRecipientViewController: UIViewController { @IBOutlet weak var paymentDropdown: UIImageView! // MARK: VC's Life cycle + var receiverID: String? = "" override func viewDidLoad() { super.viewDidLoad() setup() @@ -297,7 +298,8 @@ extension SetupRecipientViewController { //openReasonTrigger: reasonTextField.rx.controlEvent(.editingDidBegin).asDriver(), openNativeCountryTrigger: nativeCountryTextField.rx.controlEvent(.editingDidBegin).asDriver(), saveTrigger: saveTrigger, - viewController: self + viewController: self, + parentType: self.parentType ) let output = viewModel.transform(input: input) @@ -307,7 +309,7 @@ extension SetupRecipientViewController { self.alert(type: .error, message: $0.localizedDescription) }) .disposed(by: disposeBag) - + output.isProgress .drive(onNext: { [weak self] in guard let `self` = self else { return } $0 ? self.showProgressHud() : self.hideProgressHud() @@ -601,6 +603,7 @@ extension SetupRecipientViewController { } private func setText(with recipient: Recipient?) { + self.receiverID = recipient?.receiverID ?? "" fullNameTextField.text = recipient?.fullName?.uppercased() fullNameTextField.sendActions(for: .editingChanged) @@ -652,3 +655,11 @@ extension SetupRecipientViewController { } } + +extension SetupRecipientViewController: OtpDelegate { + func getOtp(otp: String, tappedButton: String) { + //self.delegate + let userId = GMEDB.shared.user.string(.userId) ?? "" + self.viewModel.presenter?.checkOtp(otp: otp, userId: userId, receiverID: self.receiverID ?? "") + } +} diff --git a/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/View/ViewModel/SetupRecipientViewModel.swift b/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/View/ViewModel/SetupRecipientViewModel.swift index 11859555..65426da0 100644 --- a/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/View/ViewModel/SetupRecipientViewModel.swift +++ b/GME Remit/Modules/RecipientModules/SetupRecipient/User Interface/View/ViewModel/SetupRecipientViewModel.swift @@ -24,6 +24,7 @@ class SetupRecipientViewModel: ViewModelType { let openNativeCountryTrigger: Driver let saveTrigger: Driver let viewController: SetupRecipientViewController? + var parentType: RecipientParentType = .sendmoney } struct Output { @@ -96,6 +97,7 @@ class SetupRecipientViewModel: ViewModelType { let relationsModel = relationsLinker.asDriverOnErrorJustComplete() let reasonsModel = reasonsLinker.asDriverOnErrorJustComplete() let viewController = input.viewController + let parentType = input.parentType let branchesModel = Observable.combineLatest(selectedCountryServicesLinker, selectedBankLinker) .asDriverOnErrorJustComplete() @@ -258,9 +260,9 @@ class SetupRecipientViewModel: ViewModelType { // if let viewController = viewController { // self.presenter?.moveToTermsAndConditionView(at: recipient, viewController) // } - - self.presenter?.saveRecipient(at: recipient) - + if let viewController = viewController { + self.presenter?.saveRecipient(at: recipient, parentType: parentType, viewcontroller: viewController) + } } }) .disposed(by: disposeBag) diff --git a/GME Remit/Modules/RegisterModules/UserAuthentication/ExistingUserKyc/User Interface/View/ExistingUserKycViewController.swift b/GME Remit/Modules/RegisterModules/UserAuthentication/ExistingUserKyc/User Interface/View/ExistingUserKycViewController.swift index d9a5bc15..21954e62 100644 --- a/GME Remit/Modules/RegisterModules/UserAuthentication/ExistingUserKyc/User Interface/View/ExistingUserKycViewController.swift +++ b/GME Remit/Modules/RegisterModules/UserAuthentication/ExistingUserKyc/User Interface/View/ExistingUserKycViewController.swift @@ -649,7 +649,7 @@ class ExistingUserKycViewController: UIViewController { .distinctUntilChanged() .asDriverOnErrorJustComplete().drive(onNext: {[weak self] isEnable in DispatchQueue.main.async { - self?.personalInfoSaveBttn.isEnabled = isEnable + self?.personalInfoSaveBttn.isEnabled = true self?.personalInfoSaveBttn.backgroundColor = isEnable ? .themeRed : .themeRed } }).disposed(by: disposeBag) @@ -658,7 +658,7 @@ class ExistingUserKycViewController: UIViewController { .distinctUntilChanged() .asDriverOnErrorJustComplete().drive(onNext: {[weak self] isEnable in DispatchQueue.main.async { - self?.pictureSaveBttn.isEnabled = isEnable + self?.pictureSaveBttn.isEnabled = true self?.pictureSaveBttn.backgroundColor = isEnable ? .themeRed : .themeRed } }).disposed(by: disposeBag) diff --git a/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/View/KYCVerifyStep1ViewController.swift b/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/View/KYCVerifyStep1ViewController.swift index e93455ca..d575be3d 100644 --- a/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/View/KYCVerifyStep1ViewController.swift +++ b/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/View/KYCVerifyStep1ViewController.swift @@ -848,7 +848,7 @@ extension KYCVerifyStep1ViewController { .asDriverOnErrorJustComplete().drive(onNext: {[weak self] isEnable in print("enabled:\(isEnable)") DispatchQueue.main.async { - self?.personalSaveButton.isEnabled = isEnable + self?.personalSaveButton.isEnabled = true self?.personalSaveButton.backgroundColor = isEnable ? .themeRed : .themeRed } }).disposed(by: disposeBag) @@ -857,7 +857,7 @@ extension KYCVerifyStep1ViewController { .distinctUntilChanged() .asDriverOnErrorJustComplete().drive(onNext: {[weak self] isEnable in DispatchQueue.main.async { - self?.pictureSaveButton.isEnabled = isEnable + self?.pictureSaveButton.isEnabled = true self?.pictureSaveButton.backgroundColor = isEnable ? .themeRed : .themeRed } }).disposed(by: disposeBag) diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewController.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewController.swift index 6c613876..43a056ea 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewController.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewController.swift @@ -291,7 +291,8 @@ class SendMoneyReceiptViewController: UIViewController { self.relationLabel.text = self.reciept?.collAmount?.decimalToCurrency(as: .krw) let charge = self.reciept?.collAmount?.decimalToCurrency(as: .krw) - self.transferFeeLabel.text = charge + let servicecharge = self.reciept?.serviceCharge?.decimalToCurrency(as: .krw) + self.transferFeeLabel.text = servicecharge self.chargeLabelSuccess.text = charge self.exchangeRateLabel.text = self.reciept?.exRate diff --git a/GME Remit/Modules/RenewID/User Interface/View/RenewIDViewController.swift b/GME Remit/Modules/RenewID/User Interface/View/RenewIDViewController.swift index a5e11583..4f270b07 100644 --- a/GME Remit/Modules/RenewID/User Interface/View/RenewIDViewController.swift +++ b/GME Remit/Modules/RenewID/User Interface/View/RenewIDViewController.swift @@ -247,8 +247,8 @@ class RenewIDViewController: UIViewController { .distinctUntilChanged() .asDriverOnErrorJustComplete().drive(onNext: {[weak self] isEnable in DispatchQueue.main.async { - self?.renewButton.isEnabled = isEnable - self?.renewButton.backgroundColor = isEnable ? .themeRed : .themeText + self?.renewButton.isEnabled = true + self?.renewButton.backgroundColor = isEnable ? .themeRed : .themeRed } }).disposed(by: disposeBag) } From 78c47a082ca136f67487b9e47645c01b33096082 Mon Sep 17 00:00:00 2001 From: Mac Date: Wed, 2 Feb 2022 20:11:12 +0545 Subject: [PATCH 2/3] Key edited --- GME Remit/APIs/Router/APIRouter.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GME Remit/APIs/Router/APIRouter.swift b/GME Remit/APIs/Router/APIRouter.swift index 03c8747c..0db46022 100644 --- a/GME Remit/APIs/Router/APIRouter.swift +++ b/GME Remit/APIs/Router/APIRouter.swift @@ -776,7 +776,7 @@ extension APIRouter { return [ "userId": userId, "OTP": "", - "requestFor": " *RECEIVER_EDIT* ", + "requestFor": " RECEIVER_EDIT ", "receiverId": receiverID, "FcmId": "" ] @@ -791,7 +791,7 @@ extension APIRouter { return [ "userId": userId, "OTP": otp, - "requestFor": " *RECEIVER_EDIT* ", + "requestFor": " RECEIVER_EDIT ", "receiverId": receiverID, "FcmId": "" ] From 06b0c1de01af592a0a8045bf78713874c50fab6e Mon Sep 17 00:00:00 2001 From: Mac Date: Wed, 2 Feb 2022 20:12:41 +0545 Subject: [PATCH 3/3] version changed --- GME Remit.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GME Remit.xcodeproj/project.pbxproj b/GME Remit.xcodeproj/project.pbxproj index aa842ce3..402eedb3 100644 --- a/GME Remit.xcodeproj/project.pbxproj +++ b/GME Remit.xcodeproj/project.pbxproj @@ -7568,7 +7568,7 @@ CODE_SIGN_ENTITLEMENTS = "GME Remit.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 27; + CURRENT_PROJECT_VERSION = 28; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 68KRG7GPAV; ENABLE_BITCODE = NO; @@ -7609,7 +7609,7 @@ CODE_SIGN_ENTITLEMENTS = "GME Remit.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 27; + CURRENT_PROJECT_VERSION = 28; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 68KRG7GPAV; ENABLE_BITCODE = NO;