package com.cooleshow.student.presenter.mine;

import com.cooleshow.base.presenter.BasePresenter;
import com.cooleshow.base.rx.BaseObserver;
import com.cooleshow.base.utils.RequestBodyUtil;
import com.cooleshow.student.api.APIService;
import com.cooleshow.student.bean.PayTestBean;
import com.cooleshow.student.contract.PayTestContract;

/**
 * 创建日期：2022/5/25 13:47
 *
 * @author Ryan
 * 类说明：
 */
public class PayTestPresenter extends BasePresenter<PayTestContract.PayTestView> implements PayTestContract.Presenter {
    public void orderPay(String jsonStr) {
        getView().showLoading();
        addSubscribe(create(APIService.class).orderPay(RequestBodyUtil.convertToRequestBodyJson(jsonStr)), new BaseObserver<PayTestBean>(getView()) {
            @Override
            protected void onSuccess(PayTestBean data) {
                if (null!=getView()){
                    getView().orderPaySuccess(data);
                }
            }

            @Override
            public void onComplete() {
                super.onComplete();
                getView().hideLoading();
            }

            @Override
            public void onError(Throwable e) {
                super.onError(e);

            }
        });
    }
}
