Browse Source

Occupation post and get added in Existing Kyc Screen

new_design
Santosh Bhandary 4 years ago
parent
commit
d7e7dad3b0
  1. 3
      app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/gateway/ExistingExistingKYCV3Gateway.java
  2. 22
      app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/model/ExistingKYCRelatedDataDTO.java
  3. 19
      app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/model/ExistingPersonalInfoDTO.java
  4. 1
      app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/presenter/ExistingKYCV3PresenterInterface.java
  5. 22
      app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/presenter/ExistingKYCV3ViewModel.java
  6. 39
      app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/view/personal/ExistingCustomerDetailFragment.java
  7. 17
      app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/view/personal/ExistingCustomerDetailViewLiveData.java
  8. 1
      app/src/main/java/com/swifttech/remit/android/features/kyc/newCustomer/gateway/KYCV3Gateway.java
  9. 14
      app/src/main/res/layout/fragment_existing_kyc_customer_detail.xml
  10. 3
      app/src/main/res/values/strings.xml

3
app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/gateway/ExistingExistingKYCV3Gateway.java

@ -62,6 +62,7 @@ public class ExistingExistingKYCV3Gateway extends PrivilegedGateway implements E
if (existingPersonalInfoDTO != null) {
map.put("employeerName", createStringUploadValue(existingPersonalInfoDTO.getEmployeerName()));
map.put("occupation", createStringUploadValue(existingPersonalInfoDTO.getOccupation()));
map.put("sourceOfFund", createStringUploadValue(existingPersonalInfoDTO.getSourceOfFund()));
map.put("monthlyIncome", createStringUploadValue(existingPersonalInfoDTO.getMonthlyIncome()));
map.put("businessType", createStringUploadValue(existingPersonalInfoDTO.getBusinessType()));
@ -131,6 +132,7 @@ public class ExistingExistingKYCV3Gateway extends PrivilegedGateway implements E
existingKycRelatedDataDTO.setBusniessType(mockedDAta);
existingKycRelatedDataDTO.setIdType(mockedDAta);
existingKycRelatedDataDTO.setOccupationList(mockedDAta);
existingKycRelatedDataDTO.setSourceOfFund(mockedDAta);
existingKycRelatedDataDTO.setMonthlyIncome(mockedDAta);
existingKycRelatedDataDTO.setVisaStatusList(mockedDAta);
@ -140,6 +142,7 @@ public class ExistingExistingKYCV3Gateway extends PrivilegedGateway implements E
"1",
"John Doe",
"2",
"2",
"3",
"123134123",
"asdf@asd.com",

22
app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/model/ExistingKYCRelatedDataDTO.java

@ -9,6 +9,9 @@ public class ExistingKYCRelatedDataDTO {
@SerializedName("MonthlyIncome")
@Expose
private List<ExistingIDTextDTO> monthlyIncome = null;
@SerializedName("OccupationList")
@Expose
private List<ExistingIDTextDTO> occupationList = null;
@SerializedName("SourceOfFund")
@Expose
private List<ExistingIDTextDTO> sourceOfFund = null;
@ -42,6 +45,14 @@ public class ExistingKYCRelatedDataDTO {
this.monthlyIncome = monthlyIncome;
}
public List<ExistingIDTextDTO> getOccupationList() {
return occupationList;
}
public void setOccupationList(List<ExistingIDTextDTO> occupationList) {
this.occupationList = occupationList;
}
public List<ExistingIDTextDTO> getSourceOfFund() {
return sourceOfFund;
}
@ -50,6 +61,7 @@ public class ExistingKYCRelatedDataDTO {
this.sourceOfFund = sourceOfFund;
}
public List<ExistingIDTextDTO> getBusniessType() {
return busniessType;
}
@ -136,6 +148,16 @@ public class ExistingKYCRelatedDataDTO {
public ExistingIDTextDTO getOccupationFromId(String id) {
if (id == null || id.length() < 1)
return null;
for (ExistingIDTextDTO item : occupationList) {
if (id.equalsIgnoreCase(item.getId()))
return item;
}
return null;
}
public ExistingIDTextDTO getSourceOfFundFromId(String id) {
if (id == null || id.length() < 1)
return null;

19
app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/model/ExistingPersonalInfoDTO.java

@ -14,6 +14,10 @@ public class ExistingPersonalInfoDTO {
@Expose
private String employeerName;
@SerializedName("occupation")
@Expose
private String occupation;
@SerializedName("sourceOfFund")
@Expose
private String sourceOfFund;
@ -48,6 +52,7 @@ public class ExistingPersonalInfoDTO {
public ExistingPersonalInfoDTO(
String visaStatus,
String employeerName,
String occupation,
String sourceOfFund,
String monthlyIncome,
String mobile,
@ -58,6 +63,7 @@ public class ExistingPersonalInfoDTO {
String businessType) {
this.visaStatus = visaStatus;
this.employeerName = employeerName;
this.occupation = occupation;
this.sourceOfFund = sourceOfFund;
this.monthlyIncome = monthlyIncome;
this.mobile = mobile;
@ -68,6 +74,14 @@ public class ExistingPersonalInfoDTO {
this.businessType=businessType;
}
public String getOccupation() {
return occupation;
}
public void setOccupation(String occupation) {
this.occupation = occupation;
}
public String getEmployeerName() {
return employeerName;
}
@ -177,6 +191,7 @@ public class ExistingPersonalInfoDTO {
return new ExistingPersonalInfoDTO(
this.visaStatus,
this.employeerName,
this.occupation,
this.sourceOfFund,
this.monthlyIncome,
this.mobile,
@ -193,6 +208,7 @@ public class ExistingPersonalInfoDTO {
return new ExistingPersonalInfoDTO(
this.visaStatus,
Utils.formatToUpperCaseSafely(this.employeerName),
this.occupation,
this.sourceOfFund,
this.monthlyIncome,
Utils.formatToUpperCaseSafely(this.mobile),
@ -212,6 +228,9 @@ public class ExistingPersonalInfoDTO {
public boolean isSourceOfFundValid() {
return Utils.isStringNotNullOrEmpty(this.sourceOfFund);
}
public boolean isOccupationValid() {
return Utils.isStringNotNullOrEmpty(this.occupation);
}
public boolean isMonthlyIncomeValid() {
return Utils.isStringNotNullOrEmpty(this.monthlyIncome);

1
app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/presenter/ExistingKYCV3PresenterInterface.java

@ -22,6 +22,7 @@ public interface ExistingKYCV3PresenterInterface extends BasePresenterInterface
void getKycRelatedData();
List<ExistingIDTextDTO> getOccupationList();
List<ExistingIDTextDTO> getSourceOfFundList();
List<ExistingIDTextDTO> getMonthlyIncomeList();
List<ExistingIDTextDTO> getBusinessTypeList();

22
app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/presenter/ExistingKYCV3ViewModel.java

@ -116,6 +116,7 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC
private void bindCustomerDetailView(ExistingCustomerDetailViewLiveData.CustomerDetailViewBinding viewBindings) {
List<Observable<Boolean>> list = Arrays.asList(
viewBindings.getOccupationObservable().map(validator::validateOccupation),
viewBindings.getSourceOfFundObservable().map(validator::validateSourceOfFund),
viewBindings.getAddressObservable().map(validator::validateAddress),
viewBindings.getBusinessTypeObservable().map(validator::validateBusineesType),
@ -212,6 +213,7 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC
mobileNumber= mobileNumber.substring(3);
}
customerDetailLiveData.getEmployerNameLiveData().postValue(new FormInputStateDTO<>(true, null, existingPersonalInfoDTO.getEmployeerName()));
customerDetailLiveData.getOccupationsLiveData().postValue(new FormInputStateDTO<>(true, null, data.getOccupationFromId(existingPersonalInfoDTO.getOccupation())));
customerDetailLiveData.getSourceOfFundLiveData().postValue(new FormInputStateDTO<>(true, null, data.getSourceOfFundFromId(existingPersonalInfoDTO.getSourceOfFund())));
customerDetailLiveData.getMonthlyIncomeLiveData().postValue(new FormInputStateDTO<>(true, null, data.getMonthlyIncomeFromId(existingPersonalInfoDTO.getMonthlyIncome())));
customerDetailLiveData.getBusinessTypeLiveData().postValue(new FormInputStateDTO<>(true, null, data.getBusinessTypeFromId(existingPersonalInfoDTO.getBusinessType())));
@ -419,6 +421,11 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC
);
}
@Override
public List<ExistingIDTextDTO> getOccupationList() {
return validator.getExistingKycRelatedDataDTO().getOccupationList();
}
@Override
public List<ExistingIDTextDTO> getSourceOfFundList() {
@ -497,7 +504,7 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC
view.lazyLoadForms();
if (t.getData().areAnyPicturesAvailableFromServer())
view.showDocumentDetailForm();
/* onReceivingKycRelatedData(gateway.getMockedData());
/* onReceivingKycRelatedData(gateway.getMockedData());
view.lazyLoadForms();
if (true)
view.showDocumentDetailForm();*/
@ -552,6 +559,19 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC
return existingKycRelatedDataDTO.getFullFormPostData(userId);
}
boolean validateOccupation(ExistingIDTextDTO data) {
if (existingKycRelatedDataDTO.getPersonalInformation() == null)
existingKycRelatedDataDTO.setPersonalInformation(new ExistingPersonalInfoDTO());
existingKycRelatedDataDTO.getPersonalInformation().setOccupation(data.getId());
if (existingKycRelatedDataDTO.getPersonalInformation().isOccupationValid()) {
return true;
} else {
customerDetailLiveData.getOccupationsLiveData().setValue(new FormInputStateDTO<>(false, view.getContext().getString(R.string.invalidOccupation), null));
return false;
}
}
boolean validateSourceOfFund(ExistingIDTextDTO data) {
if (existingKycRelatedDataDTO.getPersonalInformation() == null)
existingKycRelatedDataDTO.setPersonalInformation(new ExistingPersonalInfoDTO());

39
app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/view/personal/ExistingCustomerDetailFragment.java

@ -57,6 +57,10 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis
@BindView(R.id.ed_employerName)
EditText ed_employerName;
@BindView(R.id.ed_occupation)
EditText ed_occupation;
@BindView(R.id.ed_sourceOfFund)
EditText ed_sourceOfFund;
@ -96,6 +100,7 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis
Button btnSubmit1;
private GenericTextListingDialog<ExistingIDTextDTO> occupationSelectionDialog;
private GenericTextListingDialog<ExistingIDTextDTO> sourceOfFundSelectionDialog;
private GenericTextListingDialog<ExistingIDTextDTO> monthlyIncomeSelectionDialog;
private GenericTextListingDialog<ExistingIDTextDTO> busineessTypeSelectionDialog;
@ -103,6 +108,7 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis
private GenericTextListingDialog<ExistingIDTextDTO> idTypeSelectionDialog;
private GenericTextListingDialog<ExistingIDTextDTO> visaStatusSelectionDialog;
private PublishSubject<ExistingIDTextDTO> occupationSelectSubject;
private PublishSubject<ExistingIDTextDTO> sourceOfFundSelectSubject;
private PublishSubject<ExistingIDTextDTO> monthlyIncomeSelectSubject;
private PublishSubject<ExistingIDTextDTO> businessTypeSelectSubject;
@ -130,6 +136,7 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis
private void init() {
occupationSelectSubject = PublishSubject.create();
sourceOfFundSelectSubject = PublishSubject.create();
monthlyIncomeSelectSubject = PublishSubject.create();
businessTypeSelectSubject = PublishSubject.create();
@ -140,6 +147,7 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis
customerDetailViewBinding = new ExistingCustomerDetailViewLiveData.CustomerDetailViewBinding(
RxTextView.textChanges(ed_employerName).skipInitialValue(),
occupationSelectSubject,
sourceOfFundSelectSubject,
monthlyIncomeSelectSubject,
RxTextView.textChanges(ed_mobileNumber).skipInitialValue(),
@ -164,13 +172,22 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis
existingCustomerDetailViewLiveData.getMonthlyIncomeLiveData().observe(getViewLifecycleOwner(), this::onMonthlyIncomeSelected);
existingCustomerDetailViewLiveData.getEmployerNameLiveData().observe(getViewLifecycleOwner(), this::onEmployerNameSelected);
existingCustomerDetailViewLiveData.getSourceOfFundLiveData().observe(getViewLifecycleOwner(), this::onSourceOfFundSelected);
existingCustomerDetailViewLiveData.getOccupationsLiveData().observe(getViewLifecycleOwner(), this::onOccupationSelected);
existingCustomerDetailViewLiveData.getVisaStatusLiveData().observe(getViewLifecycleOwner(), this::onVisaStatusSelected);
existingCustomerDetailViewLiveData.getAllFieldsValidLiveData().observe(getViewLifecycleOwner(), areAllFieldsValid -> btnSubmit1.setEnabled(areAllFieldsValid));
}
private void onSourceOfFundSelected(FormInputStateDTO<ExistingIDTextDTO> data) {
private void onOccupationSelected(FormInputStateDTO<ExistingIDTextDTO> data) {
if (data.isValid()) {
if (data.hasData()) {
ed_occupation.setText(data.getData().getText());
occupationSelectSubject.onNext(data.getData());
}
}
}
private void onSourceOfFundSelected(FormInputStateDTO<ExistingIDTextDTO> data) {
if (data.isValid()) {
if (data.hasData()) {
ed_sourceOfFund.setText(data.getData().getText());
@ -406,6 +423,26 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis
if (!sourceOfFundSelectionDialog.isAdded())
sourceOfFundSelectionDialog.show(getActivity().getSupportFragmentManager(), "SOURCEOFFUNDTYPECHOOSER");
}
@OnClick(R.id.ed_occupation)
public void promptOccupation() {
hideKeyBoard();
if (occupationSelectionDialog == null)
occupationSelectionDialog = new GenericTextListingDialog<>();
occupationSelectionDialog.setData(kycv3ViewModel.getOccupationList());
occupationSelectionDialog.disableSearch(true);
occupationSelectionDialog.setListener(occupation ->
{
occupationSelectionDialog.dismiss();
ed_occupation.setText(occupation.toString());
occupationSelectSubject.onNext(occupation);
});
occupationSelectionDialog.setHintAndTitle(getString(R.string.searchOccupation), getString(R.string.selectOccupation), getString(R.string.no_result_found_text));
if (!occupationSelectionDialog.isAdded())
occupationSelectionDialog.show(getActivity().getSupportFragmentManager(), "OCCUPATIONCHOOSER");
}
@OnClick(R.id.ed_monthlyIncome)
public void promptMonthlyIncome() {

17
app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/view/personal/ExistingCustomerDetailViewLiveData.java

@ -11,6 +11,7 @@ import io.reactivex.Observable;
public class ExistingCustomerDetailViewLiveData {
private MutableLiveData<FormInputStateDTO<String>> employerNameLiveData;
private MutableLiveData<FormInputStateDTO<ExistingIDTextDTO>> occupationsLiveData;
private MutableLiveData<FormInputStateDTO<ExistingIDTextDTO>> sourceOfFundLiveData;
private MutableLiveData<FormInputStateDTO<ExistingIDTextDTO>> monthlyIncomeLiveData;
private MutableLiveData<FormInputStateDTO<String>> mobileNumberLiveData;
@ -24,6 +25,7 @@ public class ExistingCustomerDetailViewLiveData {
public ExistingCustomerDetailViewLiveData() {
employerNameLiveData = new MutableLiveData<>();
sourceOfFundLiveData = new MutableLiveData<>();
occupationsLiveData = new MutableLiveData<>();
monthlyIncomeLiveData = new MutableLiveData<>();
mobileNumberLiveData = new MutableLiveData<>();
businessTypeLiveData = new MutableLiveData<>();
@ -34,6 +36,14 @@ public class ExistingCustomerDetailViewLiveData {
allFieldsValid = new MutableLiveData<>();
}
public MutableLiveData<FormInputStateDTO<ExistingIDTextDTO>> getOccupationsLiveData() {
return occupationsLiveData;
}
public void setOccupationsLiveData(MutableLiveData<FormInputStateDTO<ExistingIDTextDTO>> occupationsLiveData) {
this.occupationsLiveData = occupationsLiveData;
}
public MutableLiveData<FormInputStateDTO<String>> getEmployerNameLiveData() {
return employerNameLiveData;
}
@ -125,6 +135,7 @@ public class ExistingCustomerDetailViewLiveData {
public static class CustomerDetailViewBinding {
private Observable<CharSequence> employerNameObservable;
private Observable<ExistingIDTextDTO> occupationObservable;
private Observable<ExistingIDTextDTO> sourceOfFundObservable;
private Observable<ExistingIDTextDTO> monthlyIncomeObservable;
private Observable<CharSequence> mobileNumberObservable;
@ -136,6 +147,7 @@ public class ExistingCustomerDetailViewLiveData {
public CustomerDetailViewBinding(
Observable<CharSequence> employerNameObservable,
Observable<ExistingIDTextDTO> occupationObservable,
Observable<ExistingIDTextDTO> sourceOfFundObservable,
Observable<ExistingIDTextDTO> monthlyIncomeObservable,
Observable<CharSequence> mobileNumberObservable,
@ -149,6 +161,7 @@ public class ExistingCustomerDetailViewLiveData {
this.employerNameObservable = employerNameObservable;
this.sourceOfFundObservable = sourceOfFundObservable;
this.occupationObservable = occupationObservable;
this.monthlyIncomeObservable = monthlyIncomeObservable;
this.mobileNumberObservable = mobileNumberObservable;
this.businessTypeObservable = businessTypeObservable;
@ -193,5 +206,9 @@ public class ExistingCustomerDetailViewLiveData {
public Observable<ExistingIDTextDTO> getVisaStatusObservable() {
return visaStatusObservable;
}
public Observable<ExistingIDTextDTO> getOccupationObservable() {
return occupationObservable;
}
}
}

1
app/src/main/java/com/swifttech/remit/android/features/kyc/newCustomer/gateway/KYCV3Gateway.java

@ -96,7 +96,6 @@ public class KYCV3Gateway extends PrivilegedGateway implements KYCV3GatewayInter
createImageUploadFieldFromFile("additionalId", additionalIdImageFile),
createImageUploadFieldFromFile("additionalIdBack", additionalIdBackImageFile)
);
}

14
app/src/main/res/layout/fragment_existing_kyc_customer_detail.xml

@ -57,6 +57,20 @@
</com.swifttech.remit.android.common.view.MTextInputLayout>
<com.swifttech.remit.android.common.view.MTextInputLayout
android:id="@+id/occupationSelectionWrapper"
android:hint="@string/select_occupation_text"
style="@style/MTextInputLayoutFormDropDown"
app:endIconMode="dropdown_menu"
app:errorEnabled="true">
<com.swifttech.remit.android.common.view.MAutoCompleteTextView
android:id="@+id/ed_occupation"
style="@style/MAutoCompleteDropDown"
android:imeOptions="actionDone"
/>
</com.swifttech.remit.android.common.view.MTextInputLayout>
<com.swifttech.remit.android.common.view.MTextInputLayout
android:id="@+id/sourceOfFundSelectionWrapper"
android:hint="@string/select_source_of_fund_text"

3
app/src/main/res/values/strings.xml

@ -812,6 +812,9 @@ All the configurations are done from backend web application system which allows
<string name="invalidAdditionalIdImage">Invalid Additional ID Image</string>
<string name="invalidAdditionalIdFrontImage">Invalid Additional ID Front Image</string>
<string name="invalidAdditionalIdBackImage">Invalid Additional ID Back Image</string>
<string name="searchOccupation">\"Search Occupation \"</string>
<string name="selectOccupation">Select Occupation</string>
<string name="invalidOccupation">Invalid Occupation</string>
</resources>
Loading…
Cancel
Save