com.github.binarywang.wxpay.exception.WxPayException类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(839)

本文整理了Java中com.github.binarywang.wxpay.exception.WxPayException类的一些代码示例,展示了WxPayException类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WxPayException类的具体详情如下:
包路径:com.github.binarywang.wxpay.exception.WxPayException
类名称:WxPayException

WxPayException介绍

[英]```
微信支付异常结果类
Created by Binary Wang on 2017-6-6.

[中]```
微信支付异常结果类 
Created by Binary Wang on 2017-6-6.

代码示例

代码示例来源:origin: jmdhappy/xxpay-master

_log.info("err_code:", e.getErrCode());
  _log.info("err_code_des:", e.getErrCodeDes());
  return WxPayNotifyResponse.fail(e.getMessage());
} catch (Exception e) {
  _log.error(e, "微信回调结果异常,异常原因");

代码示例来源:origin: linlinjava/litemall

result = wxPayService.parseOrderNotifyResult(xmlResult);
} catch (WxPayException e) {
  e.printStackTrace();
  return WxPayNotifyResponse.fail(e.getMessage());

代码示例来源:origin: jmdhappy/xxpay-master

_log.info("err_code:{}", e.getErrCode());
_log.info("err_code_des:{}", e.getErrCodeDes());
return XXPayUtil.makeRetData(XXPayUtil.makeRetMap(PayConstant.RETURN_VALUE_SUCCESS, "", PayConstant.RETURN_VALUE_FAIL, "0111", "调用微信支付失败," + e.getErrCode() + ":" + e.getErrCodeDes()), resKey);

代码示例来源:origin: binarywang/WxJava

@Override
public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData) throws WxPayException {
 try {
  log.debug("微信支付异步通知请求参数:{}", xmlData);
  WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData);
  log.debug("微信支付异步通知请求解析后的对象:{}", result);
  result.checkResult(this, this.getConfig().getSignType(), false);
  return result;
 } catch (WxPayException e) {
  log.error(e.getMessage(), e);
  throw e;
 } catch (Exception e) {
  log.error(e.getMessage(), e);
  throw new WxPayException("发生异常," + e.getMessage(), e);
 }
}

代码示例来源:origin: binarywang/WxJava

/**
 * Build wx pay exception.
 *
 * @return the wx pay exception
 */
public WxPayException build() {
 return new WxPayException(this);
}

代码示例来源:origin: linlinjava/litemall

wxPayRefundResult = wxPayService.refund(wxPayRefundRequest);
} catch (WxPayException e) {
  e.printStackTrace();
  return ResponseUtil.fail(ORDER_REFUND_FAILED, "订单退款失败");

代码示例来源:origin: binarywang/WxJava

private String handleGzipFundFlow(String url, String requestStr) throws WxPayException {
 try {
  byte[] responseBytes = this.postForBytes(url, requestStr, true);
  Path tempDirectory = Files.createTempDirectory("fundFlow");
  Path path = Paths.get(tempDirectory.toString(), System.currentTimeMillis() + ".gzip");
  Files.write(path, responseBytes);
  try {
   List<String> allLines = Files.readAllLines(ZipUtil.ungzip(path.toFile()).toPath(), StandardCharsets.UTF_8);
   return Joiner.on("\n").join(allLines);
  } catch (ZipException e) {
   if (e.getMessage().contains("Not in GZIP format")) {
    throw WxPayException.from(BaseWxPayResult.fromXML(new String(responseBytes, StandardCharsets.UTF_8),
     WxPayCommonResult.class));
   } else {
    this.log.error("解压zip文件出错", e);
    throw new WxPayException("解压zip文件出错");
   }
  }
 } catch (WxPayException wxPayException) {
  throw wxPayException;
 } catch (Exception e) {
  this.log.error("解析对账单文件时出错", e);
  throw new WxPayException("解压zip文件出错");
 }
}

代码示例来源:origin: binarywang/WxJava

private String handleGzipBill(String url, String requestStr) {
 try {
  byte[] responseBytes = this.postForBytes(url, requestStr, false);
  Path tempDirectory = Files.createTempDirectory("bill");
  Path path = Paths.get(tempDirectory.toString(), System.currentTimeMillis() + ".gzip");
  Files.write(path, responseBytes);
  try {
   List<String> allLines = Files.readAllLines(ZipUtil.ungzip(path.toFile()).toPath(), StandardCharsets.UTF_8);
   return Joiner.on("\n").join(allLines);
  } catch (ZipException e) {
   if (e.getMessage().contains("Not in GZIP format")) {
    throw WxPayException.from(BaseWxPayResult.fromXML(new String(responseBytes, StandardCharsets.UTF_8),
     WxPayCommonResult.class));
   } else {
    this.log.error("解压zip文件出错", e);
   }
  }
 } catch (Exception e) {
  this.log.error("解析对账单文件时出错", e);
 }
 return null;
}

代码示例来源:origin: jmdhappy/xxpay-master

_log.info("err_code:{}", e.getErrCode());
_log.info("err_code_des:{}", e.getErrCodeDes());
return RpcUtil.createFailResult(baseParam, RetEnum.RET_BIZ_WX_PAY_CREATE_FAIL);

代码示例来源:origin: com.github.binarywang/weixin-java-pay

@Override
public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData) throws WxPayException {
 try {
  log.debug("微信支付异步通知请求参数:{}", xmlData);
  WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData);
  log.debug("微信支付异步通知请求解析后的对象:{}", result);
  result.checkResult(this, this.getConfig().getSignType(), false);
  return result;
 } catch (WxPayException e) {
  log.error(e.getMessage(), e);
  throw e;
 } catch (Exception e) {
  log.error(e.getMessage(), e);
  throw new WxPayException("发生异常," + e.getMessage(), e);
 }
}

代码示例来源:origin: com.github.binarywang/weixin-java-pay

/**
 * Build wx pay exception.
 *
 * @return the wx pay exception
 */
public WxPayException build() {
 return new WxPayException(this);
}

代码示例来源:origin: ustcwudi/springboot-seed

/**
 * <pre>
 * 关闭订单
 * 应用场景
 * 以下情况需要调用关单接口:
 * 1. 商户订单支付失败需要生成新单号重新发起支付,要对原订单号调用关单,避免重复支付;
 * 2. 系统下单后,用户支付超时,系统退出不再受理,避免用户继续,请调用关单接口。
 * 注意:订单生成后不能马上调用关单接口,最短调用时间间隔为5分钟。
 * 接口地址:https://api.mch.weixin.qq.com/pay/closeorder
 * 是否需要证书:   不需要。
 * </pre>
 *
 * @param outTradeNo 商户系统内部的订单号
 */
