From 48c0d0f1b0005fda42923c6b993689845504a71f Mon Sep 17 00:00:00 2001 From: yare Date: Fri, 11 Feb 2022 15:09:30 +0545 Subject: [PATCH] Register Validation --- GME Remit.xcodeproj/project.pbxproj | 4 +- .../View/NewUserRegisterViewController.swift | 8 +- .../Presenter/KYCVerifyStep1Presenter.swift | 76 +++++++++++++++---- .../View/KYCVerifyStep1ViewController.swift | 1 + 4 files changed, 70 insertions(+), 19 deletions(-) diff --git a/GME Remit.xcodeproj/project.pbxproj b/GME Remit.xcodeproj/project.pbxproj index 402eedb3..15dd5675 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 = 28; + CURRENT_PROJECT_VERSION = 29; 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 = 28; + CURRENT_PROJECT_VERSION = 29; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 68KRG7GPAV; ENABLE_BITCODE = NO; diff --git a/GME Remit/Modules/RegisterModules/NewUserRegister/User Interface/View/NewUserRegisterViewController.swift b/GME Remit/Modules/RegisterModules/NewUserRegister/User Interface/View/NewUserRegisterViewController.swift index db5cd097..3de6c9a8 100644 --- a/GME Remit/Modules/RegisterModules/NewUserRegister/User Interface/View/NewUserRegisterViewController.swift +++ b/GME Remit/Modules/RegisterModules/NewUserRegister/User Interface/View/NewUserRegisterViewController.swift @@ -196,7 +196,13 @@ extension NewUserRegisterViewController: OtpDelegate { // MARK: NewUserRegisterViewInterface extension NewUserRegisterViewController: NewUserRegisterViewInterface { func success() { - self.presenter?.requestOtp(userId: self.idTextField.text ?? "") + // self.presenter?.requestOtp(userId: self.idTextField.text ?? "") + guard let id = self.idTextField.text else { + return + } + GMEDB.shared.user.set(id, .userId) + KeyChain.shared.save(data: id, key: .temporaryID) + self.presenter?.showKyc() } func showLoading() { diff --git a/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/Presenter/KYCVerifyStep1Presenter.swift b/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/Presenter/KYCVerifyStep1Presenter.swift index 37d87b3b..7928e4fa 100644 --- a/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/Presenter/KYCVerifyStep1Presenter.swift +++ b/GME Remit/Modules/RegisterModules/UserAuthentication/KYCVerifyStep1/User Interface/Presenter/KYCVerifyStep1Presenter.swift @@ -50,7 +50,7 @@ class KYCVerifyStep1Presenter: ViewModelType { let isValidPictures: Driver let editingPictureInfo: Driver - + let viewController: KYCVerifyStep1ViewController? let submit: Driver } @@ -88,7 +88,7 @@ class KYCVerifyStep1Presenter: ViewModelType { private let termsAccepted = PublishSubject() func transform(input: Input) -> Output { - + let viewController = input.viewController let newPicturesInfo = Driver.combineLatest( input.isValidPictures, input.frontIDImage, @@ -219,26 +219,70 @@ class KYCVerifyStep1Presenter: ViewModelType { input.personalInfoSave .withLatestFrom(newPersonalInfo) { $1 } .drive(onNext: {[weak self] in - let saveModel = KYCSaveInformation( - type: Step.innerStep1.rawValue, - personalInformation: $0, - pictures: nil - ) - self?.progressLinker.onNext(true) - self?.interactor?.saveInformation(with: saveModel) + if viewController?.addressTextField.text == nil || viewController?.addressTextField.text == "" { + viewController?.alert(message: "Please Enter Additional Address") + } + if viewController?.mobileNumberTextField.text == nil || viewController?.mobileNumberTextField.text == "" { + viewController?.alert(message: "mobile_placeholder_text".localized()) + } + if viewController?.monthlyIncomeTextField.text == nil || viewController?.monthlyIncomeTextField.text == "" { + viewController?.alert(message: "Please Enter Monthly Income") + } + if viewController?.businessTypeTextField.text == nil || viewController?.businessTypeTextField.text == "" { + viewController?.alert(message: "select_business_type".localized()) + } + if viewController?.idTypeTextField.text == nil || viewController?.idTypeTextField.text == "" { + viewController?.alert(message: "kyc_verification_id_error".localized()) + } + if viewController?.puroposeOfRegisterField.text == nil || viewController?.puroposeOfRegisterField.text == "" { + viewController?.alert(message: "select_purpose_of_registration_text".localized()) + } + if viewController?.additionalIDTextField.text == nil || viewController?.additionalIDTextField.text == "" { + viewController?.alert(message: "Please Select Additional ID Type") + } + if viewController?.occupationTxtField.text == nil || viewController?.occupationTxtField.text == "" { + viewController?.alert(message: "kyc_occupation_error".localized()) + } + else if (viewController?.occupationTxtField.text != nil || viewController?.occupationTxtField.text != "") && (viewController?.additionalIDTextField.text != nil || viewController?.additionalIDTextField.text != "") && (viewController?.puroposeOfRegisterField.text != nil || viewController?.puroposeOfRegisterField.text != "") && (viewController?.idTypeTextField.text != nil || viewController?.idTypeTextField.text != "") && (viewController?.businessTypeTextField.text != nil || viewController?.businessTypeTextField.text != "") && (viewController?.monthlyIncomeTextField.text != nil || viewController?.monthlyIncomeTextField.text != "") && (viewController?.mobileNumberTextField.text != nil || viewController?.mobileNumberTextField.text != "") && (viewController?.addressTextField.text != nil || viewController?.addressTextField.text != "") { + let saveModel = KYCSaveInformation( + type: Step.innerStep1.rawValue, + personalInformation: $0, + pictures: nil + ) + self?.progressLinker.onNext(true) + self?.interactor?.saveInformation(with: saveModel) + } + }).disposed(by: disposeBag) input.submit .withLatestFrom(newPersonalInfo) { $1 } .withLatestFrom(newPicturesInfo) { ($0, $1) } .drive(onNext: {[weak self] in - let saveModel = KYCSaveInformation( - type: Step.innerStep2.rawValue, - personalInformation: $0, - pictures: $1 - ) - self?.progressLinker.onNext(true) - self?.interactor?.saveInformation(with: saveModel) + let defaultImage = UIImage(named: "passport_new") + if viewController?.frontIDImageButton.currentImage == defaultImage { + viewController?.alert(message: "Please Select Front ID Image") + } + if viewController?.backIDImageButton.currentImage == defaultImage { + viewController?.alert(message: "Please Select Back ID Image") + } + if viewController?.anotherIDImageButton.currentImage == defaultImage { + viewController?.alert(message: "Please Select Another ID Front Image") + } + if viewController?.anotherIDBackImageButton.currentImage == defaultImage { + viewController?.alert(message: "Please Select Another ID Back Image") + } + + else if (viewController?.frontIDImageButton != defaultImage) && (viewController?.backIDImageButton != defaultImage) && (viewController?.anotherIDImageButton != defaultImage) && (viewController?.anotherIDBackImageButton != defaultImage) { + let saveModel = KYCSaveInformation( + type: Step.innerStep2.rawValue, + personalInformation: $0, + pictures: $1 + ) + self?.progressLinker.onNext(true) + self?.interactor?.saveInformation(with: saveModel) + } + }).disposed(by: disposeBag) return Output( 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 d575be3d..3d4a0e7e 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 @@ -718,6 +718,7 @@ extension KYCVerifyStep1ViewController { anotherIdBackImage: anotherIdBackImageBase64.asDriverOnErrorJustComplete(), isValidPictures: isValidPictures.asDriverOnErrorJustComplete(), editingPictureInfo: editingPictureInfo, + viewController: self, submit: pictureSaveButton.rx.tap.asDriverOnErrorJustComplete() )