Browse Source

Before mapping drop down values

master
Preyea Regmi 5 years ago
parent
commit
ff5050b948
  1. 2
      app/src/main/assets/mockeddynamicvalidationfullresponse.json
  2. 7
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/gateway/recipientaddeditV3/RecipientAddV3Gateway.java
  3. 3
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/gateway/recipientaddeditV3/RecipientAddV3GatewayInterface.java
  4. 24
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientaddeditV3/dynamicvalidation/DropDownDTO.java
  5. 47
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientaddeditV3/dynamicvalidation/DynamicValidationModel.java
  6. 32
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientaddeditV3/dynamicvalidation/ValidationRuleModel.java
  7. 8
      app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/add/RecipientAddV3Presenter.java

2
app/src/main/assets/mockeddynamicvalidationfullresponse.json

@ -32,7 +32,7 @@
"Field": "Full Name", "Field": "Full Name",
"FieldRequired": "M", "FieldRequired": "M",
"MinLength": 1, "MinLength": 1,
"MaxLength": 50,
"MaxLength": 10,
"Keyboard": "ANS" "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.base.PrivilegedGateway;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.countryservice.CountryServiceModel; import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.countryservice.CountryServiceModel;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation.DynamicValidationModel;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation.ValidationRuleModel; import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation.ValidationRuleModel;
import com.gmeremit.online.gmeremittance_native.utils.https.HttpClientV2; import com.gmeremit.online.gmeremittance_native.utils.https.HttpClientV2;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
@ -36,4 +37,10 @@ public class RecipientAddV3Gateway extends PrivilegedGateway implements Recipien
String mockedCountryList =loadJSONFromAsset(context, "mockeddynamicvalidationsinglecase.json"); String mockedCountryList =loadJSONFromAsset(context, "mockeddynamicvalidationsinglecase.json");
return HttpClientV2.getDeserializer().fromJson(mockedCountryList, TypeToken.getParameterized(List.class, ValidationRuleModel.class).getType()); return HttpClientV2.getDeserializer().fromJson(mockedCountryList, TypeToken.getParameterized(List.class, ValidationRuleModel.class).getType());
} }
@Override
public DynamicValidationModel getMockedAllValidationRuleList(Context context) {
String mockedCountryList =loadJSONFromAsset(context, "mockeddynamicvalidationfullresponse.json");
return HttpClientV2.getDeserializer().fromJson(mockedCountryList, TypeToken.getParameterized( DynamicValidationModel.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.base.PrivilegedGatewayInterface;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.countryservice.CountryServiceModel; import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.countryservice.CountryServiceModel;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation.DynamicValidationModel;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation.ValidationRuleModel; import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation.ValidationRuleModel;
import java.util.List; import java.util.List;
@ -20,4 +21,6 @@ public interface RecipientAddV3GatewayInterface extends PrivilegedGatewayInterfa
List<CountryServiceModel> getMockedCountryServiceDetail(Context context); List<CountryServiceModel> getMockedCountryServiceDetail(Context context);
List<ValidationRuleModel> getMockedValidationRuleList(Context context); List<ValidationRuleModel> getMockedValidationRuleList(Context context);
DynamicValidationModel getMockedAllValidationRuleList(Context context);
} }

24
app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientaddeditV3/dynamicvalidation/DropDownDTO.java

@ -1,8 +1,30 @@
package com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation; package com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation;
public class DropDownDTO {
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class DropDownDTO {
@SerializedName("id")
@Expose
String id; String id;
@SerializedName("text")
@Expose
String text; String text;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
} }

47
app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientaddeditV3/dynamicvalidation/DynamicValidationModel.java

@ -32,4 +32,51 @@ public class DynamicValidationModel {
@Expose @Expose
List<PayoutProvincesModel> proviences; List<PayoutProvincesModel> proviences;
public List<ValidationRuleModel> getValidationRuleList() {
return validationRuleList;
}
public void setValidationRuleList(List<ValidationRuleModel> validationRuleList) {
this.validationRuleList = validationRuleList;
}
public List<DropDownDTO> getTransferReasonList() {
return transferReasonList;
}
public void setTransferReasonList(List<DropDownDTO> transferReasonList) {
this.transferReasonList = transferReasonList;
}
public List<DropDownDTO> getRelationsList() {
return relationsList;
}
public void setRelationsList(List<DropDownDTO> relationsList) {
this.relationsList = relationsList;
}
public List<DropDownDTO> getReceiverIdTypeList() {
return receiverIdTypeList;
}
public void setReceiverIdTypeList(List<DropDownDTO> receiverIdTypeList) {
this.receiverIdTypeList = receiverIdTypeList;
}
public List<PaymentBankModel> getPaymentBankList() {
return paymentBankList;
}
public void setPaymentBankList(List<PaymentBankModel> paymentBankList) {
this.paymentBankList = paymentBankList;
}
public List<PayoutProvincesModel> getProviences() {
return proviences;
}
public void setProviences(List<PayoutProvincesModel> proviences) {
this.proviences = proviences;
}
} }

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

