Browse Source

Add recipient flow sperated from edit recipient flow

master
Preyea Regmi 5 years ago
parent
commit
ebd3cd0405
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 149
      app/src/main/assets/mockeddynamicvalidation.json
  3. 7
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/gateway/recipientaddeditV3/RecipientAddV3Gateway.java
  4. 3
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/gateway/recipientaddeditV3/RecipientAddV3GatewayInterface.java
  5. 68
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientaddeditV3/dynamicvalidation/ValidationRuleModel.java
  6. 2
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientDetailValidaitorV3.java
  7. 13
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/add/RecipientAddV3Presenter.java

BIN
.idea/caches/build_file_checksums.ser

149
app/src/main/assets/mockeddynamicvalidation.json

@ -0,0 +1,149 @@
[
{
"Field": "Local Name",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "First Name in Local",
"FieldRequired": "H",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Middle Name in Local",
"FieldRequired": "H",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Last Name in Local",
"FieldRequired": "H",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Full Name",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "First Name",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Middle Name",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Last Name",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Native Country",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Province",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "State",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Address",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "City",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Id Type",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "ID Number",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Mobile Number",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Realation Group",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Transfer Reason",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Bannk Name",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Branch Name",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
},
{
"Field": "Account No.",
"FieldRequired": "M",
"MinLength": "1",
"MaxLength": "50",
"Keyboard": "ANS"
}
]

7
app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/gateway/recipientaddeditV3/RecipientAddV3Gateway.java

@ -4,6 +4,7 @@ import android.content.Context;
import com.gmeremit.online.gmeremittance_native.base.PrivilegedGateway;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.countryservice.CountryServiceModel;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation.ValidationRuleModel;
import com.gmeremit.online.gmeremittance_native.utils.https.HttpClientV2;
import com.google.gson.reflect.TypeToken;
@ -28,4 +29,10 @@ public class RecipientAddV3Gateway extends PrivilegedGateway implements Recipien
String mockedCountryList =loadJSONFromAsset(context, "mockedcountryservice.json");
return HttpClientV2.getDeserializer().fromJson(mockedCountryList, TypeToken.getParameterized(List.class, CountryServiceModel.class).getType());
}
@Override
public List<ValidationRuleModel> getMockedValidationRuleList(Context context) {
String mockedCountryList =loadJSONFromAsset(context, "mockeddynamicvalidation.json");
return HttpClientV2.getDeserializer().fromJson(mockedCountryList, TypeToken.getParameterized(List.class, ValidationRuleModel.class).getType());
}
}

3
app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/gateway/recipientaddeditV3/RecipientAddV3GatewayInterface.java

@ -4,6 +4,7 @@ import android.content.Context;
import com.gmeremit.online.gmeremittance_native.base.PrivilegedGatewayInterface;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.countryservice.CountryServiceModel;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation.ValidationRuleModel;
import java.util.List;
@ -17,4 +18,6 @@ public interface RecipientAddV3GatewayInterface extends PrivilegedGatewayInterfa
Observable<ResponseBody> getCountryServiceDetail(String auth);
List<CountryServiceModel> getMockedCountryServiceDetail(Context context);
List<ValidationRuleModel> getMockedValidationRuleList(Context context);
}

68
app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientaddeditV3/dynamicvalidation/ValidationRuleModel.java

