Browse Source

KYC refactored

master
Preyea Regmi 4 years ago
parent
commit
b2409bc6d7
  1. 37
      app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/model/KYCRelatedDataDTO.java
  2. 7
      app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/presenter/KYCV3ViewModel.java
  3. 3
      app/src/main/res/layout/activity_kyc_v3.xml
  4. 6
      app/src/main/res/layout/kyc_header.xml

37
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();

7
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

3
app/src/main/res/layout/activity_kyc_v3.xml

@ -54,8 +54,7 @@
android:layout_height="match_parent"
android:fillViewport="true" >
<!-- <com.gmeremit.online.gmeremittance_native.customwidgets.SwipeDisabledViewPager-->
<androidx.viewpager.widget.ViewPager
<com.gmeremit.online.gmeremittance_native.customwidgets.SwipeDisabledViewPager
android:id="@+id/kycFormViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

6
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 @@
<View
android:id="@+id/view14"
android:layout_width="108dp"
android:layout_width="@dimen/_120sdp"
android:layout_height="2dp"
android:background="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/page1TxtView"
@ -73,7 +73,7 @@
android:id="@+id/page2TitleTxtView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="@dimen/_100sdp"
android:maxWidth="@dimen/_130sdp"
android:gravity="center"
android:paddingTop="3dp"
android:text="Documents"

Loading…
Cancel
Save