|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.gmeremit.online.gmeremittance_native.kycV3.presenter; |
|
|
|
|
|
|
|
import android.graphics.Bitmap; |
|
|
|
import android.util.Log; |
|
|
|
|
|
|
|
import androidx.lifecycle.LiveData; |
|
|
|
import androidx.lifecycle.MutableLiveData; |
|
|
@ -181,8 +182,8 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getPassportExpiryDateChangeEvent().map(val -> validator.validatePassportExpiryDate(val.toString())), |
|
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getAlternateIdTypeChangeEvent().map(val -> validator.validateAlternateIdType(val)), |
|
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getAlternateIDNoChangeEvent().map(val -> validator.validateAlternateIdNo(val.toString())), |
|
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getAlternateIDIssuedDateChangeEvent().map(val -> validator.validateAlternateIdIssuedDate(val.toString())), |
|
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getAlternateIDExpiryDateChangeEvent().map(val -> validator.validateAlternateIdIssuedDate(val.toString())), |
|
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getAlternateIDIssuedDateChangeEvent().map(val -> validator.validateAlternateIDIssuedDate(val.toString())), |
|
|
|
this.view.getCustomerDetailViewContract().getForm2ViewBindings().getAlternateIDExpiryDateChangeEvent().map(val -> validator.validateAlternateIDExpiryDate(val.toString())), |
|
|
|
(isBankValid, isBankAccNoValid, isPassportNumberValid, isPassportIssuedDateValid, isPassportExpiryDateValid, isAlternateIdTypeValid, isAlternateIdValid, isAlternateIssuedDateValid, isAlternateExpiryDateValid) -> { |
|
|
|
boolean result = isBankValid && isBankAccNoValid && isPassportNumberValid && isPassportIssuedDateValid && isPassportExpiryDateValid && isAlternateIdTypeValid && isAlternateIdValid && isAlternateIssuedDateValid && isAlternateExpiryDateValid; |
|
|
|
customerDetailForm2Button.setValue(result); |
|
|
@ -306,6 +307,11 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
return validator.getKycRelatedDataDTO().getGmeBranchList(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void sendFullKYCDataUpdate() { |
|
|
|
Log.d(TAG, validator.getKycRelatedDataDTO().toString()); |
|
|
|
} |
|
|
|
|
|
|
|
public class KycRelatedDataObserver extends GenericApiObserverResponseV2<KYCRelatedDataDTO> { |
|
|
|
|
|
|
|
@Override |
|
|
@ -411,10 +417,6 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private boolean validateAlternateIdIssuedDate(String issuedDate) { |
|
|
|
return issuedDate.length() > 0; |
|
|
|
} |
|
|
|
|
|
|
|
public boolean validateBank(String bank) { |
|
|
|
kycRelatedDataDTO.getPrimaryInformation().setBankId(bank); |
|
|
|
if (kycRelatedDataDTO.getPrimaryInformation().isBankValid()) { |
|
|
@ -440,11 +442,11 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
|
|
|
|
public boolean validatePassportNo(String passportNo) { |
|
|
|
kycRelatedDataDTO.getPrimaryInformation().setPassportNumber(passportNo); |
|
|
|
if (kycRelatedDataDTO.getPrimaryInformation().isBankAccountValid()) { |
|
|
|
customerDetailErrorLiveDataDTO.setValueToAccountNoError(null); |
|
|
|
if (kycRelatedDataDTO.getPrimaryInformation().isPassportNoValid()) { |
|
|
|
customerDetailErrorLiveDataDTO.setValueToPassportNoError(null); |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
customerDetailErrorLiveDataDTO.setValueToAccountNoError(getStringfromStringId(R.string.empty_field_error_text)); |
|
|
|
customerDetailErrorLiveDataDTO.setValueToPassportNoError(getStringfromStringId(R.string.empty_field_error_text)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
@ -464,7 +466,6 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
|
|
|
|
public boolean validatePassportExpiryDate(String passportExpiryDate) { |
|
|
|
|
|
|
|
kycRelatedDataDTO.getPrimaryInformation().setPassportExpiryDate(passportExpiryDate); |
|
|
|
if (kycRelatedDataDTO.getPrimaryInformation().isPassportExpiryDateValid()) { |
|
|
|
customerDetailErrorLiveDataDTO.setValueToPassportExpiryDateError(null); |
|
|
@ -486,6 +487,32 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean validateAlternateIDIssuedDate(String alternateIDIssuedDate) { |
|
|
|
|
|
|
|
kycRelatedDataDTO.getPrimaryInformation().setAnotherIDIssueDate(alternateIDIssuedDate); |
|
|
|
if (kycRelatedDataDTO.getPrimaryInformation().isAnotherIDIssuedDateValid()) { |
|
|
|
customerDetailErrorLiveDataDTO.setValueToAnotherIDIssuedDateError(null); |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
customerDetailErrorLiveDataDTO.setValueToAnotherIDIssuedDateError(getStringfromStringId(R.string.empty_field_error_text)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public boolean validateAlternateIDExpiryDate(String alternateIDIExpiryDate) { |
|
|
|
|
|
|
|
kycRelatedDataDTO.getPrimaryInformation().setAnotherIDExpiryDate(alternateIDIExpiryDate); |
|
|
|
if (kycRelatedDataDTO.getPrimaryInformation().isAnotherIDExpiryDateValid()) { |
|
|
|
customerDetailErrorLiveDataDTO.setValueToAnotherIDExpiryDateError(null); |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
customerDetailErrorLiveDataDTO.setValueToAnotherIDExpiryDateError(getStringfromStringId(R.string.empty_field_error_text)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public boolean validatePassportImage(File data) { |
|
|
|
|
|
|
|
kycRelatedDataDTO.getPictures().setPassportImageAsFile(data); |
|
|
|