@Test public void testReqWXPaymentAsync() throws Exception { final BCHttpClientUtil.Response response = new BCHttpClientUtil.Response(); response.code = 200; response.content = "{\"nonce_str\":\"20151119114011235\",\"package\":\"Sign=WXPay\",\"resultCode\":0,\"errMsg\":\"OK:\",\"prepay_id\":\"wx20151119114008765ce0ad440384384408\",\"result_msg\":\"OK\",\"partner_id\":\"1240421502\",\"err_detail\":\"\",\"result_code\":0,\"id\":\"ff5fef0c-93bd-46d2-8500-5ed53502d344\",\"app_id\":\"wxf1aa465362b4c8f1\",\"pay_sign\":\"D0F8E79A14731B59CE04B634FD588C35\",\"timestamp\":\"1447904408\"}"; PowerMockito.stub(PowerMockito.method(BCHttpClientUtil.class, "httpPost", String.class, Map.class)).toReturn(response); Map<String,String> optional = new HashMap<String, String>(); optional.put("aya", "啊呀"); pay.reqWXPaymentAsync("正常title", 22, "123456789ABCDE", optional, new BCCallback() { @Override public void done(BCResult result) { Assert.assertTrue(result instanceof BCPayResult); BCPayResult payResult = (BCPayResult) result; Assert.assertEquals(BCPayResult.RESULT_FAIL, payResult.getResult()); Assert.assertEquals((Integer) BCPayResult.APP_INTERNAL_EXCEPTION_ERR_CODE, payResult.getErrCode()); Assert.assertEquals(BCPayResult.FAIL_EXCEPTION, payResult.getErrMsg()); Assert.assertTrue(payResult.getDetailInfo().startsWith("Error: 微信API为空")); System.out.println(payResult.getDetailInfo()); Assert.assertEquals("ff5fef0c-93bd-46d2-8500-5ed53502d344", BCCache.getInstance().billID); latch.countDown(); } }); latch.await(2000, TimeUnit.MILLISECONDS); }
public void reqWXPaymentAsync(final String billTitle, final Integer billTotalFee, final String billNum, final Map<String, String> optional, final BCCallback callback) { this.reqPaymentAsync(BCReqParams.BCChannelTypes.WX_APP, billTitle, billTotalFee, billNum, null, null, null, null, null, null, null, optional, null, callback); }
BCPay { public void reqWXPaymentAsync(final String billTitle, final Integer billTotalFee, final String billNum, final Map<String, String> optional, final BCCallback callback) { this.reqPaymentAsync(BCReqParams.BCChannelTypes.WX_APP, billTitle, billTotalFee, billNum, null, null, null, null, null, null, null, optional, null, callback); } }
BCPay { public void reqWXPaymentAsync(final String billTitle, final Integer billTotalFee, final String billNum, final Map<String, String> optional, final BCCallback callback) { this.reqPaymentAsync(BCReqParams.BCChannelTypes.WX_APP, billTitle, billTotalFee, billNum, null, null, null, null, null, null, null, optional, null, callback); } private  BCPay(); }
BCPay { public void reqWXPaymentAsync(final String billTitle, final Integer billTotalFee, final String billNum, final Map<String, String> optional, final BCCallback callback) { this.reqPaymentAsync(BCReqParams.BCChannelTypes.WX_APP, billTitle, billTotalFee, billNum, null, null, null, null, null, null, null, optional, null, callback); } private  BCPay(); synchronized static BCPay getInstance(Context context); static String initWechatPay(Context context, String wechatAppID); static void clear(); static void detachWechat(); static void detachBaiduPay(); static boolean isWXPaySupported(); static boolean isWXAppInstalledAndSupported(); void reqPaymentAsync(final PayParams payParam, final BCCallback callback); void reqWXPaymentAsync(final String billTitle, final Integer billTotalFee,
                                  final String billNum,
                                  final Map<String, String> optional, final BCCallback callback); void reqAliPaymentAsync(final String billTitle, final Integer billTotalFee,
                                   final String billNum,
                                   final Map<String, String> optional,
                                   final BCCallback callback); void reqUnionPaymentAsync(final String billTitle, final Integer billTotalFee,
                                     final String billNum,
                                     final Map<String, String> optional,
                                     final BCCallback callback); void reqBaiduPaymentAsync(final String billTitle, final Integer billTotalFee,
                                     final String billNum,
                                     final Map<String, String> optional,
                                     final BCCallback callback); @Deprecated void reqAliInlineQRCodeAsync(final String billTitle, final Integer billTotalFee,
                                        final String billNum, final Map<String, String> optional,
                                        final String returnUrl,
                                        final String qrPayMode,
                                        final BCCallback callback); void reqBCNativeAsync(final String billTitle, final Integer billTotalFee,
                                 final String billNum, final Map<String, String> optional,
                                 final Boolean genQRCode, final Integer qrCodeWidth,
                                 final BCCallback callback); void prefund(final RefundParams params, final BCCallback callback); void sendSmsCode(final String phone, final BCCallback callback); void subscribe(final BCSubscription params, final String smsId, final String smsCode,
                          final String couponCode, final BCCallback callback); void cancelSubscription(final String sid, final BCCallback callback); }
BCPay { public void reqWXPaymentAsync(final String billTitle, final Integer billTotalFee, final String billNum, final Map<String, String> optional, final BCCallback callback) { this.reqPaymentAsync(BCReqParams.BCChannelTypes.WX_APP, billTitle, billTotalFee, billNum, null, null, null, null, null, null, null, optional, null, callback); } private  BCPay(); synchronized static BCPay getInstance(Context context); static String initWechatPay(Context context, String wechatAppID); static void clear(); static void detachWechat(); static void detachBaiduPay(); static boolean isWXPaySupported(); static boolean isWXAppInstalledAndSupported(); void reqPaymentAsync(final PayParams payParam, final BCCallback callback); void reqWXPaymentAsync(final String billTitle, final Integer billTotalFee,
                                  final String billNum,
                                  final Map<String, String> optional, final BCCallback callback); void reqAliPaymentAsync(final String billTitle, final Integer billTotalFee,
                                   final String billNum,
                                   final Map<String, String> optional,
                                   final BCCallback callback); void reqUnionPaymentAsync(final String billTitle, final Integer billTotalFee,
                                     final String billNum,
                                     final Map<String, String> optional,
                                     final BCCallback callback); void reqBaiduPaymentAsync(final String billTitle, final Integer billTotalFee,
                                     final String billNum,
                                     final Map<String, String> optional,
                                     final BCCallback callback); @Deprecated void reqAliInlineQRCodeAsync(final String billTitle, final Integer billTotalFee,
                                        final String billNum, final Map<String, String> optional,
                                        final String returnUrl,
                                        final String qrPayMode,
                                        final BCCallback callback); void reqBCNativeAsync(final String billTitle, final Integer billTotalFee,
                                 final String billNum, final Map<String, String> optional,
                                 final Boolean genQRCode, final Integer qrCodeWidth,
                                 final BCCallback callback); void prefund(final RefundParams params, final BCCallback callback); void sendSmsCode(final String phone, final BCCallback callback); void subscribe(final BCSubscription params, final String smsId, final String smsCode,
                          final String couponCode, final BCCallback callback); void cancelSubscription(final String sid, final BCCallback callback);  }