use of com.tencent.mm.opensdk.modelpay.PayReq in project WeexErosFramework by bmfe.
the class EventPay method pay.
public void pay(String params, Context context, JSCallback callback) {
this.mCallback = callback;
ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
WeChatPayModel weChatPayModal = parseManager.parseObject(params, WeChatPayModel.class);
IWXAPI wxapi = WXAPIFactory.createWXAPI(context, weChatPayModal.getAppid(), true);
if (!wxapi.isWXAppInstalled()) {
JsPoster.postFailed("请先安装微信客户端", mCallback);
// }
return;
}
PayReq request = new PayReq();
request.appId = weChatPayModal.getAppid();
request.partnerId = weChatPayModal.getPartnerid();
request.nonceStr = weChatPayModal.getNoncestr();
request.packageValue = weChatPayModal.getPackageValue();
request.prepayId = weChatPayModal.getPrepayid();
request.timeStamp = weChatPayModal.getTimestamp();
request.sign = weChatPayModal.getSign();
wxapi.registerApp(weChatPayModal.getAppid());
ManagerFactory.getManagerService(DispatchEventManager.class).getBus().register(this);
wxapi.sendReq(request);
}
Aggregations