From e83c02ff95597e2f4ddd7dd771bb5cd61eeb04fd Mon Sep 17 00:00:00 2001 From: Preyea Regmi Date: Thu, 16 Jan 2020 11:15:59 +0545 Subject: [PATCH] Full name explicitly made uppercase, location removed country city and special char, driving license format made similar to national id card --- .../kycV3/presenter/KYCV3ViewModel.java | 14 ++++++++++++-- .../view/personal/CustomerDetailFragment.java | 3 ++- .../gmeremittance_native/utils/RxUtils.java | 19 ++++++++++++++++--- .../layout/fragment_kyc_customer_detail.xml | 1 + 4 files changed, 31 insertions(+), 6 deletions(-) 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 2fb68495..73841969 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 @@ -341,6 +341,8 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter args -> { boolean result = ((boolean) args[0]) && ((boolean) args[1]) && ((boolean) args[2]) && ((boolean) args[3]) && ((boolean) args[4]); + Log.d(TAG, "Form 2 valid: " + result); + customerDetailForm2Button.setValue(result); log("Alternate ID Related Field Valid : " + ((boolean) args[3])); log("Passport Related Field Valid : " + ((boolean) args[4])); @@ -810,6 +812,8 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter } public boolean validateBankAccountNo(String bankAccNo) { + + if (kycRelatedDataDTO.getPrimaryInformation() == null) kycRelatedDataDTO.setPrimaryInformation(new PrimaryInformationDTO()); @@ -827,6 +831,8 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter } public boolean validatePassportNo(String passportNo) { + if (validator.getKycRelatedDataDTO().isUserOfKoreanNative()) + return true; if (kycRelatedDataDTO.getPrimaryInformation() == null) kycRelatedDataDTO.setPrimaryInformation(new PrimaryInformationDTO()); @@ -846,6 +852,8 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter } public boolean validatePassportIssuedDate(String passportIssuedDate) { + if (validator.getKycRelatedDataDTO().isUserOfKoreanNative()) + return true; if (kycRelatedDataDTO.getPrimaryInformation() == null) kycRelatedDataDTO.setPrimaryInformation(new PrimaryInformationDTO()); @@ -864,6 +872,8 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter } public boolean validatePassportExpiryDate(String passportExpiryDate) { + if (validator.getKycRelatedDataDTO().isUserOfKoreanNative()) + return true; if (kycRelatedDataDTO.getPrimaryInformation() == null) kycRelatedDataDTO.setPrimaryInformation(new PrimaryInformationDTO()); @@ -972,7 +982,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter if (alternateIdNumber == null || alternateIdNumber.length() == 0) { view.getCustomerDetailViewContract().enableAlternateIdFocusChangeAndImeOptionListener(false); result = false; - } else if (alternateIdNumber.length() > 25) { + } else if (alternateIdNumber.length() != ID_CARD_VALID_LENGTH) { view.getCustomerDetailViewContract().enableAlternateIdFocusChangeAndImeOptionListener(false); customerDetailErrorLiveDataDTO.setValueToAnotherIdNoError("Invalid Driving License Card"); result = false; @@ -1032,7 +1042,7 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter kycRelatedDataDTO.getPrimaryInformation().setAnotherIDType(val.getId()); anotherIdPictureLabeliveData.setValue(getAnotherIdTranslatedLable(val.getText())); - if (ID_TYPE_ALIEN_REGISTRATION_CARD.equalsIgnoreCase(val.getText()) || ID_TYPE_NATIONAL_ID_CARD.equalsIgnoreCase(val.getText())) { + if (ID_TYPE_ALIEN_REGISTRATION_CARD.equalsIgnoreCase(val.getText()) || ID_TYPE_NATIONAL_ID_CARD.equalsIgnoreCase(val.getText())||ID_TYPE_DRIVING_LICENSE.equalsIgnoreCase(val.getText())) { view.getCustomerDetailViewContract().updateAnotherIdNumberMask(1); } else { view.getCustomerDetailViewContract().updateAnotherIdNumberMask(0); diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/view/personal/CustomerDetailFragment.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/view/personal/CustomerDetailFragment.java index b07d7eb8..809aa8eb 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/view/personal/CustomerDetailFragment.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/view/personal/CustomerDetailFragment.java @@ -14,6 +14,7 @@ import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; import android.provider.Settings; +import android.text.InputFilter; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -290,7 +291,7 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present private void performDefaultAction(Bundle savedInstance) { form2.setVisibility(GONE); form3.setVisibility(GONE); - + ed_firstname.setFilters(new InputFilter[] {new InputFilter.AllCaps()}); KYCV3ViewModel kycv3ViewModel = ViewModelProviders.of(getActivity()).get(KYCV3ViewModel.class); subscribeToCustomerRelatedDataError(kycv3ViewModel); diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/RxUtils.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/RxUtils.java index 532b6d33..d8180610 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/RxUtils.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/RxUtils.java @@ -44,14 +44,27 @@ public class RxUtils { Geocoder geocoder; List
addresses; - geocoder = new Geocoder(activity, Locale.getDefault()); + geocoder = new Geocoder(activity, new Locale("en")); addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1); // Here 1 represent max location result to returned, by documents it recommended 1 to 5 String address = ""; - if (addresses.get(0).getAddressLine(0) != null) + if (addresses.get(0).getAddressLine(0) != null) { address = addresses.get(0).getAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex() - + address= address.replaceAll(",",""); + if(addresses.get(0).getCountryName()!=null&& address.contains(addresses.get(0).getCountryName())) { + Log.d("RXGPS", "Selected Country: "+addresses.get(0).getCountryName()); + address = address.replace(addresses.get(0).getCountryName(), ""); + } + if(addresses.get(0).getLocality()!=null&& address.contains(addresses.get(0).getLocality())) { + Log.d("RXGPS", "Selected city: "+addresses.get(0).getLocality()); + address = address.replace(addresses.get(0).getLocality(), ""); + } + if(addresses.get(0).getPostalCode()!=null&& address.contains(addresses.get(0).getPostalCode())) { + Log.d("RXGPS", "Selected postal Code: "+addresses.get(0).getPostalCode()); + address = address.replace(addresses.get(0).getPostalCode(), ""); + } + } return Observable.just(address); }).timeout(6000,TimeUnit.MILLISECONDS).onErrorResumeNext(Observable.error(new Throwable("Could not fetch location at the moment. Try again later."))); } else diff --git a/app/src/main/res/layout/fragment_kyc_customer_detail.xml b/app/src/main/res/layout/fragment_kyc_customer_detail.xml index ea69fa6d..2ab4d09b 100644 --- a/app/src/main/res/layout/fragment_kyc_customer_detail.xml +++ b/app/src/main/res/layout/fragment_kyc_customer_detail.xml @@ -53,6 +53,7 @@ android:id="@+id/ed_firstname" style="@style/editetxtsingleline" android:layout_width="match_parent" + android:inputType="text|textCapCharacters" android:layout_height="wrap_content" android:imeOptions="actionDone" app:maxLengthLimiter="100" />