|
@ -186,7 +186,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onCustomerDetailFormReady(boolean isReady) { |
|
|
|
|
|
|
|
|
public void onCustomerDetailFormReady(CustomerDetailFragment.Form1ViewBindings form1ViewBindings,CustomerDetailFragment.Form2ViewBindings form2ViewBindings,CustomerDetailFragment.Form3ViewBindings form3ViewBindings) { |
|
|
|
|
|
|
|
|
alternateIDImageRequiredLiveData.setValue(false); |
|
|
alternateIDImageRequiredLiveData.setValue(false); |
|
|
|
|
|
|
|
@ -198,14 +198,14 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
return form1Result && form2Result && form3Result; |
|
|
return form1Result && form2Result && form3Result; |
|
|
}).subscribeWith(new CustomerDetailFormViewBindingObserver())); |
|
|
}).subscribeWith(new CustomerDetailFormViewBindingObserver())); |
|
|
|
|
|
|
|
|
this.customerDetailViewSubscriptions.add(setUpForm1Validation().subscribe(result -> form1ValidationSubject.onNext(result))); |
|
|
|
|
|
this.customerDetailViewSubscriptions.add(setUpForm2Validation().subscribe(result -> form2ValidationSubject.onNext(result))); |
|
|
|
|
|
|
|
|
this.customerDetailViewSubscriptions.add(setUpForm1Validation(form1ViewBindings).subscribe(result -> form1ValidationSubject.onNext(result))); |
|
|
|
|
|
this.customerDetailViewSubscriptions.add(setUpForm2Validation(form2ViewBindings).subscribe(result -> form2ValidationSubject.onNext(result))); |
|
|
this.customerDetailViewSubscriptions.add(setUpForm3Validation().subscribe(result -> form3ValidationSubject.onNext(result))); |
|
|
this.customerDetailViewSubscriptions.add(setUpForm3Validation().subscribe(result -> form3ValidationSubject.onNext(result))); |
|
|
this.customerDetailViewSubscriptions.add(setupAlternateIDRelatedFieldValidation().subscribe(result -> alternateIdRelatedFieldValidationSubject.onNext(result))); |
|
|
|
|
|
this.customerDetailViewSubscriptions.add(setupPassportRelatedFieldValidation().subscribe(result -> passportRelatedFieldValidationSubject.onNext(result))); |
|
|
|
|
|
this.customerDetailViewSubscriptions.add(this.view.getCustomerDetailViewContract().getForm3ViewBindings().getAlternateIdDocChangeEvent().subscribe(alternateImage -> alternateIdImageValidationSubject.onNext(alternateImage))); |
|
|
|
|
|
this.customerDetailViewSubscriptions.add(this.view.getCustomerDetailViewContract().getForm3ViewBindings().getPassporIdDocChangeEvent().subscribe(passportImage -> passportImageValidationSubject.onNext(passportImage))); |
|
|
|
|
|
this.customerDetailViewSubscriptions.add(this.view.getCustomerDetailViewContract().getForm2ViewBindings().getReferralCodeChangeEvent().subscribe(val -> validator.validateReferralCode(val))); |
|
|
|
|
|
|
|
|
this.customerDetailViewSubscriptions.add(setupAlternateIDRelatedFieldValidation(form2ViewBindings).subscribe(result -> alternateIdRelatedFieldValidationSubject.onNext(result))); |
|
|
|
|
|
this.customerDetailViewSubscriptions.add(setupPassportRelatedFieldValidation(form2ViewBindings).subscribe(result -> passportRelatedFieldValidationSubject.onNext(result))); |
|
|
|
|
|
this.customerDetailViewSubscriptions.add(form3ViewBindings.getAlternateIdDocChangeEvent().subscribe(alternateImage -> alternateIdImageValidationSubject.onNext(alternateImage))); |
|
|
|
|
|
this.customerDetailViewSubscriptions.add(form3ViewBindings.getPassporIdDocChangeEvent().subscribe(passportImage -> passportImageValidationSubject.onNext(passportImage))); |
|
|
|
|
|
this.customerDetailViewSubscriptions.add(form2ViewBindings.getReferralCodeChangeEvent().subscribe(val -> validator.validateReferralCode(val))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (shouldRedirectToPennyTestScreen) |
|
|
if (shouldRedirectToPennyTestScreen) |
|
@ -334,14 +334,14 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private Observable<Boolean> setUpForm1Validation() { |
|
|
|
|
|
|
|
|
private Observable<Boolean> setUpForm1Validation(CustomerDetailFragment.Form1ViewBindings form1ViewBindings) { |
|
|
return Observable.combineLatest( |
|
|
return Observable.combineLatest( |
|
|
this.view.getCustomerDetailViewContract().getForm1ViewBindings().getFullNameTextChangeEvent().map(val -> validator.validateFullName(val.toString())), |
|
|
|
|
|
this.view.getCustomerDetailViewContract().getForm1ViewBindings().getGenderChangeEvent().map(val -> validator.validateGender(val)), |
|
|
|
|
|
this.view.getCustomerDetailViewContract().getForm1ViewBindings().getDobChangeEvent().map(val -> validator.validatedob(val.toString())), |
|
|
|
|
|
this.view.getCustomerDetailViewContract().getForm1ViewBindings().getEmailChangeEvent().map(val -> validator.validateEmail(val.toString())), |
|
|
|
|
|
this.view.getCustomerDetailViewContract().getForm1ViewBindings().getCityChangeEvent().map(val -> validator.validateCity(val)), |
|
|
|
|
|
this.view.getCustomerDetailViewContract().getForm1ViewBindings().getAddressChangeEvent().map(val -> validator.validateKoreaAddress(val.toString())), |
|
|
|
|
|
|
|
|
form1ViewBindings.getFullNameTextChangeEvent().map(val -> validator.validateFullName(val.toString())), |
|
|
|
|
|
form1ViewBindings.getGenderChangeEvent().map(val -> validator.validateGender(val)), |
|
|
|
|
|
form1ViewBindings.getDobChangeEvent().map(val -> validator.validatedob(val.toString())), |
|
|
|
|
|
form1ViewBindings.getEmailChangeEvent().map(val -> validator.validateEmail(val.toString())), |
|
|
|
|
|
form1ViewBindings.getCityChangeEvent().map(val -> validator.validateCity(val)), |
|
|
|
|
|
form1ViewBindings.getAddressChangeEvent().map(val -> validator.validateKoreaAddress(val.toString())), |
|
|
//TODO Ocuupation field added |
|
|
//TODO Ocuupation field added |
|
|
// this.view.getCustomerDetailViewContract().getForm1ViewBindings().getOccupationChangeEvent().map(val -> validator.validateOccupation(val)), |
|
|
// this.view.getCustomerDetailViewContract().getForm1ViewBindings().getOccupationChangeEvent().map(val -> validator.validateOccupation(val)), |
|
|
(isFullNameValid, isGenderValid, isDobValid, isEmailValid, isCityValid, isAddressValid) -> { |
|
|
(isFullNameValid, isGenderValid, isDobValid, isEmailValid, isCityValid, isAddressValid) -> { |
|
@ -356,11 +356,11 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private Observable<Boolean> setUpForm2Validation() { |
|
|
|
|
|
|
|
|
private Observable<Boolean> setUpForm2Validation(CustomerDetailFragment.Form2ViewBindings form2ViewBindings) { |
|
|
List<Observable<?>> list = new ArrayList<>(); |
|
|
List<Observable<?>> list = new ArrayList<>(); |
|
|
list.add(this.view.getCustomerDetailViewContract().getForm2ViewBindings().getPrimaryBankChangeEvent().map(val -> validator.validateBank(val))); |
|
|
|
|
|
list.add(this.view.getCustomerDetailViewContract().getForm2ViewBindings().getPrimarnyBankAccountNoChangeEvent().map(val -> validator.validateBankAccountNo(val.toString()))); |
|
|
|
|
|
list.add(this.view.getCustomerDetailViewContract().getForm2ViewBindings().getGMEBranchChangeEvent().map(val -> validator.validateGmeBranch(val))); |
|
|
|
|
|
|
|
|
list.add(form2ViewBindings.getPrimaryBankChangeEvent().map(val -> validator.validateBank(val))); |
|
|
|
|
|
list.add(form2ViewBindings.getPrimarnyBankAccountNoChangeEvent().map(val -> validator.validateBankAccountNo(val.toString()))); |
|
|
|
|
|
list.add(form2ViewBindings.getGMEBranchChangeEvent().map(val -> validator.validateGmeBranch(val))); |
|
|
list.add(alternateIdRelatedFieldValidationSubject); |
|
|
list.add(alternateIdRelatedFieldValidationSubject); |
|
|
list.add(passportRelatedFieldValidationSubject); |
|
|
list.add(passportRelatedFieldValidationSubject); |
|
|
return Observable.combineLatest( |
|
|
return Observable.combineLatest( |
|
@ -377,16 +377,16 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private Observable<Boolean> setupAlternateIDRelatedFieldValidation() { |
|
|
|
|
|
return Observable.merge(this.view.getCustomerDetailViewContract().getForm2ViewBindings().getAlternateIDNoChangeEvent().map(val -> { |
|
|
|
|
|
|
|
|
private Observable<Boolean> setupAlternateIDRelatedFieldValidation(CustomerDetailFragment.Form2ViewBindings form2ViewBindings) { |
|
|
|
|
|
return Observable.merge(form2ViewBindings.getAlternateIDNoChangeEvent().map(val -> { |
|
|
boolean result = validator.validateAlternateIdNo(val.toString()); |
|
|
boolean result = validator.validateAlternateIdNo(val.toString()); |
|
|
if (validator.hasRequiredDataForAlternatIdVerificationFromServer()) |
|
|
if (validator.hasRequiredDataForAlternatIdVerificationFromServer()) |
|
|
validateAlternateIDFromServer(); |
|
|
validateAlternateIDFromServer(); |
|
|
return result; |
|
|
return result; |
|
|
}), |
|
|
}), |
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getAlternateIDIssuedDateChangeEvent().map(val -> validator.validateAlternateIDIssuedDate(val.toString())), |
|
|
|
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getAlternateIDExpiryDateChangeEvent().map(val -> validator.validateAlternateIDExpiryDate(val.toString())), |
|
|
|
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getAlternateIdTypeChangeEvent().map(val -> { |
|
|
|
|
|
|
|
|
form2ViewBindings.getAlternateIDIssuedDateChangeEvent().map(val -> validator.validateAlternateIDIssuedDate(val.toString())), |
|
|
|
|
|
form2ViewBindings.getAlternateIDExpiryDateChangeEvent().map(val -> validator.validateAlternateIDExpiryDate(val.toString())), |
|
|
|
|
|
form2ViewBindings.getAlternateIdTypeChangeEvent().map(val -> { |
|
|
boolean result = validator.validateAlternateIdType(val); |
|
|
boolean result = validator.validateAlternateIdType(val); |
|
|
if (validator.hasRequiredDataForAlternatIdVerificationFromServer()) |
|
|
if (validator.hasRequiredDataForAlternatIdVerificationFromServer()) |
|
|
validateAlternateIDFromServer(); |
|
|
validateAlternateIDFromServer(); |
|
@ -395,12 +395,12 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private Observable<Boolean> setupPassportRelatedFieldValidation() { |
|
|
|
|
|
|
|
|
private Observable<Boolean> setupPassportRelatedFieldValidation(CustomerDetailFragment.Form2ViewBindings form2ViewBindings) { |
|
|
|
|
|
|
|
|
return Observable.combineLatest( |
|
|
return Observable.combineLatest( |
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getPassportNumberChangeEvent().map(val -> validator.validatePassportNo(val.toString())), |
|
|
|
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getPassportIssuedDateChangeEvent().map(val -> validator.validatePassportIssuedDate(val.toString())), |
|
|
|
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getPassportExpiryDateChangeEvent().map(val -> validator.validatePassportExpiryDate(val.toString())), |
|
|
|
|
|
|
|
|
form2ViewBindings.getPassportNumberChangeEvent().map(val -> validator.validatePassportNo(val.toString())), |
|
|
|
|
|
form2ViewBindings.getPassportIssuedDateChangeEvent().map(val -> validator.validatePassportIssuedDate(val.toString())), |
|
|
|
|
|
form2ViewBindings.getPassportExpiryDateChangeEvent().map(val -> validator.validatePassportExpiryDate(val.toString())), |
|
|
(isPassportNumberValid, isPasspotIssuedDateValid, isPassportExpiryDateValid) -> isPassportNumberValid && isPasspotIssuedDateValid && isPassportExpiryDateValid |
|
|
(isPassportNumberValid, isPasspotIssuedDateValid, isPassportExpiryDateValid) -> isPassportNumberValid && isPasspotIssuedDateValid && isPassportExpiryDateValid |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|