From 78c941a558b625edafb4bbb01e5f5e6d955074d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Mon, 3 Mar 2025 19:25:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=A1=88=E4=BE=8B=E5=8F=8A=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WePayV3/Contracts/BasicWePay.php | 4 +-- _test/config.php | 9 ++--- _test/pay-config.php | 54 ++++++++++++++++++++++++++++++ _test/pay-download-bill.php | 2 +- _test/pay-order-close.php | 2 +- _test/pay-order-create.php | 2 +- _test/pay-order-notify.php | 2 +- _test/pay-order-query.php | 2 +- _test/pay-redpack-create.php | 2 +- _test/pay-refund-create.php | 2 +- _test/pay-refund-query.php | 2 +- _test/pay-transfers-create.php | 2 +- _test/pay-transfersbank-create.php | 2 +- _test/pay-v3-config.php | 36 +++++++++++++------- 14 files changed, 92 insertions(+), 31 deletions(-) create mode 100644 _test/pay-config.php diff --git a/WePayV3/Contracts/BasicWePay.php b/WePayV3/Contracts/BasicWePay.php index bcea5a8..772724d 100644 --- a/WePayV3/Contracts/BasicWePay.php +++ b/WePayV3/Contracts/BasicWePay.php @@ -57,9 +57,9 @@ abstract class BasicWePay 'mch_v3_key' => '', // 微信商户密钥,需要配置 'cert_serial' => '', // 商户证书序号,无需配置 'cert_public' => '', // 商户公钥内容,需要配置 - 'cert_private' => '', // 商户密钥内容,需要配置Ï + 'cert_private' => '', // 商户密钥内容,需要配置 'mp_cert_serial' => '', // 平台证书序号,无需配置 ( 新平台,当做微信支付证书用 ) - 'mp_cert_content' => '', // 平台证书内容,无需配置 ( 新平台,当做微信支付证书Ï用 ) + 'mp_cert_content' => '', // 平台证书内容,无需配置 ( 新平台,当做微信支付证书用 ) ]; /** diff --git a/_test/config.php b/_test/config.php index 8f298e8..38616a1 100644 --- a/_test/config.php +++ b/_test/config.php @@ -45,13 +45,8 @@ return [ 'appid' => 'wx60a43dd8161666d4', 'appsecret' => 'b4e28746f1bd73b5c6684f5e01883c36', 'encodingaeskey' => 'BJIUzE0gqlWy0GxfPp4J1oPTBmOrNDIGPNav1YFH5Z5', - // 配置商户支付参数 - 'mch_id' => "1332187001", - 'mch_key' => 'A82DC5BD1F3359081049C568D8502BC5', - // 配置商户支付双向证书目录 (p12 | key,cert 二选一,两者都配置时p12优先) - 'ssl_p12' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . '1332187001_20181030_cert.p12', - // 'ssl_key' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . '1332187001_20181030_key.pem', - // 'ssl_cer' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . '1332187001_20181030_cert.pem', // 配置缓存目录,需要拥有写权限 'cache_path' => '', + // 其他支付参数可以合并在这里 + // ... ]; \ No newline at end of file diff --git a/_test/pay-config.php b/_test/pay-config.php new file mode 100644 index 0000000..b9ed98f --- /dev/null +++ b/_test/pay-config.php @@ -0,0 +1,54 @@ + function ($name, $value, $expired = 360) { +// var_dump(func_get_args()); +// return $value; +// }, +// 'get' => function ($name) { +// var_dump(func_get_args()); +// return $value; +// }, +// 'del' => function ($name) { +// var_dump(func_get_args()); +// return true; +// }, +// 'put' => function ($name) { +// var_dump(func_get_args()); +// return $filePath; +// }, +// ]; + +return [ + 'appid' => 'wx60a43dd8161666d4', + // 配置商户支付参数 + 'mch_id' => "1332187001", + 'mch_key' => 'A82DC5BD1F3359081049C568D8502BC5', + // 配置商户支付双向证书目录 (p12 | key,cert 二选一,两者都配置时p12优先) + 'ssl_p12' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . '1332187001_20181030_cert.p12', + // 'ssl_key' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . '1332187001_20181030_key.pem', + // 'ssl_cer' => __DIR__ . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR . '1332187001_20181030_cert.pem', + // 配置缓存目录,需要拥有写权限 + 'cache_path' => '', +]; \ No newline at end of file diff --git a/_test/pay-download-bill.php b/_test/pay-download-bill.php index b5bcfbb..cbc6e35 100644 --- a/_test/pay-download-bill.php +++ b/_test/pay-download-bill.php @@ -20,7 +20,7 @@ try { include "../include.php"; // 2. 准备公众号配置参数 - $config = include "./config.php"; + $config = include "./pay-config.php"; // 3. 创建接口实例 // $wechat = new \WeChat\Pay($config); diff --git a/_test/pay-order-close.php b/_test/pay-order-close.php index b330c6a..061b8e3 100644 --- a/_test/pay-order-close.php +++ b/_test/pay-order-close.php @@ -20,7 +20,7 @@ try { include "../include.php"; // 2. 准备公众号配置参数 - $config = include "./config.php"; + $config = include "./pay-config.php"; // 3. 创建接口实例 // $wechat = new \WeChat\Pay($config); diff --git a/_test/pay-order-create.php b/_test/pay-order-create.php index d2afc7f..6b5ccce 100644 --- a/_test/pay-order-create.php +++ b/_test/pay-order-create.php @@ -20,7 +20,7 @@ try { include "../include.php"; // 2. 准备公众号配置参数 - $config = include "./config.php"; + $config = include "./pay-config.php"; // 3. 创建接口实例 // $wechat = new \WeChat\Pay($config); diff --git a/_test/pay-order-notify.php b/_test/pay-order-notify.php index 32a84f5..a1e755b 100644 --- a/_test/pay-order-notify.php +++ b/_test/pay-order-notify.php @@ -20,7 +20,7 @@ try { include "../include.php"; // 2. 准备公众号配置参数 - $config = include "./config.php"; + $config = include "./pay-config.php"; // 3. 创建接口实例 // $wechat = new \WeChat\Pay($config); diff --git a/_test/pay-order-query.php b/_test/pay-order-query.php index 23e9178..a569e23 100644 --- a/_test/pay-order-query.php +++ b/_test/pay-order-query.php @@ -20,7 +20,7 @@ try { include "../include.php"; // 2. 准备公众号配置参数 - $config = include "./config.php"; + $config = include "./pay-config.php"; // 3. 创建接口实例 // $wechat = new \WeChat\Pay($config); diff --git a/_test/pay-redpack-create.php b/_test/pay-redpack-create.php index f614f59..c6591fe 100644 --- a/_test/pay-redpack-create.php +++ b/_test/pay-redpack-create.php @@ -20,7 +20,7 @@ try { include "../include.php"; // 2. 准备公众号配置参数 - $config = include "./config.php"; + $config = include "./pay-config.php"; // 3. 创建接口实例 // $wechat = new \WePay\Redpack($config); diff --git a/_test/pay-refund-create.php b/_test/pay-refund-create.php index 21e79d5..25ccb55 100644 --- a/_test/pay-refund-create.php +++ b/_test/pay-refund-create.php @@ -20,7 +20,7 @@ try { include "../include.php"; // 2. 准备公众号配置参数 - $config = include "./config.php"; + $config = include "./pay-config.php"; // 3. 创建接口实例 // $wechat = new \WeChat\Pay($config); diff --git a/_test/pay-refund-query.php b/_test/pay-refund-query.php index 3af6db3..edf0d0f 100644 --- a/_test/pay-refund-query.php +++ b/_test/pay-refund-query.php @@ -20,7 +20,7 @@ try { include "../include.php"; // 2. 准备公众号配置参数 - $config = include "./config.php"; + $config = include "./pay-config.php"; // 3. 创建接口实例 // $wechat = new \WeChat\Pay($config); diff --git a/_test/pay-transfers-create.php b/_test/pay-transfers-create.php index 4053445..a9d70e0 100644 --- a/_test/pay-transfers-create.php +++ b/_test/pay-transfers-create.php @@ -20,7 +20,7 @@ try { include "../include.php"; // 2. 准备公众号配置参数 - $config = include "./config.php"; + $config = include "./pay-config.php"; // 3. 创建接口实例 // $wechat = new \WeChat\Pay($config); diff --git a/_test/pay-transfersbank-create.php b/_test/pay-transfersbank-create.php index 885ab24..3bc3496 100644 --- a/_test/pay-transfersbank-create.php +++ b/_test/pay-transfersbank-create.php @@ -20,7 +20,7 @@ try { include "../include.php"; // 2. 准备公众号配置参数 - $config = include "./config.php"; + $config = include "./pay-config.php"; // 3. 创建接口实例 // $wechat = new \WeChat\Pay($config); diff --git a/_test/pay-v3-config.php b/_test/pay-v3-config.php index 900d43c..d5aa74a 100644 --- a/_test/pay-v3-config.php +++ b/_test/pay-v3-config.php @@ -16,16 +16,24 @@ $certPublic = << '', + 'appid' => 'wxbbc5782d4d77a43b', // 必填,微信商户编号ID - 'mch_id' => '', + 'mch_id' => '1643053551', // 必填,微信商户V3接口密钥 - 'mch_v3_key' => '', - // 可选,微信商户证书序列号,可从公钥中提取 - 'cert_serial' => '', - // 必填,微信商户证书公钥,支持证书内容或文件路径 - 'cert_public' => $certPublic, - // 必填,微信商户证书私钥,支持证书内容或文件路径 - 'cert_private' => $certPrivate, + 'mch_v3_key' => 'ThinkAdminThinkAdminThinkAdminTh', + // 可选,微信商户证书序列号,可从公钥中提取,请求签名使用 + 'cert_serial' => '', + // 必填,微信商户证书公钥,支持证书内容或文件路径,仅用于提取序号 + 'cert_public' => $certPublic, + // 必填,微信商户证书私钥,支持证书内容或文件路径,用请求数据签名 + 'cert_private' => $certPrivate, + // 可选,微信平台证书序号或支付证书序号,用于接口请求序号 + 'mp_cert_serial' => 'PUB_KEY_ID_0116430535512025030300389200001906', + // 可选,微信平台证书内容或支付证书内容 + 'mp_cert_content' => $certPayment, // 可选,运行时的文件缓存路径 - 'cache_path' => '' + 'cache_path' => '' ]; \ No newline at end of file