@Test public void testQueryOfflineBillStatusAsyncTestMode() throws Exception { BeeCloud.setSandbox(true); query.queryOfflineBillStatusAsync(BCReqParams.BCChannelTypes.WX_NATIVE, "fakeid", new BCCallback() { @Override public void done(BCResult result) { Assert.assertTrue(result instanceof BCBillStatus); BCBillStatus status = (BCBillStatus) result; Assert.assertEquals(BCRestfulCommonResult.APP_INNER_FAIL_NUM, status.getResultCode()); Assert.assertEquals("该功能暂不支持测试模式", status.getErrDetail()); BeeCloud.setSandbox(false); latch.countDown(); } }); latch.await(2000, TimeUnit.MILLISECONDS); }
public void queryOfflineBillStatusAsync(final BCReqParams.BCChannelTypes channelType, final String billNum, final BCCallback callback) { if (callback == null) { Log.w(TAG, "请初始化callback"); return; } BCCache.executorService.execute(new Runnable() { @Override public void run() { if (BCCache.getInstance().isTestMode){ callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "该功能暂不支持测试模式")); return; } BCReqParams parameters; try { parameters = new BCReqParams(channelType); } catch (BCException e) { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, e.getMessage())); return; } if (billNum == null || billNum.length() == 0){ callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "invalid bill number")); return; } String queryURL = BCHttpClientUtil.getOfflineBillStatusURL(); Map<String, Object> reqMap = parameters.transToReqMapParams(); reqMap.put("bill_no", billNum); BCHttpClientUtil.Response response = BCHttpClientUtil.httpPost(queryURL, reqMap); if (response.code == 200 || (response.code >= 400 && response.code < 500)) { try { callback.done(BCBillStatus.transJsonToObject(response.content)); } catch (JsonSyntaxException ex) { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "JsonSyntaxException or Network Error:" + response.code + " # " + response.content)); } } else { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "Network Error:" + response.code + " # " + response.content)); } } }); }
BCQuery { public void queryOfflineBillStatusAsync(final BCReqParams.BCChannelTypes channelType, final String billNum, final BCCallback callback) { if (callback == null) { Log.w(TAG, "请初始化callback"); return; } BCCache.executorService.execute(new Runnable() { @Override public void run() { if (BCCache.getInstance().isTestMode){ callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "该功能暂不支持测试模式")); return; } BCReqParams parameters; try { parameters = new BCReqParams(channelType); } catch (BCException e) { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, e.getMessage())); return; } if (billNum == null || billNum.length() == 0){ callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "invalid bill number")); return; } String queryURL = BCHttpClientUtil.getOfflineBillStatusURL(); Map<String, Object> reqMap = parameters.transToReqMapParams(); reqMap.put("bill_no", billNum); BCHttpClientUtil.Response response = BCHttpClientUtil.httpPost(queryURL, reqMap); if (response.code == 200 || (response.code >= 400 && response.code < 500)) { try { callback.done(BCBillStatus.transJsonToObject(response.content)); } catch (JsonSyntaxException ex) { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "JsonSyntaxException or Network Error:" + response.code + " # " + response.content)); } } else { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "Network Error:" + response.code + " # " + response.content)); } } }); } }
BCQuery { public void queryOfflineBillStatusAsync(final BCReqParams.BCChannelTypes channelType, final String billNum, final BCCallback callback) { if (callback == null) { Log.w(TAG, "请初始化callback"); return; } BCCache.executorService.execute(new Runnable() { @Override public void run() { if (BCCache.getInstance().isTestMode){ callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "该功能暂不支持测试模式")); return; } BCReqParams parameters; try { parameters = new BCReqParams(channelType); } catch (BCException e) { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, e.getMessage())); return; } if (billNum == null || billNum.length() == 0){ callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "invalid bill number")); return; } String queryURL = BCHttpClientUtil.getOfflineBillStatusURL(); Map<String, Object> reqMap = parameters.transToReqMapParams(); reqMap.put("bill_no", billNum); BCHttpClientUtil.Response response = BCHttpClientUtil.httpPost(queryURL, reqMap); if (response.code == 200 || (response.code >= 400 && response.code < 500)) { try { callback.done(BCBillStatus.transJsonToObject(response.content)); } catch (JsonSyntaxException ex) { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "JsonSyntaxException or Network Error:" + response.code + " # " + response.content)); } } else { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "Network Error:" + response.code + " # " + response.content)); } } }); } private  BCQuery(); }
BCQuery { public void queryOfflineBillStatusAsync(final BCReqParams.BCChannelTypes channelType, final String billNum, final BCCallback callback) { if (callback == null) { Log.w(TAG, "请初始化callback"); return; } BCCache.executorService.execute(new Runnable() { @Override public void run() { if (BCCache.getInstance().isTestMode){ callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "该功能暂不支持测试模式")); return; } BCReqParams parameters; try { parameters = new BCReqParams(channelType); } catch (BCException e) { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, e.getMessage())); return; } if (billNum == null || billNum.length() == 0){ callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "invalid bill number")); return; } String queryURL = BCHttpClientUtil.getOfflineBillStatusURL(); Map<String, Object> reqMap = parameters.transToReqMapParams(); reqMap.put("bill_no", billNum); BCHttpClientUtil.Response response = BCHttpClientUtil.httpPost(queryURL, reqMap); if (response.code == 200 || (response.code >= 400 && response.code < 500)) { try { callback.done(BCBillStatus.transJsonToObject(response.content)); } catch (JsonSyntaxException ex) { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "JsonSyntaxException or Network Error:" + response.code + " # " + response.content)); } } else { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "Network Error:" + response.code + " # " + response.content)); } } }); } private  BCQuery(); synchronized static BCQuery getInstance(); void queryBillsAsync(final BCReqParams.BCChannelTypes channel, final String billNum,
                                final Long startTime, final Long endTime,
                                final Integer skip, final Integer limit, final BCCallback callback); void queryBillsAsync(final BCReqParams.BCChannelTypes channel, final BCCallback callback); void queryBillsAsync(final BCReqParams.BCChannelTypes channel, final String billNum, final BCCallback callback); void queryBillsAsync(final QueryParams queryParams, final BCCallback callback); void queryRefundsAsync(final BCReqParams.BCChannelTypes channel, final String billNum, final String refundNum,
                                final Long startTime, final Long endTime,
                                final Integer skip, final Integer limit, final BCCallback callback); void queryRefundsAsync(final BCReqParams.BCChannelTypes channel, final BCCallback callback); void queryRefundsAsync(final BCReqParams.BCChannelTypes channel, final String billNum,
                                  final String refundNum, final BCCallback callback); void queryRefundsAsync(final QueryParams queryParams, final BCCallback callback); void queryBillsCountAsync(final QueryParams queryParams, final BCCallback callback); void queryRefundsCountAsync(final QueryParams queryParams, final BCCallback callback); void queryRefundStatusAsync(final BCReqParams.BCChannelTypes channel, final String refundNum,
                                       final BCCallback callback); void queryBillByIDAsync(final String id, final BCCallback callback); void queryRefundByIDAsync(final String id, final BCCallback callback); void queryOfflineBillStatusAsync(final BCReqParams.BCChannelTypes channelType,
                                          final String billNum,
                                          final BCCallback callback); void subscriptionSupportedBanks(final BCCallback callback); void queryPlans(final BCPlanCriteria criteria, final BCCallback callback); void querySubscriptions(final BCSubscriptionCriteria criteria, final BCCallback callback); }