@GetMapping("/closeOrder/{outTradeNo}")
public WxPayOrderCloseResult closeOrder(@PathVariable String outTradeNo) {
  try {
    WxPayOrderCloseResult orderCloseResult = this.wxService.closeOrder(outTradeNo);
    return orderCloseResult;
  } catch (WxPayException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.github.binarywang/weixin-java-pay

private String handleGzipFundFlow(String url, String requestStr) throws WxPayException {
 try {
  byte[] responseBytes = this.postForBytes(url, requestStr, true);
  Path tempDirectory = Files.createTempDirectory("fundFlow");
  Path path = Paths.get(tempDirectory.toString(), System.currentTimeMillis() + ".gzip");
  Files.write(path, responseBytes);
  try {
   List<String> allLines = Files.readAllLines(ZipUtil.ungzip(path.toFile()).toPath(), StandardCharsets.UTF_8);
   return Joiner.on("\n").join(allLines);
  } catch (ZipException e) {
   if (e.getMessage().contains("Not in GZIP format")) {
    throw WxPayException.from(BaseWxPayResult.fromXML(new String(responseBytes, StandardCharsets.UTF_8),
     WxPayCommonResult.class));
   } else {
    this.log.error("解压zip文件出错", e);
    throw new WxPayException("解压zip文件出错");
   }
  }
 } catch (WxPayException wxPayException) {
  throw wxPayException;
 } catch (Exception e) {
  this.log.error("解析对账单文件时出错", e);
  throw new WxPayException("解压zip文件出错");
 }
}

代码示例来源:origin: com.github.binarywang/weixin-java-pay

private String handleGzipBill(String url, String requestStr) {
 try {
  byte[] responseBytes = this.postForBytes(url, requestStr, false);
  Path tempDirectory = Files.createTempDirectory("bill");
  Path path = Paths.get(tempDirectory.toString(), System.currentTimeMillis() + ".gzip");
  Files.write(path, responseBytes);
  try {
   List<String> allLines = Files.readAllLines(ZipUtil.ungzip(path.toFile()).toPath(), StandardCharsets.UTF_8);
   return Joiner.on("\n").join(allLines);
  } catch (ZipException e) {
   if (e.getMessage().contains("Not in GZIP format")) {
    throw WxPayException.from(BaseWxPayResult.fromXML(new String(responseBytes, StandardCharsets.UTF_8),
     WxPayCommonResult.class));
   } else {
    this.log.error("解压zip文件出错", e);
   }
  }
 } catch (Exception e) {
  this.log.error("解析对账单文件时出错", e);
 }
 return null;
}

代码示例来源:origin: jmdhappy/xxpay-master

_log.info("err_code:", e.getErrCode());
  _log.info("err_code_des:", e.getErrCodeDes());
  return RpcUtil.createBizResult(baseParam, WxPayNotifyResponse.fail(e.getMessage()));
} catch (Exception e) {
  _log.error(e, "微信回调结果异常,异常原因");

代码示例来源:origin: jmdhappy/xxpay-master

_log.info("err_code:{}", e.getErrCode());
_log.info("err_code_des:{}", e.getErrCodeDes());

代码示例来源:origin: com.github.binarywang/weixin-java-pay

@Override
public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData) throws WxPayException {
 try {
  log.debug("扫码支付回调通知请求参数:{}", xmlData);
  WxScanPayNotifyResult result = BaseWxPayResult.fromXML(xmlData, WxScanPayNotifyResult.class);
  log.debug("扫码支付回调通知解析后的对象:{}", result);
  result.checkResult(this, this.getConfig().getSignType(), false);
  return result;
 } catch (WxPayException e) {
  log.error(e.getMessage(), e);
  throw e;
 } catch (Exception e) {
  log.error(e.getMessage(), e);
  throw new WxPayException("发生异常," + e.getMessage(), e);
 }
}

代码示例来源:origin: com.github.binarywang/weixin-java-pay

@Override
protected void checkConstraints() throws WxPayException {
 if (StringUtils.isBlank(transactionId) && StringUtils.isBlank(outTradeNo)) {
  throw new WxPayException("transaction_id 和 out_trade_no不能同时为空!");
 }
}

代码示例来源:origin: binarywang/WxJava

if (getSign() != null && !SignUtils.checkSign(map, signType, wxPayService.getConfig().getMchKey())) {
 this.getLogger().debug("校验结果签名失败,参数:{}", map);
 throw new WxPayException("参数格式校验错误!");
  throw WxPayException.from(this);

代码示例来源:origin: binarywang/WxJava

@Override
public String downloadRawBill(WxPayDownloadBillRequest request) throws WxPayException {
 request.checkAndSign(this.getConfig());
 String url = this.getPayBaseUrl() + "/pay/downloadbill";
 String responseContent;
 if (TarType.GZIP.equals(request.getTarType())) {
  responseContent = this.handleGzipBill(url, request.toXML());
 } else {
  responseContent = this.post(url, request.toXML(), false);
  if (responseContent.startsWith("<")) {
   throw WxPayException.from(BaseWxPayResult.fromXML(responseContent, WxPayCommonResult.class));
  }
 }
 return responseContent;
}

相关文章

微信公众号

最新文章

更多