From b2409bc6d708bb6696bb47d0a3aa814aa7678027 Mon Sep 17 00:00:00 2001 From: Preyea Regmi Date: Fri, 5 Jun 2020 17:46:14 +0545 Subject: [PATCH] KYC refactored --- .../kycV3/model/KYCRelatedDataDTO.java | 37 +++++++++++++++++++ .../kycV3/presenter/KYCV3ViewModel.java | 7 +++- app/src/main/res/layout/activity_kyc_v3.xml | 3 +- app/src/main/res/layout/kyc_header.xml | 6 +-- 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/model/KYCRelatedDataDTO.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/model/KYCRelatedDataDTO.java index 77bfa59e..e9130d49 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/model/KYCRelatedDataDTO.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/model/KYCRelatedDataDTO.java @@ -294,10 +294,47 @@ public class KYCRelatedDataDTO { return false; } + /** + * Only checks if server send not null pictures, doesn't verify weather atleast any indivisual pictures are available or not. + * + * @return + */ public boolean arePicturesAvailable() { return pictures != null; } + /** + * Check if server has send any pictures url + * + * @return + */ + public boolean areAnyPicturesAvailableFromServer() { + if (pictures != null) { + if (pictures.getPassportPicture() != null && pictures.getPassportPicture().length() > 0) + return true; + else + return pictures.getAnotherIDPicture() != null && pictures.getAnotherIDPicture().length() > 0; + + } + return false; + } + + /** + * Check if user has prepared any pictures to be send to server + * + * @return + */ + public boolean areAnyPicturesPreparedForKYCByUser() { + if (pictures != null) { + if (pictures.getPassportImageFile() != null ) + return true; + else + return pictures.getAlternateIDImageFile() != null; + + } + return false; + } + public void seedInitialData() { if (primaryInformation == null) primaryInformation = new PrimaryInformationDTO(); diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/presenter/KYCV3ViewModel.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/presenter/KYCV3ViewModel.java index 6a2d60d5..9df93aab 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/presenter/KYCV3ViewModel.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/presenter/KYCV3ViewModel.java @@ -679,7 +679,10 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter @Override public void sendForm2KYCUpdate() { - postKYCFormToServer(validator.getKycRelatedDataDTO().getForm2PostData(gateway.getUserID()), view::showDocumentDetailForm); + if (validator.getKycRelatedDataDTO().areAnyPicturesPreparedForKYCByUser()) + postKYCFormToServer(validator.getKycRelatedDataDTO().getFullFormPostData(gateway.getUserID()), view::showDocumentDetailForm); + else + postKYCFormToServer(validator.getKycRelatedDataDTO().getForm2PostData(gateway.getUserID()), view::showDocumentDetailForm); } @@ -695,7 +698,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { onReceivingKycRelatedData(t.getData()); view.lazyLoadForms(); - if (t.getData().arePicturesAvailable()) + if (t.getData().areAnyPicturesAvailableFromServer()) view.showDocumentDetailForm(); } else diff --git a/app/src/main/res/layout/activity_kyc_v3.xml b/app/src/main/res/layout/activity_kyc_v3.xml index ba4c0abc..fba83c4f 100644 --- a/app/src/main/res/layout/activity_kyc_v3.xml +++ b/app/src/main/res/layout/activity_kyc_v3.xml @@ -54,8 +54,7 @@ android:layout_height="match_parent" android:fillViewport="true" > - - diff --git a/app/src/main/res/layout/kyc_header.xml b/app/src/main/res/layout/kyc_header.xml index 3af35890..f02956a3 100644 --- a/app/src/main/res/layout/kyc_header.xml +++ b/app/src/main/res/layout/kyc_header.xml @@ -28,7 +28,7 @@ android:layout_marginTop="@dimen/_3sdp" android:id="@+id/page1TitleTxtView" android:layout_width="wrap_content" - android:maxWidth="@dimen/_100sdp" + android:maxWidth="@dimen/_130sdp" android:layout_height="wrap_content" android:gravity="center" android:paddingTop="3dp" @@ -41,7 +41,7 @@