@ -17,10 +17,10 @@ public class ValidationRuleModel {
private String fieldRequired; private String fieldRequired;
@SerializedName("MaxLength") @SerializedName("MaxLength")
@Expose @Expose
private String maxFieldLength;
private int maxFieldLength;
@SerializedName("MinLength") @SerializedName("MinLength")
@Expose @Expose
private String minFieldLength;
private int minFieldLength;
@SerializedName("Keyboard") @SerializedName("Keyboard")
@Expose @Expose
private String keyboardType; private String keyboardType;
@ -28,7 +28,7 @@ public class ValidationRuleModel {
private boolean hasValidValue; private boolean hasValidValue;
public ValidationRuleModel( String field, String fieldRequired, String maxFieldLength, String minFieldLength, String keyboardType) {
public ValidationRuleModel( String field, String fieldRequired, int maxFieldLength, int minFieldLength, String keyboardType) {
this.field = field; this.field = field;
this.fieldRequired = fieldRequired; this.fieldRequired = fieldRequired;
this.maxFieldLength = maxFieldLength; this.maxFieldLength = maxFieldLength;
@ -69,35 +69,37 @@ public class ValidationRuleModel {
} }
public String getMaxFieldLength() {
public int getMaxFieldLength() {
return maxFieldLength; return maxFieldLength;
} }
public Integer getMaxFieldLengthInt() { public Integer getMaxFieldLengthInt() {
if(maxFieldLength!=null&&maxFieldLength.length()>0)
return Integer.parseInt(maxFieldLength);
else
return 50;
// if(maxFieldLength!=null&&maxFieldLength.length()>0)
// return Integer.parseInt(maxFieldLength);
// else
// return 50;
return getMaxFieldLength();
} }
public void setMaxFieldLength(String maxFieldLength) {
public void setMaxFieldLength(int maxFieldLength) {
this.maxFieldLength = maxFieldLength; this.maxFieldLength = maxFieldLength;
} }
public String getMinFieldLength() {
public int getMinFieldLength() {
return minFieldLength; return minFieldLength;
} }
public Integer getMinFieldLengthInt() { public Integer getMinFieldLengthInt() {
if(minFieldLength!=null&&minFieldLength.length()>0)
return Integer.parseInt(minFieldLength);
else
return 0;
// if(minFieldLength!=null&&minFieldLength.length()>0)
// return Integer.parseInt(minFieldLength);
// else
// return 0;
return getMinFieldLength();
} }
public void setMinFieldLength(String minFieldLength) {
public void setMinFieldLength(int minFieldLength) {
this.minFieldLength = minFieldLength; this.minFieldLength = minFieldLength;
} }

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

@ -7,6 +7,7 @@ import com.gmeremit.online.gmeremittance_native.customwidgets.exchangecountrylis
import com.gmeremit.online.gmeremittance_native.recipientV3.gateway.recipientaddeditV3.RecipientAddV3GatewayInterface; import com.gmeremit.online.gmeremittance_native.recipientV3.gateway.recipientaddeditV3.RecipientAddV3GatewayInterface;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.countryservice.CountryServiceModel; import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.countryservice.CountryServiceModel;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.countryservice.ServiceTypeModel; import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.countryservice.ServiceTypeModel;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation.DynamicValidationModel;
import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation.ValidationRuleModel; import com.gmeremit.online.gmeremittance_native.recipientV3.model.recipientaddeditV3.dynamicvalidation.ValidationRuleModel;
import com.gmeremit.online.gmeremittance_native.recipientV3.presenter.recipientaddeditV3.RecipientAddV3ContractInterface; import com.gmeremit.online.gmeremittance_native.recipientV3.presenter.recipientaddeditV3.RecipientAddV3ContractInterface;
import com.gmeremit.online.gmeremittance_native.recipientV3.presenter.recipientaddeditV3.RecipientDetailValidatorV3; import com.gmeremit.online.gmeremittance_native.recipientV3.presenter.recipientaddeditV3.RecipientDetailValidatorV3;
@ -81,8 +82,11 @@ public class RecipientAddV3Presenter extends BasePresenter implements RecipientA
} }
private void mockDynamicValidaitonList() private void mockDynamicValidaitonList()
{ {
List<ValidationRuleModel> validationRuleList=this.gateway.getMockedValidationRuleList(view.getContext());
applyValidationRulesToView(validationRuleList);
// List<ValidationRuleModel> validationRuleList=this.gateway.getMockedValidationRuleList(view.getContext());
// applyValidationRulesToView(validationRuleList);
DynamicValidationModel validationModel=this.gateway.getMockedAllValidationRuleList(view.getContext());
applyValidationRulesToView(validationModel.getValidationRuleList());
} }

Loading…
Cancel
Save