BCQuery { public void queryOfflineBillStatusAsync(final BCReqParams.BCChannelTypes channelType, final String billNum, final BCCallback callback) { if (callback == null) { Log.w(TAG, "请初始化callback"); return; } BCCache.executorService.execute(new Runnable() { @Override public void run() { if (BCCache.getInstance().isTestMode){ callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "该功能暂不支持测试模式")); return; } BCReqParams parameters; try { parameters = new BCReqParams(channelType); } catch (BCException e) { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, e.getMessage())); return; } if (billNum == null || billNum.length() == 0){ callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "invalid bill number")); return; } String queryURL = BCHttpClientUtil.getOfflineBillStatusURL(); Map<String, Object> reqMap = parameters.transToReqMapParams(); reqMap.put("bill_no", billNum); BCHttpClientUtil.Response response = BCHttpClientUtil.httpPost(queryURL, reqMap); if (response.code == 200 || (response.code >= 400 && response.code < 500)) { try { callback.done(BCBillStatus.transJsonToObject(response.content)); } catch (JsonSyntaxException ex) { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "JsonSyntaxException or Network Error:" + response.code + " # " + response.content)); } } else { callback.done(new BCBillStatus(BCRestfulCommonResult.APP_INNER_FAIL_NUM, BCRestfulCommonResult.APP_INNER_FAIL, "Network Error:" + response.code + " # " + response.content)); } } }); } private  BCQuery(); synchronized static BCQuery getInstance(); void queryBillsAsync(final BCReqParams.BCChannelTypes channel, final String billNum,
                                final Long startTime, final Long endTime,
                                final Integer skip, final Integer limit, final BCCallback callback); void queryBillsAsync(final BCReqParams.BCChannelTypes channel, final BCCallback callback); void queryBillsAsync(final BCReqParams.BCChannelTypes channel, final String billNum, final BCCallback callback); void queryBillsAsync(final QueryParams queryParams, final BCCallback callback); void queryRefundsAsync(final BCReqParams.BCChannelTypes channel, final String billNum, final String refundNum,
                                final Long startTime, final Long endTime,
                                final Integer skip, final Integer limit, final BCCallback callback); void queryRefundsAsync(final BCReqParams.BCChannelTypes channel, final BCCallback callback); void queryRefundsAsync(final BCReqParams.BCChannelTypes channel, final String billNum,
                                  final String refundNum, final BCCallback callback); void queryRefundsAsync(final QueryParams queryParams, final BCCallback callback); void queryBillsCountAsync(final QueryParams queryParams, final BCCallback callback); void queryRefundsCountAsync(final QueryParams queryParams, final BCCallback callback); void queryRefundStatusAsync(final BCReqParams.BCChannelTypes channel, final String refundNum,
                                       final BCCallback callback); void queryBillByIDAsync(final String id, final BCCallback callback); void queryRefundByIDAsync(final String id, final BCCallback callback); void queryOfflineBillStatusAsync(final BCReqParams.BCChannelTypes channelType,
                                          final String billNum,
                                          final BCCallback callback); void subscriptionSupportedBanks(final BCCallback callback); void queryPlans(final BCPlanCriteria criteria, final BCCallback callback); void querySubscriptions(final BCSubscriptionCriteria criteria, final BCCallback callback);  }