| | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials; |
| | | import com.wechat.pay.contrib.apache.httpclient.notification.NotificationHandler; |
| | | import okhttp3.HttpUrl; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.net.URLConnection; |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.KeyPair; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.PrivateKey; |
| | |
| | | } |
| | | |
| | | @Test |
| | | public void rankProfit05() throws IOException {//获取用户填写的抬头 |
| | | byte[] bytes = "daL341aN5orDt13puXadsAf2rpuX12v3".getBytes("utf-8"); |
| | | try { |
| | | //传入证书 |
| | | PrivateKey privateKey = wxFaPiaoService.getPrivateKeyV3(); |
| | | //刷新 |
| | | PrivateKeySigner signer = new PrivateKeySigner(AppContants.WX_CARD_NUM, privateKey); |
| | | WechatPay2Credentials credentials = new WechatPay2Credentials("1658958205", signer); |
| | | AutoUpdateCertificatesVerifier autoUpdateCertificatesVerifier = new AutoUpdateCertificatesVerifier(credentials |
| | | , bytes); |
| | | |
| | | NotificationHandler handler = new NotificationHandler(autoUpdateCertificatesVerifier,bytes); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void rankProfit2() throws IOException {//查询配置开发选项 |
| | | PrivateKey privateKey = wxFaPiaoService.getPrivateKeyV3(); |
| | | String baseUrl = "https://api.mch.weixin.qq.com"; |