|
|
@ -3,6 +3,7 @@ package com.swifttech.remit.android.features.kyc.newCustomer.presenter; |
|
|
|
import android.annotation.SuppressLint; |
|
|
|
import android.util.Log; |
|
|
|
|
|
|
|
import com.google.gson.reflect.TypeToken; |
|
|
|
import com.swifttech.remit.android.R; |
|
|
|
import com.swifttech.remit.android.base.BaseViewModel; |
|
|
|
import com.swifttech.remit.android.common.customwidgets.CustomAlertDialog; |
|
|
@ -13,10 +14,9 @@ import com.swifttech.remit.android.features.kyc.newCustomer.model.KYCRelatedData |
|
|
|
import com.swifttech.remit.android.features.kyc.newCustomer.model.KYCRequestDataDTO; |
|
|
|
import com.swifttech.remit.android.features.kyc.newCustomer.model.PersonalInfoDTO; |
|
|
|
import com.swifttech.remit.android.features.kyc.newCustomer.model.PicturesDTO; |
|
|
|
import com.swifttech.remit.android.features.kyc.newCustomer.view.documents.KYCIDTypeViewLiveData; |
|
|
|
import com.swifttech.remit.android.features.kyc.newCustomer.view.documents.KYCIDTypeFragment; |
|
|
|
import com.swifttech.remit.android.features.kyc.newCustomer.view.documents.KYCIDTypeViewLiveData; |
|
|
|
import com.swifttech.remit.android.features.kyc.newCustomer.view.personal.CustomerDetailViewLiveData; |
|
|
|
|
|
|
|
import com.swifttech.remit.android.features.login.model.LoginV2DataApiResponse; |
|
|
|
import com.swifttech.remit.android.features.login.presenter.LoginV2InteractorInterface; |
|
|
|
import com.swifttech.remit.android.utils.Constants; |
|
|
@ -25,10 +25,10 @@ import com.swifttech.remit.android.utils.https.GenericApiObserverResponse; |
|
|
|
import com.swifttech.remit.android.utils.https.GenericApiObserverResponseV2; |
|
|
|
import com.swifttech.remit.android.utils.https.GenericResponseDataModel; |
|
|
|
import com.swifttech.remit.android.utils.https.MessageResponseDataModel; |
|
|
|
import com.google.gson.reflect.TypeToken; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.lang.reflect.Type; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
@ -44,34 +44,22 @@ import static android.app.Activity.RESULT_OK; |
|
|
|
public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInterface { |
|
|
|
|
|
|
|
|
|
|
|
public static final String TAG = "KYCV3Process"; |
|
|
|
private static final int THUMBNAIL_HEIGHT = 150; |
|
|
|
private static final int THUMBNAIL_WIDTH = 150; |
|
|
|
private final KYCV3PresenterInterface.KYCV3ViewContractInterface view; |
|
|
|
private final KYCV3GatewayInterface gateway; |
|
|
|
private final FileDownloadGateway fileDownloadGateway; |
|
|
|
private final LoginV2InteractorInterface.Login2GatewayInterface loginGateway; |
|
|
|
private CustomerDetailViewValidator validator; |
|
|
|
|
|
|
|
|
|
|
|
private PublishSubject<Boolean> form1ValidationSubject; |
|
|
|
private PublishSubject<Boolean> form2ValidationSubject; |
|
|
|
|
|
|
|
private final CompositeDisposable viewSubscriptions; |
|
|
|
|
|
|
|
private final CustomerDetailViewLiveData customerDetailLiveData; |
|
|
|
private final KYCIDTypeViewLiveData idTypeLiveData; |
|
|
|
|
|
|
|
|
|
|
|
private final CompositeDisposable compositeDisposable; |
|
|
|
|
|
|
|
public static final String TAG = "KYCV3Process"; |
|
|
|
private final String userId; |
|
|
|
private final String userPwd; |
|
|
|
|
|
|
|
public static void log(String message) { |
|
|
|
Log.d(TAG, message); |
|
|
|
} |
|
|
|
|
|
|
|
private CustomerDetailViewValidator validator; |
|
|
|
private PublishSubject<Boolean> form1ValidationSubject; |
|
|
|
private PublishSubject<Boolean> form2ValidationSubject; |
|
|
|
|
|
|
|
public KYCV3ViewModel(KYCV3ViewContractInterface view, KYCV3GatewayInterface gatewayInterface, FileDownloadGateway fileDownloadGateway, LoginV2InteractorInterface.Login2GatewayInterface loginGateway, String userId, String userPwd) { |
|
|
|
this.compositeDisposable = new CompositeDisposable(); |
|
|
@ -95,6 +83,10 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static void log(String message) { |
|
|
|
Log.d(TAG, message); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onViewReady() { |
|
|
|
|
|
|
@ -121,21 +113,26 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
|
|
|
|
private void bindCustomerDetailView(CustomerDetailViewLiveData.CustomerDetailViewBinding viewBindings) { |
|
|
|
List<Observable<Boolean>> list = Arrays.asList( |
|
|
|
viewBindings.getAdditionalIdTypeObservable().map(validator::validateAdditionalIdType), |
|
|
|
viewBindings.getOccupationObservable().map(validator::validateOccupation), |
|
|
|
viewBindings.getSourceOfFundObservable().map(validator::validateSourceOfFund), |
|
|
|
viewBindings.getAddressObservable().map(validator::validateAddress), |
|
|
|
viewBindings.getBusinessTypeObservable().map(validator::validateBusineesType), |
|
|
|
viewBindings.getEmailObservable().map(validator::validateEmail), |
|
|
|
viewBindings.getIdTypeObservable().map(validator::validateSelectedIDType), |
|
|
|
viewBindings.getMobileNumberObservable().map(validator::validateMobileNumber), |
|
|
|
viewBindings.getMonthlyIncomeObservable().map(validator::validateMonthlyIncome), |
|
|
|
viewBindings.getEmployerNameObservable().map(validator::validateEmployerName) |
|
|
|
); |
|
|
|
viewSubscriptions.add( |
|
|
|
Observable.combineLatest( |
|
|
|
viewBindings.getAdditionalIdTypeObservable().map(validator::validateAdditionalIdType), |
|
|
|
viewBindings.getSourceOfFundObservable().map(validator::validateSourceOfFund), |
|
|
|
viewBindings.getAddressObservable().map(validator::validateAddress), |
|
|
|
viewBindings.getBusinessTypeObservable().map(validator::validateBusineesType), |
|
|
|
viewBindings.getEmailObservable().map(validator::validateEmail), |
|
|
|
viewBindings.getIdTypeObservable().map(validator::validateSelectedIDType), |
|
|
|
viewBindings.getMobileNumberObservable().map(validator::validateMobileNumber), |
|
|
|
viewBindings.getMonthlyIncomeObservable().map(validator::validateMonthlyIncome), |
|
|
|
viewBindings.getEmployerNameObservable().map(validator::validateEmployerName), |
|
|
|
(isAdditionalTypeValid, isSourceOfFundValid, isAddressValid, isBusinessTypeValid, isEmailValid, isIdTypeValid, isMobileNumberValid, isMonthlyIncomeValid, isEmployerNameValid) -> |
|
|
|
isAdditionalTypeValid && isSourceOfFundValid && isAddressValid && isBusinessTypeValid && isEmailValid && isIdTypeValid && isMobileNumberValid && isMonthlyIncomeValid && isEmployerNameValid |
|
|
|
|
|
|
|
).subscribeWith(new DisposableObserver<Boolean>() { |
|
|
|
Observable.combineLatest(list, objects -> { |
|
|
|
for (Object value : objects) { |
|
|
|
if (!(value instanceof Boolean)) return false; |
|
|
|
if (!((Boolean) value)) return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
}).subscribeWith(new DisposableObserver<Boolean>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onNext(Boolean form1ValidationResult) { |
|
|
@ -172,7 +169,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
viewBindings.getIdTypeSideDocImageLoadedResultObservable(), |
|
|
|
viewBindings.getAdditionalidTypeDocImageLoadedResultObservable(), |
|
|
|
viewBindings.getAdditionalidBackTypeDocImageLoadedResultObservable(), |
|
|
|
(isFacePictureValid, isFrontIdPictureValid, isBackIdPictureValid, isSideIdPictureValid, isAdditionalIdValid,isAdditionalIdBackValid) -> |
|
|
|
(isFacePictureValid, isFrontIdPictureValid, isBackIdPictureValid, isSideIdPictureValid, isAdditionalIdValid, isAdditionalIdBackValid) -> |
|
|
|
isFacePictureValid && isFrontIdPictureValid && isBackIdPictureValid && isSideIdPictureValid && isAdditionalIdValid && isAdditionalIdBackValid |
|
|
|
).subscribeWith(new DisposableObserver<Boolean>() { |
|
|
|
|
|
|
@ -208,24 +205,25 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
|
|
|
|
private void updateCustomerDetailData(KYCRelatedDataDTO data) { |
|
|
|
PersonalInfoDTO personalInfoDTO=data.getPersonalInformation(); |
|
|
|
|
|
|
|
if(personalInfoDTO!=null){ |
|
|
|
String mobileNumber=personalInfoDTO.getMobile(); |
|
|
|
if(mobileNumber!=null &&mobileNumber.startsWith(view.getContext().getResources().getString(R.string.mobile_prefix))){ |
|
|
|
mobileNumber=mobileNumber.substring(3); |
|
|
|
} |
|
|
|
customerDetailLiveData.getEmployerNameLiveData().postValue(new FormInputStateDTO<>(true,null, personalInfoDTO.getEmployeerName())); |
|
|
|
customerDetailLiveData.getSourceOfFundLiveData().postValue(new FormInputStateDTO<>(true,null, data.getSourceOfFundFromId(personalInfoDTO.getSourceOfFund()))); |
|
|
|
customerDetailLiveData.getMonthlyIncomeLiveData().postValue(new FormInputStateDTO<>(true,null, data.getMonthlyIncomeFromId(personalInfoDTO.getMonthlyIncome()))); |
|
|
|
customerDetailLiveData.getBusinessTypeLiveData().postValue(new FormInputStateDTO<>(true,null, data.getBusinessTypeFromId(personalInfoDTO.getBusinessType()))); |
|
|
|
customerDetailLiveData.getIdTypeLiveData().postValue(new FormInputStateDTO<>(true,null, data.getIDypeFromId(personalInfoDTO.getIdType()))); |
|
|
|
customerDetailLiveData.getAdditionalIdTypeLiveData().postValue(new FormInputStateDTO<>(true,null, data.getAdditionalIdTypeFromId(personalInfoDTO.getAdditionalIdType()))); |
|
|
|
|
|
|
|
customerDetailLiveData.getMobileNumberLiveData().postValue(new FormInputStateDTO<>(true,null, mobileNumber)); |
|
|
|
customerDetailLiveData.getEmailLiveData().postValue(new FormInputStateDTO<>(true,null, personalInfoDTO.getEmail())); |
|
|
|
customerDetailLiveData.getAddressLiveData().postValue(new FormInputStateDTO<>(true,null, personalInfoDTO.getAdditionalAddress())); |
|
|
|
} |
|
|
|
PersonalInfoDTO personalInfoDTO = data.getPersonalInformation(); |
|
|
|
|
|
|
|
if (personalInfoDTO != null) { |
|
|
|
String mobileNumber = personalInfoDTO.getMobile(); |
|
|
|
if (mobileNumber != null && mobileNumber.startsWith(view.getContext().getResources().getString(R.string.mobile_prefix))) { |
|
|
|
mobileNumber = mobileNumber.substring(3); |
|
|
|
} |
|
|
|
customerDetailLiveData.getEmployerNameLiveData().postValue(new FormInputStateDTO<>(true, null, personalInfoDTO.getEmployeerName())); |
|
|
|
customerDetailLiveData.getOccupationsLiveData().postValue(new FormInputStateDTO<>(true, null, data.getOccupationFromId(personalInfoDTO.getOccupation()))); |
|
|
|
customerDetailLiveData.getSourceOfFundLiveData().postValue(new FormInputStateDTO<>(true, null, data.getSourceOfFundFromId(personalInfoDTO.getSourceOfFund()))); |
|
|
|
customerDetailLiveData.getMonthlyIncomeLiveData().postValue(new FormInputStateDTO<>(true, null, data.getMonthlyIncomeFromId(personalInfoDTO.getMonthlyIncome()))); |
|
|
|
customerDetailLiveData.getBusinessTypeLiveData().postValue(new FormInputStateDTO<>(true, null, data.getBusinessTypeFromId(personalInfoDTO.getBusinessType()))); |
|
|
|
customerDetailLiveData.getIdTypeLiveData().postValue(new FormInputStateDTO<>(true, null, data.getIDypeFromId(personalInfoDTO.getIdType()))); |
|
|
|
customerDetailLiveData.getAdditionalIdTypeLiveData().postValue(new FormInputStateDTO<>(true, null, data.getAdditionalIdTypeFromId(personalInfoDTO.getAdditionalIdType()))); |
|
|
|
|
|
|
|
customerDetailLiveData.getMobileNumberLiveData().postValue(new FormInputStateDTO<>(true, null, mobileNumber)); |
|
|
|
customerDetailLiveData.getEmailLiveData().postValue(new FormInputStateDTO<>(true, null, personalInfoDTO.getEmail())); |
|
|
|
customerDetailLiveData.getAddressLiveData().postValue(new FormInputStateDTO<>(true, null, personalInfoDTO.getAdditionalAddress())); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -453,6 +451,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void checkImageStatus(int requestCode, int resultCode, File data) { |
|
|
|
if (data == null) { |
|
|
@ -564,6 +563,10 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IDTextDTO> getOccupationList() { |
|
|
|
return validator.getKycRelatedDataDTO().getOccupationList(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -618,8 +621,18 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
postKYCFormToServer(validator.getKycRelatedDataDTO().getForm1PostData(gateway.getUserID()), view::showDocumentDetailForm); |
|
|
|
} |
|
|
|
|
|
|
|
private void getNewAccessToken(Runnable task) { |
|
|
|
compositeDisposable.add( |
|
|
|
loginGateway.loginUser(loginGateway.getBasicAuth(view.getContext()), this.userId, this.userPwd) |
|
|
|
.doOnSubscribe(sub -> view.showProgressBar(true, "")) |
|
|
|
.subscribeOn(Schedulers.io()) |
|
|
|
.observeOn(AndroidSchedulers.mainThread()) |
|
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
|
.subscribeWith(new AccessTokenGenerationObserver(task))); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public class KycRelatedDataObserver extends GenericApiObserverResponseV2<KYCRelatedDataDTO> { |
|
|
|
|
|
|
|
@Override |
|
|
@ -630,9 +643,14 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
@Override |
|
|
|
protected void onSuccess(GenericResponseDataModel<KYCRelatedDataDTO> t) { |
|
|
|
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|
|
|
onReceivingKycRelatedData(t.getData()); |
|
|
|
/* onReceivingKycRelatedData(t.getData()); |
|
|
|
view.lazyLoadForms(); |
|
|
|
if (t.getData().areAnyPicturesAvailableFromServer()) |
|
|
|
view.showDocumentDetailForm();*/ |
|
|
|
|
|
|
|
onReceivingKycRelatedData(gateway.getMockedData()); |
|
|
|
view.lazyLoadForms(); |
|
|
|
if (true) |
|
|
|
view.showDocumentDetailForm(); |
|
|
|
|
|
|
|
} else |
|
|
@ -657,7 +675,6 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class CustomerDetailViewValidator { |
|
|
|
|
|
|
|
/** |
|
|
@ -693,7 +710,20 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateSourceOfFund(IDTextDTO data) { |
|
|
|
boolean validateOccupation(IDTextDTO data) { |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation() == null) |
|
|
|
kycRelatedDataDTO.setPersonalInformation(new PersonalInfoDTO()); |
|
|
|
|
|
|
|
kycRelatedDataDTO.getPersonalInformation().setOccupation(data.getId()); |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation().isOccupationValid()) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
customerDetailLiveData.getOccupationsLiveData().setValue(new FormInputStateDTO<>(false, view.getContext().getString(R.string.invalidOccupation), null)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateSourceOfFund(IDTextDTO data) { |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation() == null) |
|
|
|
kycRelatedDataDTO.setPersonalInformation(new PersonalInfoDTO()); |
|
|
|
|
|
|
@ -706,11 +736,11 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateAddress(CharSequence data) { |
|
|
|
boolean validateAddress(CharSequence data) { |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation() == null) |
|
|
|
kycRelatedDataDTO.setPersonalInformation(new PersonalInfoDTO()); |
|
|
|
|
|
|
|
kycRelatedDataDTO.getPersonalInformation().setAdditionalAddress(data!=null?data.toString():null); |
|
|
|
kycRelatedDataDTO.getPersonalInformation().setAdditionalAddress(data != null ? data.toString() : null); |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation().isAdditionalAddressValid()) { |
|
|
|
customerDetailLiveData.getAddressLiveData().setValue(new FormInputStateDTO<>(true, null, null)); |
|
|
|
return true; |
|
|
@ -720,7 +750,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateBusineesType(IDTextDTO data) { |
|
|
|
boolean validateBusineesType(IDTextDTO data) { |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation() == null) |
|
|
|
kycRelatedDataDTO.setPersonalInformation(new PersonalInfoDTO()); |
|
|
|
|
|
|
@ -733,11 +763,11 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateEmail(CharSequence data) { |
|
|
|
boolean validateEmail(CharSequence data) { |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation() == null) |
|
|
|
kycRelatedDataDTO.setPersonalInformation(new PersonalInfoDTO()); |
|
|
|
|
|
|
|
kycRelatedDataDTO.getPersonalInformation().setEmail(data!=null?data.toString():null); |
|
|
|
kycRelatedDataDTO.getPersonalInformation().setEmail(data != null ? data.toString() : null); |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation().isEmailValid()) { |
|
|
|
customerDetailLiveData.getEmailLiveData().setValue(new FormInputStateDTO<>(true, null, null)); |
|
|
|
return true; |
|
|
@ -747,7 +777,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateSelectedIDType(IDTextDTO data) { |
|
|
|
boolean validateSelectedIDType(IDTextDTO data) { |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation() == null) |
|
|
|
kycRelatedDataDTO.setPersonalInformation(new PersonalInfoDTO()); |
|
|
|
|
|
|
@ -760,11 +790,11 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateMobileNumber(CharSequence data) { |
|
|
|
boolean validateMobileNumber(CharSequence data) { |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation() == null) |
|
|
|
kycRelatedDataDTO.setPersonalInformation(new PersonalInfoDTO()); |
|
|
|
|
|
|
|
kycRelatedDataDTO.getPersonalInformation().setMobile(data!=null?data.toString():null); |
|
|
|
kycRelatedDataDTO.getPersonalInformation().setMobile(data != null ? data.toString() : null); |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation().isMobileNumberValid()) { |
|
|
|
customerDetailLiveData.getMobileNumberLiveData().setValue(new FormInputStateDTO<>(true, null, null)); |
|
|
|
return true; |
|
|
@ -774,7 +804,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateMonthlyIncome(IDTextDTO data) { |
|
|
|
boolean validateMonthlyIncome(IDTextDTO data) { |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation() == null) |
|
|
|
kycRelatedDataDTO.setPersonalInformation(new PersonalInfoDTO()); |
|
|
|
|
|
|
@ -787,11 +817,11 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateEmployerName(CharSequence data) { |
|
|
|
boolean validateEmployerName(CharSequence data) { |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation() == null) |
|
|
|
kycRelatedDataDTO.setPersonalInformation(new PersonalInfoDTO()); |
|
|
|
|
|
|
|
kycRelatedDataDTO.getPersonalInformation().setEmployeerName(data!=null?data.toString():null); |
|
|
|
kycRelatedDataDTO.getPersonalInformation().setEmployeerName(data != null ? data.toString() : null); |
|
|
|
if (kycRelatedDataDTO.getPersonalInformation().isEmployerNameValid()) { |
|
|
|
customerDetailLiveData.getEmployerNameLiveData().setValue(new FormInputStateDTO<>(true, null, null)); |
|
|
|
return true; |
|
|
@ -801,7 +831,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
boolean validateFacePicture(File data) { |
|
|
|
boolean validateFacePicture(File data) { |
|
|
|
|
|
|
|
if (kycRelatedDataDTO.getPictures() == null) |
|
|
|
kycRelatedDataDTO.setPictures(new PicturesDTO()); |
|
|
@ -816,7 +846,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
boolean validateFrontIdTypePicture(File data) { |
|
|
|
boolean validateFrontIdTypePicture(File data) { |
|
|
|
if (kycRelatedDataDTO.getPictures() == null) |
|
|
|
kycRelatedDataDTO.setPictures(new PicturesDTO()); |
|
|
|
|
|
|
@ -830,7 +860,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
boolean validateBackIdTypePicture(File data) { |
|
|
|
boolean validateBackIdTypePicture(File data) { |
|
|
|
if (kycRelatedDataDTO.getPictures() == null) |
|
|
|
kycRelatedDataDTO.setPictures(new PicturesDTO()); |
|
|
|
|
|
|
@ -844,7 +874,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
boolean validateSideIdTypePicture(File data) { |
|
|
|
boolean validateSideIdTypePicture(File data) { |
|
|
|
if (kycRelatedDataDTO.getPictures() == null) |
|
|
|
kycRelatedDataDTO.setPictures(new PicturesDTO()); |
|
|
|
|
|
|
@ -884,20 +914,6 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void getNewAccessToken(Runnable task) { |
|
|
|
compositeDisposable.add( |
|
|
|
loginGateway.loginUser(loginGateway.getBasicAuth(view.getContext()), this.userId, this.userPwd) |
|
|
|
.doOnSubscribe(sub -> view.showProgressBar(true, "")) |
|
|
|
.subscribeOn(Schedulers.io()) |
|
|
|
.observeOn(AndroidSchedulers.mainThread()) |
|
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
|
.subscribeWith(new AccessTokenGenerationObserver(task))); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class KYCFormUploadObserver extends GenericApiObserverResponseV2<MessageResponseDataModel> { |
|
|
|
|
|
|
|
Runnable task; |
|
|
@ -917,15 +933,15 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter |
|
|
|
if ((userId != null && userId.length() > 0) && userPwd != null && userPwd.length() > 0) |
|
|
|
getNewAccessToken(task); |
|
|
|
else if (task != null) |
|
|
|
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.SUCCESS,alertType -> { |
|
|
|
if(task!=null) |
|
|
|
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.SUCCESS, alertType -> { |
|
|
|
if (task != null) |
|
|
|
task.run(); |
|
|
|
}); |
|
|
|
} else if(task!=null) |
|
|
|
} else if (task != null) |
|
|
|
task.run(); |
|
|
|
|
|
|
|
} else |
|
|
|
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED,null); |
|
|
|
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|