Search in sources :

Example 1 with IWXAPI

use of com.tencent.mm.opensdk.openapi.IWXAPI 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);
}
Also used : WeChatPayModel(com.benmu.framework.model.WeChatPayModel) IWXAPI(com.tencent.mm.opensdk.openapi.IWXAPI) PayReq(com.tencent.mm.opensdk.modelpay.PayReq) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Aggregations

ParseManager (com.benmu.framework.manager.impl.ParseManager)1 WeChatPayModel (com.benmu.framework.model.WeChatPayModel)1 PayReq (com.tencent.mm.opensdk.modelpay.PayReq)1 IWXAPI (com.tencent.mm.opensdk.openapi.IWXAPI)1