|
|
@@ -8,9 +8,12 @@ import java.util.ArrayList;
|
|
|
import io.reactivex.disposables.Disposable;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.PolicyBean;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.PolicyListResultBean;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.PolicyNoRequestBean;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.PolicyResultBean;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.RequestBean;
|
|
|
import kr.co.zumo.app.lifeplus.model.Model;
|
|
|
import kr.co.zumo.app.lifeplus.model.module.APIMemberPolicyLoadModule;
|
|
|
+import kr.co.zumo.app.lifeplus.model.module.APIPolicyDetailModule;
|
|
|
import kr.co.zumo.app.lifeplus.model.module.IAPIModuleListener;
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
|
|
|
@@ -70,19 +73,45 @@ public class SettingTermsModel extends Model {
|
|
|
@Override
|
|
|
public void onApiSuccess(PolicyListResultBean resultBean) {
|
|
|
agreeItems = resultBean.getData();
|
|
|
- onResult(new Event.Builder(Event.RESULT).integer(Event.POLICY_REQUEST).build());
|
|
|
+ onResult(new Event.Builder(Event.RESULT).index(Event.POLICY_REQUEST).build());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onApiReason(PolicyListResultBean resultBean) {
|
|
|
- onResult(new Event.Builder(Event.ERROR).integer(Event.POLICY_REQUEST).string(resultBean.getReturnMessage()).build());
|
|
|
+ onResult(new Event.Builder(Event.ERROR).index(Event.POLICY_REQUEST).string(resultBean.getReturnMessage()).build());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onApiError(String errorMessage) {
|
|
|
- onResult(new Event.Builder(Event.ERROR).integer(Event.POLICY_REQUEST).string(errorMessage).build());
|
|
|
+ onResult(new Event.Builder(Event.ERROR).index(Event.POLICY_REQUEST).string(errorMessage).build());
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ public void loadTerms(int index) {
|
|
|
+ disposable = new APIPolicyDetailModule().call(new PolicyNoRequestBean(agreeItems.get(index).getPolicyNumber()), new IAPIModuleListener<PolicyResultBean>() {
|
|
|
+ @Override
|
|
|
+ public void onApiSuccess(PolicyResultBean resultBean) {
|
|
|
+ if (null != resultBean.getData()) {
|
|
|
+ onResult(new Event.Builder(Event.RESULT).index(Event.POLICY_DETAIL).string(resultBean.getData().getContents()).build());
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ onResult(new Event.Builder(Event.ERROR).index(Event.POLICY_DETAIL).string("loading error...").build());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onApiReason(PolicyResultBean resultBean) {
|
|
|
+ onResult(new Event.Builder(Event.ERROR).index(Event.POLICY_DETAIL).string(resultBean.getReturnMessage()).build());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onApiError(String errorMessage) {
|
|
|
+ onResult(new Event.Builder(Event.ERROR).index(Event.POLICY_DETAIL).string(errorMessage).build());
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|