@ -5,45 +5,33 @@ import com.google.gson.annotations.SerializedName;
public class ValidationRuleModel {
@SerializedName("Field Id")
@Expose
private Integer filedId;
@SerializedName("Field")
@Expose
private String field;
@SerializedName("FieldRequired")
@Expose
private Boolean fieldRequired;
private String fieldRequired;
@SerializedName("MaxLength")
@Expose
private Integer maxFieldLength;
private String maxFieldLength;
@SerializedName("MinLength")
@Expose
private Integer minFieldLength;
private String minFieldLength;
@SerializedName("Keyboard")
@Expose
private String keyboardType;
@SerializedName("LocalKeyboardAllow")
@Expose
private Boolean localKeyboardAllow;
public ValidationRuleModel(Integer filedId, String field, Boolean fieldRequired, Integer maxFieldLength, Integer minFieldLength, String keyboardType, Boolean localKeyboardAllow) {
this.filedId = filedId;
public ValidationRuleModel( String field, String fieldRequired, String maxFieldLength, String minFieldLength, String keyboardType) {
this.field = field;
this.fieldRequired = fieldRequired;
this.maxFieldLength = maxFieldLength;
this.minFieldLength = minFieldLength;
this.keyboardType = keyboardType;
this.localKeyboardAllow = localKeyboardAllow;
}
public Integer getFiledId() {
return filedId;
}
public void setFiledId(Integer filedId) {
this.filedId = filedId;
}
public String getField() {
return field;
@ -54,26 +42,47 @@ public class ValidationRuleModel {
}
public Boolean isFieldRequired() {
return fieldRequired;
return "M".equalsIgnoreCase(fieldRequired);
}
public void setFieldRequired(Boolean fieldRequired) {
public void setFieldRequired(String fieldRequired) {
this.fieldRequired = fieldRequired;
}
public Integer getMaxFieldLength() {
public String getFieldRequired() {
return this.fieldRequired;
}
public String getMaxFieldLength() {
return maxFieldLength;
}
public void setMaxFieldLength(Integer maxFieldLength) {
public Integer getMaxFieldLengthInt() {
if(maxFieldLength!=null&&maxFieldLength.length()>0)
return Integer.parseInt(maxFieldLength);
else
return 50;
}
public void setMaxFieldLength(String maxFieldLength) {
this.maxFieldLength = maxFieldLength;
}
public Integer getMinFieldLength() {
public String getMinFieldLength() {
return minFieldLength;
}
public void setMinFieldLength(Integer minFieldLength) {
public Integer getMinFieldLengthInt() {
if(minFieldLength!=null&&minFieldLength.length()>0)
return Integer.parseInt(minFieldLength);
else
return 0;
}
public void setMinFieldLength(String minFieldLength) {
this.minFieldLength = minFieldLength;
}
@ -85,13 +94,6 @@ public class ValidationRuleModel {
this.keyboardType = keyboardType;
}
public Boolean getLocalKeyboardAllow() {
return localKeyboardAllow;
}
public void setLocalKeyboardAllow(Boolean localKeyboardAllow) {
this.localKeyboardAllow = localKeyboardAllow;
}
public String getFieldIsRequiredErrorMessage() {
return "";
@ -121,7 +123,7 @@ public class ValidationRuleModel {
else {
String result = validateMinLengthAndReturnErrorMessageOnFail(value);
if (result == null) {
if (value.length() <= maxFieldLength)
if (value.length() <= getMaxFieldLengthInt())
return null;
else
return getFieldLengthIsGreaterThanUpperBoundDefinedErrorMessage();
@ -134,7 +136,7 @@ public class ValidationRuleModel {
}
private String validateMinLengthAndReturnErrorMessageOnFail(String value) {
if (value.length() > minFieldLength)
if (value.length() > getMinFieldLengthInt())
return null;
else
return getFieldLengthIsLessThanLowerBoundDefinedErrorMessage();

2
app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientDetailValidaitorV3.java

@ -36,7 +36,7 @@ public class RecipientDetailValidaitorV3 {
case FIELD_FULL_NAME:
view.updateValueToWidgetFullName(recipientInfo.getName());
view.updateValidationRuleToWidgetFullName(rule.isFieldRequired(), true, 50);
view.updateValidationRuleToWidgetFullName(rule.isFieldRequired(), rule.getKeyboardType().equalsIgnoreCase("ANS"), rule.getMaxFieldLengthInt());
validationRuleModelMap.put(FIELD_FULL_NAME,rule);
break;
}

13
app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/add/RecipientAddV3Presenter.java

@ -77,16 +77,16 @@ public class RecipientAddV3Presenter extends BasePresenter implements RecipientA
updateViewOnGettingCountryServiceList();
}
private void mockDynamic()
private void mockDynamicValidaitonList()
{
// List<CountryServiceModel> countryServiceModels=this.gateway.getMockedDynamicValidation(view.getContext());
// persistAvailableCountryServiceList(countryServiceModels);
// updateViewOnGettingCountryServiceList();
List<ValidationRuleModel> validationRuleList=this.gateway.getMockedValidationRuleList(view.getContext());
applyValidationRulesToView(validationRuleList);
}
private void getDynamicValidationAndDropDownList() {
compositeDisposable.add(
this.gateway.getCountryServiceDetail(gateway.getAuth())
@ -133,7 +133,7 @@ public class RecipientAddV3Presenter extends BasePresenter implements RecipientA
}
/**
* 3 .OnCountryServiceSelected erase existing data and update corresponding country data and
* 3. OnCountryServiceSelected erase existing data and update corresponding country data and
* show service selection view and hide other views along clearing view data
* @param selectedCountry
*/
@ -142,7 +142,9 @@ public class RecipientAddV3Presenter extends BasePresenter implements RecipientA
this.selectedCountry=selectedCountry;
validator.getRecipientDetail().updateSelectedCountryAndClearOtherData(selectedCountry);
view.updateValueToWidgetSelectedCountry(selectedCountry.getCountryName());
view.updateValueToWidgetSelectedPaymentMethod(null);
view.updateValidationRuleToWidgetPaymentMethodSelection(true);
}
@ -160,6 +162,7 @@ public class RecipientAddV3Presenter extends BasePresenter implements RecipientA
//TODO Right now mock
//getDynamicValidationAndDropDownList();
mockDynamicValidaitonList();
}

Loading…
Cancel
Save