|
|
@ -190,6 +190,26 @@ public class SendMoneyV2ViewModel extends BaseViewModel implements SendMoneyV2Pr |
|
|
|
return new WebRequestModel("", JME_TERMS_N_CONDITIONS, null); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean validateAllCCDiForm() { |
|
|
|
if(ccdiValidator.getCcdiDataDto().getSourceOfFundModel()!=null&&ccdiValidator.getCcdiDataDto().getPurposeOfRemittanceModel()!=null){ |
|
|
|
ccdiValidator.validateSourceOfFund(ccdiValidator.getCcdiDataDto().getSourceOfFundModel()); |
|
|
|
ccdiValidator.validatePurposeOfRemit(ccdiValidator.getCcdiDataDto().getPurposeOfRemittanceModel()); |
|
|
|
return true; |
|
|
|
}else{ |
|
|
|
ccdiValidator.validateSourceOfFund(ccdiValidator.getCcdiDataDto().getSourceOfFundModel()); |
|
|
|
ccdiValidator.validatePurposeOfRemit(ccdiValidator.getCcdiDataDto().getPurposeOfRemittanceModel()); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void clearCCDIFormData() { |
|
|
|
ccdiValidator.getCcdiDataDto().setSourceOfFundModel(null); |
|
|
|
ccdiValidator.getCcdiDataDto().setPurposeOfRemittanceModel(null); |
|
|
|
} |
|
|
|
|
|
|
|
private String calculatedDiscountedServiceFee() { |
|
|
|
return selectedTransferFee; |
|
|
|
} |
|
|
@ -565,6 +585,11 @@ public class SendMoneyV2ViewModel extends BaseViewModel implements SendMoneyV2Pr |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateSourceOfFund(IDTextDTO data) { |
|
|
|
if(data==null){ |
|
|
|
ccidDetailViewLiveData.getSourceOfFundLiveData().postValue(new FormInputStateDTO<>(false, view.getContext().getResources().getString(R.string.InvalidSourceOfFund_text), null)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (shouldPromptToInputAnswer(data)) { |
|
|
|
view.promptToInputAnswer(view.getContext().getResources().getString(R.string.specifySourceOfFund_text), new AnswerInputDialog.AnswerInputDialogListener() { |
|
|
@ -572,10 +597,12 @@ public class SendMoneyV2ViewModel extends BaseViewModel implements SendMoneyV2Pr |
|
|
|
public void onAnswerSubmitted(String answer) { |
|
|
|
ccdiDataDto.setOtherSourceOfFund(answer); |
|
|
|
ccdiDataDto.setSourceOfFund(""); |
|
|
|
ccdiDataDto.setSourceOfFundModel(new IDTextDTO(answer,answer)); |
|
|
|
ccidDetailViewLiveData.getSourceOfFundLiveData().postValue(new FormInputStateDTO<>(true, null, IDTextDTO.createFromUserAnswerInput(answer))); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
ccdiDataDto.setSourceOfFundModel(data); |
|
|
|
if (!data.getId().equalsIgnoreCase(data.getText())) { |
|
|
|
ccdiDataDto.setSourceOfFund(data.getId()); |
|
|
|
ccdiDataDto.setOtherSourceOfFund(""); |
|
|
@ -586,6 +613,7 @@ public class SendMoneyV2ViewModel extends BaseViewModel implements SendMoneyV2Pr |
|
|
|
|
|
|
|
} |
|
|
|
if (Utils.isStringNotNullOrEmpty(ccdiDataDto.getSourceOfFund()) || Utils.isStringNotNullOrEmpty(ccdiDataDto.getOtherSourceOfFund())) { |
|
|
|
ccidDetailViewLiveData.getSourceOfFundLiveData().postValue(new FormInputStateDTO<>(true, null, null)); |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
ccidDetailViewLiveData.getSourceOfFundLiveData().postValue(new FormInputStateDTO<>(false, view.getContext().getResources().getString(R.string.InvalidSourceOfFund_text), null)); |
|
|
@ -594,16 +622,21 @@ public class SendMoneyV2ViewModel extends BaseViewModel implements SendMoneyV2Pr |
|
|
|
} |
|
|
|
|
|
|
|
private boolean validatePurposeOfRemit(IDTextDTO data) { |
|
|
|
|
|
|
|
if(data==null){ |
|
|
|
ccidDetailViewLiveData.getPurposeOfRemittanceLiveData().setValue(new FormInputStateDTO<>(false, view.getContext().getResources().getString(R.string.invalidPurposeOfRemittance), null)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (shouldPromptToInputAnswer(data)) { |
|
|
|
view.promptToInputAnswer(view.getContext().getResources().getString(R.string.specifyPurposeOfRemit_text), new AnswerInputDialog.AnswerInputDialogListener() { |
|
|
|
@Override |
|
|
|
public void onAnswerSubmitted(String answer) { |
|
|
|
ccdiDataDto.setOtherPurposeOfRemittance(answer); |
|
|
|
ccidDetailViewLiveData.getPurposeOfRemittanceLiveData().postValue(new FormInputStateDTO<>(true, null, IDTextDTO.createFromUserAnswerInput(answer))); |
|
|
|
ccdiDataDto.setPurposeOfRemittanceModel(new IDTextDTO(answer,answer)); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
ccdiDataDto.setPurposeOfRemittanceModel(data); |
|
|
|
if (!data.getId().equalsIgnoreCase(data.getText())) { |
|
|
|
ccdiDataDto.setPurposeOfRemittance(data.getId()); |
|
|
|
ccdiDataDto.setOtherPurposeOfRemittance(""); |
|
|
@ -614,6 +647,7 @@ public class SendMoneyV2ViewModel extends BaseViewModel implements SendMoneyV2Pr |
|
|
|
|
|
|
|
} |
|
|
|
if (Utils.isStringNotNullOrEmpty(ccdiDataDto.getPurposeOfRemittance()) || Utils.isStringNotNullOrEmpty(ccdiDataDto.getOtherPurposeOfRemittance())) { |
|
|
|
ccidDetailViewLiveData.getPurposeOfRemittanceLiveData().postValue(new FormInputStateDTO<>(true, null, null)); |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
ccidDetailViewLiveData.getPurposeOfRemittanceLiveData().setValue(new FormInputStateDTO<>(false, view.getContext().getResources().getString(R.string.invalidPurposeOfRemittance), null)); |
|
|
|