Commit 332b953f authored by zhang_z's avatar zhang_z

打包;

parent 88dc5b5e
...@@ -2,11 +2,9 @@ package com.xingdata.zzdpos.ui.settle; ...@@ -2,11 +2,9 @@ package com.xingdata.zzdpos.ui.settle;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.StringUtils; import com.blankj.utilcode.util.StringUtils;
import com.blankj.utilcode.util.ToastUtils; import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.api.print.ZX_PrintPOS; import com.xingdata.api.print.ZX_PrintPOS;
import com.xingdata.zxpay.PayCenter;
import com.xingdata.zzdpos.C; import com.xingdata.zzdpos.C;
import com.xingdata.zzdpos.api.ApiFactory; import com.xingdata.zzdpos.api.ApiFactory;
import com.xingdata.zzdpos.api.JniFactory; import com.xingdata.zzdpos.api.JniFactory;
...@@ -226,72 +224,72 @@ public class SettlePresenter extends SettleContract.Presenter { ...@@ -226,72 +224,72 @@ public class SettlePresenter extends SettleContract.Presenter {
@Override @Override
public void payInAli(String payCode) { public void payInAli(String payCode) {
mView.showLoadingDialog(); mView.showLoadingDialog();
// commitOrder()
// .flatMap(orderNo -> JniFactory.Settle.pay(C.PAY_CHANNEL.ALI, payCode, mSaleorder.getOrderPayAmt(), orderNo))
// .doFinally(() -> mView.dismissLoadingDialog())
// .subscribe(
// response -> {
// com.xingdata.zzdpos.api.Pay.Response r1 = JSON.parseObject(response.replace("\\", ""), com.xingdata.zzdpos.api.Pay.Response.class);
// switch (r1.getResponseCode()) {
// case "0000":
// subscribePay(commitOrder().flatMap(orderNo -> ApiFactory.Saleorder.addOrderPayMis(mSaleorder.pay(orderNo, C.PAY_CHANNEL.ALI)).doFinally(() -> mView.dismissLoadingDialog())));
// break;
// case "0098":
// mView.showPayingDialog(C.PAY_CHANNEL.ALI, r1);
// break;
// default:
// mView.showPayFailFragment(null, mSaleorder);
// break;
// }
// },
// throwable -> mView.showPayFailFragment(throwable, mSaleorder));
commitOrder() commitOrder()
.flatMap(orderNo -> PayCenter.getInstance().pay(C.PAY_CHANNEL.ALI, payCode, mSaleorder.getOrderPayAmt())) .flatMap(orderNo -> JniFactory.Settle.pay(C.PAY_CHANNEL.ALI, payCode, mSaleorder.getOrderPayAmt(), orderNo))
.doFinally(() -> mView.dismissLoadingDialog()) .doFinally(() -> mView.dismissLoadingDialog())
.subscribe( .subscribe(
response -> { response -> {
LogUtils.e(response.getMsg()); com.xingdata.zzdpos.api.Pay.Response r1 = JSON.parseObject(response.replace("\\", ""), com.xingdata.zzdpos.api.Pay.Response.class);
switch (r1.getResponseCode()) {
case "0000":
subscribePay(commitOrder().flatMap(orderNo -> ApiFactory.Saleorder.addOrderPayMis(mSaleorder.pay(orderNo, C.PAY_CHANNEL.ALI)).doFinally(() -> mView.dismissLoadingDialog())));
break;
case "0098":
mView.showPayingDialog(C.PAY_CHANNEL.ALI, r1);
break;
default:
mView.showPayFailFragment(null, mSaleorder);
break;
}
}, },
throwable -> { throwable -> mView.showPayFailFragment(throwable, mSaleorder));
mView.showPayFailFragment(throwable, mSaleorder);
});
}
@Override
public void payInWechat(String payCode) {
mView.showLoadingDialog();
// commitOrder() // commitOrder()
// .flatMap(orderNo -> JniFactory.Settle.pay(C.PAY_CHANNEL.WECHAT, payCode, mSaleorder.getOrderPayAmt(), orderNo)) // .flatMap(orderNo -> PayCenter.getInstance().pay(C.PAY_CHANNEL.ALI, payCode, mSaleorder.getOrderPayAmt()))
// .doFinally(() -> mView.dismissLoadingDialog()) // .doFinally(() -> mView.dismissLoadingDialog())
// .subscribe( // .subscribe(
// response -> { // response -> {
// com.xingdata.zzdpos.api.Pay.Response r1 = JSON.parseObject(response.replace("\\", ""), com.xingdata.zzdpos.api.Pay.Response.class); // LogUtils.e(response.getMsg());
// switch (r1.getResponseCode()) {
// case C.PAY_STATE.SUCC:
// subscribePay(commitOrder().flatMap(orderNo -> ApiFactory.Saleorder.addOrderPayMis(mSaleorder.pay(orderNo, C.PAY_CHANNEL.WECHAT)).doFinally(() -> mView.dismissLoadingDialog())));
// break;
// case C.PAY_STATE.PAYING:
// mView.showPayingDialog(C.PAY_CHANNEL.WECHAT, r1);
// break;
// default:
// mView.showPayFailFragment(null, mSaleorder);
// break;
// }
// }, // },
// throwable -> mView.showPayFailFragment(throwable, mSaleorder)); // throwable -> {
ApiFactory.Pay.getPayKey().flatMap(s -> { // mView.showPayFailFragment(throwable, mSaleorder);
return Observable.just(commitOrder() // });
.flatMap(orderNo -> PayCenter.getInstance().init(s).pay(C.PAY_CHANNEL.WECHAT, payCode, mSaleorder.getOrderPayAmt())) }
.doFinally(() -> mView.dismissLoadingDialog())
.subscribe( @Override
response -> { public void payInWechat(String payCode) {
LogUtils.e(response.getMsg()); mView.showLoadingDialog();
}, commitOrder()
throwable -> { .flatMap(orderNo -> JniFactory.Settle.pay(C.PAY_CHANNEL.WECHAT, payCode, mSaleorder.getOrderPayAmt(), orderNo))
mView.showPayFailFragment(throwable, mSaleorder); .doFinally(() -> mView.dismissLoadingDialog())
}) .subscribe(
); response -> {
}).subscribe(); com.xingdata.zzdpos.api.Pay.Response r1 = JSON.parseObject(response.replace("\\", ""), com.xingdata.zzdpos.api.Pay.Response.class);
switch (r1.getResponseCode()) {
case C.PAY_STATE.SUCC:
subscribePay(commitOrder().flatMap(orderNo -> ApiFactory.Saleorder.addOrderPayMis(mSaleorder.pay(orderNo, C.PAY_CHANNEL.WECHAT)).doFinally(() -> mView.dismissLoadingDialog())));
break;
case C.PAY_STATE.PAYING:
mView.showPayingDialog(C.PAY_CHANNEL.WECHAT, r1);
break;
default:
mView.showPayFailFragment(null, mSaleorder);
break;
}
},
throwable -> mView.showPayFailFragment(throwable, mSaleorder));
// ApiFactory.Pay.getPayKey().flatMap(s -> {
// return Observable.just(commitOrder()
// .flatMap(orderNo -> PayCenter.getInstance().init(s).pay(C.PAY_CHANNEL.WECHAT, payCode, mSaleorder.getOrderPayAmt()))
// .doFinally(() -> mView.dismissLoadingDialog())
// .subscribe(
// response -> {
// LogUtils.e(response.getMsg());
// },
// throwable -> {
// mView.showPayFailFragment(throwable, mSaleorder);
// })
// );
// }).subscribe();
} }
......
...@@ -5,6 +5,8 @@ import retrofit2.http.Body; ...@@ -5,6 +5,8 @@ import retrofit2.http.Body;
import retrofit2.http.POST; import retrofit2.http.POST;
interface Service { interface Service {
@POST(C.URL.ACTION) @POST(C.URL.ACTION)
Observable<Response> action(@Body com.xingdata.zxpay.pax.Request request); Observable<Response> action(@Body com.xingdata.zxpay.pax.Request request);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment