Procházet zdrojové kódy

[가입][New] 새 API 적용
- 가입 완료 안됨

hyodong.min před 7 roky
rodič
revize
a485f73613

+ 12 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/AuthConfirmRequestBean.java

@@ -20,9 +20,11 @@ public class AuthConfirmRequestBean extends RequestBean {
   ""auth_no"" : 인증번호(string) ,
   ""phone_no"" :  폰번호(string) 인증서버 연결 이전까지 테스트용
    */
-  @SerializedName("auth_no")
+  @SerializedName("authNo")
   private String authorizationNumber;
-  @SerializedName("phone_no")
+  @SerializedName("devPrno")
+  private String deviceUuid;
+  @SerializedName("phNo")
   private String phoneNumber;
 
   public String getAuthorizationNumber() {
@@ -40,4 +42,12 @@ public class AuthConfirmRequestBean extends RequestBean {
   public void setPhoneNumber(String phoneNumber) {
     this.phoneNumber = phoneNumber;
   }
+
+  public String getDeviceUuid() {
+    return deviceUuid;
+  }
+
+  public void setDeviceUuid(String deviceUuid) {
+    this.deviceUuid = deviceUuid;
+  }
 }

+ 4 - 12
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/AuthNumberRequestBean.java

@@ -16,28 +16,20 @@ import com.google.gson.annotations.SerializedName;
  * @since 2018. 9. 27.
  */
 public class AuthNumberRequestBean extends RequestBean {
-  /*
-  "name" :             이름(string) ,
-   "gender" :           성별(string) ,
-   "nationality" :      내외국인(bool)  ,
-   "phone_no" :         전화번호(string) ,
-   "birthdate" :        생년월일(string) ,
-   "device_no" :        기기번호(string) ,
-   "tele_company" :     통신사(string)
-   */
+
   @SerializedName("name")
   private String name;
   @SerializedName("gender")
   private String gender;
   @SerializedName("nationality")
   private String nationality;
-  @SerializedName("phone_no")
+  @SerializedName("hpNo")
   private String phoneNumber;
   @SerializedName("birthdate")
   private String birthDate;
-  @SerializedName("device_no")
+  @SerializedName("devPrno")
   private String deviceUuid;
-  @SerializedName("tele_company")
+  @SerializedName("corpDvsn")
   private String mobileCompany;
 
   public String getName() {

+ 4 - 4
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/PolicyConfirmRequestBean.java

@@ -19,21 +19,21 @@ import java.util.ArrayList;
  */
 public class PolicyConfirmRequestBean extends RequestBean {
   @SerializedName("policyList")
-  private ArrayList<MemberPolicyRequestBean> policyList;
+  private ArrayList<PolicyBean> policyList;
 
   public PolicyConfirmRequestBean() {
     policyList = new ArrayList<>();
   }
 
-  public void addBean(MemberPolicyRequestBean bean) {
+  public void addBean(PolicyBean bean) {
     policyList.add(bean);
   }
 
-  public ArrayList<MemberPolicyRequestBean> getPolicyList() {
+  public ArrayList<PolicyBean> getPolicyList() {
     return policyList;
   }
 
-  public void setPolicyList(ArrayList<MemberPolicyRequestBean> policyList) {
+  public void setPolicyList(ArrayList<PolicyBean> policyList) {
     this.policyList = policyList;
   }
 }

+ 22 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/model/module/APIPolicyConfirmModule.java

@@ -3,8 +3,14 @@
  */
 package kr.co.zumo.app.lifeplus.model.module;
 
+import io.reactivex.Observable;
+import io.reactivex.ObservableSource;
 import io.reactivex.Single;
+import io.reactivex.functions.Function;
+import io.reactivex.schedulers.Schedulers;
 import kr.co.zumo.app.lifeplus.bean.api.LifeplusAPIBean;
+import kr.co.zumo.app.lifeplus.bean.api.MemberPolicyRequestBean;
+import kr.co.zumo.app.lifeplus.bean.api.PolicyBean;
 import kr.co.zumo.app.lifeplus.bean.api.PolicyConfirmRequestBean;
 import kr.co.zumo.app.lifeplus.network.api.LifeplusAPIRepository;
 
@@ -22,6 +28,21 @@ public class APIPolicyConfirmModule extends APIModule<PolicyConfirmRequestBean,
 
   @Override
   protected Single<LifeplusAPIBean> getAPI(PolicyConfirmRequestBean requestBean) {
-    return new LifeplusAPIRepository().confirmPolicy(requestBean);
+    return Observable.fromIterable(requestBean.getPolicyList())   // 배열에서 가져옴
+      .concatMap((Function<PolicyBean, ObservableSource<LifeplusAPIBean>>) policyBean -> {  // 개별 API 를 호출한다.
+        MemberPolicyRequestBean policyRequestBean = new MemberPolicyRequestBean(policyBean.getPolicyNumber(), policyBean.getChecked());
+        return new LifeplusAPIRepository().setMemberPolicyAgree(policyRequestBean).subscribeOn(Schedulers.io()).toObservable();
+      })
+      .toList()   // 결과를 배열로.
+      .map(lifeplusAPIBeans -> {    // 에러가 없으면 성공.
+        int result = LifeplusAPIBean.RETURN_SUCCESS;
+        for (LifeplusAPIBean lifeplusAPIBean : lifeplusAPIBeans) {
+          if (lifeplusAPIBean.isSuccess() == false) {
+            result = LifeplusAPIBean.RETURN_PARAMETER_ERROR;
+            break;
+          }
+        }
+        return new LifeplusAPIBean(result, result == LifeplusAPIBean.RETURN_SUCCESS ? "" : "하나 이상 에러 있음.");
+      });
   }
 }

+ 2 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/network/api/LifeplusAPI.java

@@ -68,10 +68,10 @@ public interface LifeplusAPI {
   /***********************************
    * 가입
    ***********************************/
-  @POST("api/v1/mobileAuth/requestMobileAuth.plus")
+  @POST("mapi/mobileauth/reqmobileauth.plus")
   Single<LifeplusAPIBean> requestMobileAuth(@Body AuthNumberRequestBean bean);
 
-  @POST("api/v1/mobileAuth/confirmMobileAuth.plus")
+  @POST("mapi/mobileauth/confmobileauth.plus")
   Single<LifeplusAPIBean> confirmMobileAuth(@Body AuthConfirmRequestBean bean);
 
   @POST("api/v1/textRes/confirmPolicy.plus")

+ 2 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/supervisor/ScreenID.java

@@ -82,6 +82,7 @@ public class ScreenID {
   public static final int PIN_RESET_INPUT_FROM_ALREADY_MEMBER = 62;
   public static final int CONTENTS = 63;
   public static final int EVENT= 64;
+  public static final int PHONE_NUMBER_RESET= 65;
 
   @Retention(RetentionPolicy.SOURCE)
   @IntDef({
@@ -92,7 +93,7 @@ public class ScreenID {
     FOURTH_CATEGORY, FIFTH_CATEGORY, NOTIFICATION, SETTING_CODE, MY_MAIN, BOOK_MARK_DEFAULT, BOOK_MARK_LIST, MY_COIN_MAIN, MY_COIN_EXTINCT, MY_PURCHASE_HISTORY,
     GUIDE, LIFE_PLUS_X, SETTING_MEMBER_INFO, MY_MAIN_GUEST, COUPON_MALL, ALL_MENU_GUEST, SETTING_MEMBER_QUIT_INFO, MY_FAQ, SETTING_MEMBER_QUIT_REQUEST,
     SETTING_MEMBER_QUIT_FINISH, SETTING_TERMS, SETTING_MEMBER_QUIT_FAIL, MAIN_PIN_UNLOCK, PIN_RESET_AUTH, PIN_RESET_INPUT, PIN_RESET_AUTH_FROM_SETTING,
-    PIN_RESET_INPUT_FROM_SETTING, PIN_RESET_AUTH_FROM_ALREADY_MEMBER, PIN_RESET_INPUT_FROM_ALREADY_MEMBER, CONTENTS, EVENT
+    PIN_RESET_INPUT_FROM_SETTING, PIN_RESET_AUTH_FROM_ALREADY_MEMBER, PIN_RESET_INPUT_FROM_ALREADY_MEMBER, CONTENTS, EVENT, PHONE_NUMBER_RESET
   })
   public @interface FragmentID {}
 

+ 12 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/auth/MobileAuthPresenter.java

@@ -330,6 +330,7 @@ public class MobileAuthPresenter implements IMobileAuthContract.Presenter {
       AuthConfirmRequestBean bean = new AuthConfirmRequestBean();
       bean.setPhoneNumber(succeedUserBean.getFirstPhoneNumber() + succeedUserBean.getPhoneNumber());
       bean.setAuthorizationNumber(this.authorizationNumber);
+      bean.setDeviceUuid(SuperModel.getInstance().getDeviceId());
 
       disposable.add(
         new APIAuthConfirmModule().call(bean, new IAPIModuleListener<LifeplusAPIBean>() {
@@ -350,13 +351,22 @@ public class MobileAuthPresenter implements IMobileAuthContract.Presenter {
             }
             else {
               // 실패
-              countFailWithPopup();
+//              countFailWithPopup();
+
+              // fixme 일단 무조건 성공
+              LifeplusAPIBean bean = new LifeplusAPIBean(LifeplusAPIBean.RETURN_SUCCESS, "");
+              doSomeWhenConfirmSuccess(bean);
             }
           }
 
           @Override
           public void onApiError(String errorMessage) {
-            countFailWithPopup();
+            // 실패
+//              countFailWithPopup();
+
+            // fixme 일단 무조건 성공
+            LifeplusAPIBean bean = new LifeplusAPIBean(LifeplusAPIBean.RETURN_SUCCESS, "");
+            doSomeWhenConfirmSuccess(bean);
           }
         })
       );

+ 1 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/signup/SignUpAgreeModel.java

@@ -14,7 +14,6 @@ import kr.co.zumo.app.lifeplus.bean.api.LifeplusAPIBean;
 import kr.co.zumo.app.lifeplus.bean.api.LoginResultBean;
 import kr.co.zumo.app.lifeplus.bean.api.MemberJoinRequestBean;
 import kr.co.zumo.app.lifeplus.bean.api.MemberJoinResultBean;
-import kr.co.zumo.app.lifeplus.bean.api.MemberPolicyRequestBean;
 import kr.co.zumo.app.lifeplus.bean.api.PolicyBean;
 import kr.co.zumo.app.lifeplus.bean.api.PolicyConfirmRequestBean;
 import kr.co.zumo.app.lifeplus.bean.api.PolicyListResultBean;
@@ -256,7 +255,7 @@ public class SignUpAgreeModel extends Model {
 
     List<PolicyBean> agreeBean = getAgreeItems();
     for (PolicyBean bean : agreeBean) {
-      policyConfirmRequestBean.addBean(new MemberPolicyRequestBean(bean.getPolicyNumber(), bean.getChecked()));
+      policyConfirmRequestBean.addBean(bean);
     }
 
     disposable.add(new APIPolicyConfirmModule().call(policyConfirmRequestBean, new IAPIModuleListener<LifeplusAPIBean>() {