Browse Source

fix kyc screen not launching to correct screen

new_design
Mukesh Dhungana 3 years ago
parent
commit
6134a259a0
  1. 2
      app/src/main/java/com/remit/jmecustomer/features/home/view/HomeActivityV2.java
  2. 2
      app/src/main/java/com/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3PresenterInterface.java
  3. 53
      app/src/main/java/com/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3ViewModel.java
  4. 8
      app/src/main/java/com/remit/jmecustomer/features/kyc/existingCustomer/view/ExistingKYCV3Activity.java

2
app/src/main/java/com/remit/jmecustomer/features/home/view/HomeActivityV2.java

@ -518,7 +518,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra
@Override
public void showKYCScreen(boolean isForExistingCustomer, boolean isKYCSubmitted) {
if (isForExistingCustomer) {
ExistingKYCV3Activity.startActivity(this, false, "", "");
ExistingKYCV3Activity.startActivity(this, false, "", "",isKYCSubmitted);
} else {
KYCV3Activity.startActivity(this, false, "", "", isKYCSubmitted);
}

2
app/src/main/java/com/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3PresenterInterface.java

@ -20,7 +20,7 @@ public interface ExistingKYCV3PresenterInterface extends BasePresenterInterface
void checkImageStatus(int requestCode, int resultCode, File data);
void getKycRelatedData();
void getKycRelatedData(boolean isKYCSubmitted);
void setNewToken(String newToken);
void termsAndConditionAccept();

53
app/src/main/java/com/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3ViewModel.java

@ -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;
}

8
app/src/main/java/com/remit/jmecustomer/features/kyc/existingCustomer/view/ExistingKYCV3Activity.java

@ -67,6 +67,7 @@ public class ExistingKYCV3Activity extends BaseActivity implements ExistingKYCV3
private ExistingKycTermsAndConditionFragment existingKycTermsAndConditionFragment;
private GenericViewPagerAdapter kycViewPagerAdapter;
private ExistingKYCV3ViewModel viewModel;
private static boolean isKYCSubmitted = false;
public static void startActivityForResult(Activity context, boolean shouldRedirectToPennyTestScreen, String userId, String userPwd) {
Intent intent = new Intent(context, ExistingKYCV3Activity.class);
@ -76,7 +77,8 @@ public class ExistingKYCV3Activity extends BaseActivity implements ExistingKYCV3
context.startActivityForResult(intent, KYC_EXISTING_FORM_REQUEST_CODE);
}
public static void startActivity(Activity context, boolean shouldRedirectToPennyTestScreen, String userId, String userPwd) {
public static void startActivity(Activity context, boolean shouldRedirectToPennyTestScreen, String userId, String userPwd, boolean isKYCSubmittedKey) {
isKYCSubmitted = isKYCSubmittedKey;
Intent intent = new Intent(context, ExistingKYCV3Activity.class);
intent.putExtra(SHOULD_REDIRECT_TO_PENNY_TEST_BUNDLE_KEY, shouldRedirectToPennyTestScreen);
intent.putExtra(USER_ID_BUNDLE_KEY, userId);
@ -95,7 +97,7 @@ public class ExistingKYCV3Activity extends BaseActivity implements ExistingKYCV3
}
private void performDefaultAction(Bundle savedInstanceState) {
viewModel.getKycRelatedData();
viewModel.getKycRelatedData(isKYCSubmitted);
}
@ -125,7 +127,7 @@ public class ExistingKYCV3Activity extends BaseActivity implements ExistingKYCV3
fragments.add(documentFragment);
fragments.add(existingKycTermsAndConditionFragment);
kycViewPagerAdapter= new GenericViewPagerAdapter(getSupportFragmentManager(),fragments);
kycViewPagerAdapter = new GenericViewPagerAdapter(getSupportFragmentManager(), fragments);
kycFormViewPager.setOffscreenPageLimit(2);

Loading…
Cancel
Save