|
|
@ -66,6 +66,7 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC |
|
|
|
ExistingCustomerDetailViewLiveData.CustomerDetailViewBinding viewBindings; |
|
|
|
private CustomerDetailViewValidator validator; |
|
|
|
private String newToken; |
|
|
|
private boolean isKYCSubmitted; |
|
|
|
|
|
|
|
public ExistingKYCV3ViewModel(KYCV3ViewContractInterface view, ExistingKYCV3GatewayInterface gatewayInterface, ExistingFileDownloadGateway existingFileDownloadGateway, LoginV2InteractorInterface.Login2GatewayInterface loginGateway, String userId, String userPwd) { |
|
|
|
this.compositeDisposable = new CompositeDisposable(); |
|
|
@ -404,7 +405,8 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void getKycRelatedData() { |
|
|
|
public void getKycRelatedData(boolean isKYCSubmittedkey) { |
|
|
|
isKYCSubmitted = isKYCSubmittedkey; |
|
|
|
viewSubscriptions.add( |
|
|
|
Observable.combineLatest( |
|
|
|
form1ValidationSubject, |
|
|
@ -470,34 +472,34 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC |
|
|
|
public boolean validateAllDetailForm() { |
|
|
|
ExistingKYCRelatedDataDTO existingKYCRelatedDataDTO = validator.getExistingKycRelatedDataDTO(); |
|
|
|
ExistingIDTextDTO visaStatus = existingKYCRelatedDataDTO.getVisaStatusFromId(existingKYCRelatedDataDTO.getPersonalInformation().getVisaStatus()); |
|
|
|
ExistingIDTextDTO occupation=null; |
|
|
|
if( !TextUtils.isEmpty(existingKYCRelatedDataDTO.getPersonalInformation().getOccupation())){ |
|
|
|
occupation=existingKYCRelatedDataDTO.getOccupationFromId(existingKYCRelatedDataDTO.getPersonalInformation().getOccupation()); |
|
|
|
}else if(!TextUtils.isEmpty(existingKYCRelatedDataDTO.getPersonalInformation().getOtherOccupation())){ |
|
|
|
occupation=ExistingIDTextDTO.createFromUserAnswerInput(existingKYCRelatedDataDTO.getPersonalInformation().getOtherOccupation()); |
|
|
|
ExistingIDTextDTO occupation = null; |
|
|
|
if (!TextUtils.isEmpty(existingKYCRelatedDataDTO.getPersonalInformation().getOccupation())) { |
|
|
|
occupation = existingKYCRelatedDataDTO.getOccupationFromId(existingKYCRelatedDataDTO.getPersonalInformation().getOccupation()); |
|
|
|
} else if (!TextUtils.isEmpty(existingKYCRelatedDataDTO.getPersonalInformation().getOtherOccupation())) { |
|
|
|
occupation = ExistingIDTextDTO.createFromUserAnswerInput(existingKYCRelatedDataDTO.getPersonalInformation().getOtherOccupation()); |
|
|
|
} |
|
|
|
ExistingIDTextDTO purposeOfRegistration = existingKYCRelatedDataDTO.getPurposeOfRegistrationFromId(existingKYCRelatedDataDTO.getPersonalInformation().getPurposeOfRegistration()); |
|
|
|
CharSequence address = existingKYCRelatedDataDTO.getPersonalInformation().getAdditionalAddress(); |
|
|
|
ExistingIDTextDTO businessType = existingKYCRelatedDataDTO.getBusinessTypeFromId(existingKYCRelatedDataDTO.getPersonalInformation().getBusinessType()); |
|
|
|
ExistingIDTextDTO selectedIdType=null; |
|
|
|
if( !TextUtils.isEmpty(existingKYCRelatedDataDTO.getPersonalInformation().getIdType())){ |
|
|
|
selectedIdType=existingKYCRelatedDataDTO.getIDTypeFromId(existingKYCRelatedDataDTO.getPersonalInformation().getIdType()); |
|
|
|
}else if(!TextUtils.isEmpty(existingKYCRelatedDataDTO.getPersonalInformation().getOtherIdType())){ |
|
|
|
selectedIdType=ExistingIDTextDTO.createFromUserAnswerInput(existingKYCRelatedDataDTO.getPersonalInformation().getOtherIdType()); |
|
|
|
ExistingIDTextDTO selectedIdType = null; |
|
|
|
if (!TextUtils.isEmpty(existingKYCRelatedDataDTO.getPersonalInformation().getIdType())) { |
|
|
|
selectedIdType = existingKYCRelatedDataDTO.getIDTypeFromId(existingKYCRelatedDataDTO.getPersonalInformation().getIdType()); |
|
|
|
} else if (!TextUtils.isEmpty(existingKYCRelatedDataDTO.getPersonalInformation().getOtherIdType())) { |
|
|
|
selectedIdType = ExistingIDTextDTO.createFromUserAnswerInput(existingKYCRelatedDataDTO.getPersonalInformation().getOtherIdType()); |
|
|
|
} |
|
|
|
CharSequence mobileNumber = existingKYCRelatedDataDTO.getPersonalInformation().getMobile(); |
|
|
|
CharSequence monthlyIncome = existingKYCRelatedDataDTO.getPersonalInformation().getMonthlyIncome(); |
|
|
|
CharSequence employerName = existingKYCRelatedDataDTO.getPersonalInformation().getEmployeerName(); |
|
|
|
|
|
|
|
if (validator.validateEmployerName(employerName) && |
|
|
|
validator.validateOccupation(occupation) && |
|
|
|
validator.validateMonthlyIncome(monthlyIncome) && |
|
|
|
validator.validateMobileNumber(mobileNumber) && |
|
|
|
validator.validateBusinessType(businessType) && |
|
|
|
validator.validateAddress(address) && |
|
|
|
validator.validatePurposeOfRegistration(purposeOfRegistration) && |
|
|
|
validator.validateSelectedIDType(selectedIdType) && |
|
|
|
validator.validateVisaStatus(visaStatus) |
|
|
|
validator.validateOccupation(occupation) && |
|
|
|
validator.validateMonthlyIncome(monthlyIncome) && |
|
|
|
validator.validateMobileNumber(mobileNumber) && |
|
|
|
validator.validateBusinessType(businessType) && |
|
|
|
validator.validateAddress(address) && |
|
|
|
validator.validatePurposeOfRegistration(purposeOfRegistration) && |
|
|
|
validator.validateSelectedIDType(selectedIdType) && |
|
|
|
validator.validateVisaStatus(visaStatus) |
|
|
|
|
|
|
|
) { |
|
|
|
return true; |
|
|
@ -604,6 +606,7 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private boolean shouldPromptToInputAnswer(ExistingIDTextDTO data) { |
|
|
|
return (data != null && (view.getContext().getString(R.string.othersSpecify).equalsIgnoreCase(data.getText()) || view.getContext().getString(R.string.othersSpecify1).equalsIgnoreCase(data.getText()) || view.getContext().getString(R.string.othersSpecify2).equalsIgnoreCase(data.getText()))); |
|
|
|
} |
|
|
@ -620,8 +623,8 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC |
|
|
|
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|
|
|
onReceivingKycRelatedData(t.getData()); |
|
|
|
view.lazyLoadForms(); |
|
|
|
if (t.getData().areAnyPicturesAvailableFromServer()) |
|
|
|
view.showTermsAndCondition(); |
|
|
|
if (t.getData().areAnyPicturesAvailableFromServer() && isKYCSubmitted) |
|
|
|
view.showTermsAndCondition(); |
|
|
|
/* onReceivingKycRelatedData(gateway.getMockedData()); |
|
|
|
view.lazyLoadForms(); |
|
|
|
if (true) |
|
|
@ -792,7 +795,7 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateVisaStatus(ExistingIDTextDTO data) { |
|
|
|
if(data!=null){ |
|
|
|
if (data != null) { |
|
|
|
if (existingKycRelatedDataDTO.getPersonalInformation() == null) |
|
|
|
existingKycRelatedDataDTO.setPersonalInformation(new ExistingPersonalInfoDTO()); |
|
|
|
|
|
|
@ -803,7 +806,7 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC |
|
|
|
customerDetailLiveData.getVisaStatusLiveData().setValue(new FormInputStateDTO<>(false, view.getContext().getResources().getString(R.string.invalidVisaStatus_text), null)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
customerDetailLiveData.getVisaStatusLiveData().setValue(new FormInputStateDTO<>(false, view.getContext().getResources().getString(R.string.invalidVisaStatus_text), null)); |
|
|
|
return false; |
|
|
|
} |
|
|
@ -811,7 +814,7 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC |
|
|
|
} |
|
|
|
|
|
|
|
boolean validatePurposeOfRegistration(ExistingIDTextDTO data) { |
|
|
|
if(data!=null){ |
|
|
|
if (data != null) { |
|
|
|
if (existingKycRelatedDataDTO.getPersonalInformation() == null) |
|
|
|
existingKycRelatedDataDTO.setPersonalInformation(new ExistingPersonalInfoDTO()); |
|
|
|
|
|
|
@ -823,7 +826,7 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC |
|
|
|
customerDetailLiveData.getPurposeOfRegistrationLiveData().setValue(new FormInputStateDTO<>(false, view.getContext().getResources().getString(R.string.invalidPuropseOfReg_text), null)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
customerDetailLiveData.getPurposeOfRegistrationLiveData().setValue(new FormInputStateDTO<>(false, view.getContext().getResources().getString(R.string.invalidPuropseOfReg_text), null)); |
|
|
|
return false; |
|
|
|
} |
|
|
|