diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 21c0141d7..0330cac1d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -889,17 +889,17 @@ }, { "name": "zoujingli/wechat-developer", - "version": "v1.2.29", - "version_normalized": "1.2.29.0", + "version": "v1.2.30", + "version_normalized": "1.2.30.0", "source": { "type": "git", "url": "https://github.com/zoujingli/WeChatDeveloper.git", - "reference": "0b086a29d799ac1c7e04fedddd5ea38e4a885657" + "reference": "4ba213dceae358c028dd23a0572e0c85cb6be2aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/WeChatDeveloper/zipball/0b086a29d799ac1c7e04fedddd5ea38e4a885657", - "reference": "0b086a29d799ac1c7e04fedddd5ea38e4a885657", + "url": "https://api.github.com/repos/zoujingli/WeChatDeveloper/zipball/4ba213dceae358c028dd23a0572e0c85cb6be2aa", + "reference": "4ba213dceae358c028dd23a0572e0c85cb6be2aa", "shasum": "", "mirrors": [ { @@ -919,7 +919,7 @@ "ext-xml": "*", "php": ">=5.4" }, - "time": "2021-03-23T10:12:26+00:00", + "time": "2021-04-15T03:16:50+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/services.php b/vendor/services.php index 2c4c16f74..eb23b34e1 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\admin\\Library', diff --git a/vendor/zoujingli/wechat-developer/We.php b/vendor/zoujingli/wechat-developer/We.php index 1fdfe2fe5..cf3c887b2 100644 --- a/vendor/zoujingli/wechat-developer/We.php +++ b/vendor/zoujingli/wechat-developer/We.php @@ -88,7 +88,7 @@ class We * 定义当前版本 * @var string */ - const VERSION = '1.2.29'; + const VERSION = '1.2.30'; /** * 静态配置 diff --git a/vendor/zoujingli/wechat-developer/WeChat/Contracts/BasicWePay.php b/vendor/zoujingli/wechat-developer/WeChat/Contracts/BasicWePay.php index 46de39c8c..24a0e512b 100644 --- a/vendor/zoujingli/wechat-developer/WeChat/Contracts/BasicWePay.php +++ b/vendor/zoujingli/wechat-developer/WeChat/Contracts/BasicWePay.php @@ -170,7 +170,7 @@ class BasicWePay * @throws InvalidResponseException * @throws \WeChat\Exceptions\LocalCacheException */ - protected function callPostApi($url, array $data, $isCert = false, $signType = 'HMAC-SHA256', $needSignType = true) + protected function callPostApi($url, array $data, $isCert = false, $signType = 'HMAC-SHA256', $needSignType = true, $needNonceStr = true) { $option = []; if ($isCert) { @@ -192,7 +192,8 @@ class BasicWePay } } $params = $this->params->merge($data); - $needSignType && ($params['sign_type'] = strtoupper($signType)); + if (!$needNonceStr) unset($params['nonce_str']); + if ($needSignType) $params['sign_type'] = strtoupper($signType); $params['sign'] = $this->getPaySign($params, $signType); $result = Tools::xml2arr(Tools::post($url, Tools::arr2xml($params), $option)); if ($result['return_code'] !== 'SUCCESS') { diff --git a/vendor/zoujingli/wechat-developer/WePay/Custom.php b/vendor/zoujingli/wechat-developer/WePay/Custom.php index 2171ea4ae..21fdb3c52 100644 --- a/vendor/zoujingli/wechat-developer/WePay/Custom.php +++ b/vendor/zoujingli/wechat-developer/WePay/Custom.php @@ -1,11 +1,23 @@ callPostApi($url, $options, false, 'MD5'); + return $this->callPostApi($url, $options, false, 'MD5', false, false); } /** @@ -35,7 +47,7 @@ class Custom extends BasicWePay public function get(array $options = []) { $url = 'https://api.mch.weixin.qq.com/cgi-bin/mch/customs/customdeclarequery'; - return $this->callPostApi($url, $options, false, 'MD5'); + return $this->callPostApi($url, $options, false, 'MD5', true, false); } @@ -49,7 +61,7 @@ class Custom extends BasicWePay public function reset(array $options = []) { $url = 'https://api.mch.weixin.qq.com/cgi-bin/mch/newcustoms/customdeclareredeclare'; - return $this->callPostApi($url, $options, false, 'MD5'); + return $this->callPostApi($url, $options, false, 'MD5', true, false); } } \ No newline at end of file diff --git a/vendor/zoujingli/wechat-developer/WePayV3/Contracts/BasicWePay.php b/vendor/zoujingli/wechat-developer/WePayV3/Contracts/BasicWePay.php index 4f40e1429..0394a869f 100644 --- a/vendor/zoujingli/wechat-developer/WePayV3/Contracts/BasicWePay.php +++ b/vendor/zoujingli/wechat-developer/WePayV3/Contracts/BasicWePay.php @@ -71,6 +71,22 @@ abstract class BasicWePay throw new InvalidArgumentException("Missing Config -- [cert_public]"); } + if (stripos($options['cert_public'], '-----BEGIN CERTIFICATE-----') === false) { + if (file_exists($options['cert_public'])) { + $options['cert_public'] = file_get_contents($options['cert_public']); + } else { + throw new InvalidArgumentException("File Non-Existent -- [cert_public]"); + } + } + + if (stripos($options['cert_private'], '-----BEGIN PRIVATE KEY-----') === false) { + if (file_exists($options['cert_private'])) { + $options['cert_private'] = file_get_contents($options['cert_private']); + } else { + throw new InvalidArgumentException("File Non-Existent -- [cert_private]"); + } + } + $this->config['appid'] = isset($options['appid']) ? $options['appid'] : ''; $this->config['mch_id'] = $options['mch_id']; $this->config['mch_v3_key'] = $options['mch_v3_key']; @@ -88,7 +104,7 @@ abstract class BasicWePay * @param array $config * @return static */ - public static function instance(array $config) + public static function instance($config) { $key = md5(get_called_class() . serialize($config)); if (isset(self::$cache[$key])) return self::$cache[$key]; diff --git a/vendor/zoujingli/wechat-developer/_test/pay-v3-config.php b/vendor/zoujingli/wechat-developer/_test/pay-v3-config.php index 14d095a98..c844e3740 100644 --- a/vendor/zoujingli/wechat-developer/_test/pay-v3-config.php +++ b/vendor/zoujingli/wechat-developer/_test/pay-v3-config.php @@ -1,17 +1,26 @@ '绑定的APPID', - 'mch_id' => '您的商户编号', - 'mch_v3_key' => '您的V3接口密码', - 'cert_public' => << << '', + // 微信商户编号ID + 'mch_id' => '', + // 微信商户V3接口密钥 + 'mch_v3_key' => '', + // 微信商户证书公钥,支持证书内容或文件路径 + 'cert_public' => $certPublic, + // 微信商户证书私钥,支持证书内容或文件路径 + 'cert_private' => $certPrivate, ]; \ No newline at end of file