Class PayUtil

java.lang.Object
cn.sinozg.applet.common.utils.PayUtil

public class PayUtil extends Object
  • Field Details

    • PRIVATE_KEY

      private static volatile PrivateKey PRIVATE_KEY
    • log

      private static final org.slf4j.Logger log
  • Constructor Details

    • PayUtil

      private PayUtil()
  • Method Details

    • privateKeyInstance

      public static PrivateKey privateKeyInstance()
    • httpClient

      public static org.apache.http.impl.client.CloseableHttpClient httpClient()
      初始化 clientBuilder和证书管理器
      Returns:
      CloseableHttpClient
    • signVerify

      public static boolean signVerify(jakarta.servlet.http.HttpServletRequest request, String body) throws com.wechat.pay.contrib.apache.httpclient.exception.ValidationException, com.wechat.pay.contrib.apache.httpclient.exception.ParseException
      验证签名
      Parameters:
      request - 序列号
      body - 请求体
      Returns:
      签名是否正确
      Throws:
      com.wechat.pay.contrib.apache.httpclient.exception.ValidationException
      com.wechat.pay.contrib.apache.httpclient.exception.ParseException
    • verifier

      private static com.wechat.pay.contrib.apache.httpclient.auth.Verifier verifier(WechatValue wechat)
      获取证书验证器
      Parameters:
      wechat - 请求参数
      Returns:
      验证器
    • post

      public static <T> T post(String url, Object params, Class<T> clazz)
      微信post 请求
      Type Parameters:
      T - 返回类型
      Parameters:
      url - 请求地址
      params - 参数
      clazz - 返回类型
      Returns:
      请求结果
    • decryptOrder

      public static String decryptOrder(String body)
      解密订单信息
      Parameters:
      body - 应答报文主体
      Returns:
      解密结果