mirror of
https://gitee.com/zoujingli/WeChatDeveloper.git
synced 2025-12-27 01:06:57 +08:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c901adfb29 | ||
|
|
15622a4009 | ||
|
|
8dd0601357 | ||
|
|
cdf88da1a9 | ||
|
|
59ca095072 | ||
|
|
1182a2dc97 | ||
|
|
97825e0556 | ||
|
|
c617666343 | ||
|
|
7b291e343c | ||
|
|
0885bd4c5a | ||
|
|
1f0b17fd1c | ||
|
|
989fd68111 | ||
|
|
882fcc60a8 | ||
|
|
fc62209e64 | ||
|
|
d0955ea5c7 | ||
|
|
4d9994b0a2 | ||
|
|
78c941a558 | ||
|
|
1095b6c192 | ||
|
|
1443769c52 | ||
|
|
5b6b09b955 | ||
|
|
4a624380ea | ||
|
|
1701ad0e48 | ||
|
|
bd5b36373c | ||
|
|
6e349d997d | ||
|
|
c909d97e12 | ||
|
|
ff8a0eacf0 | ||
|
|
4eec331f7f | ||
|
|
c4db8b7ee8 | ||
|
|
4cd6c1206f | ||
|
|
a21c12f775 | ||
|
|
bc70e420bd | ||
|
|
02d9243b40 |
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
2
We.php
2
We.php
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
@ -628,4 +628,17 @@ class Card extends BasicWeChat
|
||||
$url = "https://api.weixin.qq.com/card/pay/getorderlist?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开卡插件参数
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getActivateUrl(array $data)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/card/membercard/activate/geturl?access_token=ACCESS_TOKEN";
|
||||
return $this->callPostApi($url, $data);
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
@ -152,6 +152,22 @@ abstract class BasicAliPay
|
||||
return $this->getResult($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝订单退款查询
|
||||
* @param array|string $options 退款参数或退款商户订单号
|
||||
* @param array|null $queryOptions 查询选项
|
||||
* @return array|bool
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function refundQuery($options, $queryOptions = null)
|
||||
{
|
||||
if (!is_array($options)) $options = ['out_trade_no' => $options];
|
||||
empty($queryOptions) || $options['query_options'] = $queryOptions;
|
||||
$this->options->set('method', 'alipay.trade.fastpay.refund.query');
|
||||
return $this->getResult($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭支付宝进行中的订单
|
||||
* @param array|string $options
|
||||
@ -350,6 +366,9 @@ abstract class BasicAliPay
|
||||
*/
|
||||
private function getRootCertSN($sign)
|
||||
{
|
||||
if (strlen($sign) < 500 && file_exists($sign)) {
|
||||
$sign = file_get_contents($sign);
|
||||
}
|
||||
$sn = null;
|
||||
$array = explode('-----END CERTIFICATE-----', $sign);
|
||||
for ($i = 0; $i < count($array) - 1; $i++) {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
209
WeMini/Insurance.php
Normal file
209
WeMini/Insurance.php
Normal file
@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// | 免责声明 ( https://thinkadmin.top/disclaimer )
|
||||
// +----------------------------------------------------------------------
|
||||
// | gitee 代码仓库:https://gitee.com/zoujingli/WeChatDeveloper
|
||||
// | github 代码仓库:https://github.com/zoujingli/WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace WeMini;
|
||||
|
||||
use WeChat\Contracts\BasicWeChat;
|
||||
|
||||
/**
|
||||
* 小程序运费险
|
||||
* Class Insurance
|
||||
* @package WeMini
|
||||
*/
|
||||
class Insurance extends BasicWeChat
|
||||
{
|
||||
|
||||
/**
|
||||
* 开通无忧退货接口
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function open()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/business/insurance_freight/open?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, [], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询开通状态接口
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function queryOpen()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/business/insurance_freight/query_open?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, [], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 投保接口(发货时投保)
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function createOrder($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/business/insurance_freight/createorder?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 理赔接口 (收到用户退货后再触发)
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function claim($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/business/insurance_freight/claim?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请充值订单号接口 (支持自定义金额)
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function createChargeId($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/business/insurance_freight/createchargeid?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请支付接口
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function applyPay($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/business/insurance_freight/applypay?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取充值订单信息接口
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getPayOrderList($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/business/insurance_freight/getpayorderlist?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退款接口
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function refund($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/business/insurance_freight/refund?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取摘要接口 (查询当前保费、投保单量、理赔单量、账号余额等信息)
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getSummary($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/business/insurance_freight/getsummary?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取保单信息接口
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getOrderList($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/business/insurance_freight/getorderlist?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置告警余额接口
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function updateNotifyFunds($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/business/insurance_freight/update_notify_funds?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建退货 ID
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function returnAdd($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/no_worry_return/add?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退货 ID 状态
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function returnGet($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/no_worry_return/get?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查解绑退货 ID
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function returnUbind($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/no_worry_return/unbind?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
@ -110,7 +110,7 @@ class Logistics extends BasicWeChat
|
||||
*/
|
||||
public function getQuota($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/path/get?access_token=ACCESS_TOKEN';
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/quota/get?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
@ -191,4 +191,47 @@ class Logistics extends BasicWeChat
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/path/update?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绑定/解绑物流账号
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function bindAccount($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/account/bind?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有绑定的物流账号
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getAllAccount($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/account/getall?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取运单数据
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function batchGetOrder($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/order/batchget?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
@ -38,4 +38,33 @@ class Operation extends BasicWeChat
|
||||
$url = 'https://api.weixin.qq.com/wxaapi/userlog/userlog_search?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 mediaId 图片
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getFeedbackmedia($data)
|
||||
{
|
||||
$query = http_build_query($data);
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/media/getfeedbackmedia?'. $query .'&access_token=ACCESS_TOKEN';
|
||||
return $this->callGetApi($url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实时日志查询
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getFeedback($data)
|
||||
{
|
||||
$query = http_build_query($data);
|
||||
$url = 'https://api.weixin.qq.com/wxaapi/userlog/userlog_search?'.$query.'&access_token=ACCESS_TOKEN';
|
||||
return $this->callGetApi($url);
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
95
WeMini/Shopping.php
Normal file
95
WeMini/Shopping.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// | 免责声明 ( https://thinkadmin.top/disclaimer )
|
||||
// +----------------------------------------------------------------------
|
||||
// | gitee 代码仓库:https://gitee.com/zoujingli/WeChatDeveloper
|
||||
// | github 代码仓库:https://github.com/zoujingli/WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace WeMini;
|
||||
|
||||
use WeChat\Contracts\BasicWeChat;
|
||||
|
||||
/**
|
||||
* 小程序购物订单
|
||||
* Class Shopping
|
||||
* @package WeMini
|
||||
*/
|
||||
class Shopping extends BasicWeChat
|
||||
{
|
||||
|
||||
/**
|
||||
* 上传购物详情
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function uploadShoppingInfo($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/user-order/orders?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传物流信息
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function uploadShippingInfo($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/user-order/orders?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传合单购物详情
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function uploadCombinedShoppingInfo($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/user-order/orders?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传合单物流信息
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function uploadCombinedShippingInfo($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/user-order/orders?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证购物订单上传结果
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function ShoppingInfoVerifyUploadResult($data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/user-order/shoppinginfo/verify?access_token=ACCESS_TOKEN';
|
||||
return $this->callPostApi($url, $data, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
@ -42,13 +42,17 @@ class Cert extends BasicWePay
|
||||
public function download()
|
||||
{
|
||||
try {
|
||||
$aes = new DecryptAes($this->config['mch_v3_key']);
|
||||
$result = $this->doRequest('GET', '/v3/certificates');
|
||||
$certs = [];
|
||||
$result = $this->doRequest('GET', '/v3/certificates');
|
||||
if (empty($result['data']) && !empty($result['message'])) {
|
||||
throw new InvalidResponseException($result['message']);
|
||||
}
|
||||
$decrypt = new DecryptAes($this->config['mch_v3_key']);
|
||||
foreach ($result['data'] as $vo) {
|
||||
$certs[$vo['serial_no']] = [
|
||||
'expire' => strtotime($vo['expire_time']),
|
||||
'content' => $aes->decryptToString(
|
||||
'serial' => $vo['serial_no'],
|
||||
'content' => $decrypt->decryptToString(
|
||||
$vo['encrypt_certificate']['associated_data'],
|
||||
$vo['encrypt_certificate']['nonce'],
|
||||
$vo['encrypt_certificate']['ciphertext']
|
||||
|
||||
147
WePayV3/Complaints.php
Normal file
147
WePayV3/Complaints.php
Normal file
@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
namespace WePayV3;
|
||||
|
||||
use WePayV3\Contracts\BasicWePay;
|
||||
|
||||
/**
|
||||
* 普通商户消费者投诉2.0
|
||||
* @class Complaints
|
||||
* @package WePayV3
|
||||
*/
|
||||
class Complaints extends BasicWePay
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询投诉列表
|
||||
* @param int $offset 分页开始位置
|
||||
* @param int $limit 分页大小
|
||||
* @param String $begin_date 开始日期
|
||||
* @param String $end_date 结束日期
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function complaintList($offset, $limit, $begin_date, $end_date)
|
||||
{
|
||||
$mchId = $this->config['mch_id'];
|
||||
$pathinfo = "/v3/merchant-service/complaints-v2?limit={$limit}&offset={$offset}&begin_date={$begin_date}&end_date={$end_date}&complainted_mchid={$mchId}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询投诉详情
|
||||
* @param string $complaint_id 被投诉单号
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function complaintDetails($complaint_id)
|
||||
{
|
||||
$pathinfo = "/v3/merchant-service/complaints-v2/{$complaint_id}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询投诉协商历史
|
||||
* @param string $complaint_id 被投诉单号
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function negotiationHistory($complaint_id)
|
||||
{
|
||||
$pathinfo = "/v3/merchant-service/complaints-v2/{$complaint_id}/negotiation-historys";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建投诉通知回调地址
|
||||
* @param string $url 回调通知地址
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function CreateComplaintsNotify($url)
|
||||
{
|
||||
return $this->doRequest('POST', '/v3/merchant-service/complaint-notifications', json_encode(['url' => $url], JSON_UNESCAPED_UNICODE), true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询投诉通知回调地址
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function queryComplaintsNotify()
|
||||
{
|
||||
return $this->doRequest('GET', '/v3/merchant-service/complaint-notifications', '', true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新投诉通知回调地址
|
||||
* @param string $url 回调通知地址
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function updateComplaintsNotify($url)
|
||||
{
|
||||
return $this->doRequest('PUT', '/v3/merchant-service/complaint-notifications', json_encode(['url' => $url], JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除投诉通知回调地址
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function deleteComplaintsNotify()
|
||||
{
|
||||
return $this->doRequest('DELETE', '/v3/merchant-service/complaint-notifications', '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 回复投诉
|
||||
* @param string $complaint_id 被投诉单号
|
||||
* @param array $content 回复内容
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function replyInfo($complaint_id, array $content)
|
||||
{
|
||||
$content['complainted_mchid'] = $this->config['mch_id'];
|
||||
$pathinfo = "/v3/merchant-service/complaints-v2/{$complaint_id}/response";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($content, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈处理完成
|
||||
* @param string $complaint_id 被投诉单号
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function completeComplaints($complaint_id)
|
||||
{
|
||||
$mchId = $this->config['mch_id'];
|
||||
$pathinfo = "/v3/merchant-service/complaints-v2/{$complaint_id}/complete";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode(['complainted_mchid' => $mchId], JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片请求接口
|
||||
* @param string $pathinfo
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function downLoadImg($pathinfo)
|
||||
{
|
||||
return $this->doRequest('GET', $pathinfo, '', true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片上传接口
|
||||
* @param array $imginfo
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function uploadImg(array $imginfo)
|
||||
{
|
||||
return $this->doRequest('POST', '/v3/merchant-service/images/upload', json_encode($imginfo, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
@ -39,7 +39,7 @@ abstract class BasicWePay
|
||||
* 实例对象静态缓存
|
||||
* @var array
|
||||
*/
|
||||
static $cache = [];
|
||||
protected static $cache = [];
|
||||
|
||||
/**
|
||||
* 自动配置平台证书
|
||||
@ -58,8 +58,9 @@ abstract class BasicWePay
|
||||
'cert_serial' => '', // 商户证书序号,无需配置
|
||||
'cert_public' => '', // 商户公钥内容,需要配置
|
||||
'cert_private' => '', // 商户密钥内容,需要配置
|
||||
'mp_cert_serial' => '', // 平台证书序号,无需配置
|
||||
'mp_cert_content' => '', // 平台证书内容,无需配置
|
||||
'cert_package' => [], // 平台证书或支付证书配置
|
||||
'mp_cert_serial' => '', // 平台证书序号,无需配置 ( 指定平台证书或支付公钥 )
|
||||
'mp_cert_content' => '', // 平台证书内容,无需配置 ( 指定平台证书或支付公钥 )
|
||||
];
|
||||
|
||||
/**
|
||||
@ -117,9 +118,21 @@ abstract class BasicWePay
|
||||
Tools::$cache_path = $options['cache_path'];
|
||||
}
|
||||
|
||||
// 自动配置平台证书
|
||||
if ($this->autoCert) {
|
||||
$this->_autoCert();
|
||||
// 批量设置自定义证书
|
||||
if (isset($options['cert_package']) && is_array($options['cert_package'])) {
|
||||
foreach ($options['cert_package'] as $key => $cert) {
|
||||
$this->withCertContent($key, $cert);
|
||||
}
|
||||
}
|
||||
|
||||
// 自动配置平台证书或支付公钥
|
||||
if (empty($options['mp_cert_serial']) || empty($options['mp_cert_content'])) {
|
||||
if ($this->autoCert && !$this->withCertPayment()) {
|
||||
$this->_autoCert();
|
||||
}
|
||||
} elseif ($this->withCertContent($options['mp_cert_serial'], $options['mp_cert_content'])) {
|
||||
$this->config['mp_cert_serial'] = $options['mp_cert_serial'];
|
||||
$this->config['mp_cert_content'] = $options['mp_cert_content'];
|
||||
}
|
||||
|
||||
// 服务商参数支持
|
||||
@ -206,6 +219,83 @@ abstract class BasicWePay
|
||||
return $isjson ? json_decode($content, true) : $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟发起上传请求
|
||||
* @param string $pathinfo 请求路由
|
||||
* @param string $filename 文件本地路径
|
||||
* @param boolean $verify 是否验证
|
||||
* @param boolean $isjson 返回JSON
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function doUpload($pathinfo, $filename, $verify = false, $isjson = true)
|
||||
{
|
||||
$filedata = file_get_contents($filename);
|
||||
$fileinfo = [
|
||||
'sha256' => hash("sha256", $filedata),
|
||||
'filename' => basename($filename)
|
||||
];
|
||||
$jsondata = json_encode($fileinfo);
|
||||
list($time, $nonce) = [time(), uniqid() . rand(1000, 9999)];
|
||||
$signstr = join("\n", ['POST', $pathinfo, $time, $nonce, $jsondata, '']);
|
||||
// 生成签名
|
||||
$sign = $this->signBuild($signstr);
|
||||
// 生成数据签名TOKEN
|
||||
$token = sprintf('mchid="%s",nonce_str="%s",timestamp="%d",serial_no="%s",signature="%s"',
|
||||
$this->config['mch_id'], $nonce, $time, $this->config['cert_serial'], $sign
|
||||
);
|
||||
$location = (preg_match('|^https?://|', $pathinfo) ? '' : $this->base) . $pathinfo;
|
||||
$boundary = mt_rand(100000000000000000, 999999999999999999);
|
||||
$header = [
|
||||
'Accept: application/json',
|
||||
"Content-Type: multipart/form-data; boundary={$boundary}",
|
||||
'User-Agent: https://thinkadmin.top',
|
||||
"Authorization: WECHATPAY2-SHA256-RSA2048 {$token}",
|
||||
"serial_no: {$this->config['mp_cert_serial']}",
|
||||
"nonce_str: {$nonce}",
|
||||
"signature: {$sign}"
|
||||
];
|
||||
$line = [];
|
||||
$line[] = "--{$boundary}";
|
||||
$line[] = "Content-Disposition: form-data; name=\"meta\"";
|
||||
$line[] = "Content-Type: application/json";
|
||||
$line[] = "";
|
||||
$line[] = $jsondata;
|
||||
$line[] = "--{$boundary}";
|
||||
$line[] = "Content-Disposition: form-data; name=\"file\"; filename=\"{$fileinfo['filename']}\";";
|
||||
$line[] = "Content-Type: image/jpg";
|
||||
$line[] = "";
|
||||
$line[] = $filedata;
|
||||
$line[] = "--{$boundary}--";
|
||||
$postdata = join("\r\n", $line);
|
||||
list($header, $content) = $this->_doRequestCurl('POST', $location, [
|
||||
'data' => $postdata, 'header' => $header,
|
||||
]);
|
||||
if ($verify) {
|
||||
$headers = [];
|
||||
foreach (explode("\n", $header) as $line) {
|
||||
if (stripos($line, 'Wechatpay') !== false) {
|
||||
list($name, $value) = explode(':', $line);
|
||||
list(, $keys) = explode('wechatpay-', strtolower($name));
|
||||
$headers[$keys] = trim($value);
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (empty($headers)) {
|
||||
return $isjson ? json_decode($content, true) : $content;
|
||||
}
|
||||
$string = join("\n", [$headers['timestamp'], $headers['nonce'], $content, '']);
|
||||
if (!$this->signVerify($string, $headers['signature'], $headers['serial'])) {
|
||||
throw new InvalidResponseException('验证响应签名失败');
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
throw new InvalidResponseException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
}
|
||||
return $isjson ? json_decode($content, true) : $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过CURL模拟网络请求
|
||||
* @param string $method 请求方法
|
||||
@ -260,8 +350,11 @@ abstract class BasicWePay
|
||||
*/
|
||||
protected function signVerify($data, $sign, $serial)
|
||||
{
|
||||
$cert = $this->_getCert($serial);
|
||||
return @openssl_verify($data, base64_decode($sign), openssl_x509_read($cert), 'sha256WithRSAEncryption');
|
||||
if (stripos($serial, 'PUB_KEY_ID_') !== false && !empty($this->config['cert_package'][$serial])) {
|
||||
return openssl_verify($data, base64_decode($sign), $this->config['cert_package'][$serial], OPENSSL_ALGO_SHA256);
|
||||
} else {
|
||||
return openssl_verify($data, base64_decode($sign), openssl_x509_read($this->_getCert($serial)), 'sha256WithRSAEncryption');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -274,14 +367,27 @@ abstract class BasicWePay
|
||||
protected function _getCert($serial = '')
|
||||
{
|
||||
$certs = $this->tmpFile("{$this->config['mch_id']}_certs");
|
||||
if (empty($certs) || empty($certs[$serial]['content'])) {
|
||||
if (empty($certs) || empty($certs[$serial]['serial']) || empty($certs[$serial]['content'])) {
|
||||
Cert::instance($this->config)->download();
|
||||
$certs = $this->tmpFile("{$this->config['mch_id']}_certs");
|
||||
}
|
||||
if (empty($certs[$serial]['content']) || $certs[$serial]['expire'] < time()) {
|
||||
throw new InvalidResponseException("读取平台证书失败!");
|
||||
foreach ($certs as $cert) {
|
||||
if (!empty($cert['serial']) && !empty($cert['content']) && $cert['expire'] > time()) {
|
||||
$this->config['cert_package'][$cert['serial']] = $cert['content'];
|
||||
if (empty($this->config['mp_cert_serial']) && (empty($serial) || $serial === $cert['serial'])) {
|
||||
$this->config['mp_cert_serial'] = $cert['serial'];
|
||||
$this->config['mp_cert_content'] = $cert['content'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($this->config['cert_package'][$serial])) {
|
||||
return $this->config['cert_package'][$serial];
|
||||
} elseif (!empty($this->config['mp_cert_content'])) {
|
||||
return $this->config['mp_cert_content'];
|
||||
} elseif ($cert = $this->withCertPayment()) {
|
||||
return $cert;
|
||||
} else {
|
||||
return $certs[$serial]['content'];
|
||||
throw new InvalidResponseException("读取平台证书失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,11 +411,13 @@ abstract class BasicWePay
|
||||
throw new InvalidResponseException("读取平台证书失败!");
|
||||
}
|
||||
foreach ($certs as $k => $v) if ($v['expire'] > time() + 10) {
|
||||
$this->config['mp_cert_serial'] = $k;
|
||||
$this->config['mp_cert_content'] = $v['content'];
|
||||
break;
|
||||
$this->config['cert_package'][$k] = $v['content'];
|
||||
if (empty($this->config['mp_cert_serial'])) {
|
||||
$this->config['mp_cert_serial'] = $k;
|
||||
$this->config['mp_cert_content'] = $v['content'];
|
||||
}
|
||||
}
|
||||
if (empty($this->config['mp_cert_serial']) || empty($this->config['mp_cert_content'])) {
|
||||
if (empty($this->config['cert_package'])) {
|
||||
throw new InvalidResponseException("自动配置平台证书失败!");
|
||||
}
|
||||
}
|
||||
@ -349,4 +457,41 @@ abstract class BasicWePay
|
||||
throw new InvalidDecryptException('Rsa Encrypt Error.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置证书内容
|
||||
* @param string $key 证书ID或序号
|
||||
* @param string $cert 证书文本内容
|
||||
* @return string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
private function withCertContent($key, $cert)
|
||||
{
|
||||
if (substr(trim($cert), 0, 5) == '-----') {
|
||||
$this->config['cert_package'][$key] = $cert;
|
||||
} elseif (file_exists($cert)) {
|
||||
$this->config['cert_package'][$key] = file_get_contents($cert);
|
||||
} else {
|
||||
throw new InvalidResponseException("证书设置失败!");
|
||||
}
|
||||
return $cert;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付证书
|
||||
* @return mixed|string
|
||||
*/
|
||||
private function withCertPayment()
|
||||
{
|
||||
foreach ($this->config['cert_package'] as $key => $cert) {
|
||||
if (strpos($key, 'PUB_KEY_ID_') === 0) {
|
||||
if (empty($this->config['mp_cert_serial']) || empty($this->config['mp_cert_content'])) {
|
||||
$this->config['mp_cert_serial'] = $key;
|
||||
$this->config['mp_cert_content'] = $cert;
|
||||
}
|
||||
return $cert;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
@ -47,7 +47,7 @@ class Coupon extends BasicWePay
|
||||
* @return array|string
|
||||
* @throws InvalidResponseException
|
||||
*/
|
||||
public function stocksStart(string $stock_id , string $stock_creator_mchid)
|
||||
public function stocksStart($stock_id, $stock_creator_mchid)
|
||||
{
|
||||
$path = "/v3/marketing/favor/stocks/{$stock_id}/start";
|
||||
return $this->doRequest('POST', $path, json_encode(['stock_creator_mchid' => $stock_creator_mchid]), true);
|
||||
@ -60,7 +60,7 @@ class Coupon extends BasicWePay
|
||||
* @return array|string
|
||||
* @throws InvalidResponseException
|
||||
*/
|
||||
public function stocksPause(string $stock_id , string $stock_creator_mchid)
|
||||
public function stocksPause($stock_id, $stock_creator_mchid)
|
||||
{
|
||||
$path = "/v3/marketing/favor/stocks/{$stock_id}/pause";
|
||||
return $this->doRequest('POST', $path, json_encode(['stock_creator_mchid' => $stock_creator_mchid]), true);
|
||||
@ -73,7 +73,7 @@ class Coupon extends BasicWePay
|
||||
* @return array|string
|
||||
* @throws InvalidResponseException
|
||||
*/
|
||||
public function stocksRestart(string $stock_id , string $stock_creator_mchid)
|
||||
public function stocksRestart($stock_id, $stock_creator_mchid)
|
||||
{
|
||||
$path = "/v3/marketing/favor/stocks/{$stock_id}/restart";
|
||||
return $this->doRequest('POST', $path, json_encode(['stock_creator_mchid' => $stock_creator_mchid]), true);
|
||||
@ -86,7 +86,7 @@ class Coupon extends BasicWePay
|
||||
* @return array|string
|
||||
* @throws InvalidResponseException
|
||||
*/
|
||||
public function stocksDetail(string $stock_id , string $stock_creator_mchid)
|
||||
public function stocksDetail($stock_id, $stock_creator_mchid)
|
||||
{
|
||||
$path = "/v3/marketing/favor/stocks/{$stock_id}?stock_creator_mchid={$stock_creator_mchid}";
|
||||
return $this->doRequest('GET', $path, '', true);
|
||||
@ -122,7 +122,7 @@ class Coupon extends BasicWePay
|
||||
* @return array|string
|
||||
* @throws InvalidResponseException
|
||||
*/
|
||||
public function couponsSend( array $param)
|
||||
public function couponsSend(array $param)
|
||||
{
|
||||
$path = "/v3/marketing/favor/users/{$param['openid']}/coupons";
|
||||
return $this->doRequest('POST', $path, json_encode($param), true);
|
||||
@ -148,11 +148,9 @@ class Coupon extends BasicWePay
|
||||
* @return array|string
|
||||
* @throws InvalidResponseException
|
||||
*/
|
||||
public function couponsDetail( string $openid , string $coupon_id , string $appid)
|
||||
public function couponsDetail($openid, $coupon_id, $appid)
|
||||
{
|
||||
$path = "/v3/marketing/favor/users/{$openid}/coupons/{$coupon_id}?appid={$appid}";
|
||||
return $this->doRequest('GET', $path,'', true);
|
||||
return $this->doRequest('GET', $path, '', true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
776
WePayV3/Ecommerce.php
Normal file
776
WePayV3/Ecommerce.php
Normal file
@ -0,0 +1,776 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// | 免责声明 ( https://thinkadmin.top/disclaimer )
|
||||
// +----------------------------------------------------------------------
|
||||
// | gitee 代码仓库:https://gitee.com/zoujingli/WeChatDeveloper
|
||||
// | github 代码仓库:https://github.com/zoujingli/WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace WePayV3;
|
||||
|
||||
use WeChat\Contracts\Tools;
|
||||
use WePayV3\Contracts\BasicWePay;
|
||||
|
||||
/**
|
||||
* 平台收付通
|
||||
* @class Ecommerce
|
||||
* @package WePayV3
|
||||
*/
|
||||
class Ecommerce extends BasicWePay
|
||||
{
|
||||
/**
|
||||
* 提交申请单(商户进件)
|
||||
* @param array $data 进件参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidDecryptException
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function ecommerceApplyments($data)
|
||||
{
|
||||
if (isset($data['id_card_info'])) {
|
||||
if (isset($data['id_card_info']['id_card_name'])) $data['id_card_info']['id_card_name'] = $this->rsaEncode($data['id_card_info']['id_card_name']);
|
||||
if (isset($data['id_card_info']['id_card_number'])) $data['id_card_info']['id_card_number'] = $this->rsaEncode($data['id_card_info']['id_card_number']);
|
||||
}
|
||||
if (isset($data['id_doc_info'])) {
|
||||
if (isset($data['id_doc_info']['id_doc_name'])) $data['id_doc_info']['id_doc_name'] = $this->rsaEncode($data['id_doc_info']['id_doc_name']);
|
||||
if (isset($data['id_doc_info']['id_doc_number'])) $data['id_doc_info']['id_doc_number'] = $this->rsaEncode($data['id_doc_info']['id_doc_number']);
|
||||
}
|
||||
if (isset($data['contact_info'])) {
|
||||
if (isset($data['contact_info']['contact_name'])) $data['contact_info']['contact_name'] = $this->rsaEncode($data['contact_info']['contact_name']);
|
||||
if (isset($data['contact_info']['contact_id_card_number'])) $data['contact_info']['contact_id_card_number'] = $this->rsaEncode($data['contact_info']['contact_id_card_number']);
|
||||
if (isset($data['contact_info']['mobile_phone'])) $data['contact_info']['mobile_phone'] = $this->rsaEncode($data['contact_info']['mobile_phone']);
|
||||
}
|
||||
if (isset($data['account_info'])) {
|
||||
if (isset($data['account_info']['account_name'])) $data['account_info']['account_name'] = $this->rsaEncode($data['account_info']['account_name']);
|
||||
if (isset($data['account_info']['account_number'])) $data['account_info']['account_number'] = $this->rsaEncode($data['account_info']['account_number']);
|
||||
}
|
||||
if (!empty($data['ubo_info_list'])) {
|
||||
$data['ubo_info_list'] = array_map(function ($item) {
|
||||
$item['ubo_id_doc_name'] = $this->rsaEncode($item['ubo_id_doc_name']);
|
||||
$item['ubo_id_doc_number'] = $this->rsaEncode($item['ubo_id_doc_number']);
|
||||
$item['ubo_id_doc_address'] = $this->rsaEncode($item['ubo_id_doc_address']);
|
||||
return $item;
|
||||
}, $data['ubo_info_list']);
|
||||
}
|
||||
return $this->doRequest('POST', '/v3/ecommerce/applyments/', json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过业务申请编号查询申请状态(商户进件)
|
||||
* @param string $out_request_no 业务申请编号
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function ecommerceApplymentsByRequestNo($out_request_no)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/applyments/out-request-no/{$out_request_no}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过申请单ID查询申请状态(商户进件)
|
||||
* @param string $applyment_id 微信支付申请单号
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function ecommerceApplymentsByApplymentId($applyment_id)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/applyments/{$applyment_id}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改结算账户(商户进件)
|
||||
* @param string $sub_mchid 特约商户/二级商户号
|
||||
* @param array $data 包体参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function modifySettlement($sub_mchid, $data)
|
||||
{
|
||||
$pathinfo = "/v3/apply4sub/sub_merchants/{$sub_mchid}/modify-settlement";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询结算账户修改申请状态(商户进件)
|
||||
* @param string $sub_mchid 特约商户/二级商户号
|
||||
* @param string $application_no 修改结算账户申请单号
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function modifySettlementResult($sub_mchid, $application_no)
|
||||
{
|
||||
$pathinfo = "/v3/apply4sub/sub_merchants/{$sub_mchid}/application/{$application_no}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询结算账户(商户进件)
|
||||
* @param string $sub_mchid 特约商户/二级商户号
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function getSettlement($sub_mchid)
|
||||
{
|
||||
$pathinfo = "/v3/apply4sub/sub_merchants/{$sub_mchid}/settlement";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件(商户进件)
|
||||
* @param string $filename 文件目录
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function mediaUpload($filename)
|
||||
{
|
||||
return $this->doUpload('/v3/merchant/media/upload', $filename, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP下单(普通支付)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function transactionsApp($data)
|
||||
{
|
||||
$pathinfo = "/v3/pay/partner/transactions/app";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* JSAPI下单(普通支付)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function transactionsJsapi($data)
|
||||
{
|
||||
$pathinfo = "/v3/pay/partner/transactions/jsapi";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Native下单(普通支付)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function transactionsNative($data)
|
||||
{
|
||||
$pathinfo = "/v3/pay/partner/transactions/native";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* H5下单(普通支付)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function transactionsH5($data)
|
||||
{
|
||||
$pathinfo = "/v3/pay/partner/transactions/h5";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信支付订单号查询订单(普通支付)
|
||||
* @param string $transaction_id
|
||||
* @param string $sub_mchid
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function getTransactionsById($transaction_id, $sub_mchid)
|
||||
{
|
||||
$pathinfo = "/v3/pay/partner/transactions/id/{$transaction_id}";
|
||||
$pathinfo = $pathinfo . "?sp_mchid={$this->config['mch_id']}&sub_mchid={$sub_mchid}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信支付商户订单号查询订单(普通支付)
|
||||
* @param string $out_trade_no
|
||||
* @param string $sub_mchid
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function getTransactionsByTradeNo($out_trade_no, $sub_mchid)
|
||||
{
|
||||
$pathinfo = "/v3/pay/partner/transactions/out-trade-no/{$out_trade_no}";
|
||||
$pathinfo = $pathinfo . "?sp_mchid={$this->config['mch_id']}&sub_mchid={$sub_mchid}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭订单(普通支付)
|
||||
* @param string $out_trade_no 商户订单号
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function transactionsClose($out_trade_no, $data)
|
||||
{
|
||||
$pathinfo = "/v3/pay/partner/transactions/out-trade-no/{$out_trade_no}/close";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* JSAPI支付(合单下单)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function combineTransactionsJsapi($data)
|
||||
{
|
||||
$pathinfo = "/v3/combine-transactions/jsapi";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP支付(合单下单)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function combineTransactionsApp($data)
|
||||
{
|
||||
$pathinfo = "/v3/combine-transactions/app";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* H5支付(合单下单)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function combineTransactionsH5($data)
|
||||
{
|
||||
$pathinfo = "/v3/combine-transactions/h5";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Native支付(合单下单)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function combineTransactionsNative($data)
|
||||
{
|
||||
$pathinfo = "/v3/combine-transactions/native";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 合单查询(合单支付)
|
||||
* @param string $combine_out_trade_no
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function getCombineTransactionsByTradeNo($combine_out_trade_no)
|
||||
{
|
||||
$pathinfo = "/v3/combine-transactions/out-trade-no/{$combine_out_trade_no}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 合单关单(合单下单)
|
||||
* @param $combine_out_trade_no
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function combineTransactionsClose($combine_out_trade_no, $data)
|
||||
{
|
||||
$pathinfo = "/v3/combine-transactions/out-trade-no/{$combine_out_trade_no}/close";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求分账(分账)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function profitsharingOrders($data)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/profitsharing/orders";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分账结果(分账)
|
||||
* @param array $param
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function queryProfitsharingOrders($param = [])
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/profitsharing/orders?" . http_build_query($param);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求分账回退(分账)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function profitsharingReturnOrders($data)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/profitsharing/returnorders";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分账回退结果(分账)
|
||||
* @param array $param
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function queryProfitsharingReturnOrders($param = [])
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/profitsharing/returnorders?" . http_build_query($param);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完结分账(分账)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function profitsharingFinishOrder($data)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/profitsharing/finish-order";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单剩余待分金额(分账)
|
||||
* @param string $transaction_id 微信订单号
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function profitsharingReturnOrdersAmounts($transaction_id)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/profitsharing/orders/{$transaction_id}/amounts";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加分账接收方(分账)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function profitsharingReceiversAdd($data)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/profitsharing/receivers/add";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加分账接收方(分账)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function profitsharingReceiversDelete($data)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/profitsharing/receivers/delete";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求补差(补差)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function subsidiesCreate($data)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/subsidies/create";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求补差回退(补差)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function subsidiesReturn($data)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/subsidies/return";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消补差(补差)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function subsidiesCancel($data)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/subsidies/cancel";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请退款(退款)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function refundsApply($data)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/refunds/apply";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单笔退款(按商户退款单号)(退款)
|
||||
* @param string $refund_id
|
||||
* @param string $sub_mchid
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function queryRefundsById($refund_id, $sub_mchid)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/refunds/id/{$refund_id}?sub_mchid={$$sub_mchid}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单笔退款(按商户退款单号)(退款)
|
||||
* @param string $out_refund_no
|
||||
* @param string $sub_mchid
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function queryRefundsByNo($out_refund_no, $sub_mchid)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/refunds/out-refund-no/{$out_refund_no}?sub_mchid={$sub_mchid}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询垫付回补结果(退款)
|
||||
* @param string $refund_id
|
||||
* @param string $sub_mchid
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function queryRefundsReturnAdvance($refund_id, $sub_mchid)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/refunds/{$refund_id}/return-advance?sub_mchid={$sub_mchid}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 垫付退款回补
|
||||
* @param string $refund_id
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function refundsReturnAdvance($refund_id, $data)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/refunds/{$refund_id}/return-advance";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询二级商户账户实时余额API(余额查询)
|
||||
* @param string $sub_mchid
|
||||
* @param string $account_type 二级商户账户类型 BASIC: 基本账户 FEES: 手续费账户 OPERATION: 运营账户 DEPOSIT: 保证金账户
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function fundBalance($sub_mchid, $account_type = 'BASIC')
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/fund/balance/{$sub_mchid}?account_type={$account_type}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询二级商户账户日终余额API(余额查询)
|
||||
* @param string $sub_mchid
|
||||
* @param array $query
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function fundEnddayBalance($sub_mchid, $query)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/fund/enddaybalance/{$sub_mchid}?" . http_build_query($query);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收付通平台账户实时余额API(余额查询)
|
||||
* @param string $account_type
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function merchantFundBalance($account_type)
|
||||
{
|
||||
$pathinfo = "/v3/merchant/fund/balance/{$account_type}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收付通平台账户日终余额API(余额查询)
|
||||
* @param string $account_type
|
||||
* @param array $query
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function merchantEnddayBalance($account_type, $query)
|
||||
{
|
||||
$pathinfo = "/v3/merchant/fund/enddaybalance/{$account_type}?" . http_build_query($query);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 二级商户预约提现(商户提现)
|
||||
* @param array $data POST请求参数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function fundWithdraw($data)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/fund/withdraw";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 二级商户查询预约提现状态(根据商户预约提现单号查询)(商户提现)
|
||||
* @param string $out_request_no
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function queryFundWithdrawByNo($out_request_no)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/fund/withdraw/out-request-no/{$out_request_no}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 二级商户查询预约提现状态(根据微信支付预约提现单号查询)(商户提现)
|
||||
* @param string $withdraw_id
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function queryFundWithdrawById($withdraw_id)
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/fund/withdraw/{$withdraw_id}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收付通平台预约提现(商户提现)
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function merchantFundWithdraw($data)
|
||||
{
|
||||
$pathinfo = "/v3/merchant/fund/withdraw";
|
||||
return $this->doRequest('POST', $pathinfo, json_encode($data, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收付通平台查询预约提现状态(根据商户预约提现单号查询)(商户提现)
|
||||
* @param string $out_request_no
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function queryMerchantFundWithdrawByNo($out_request_no)
|
||||
{
|
||||
$pathinfo = "/v3/merchant/fund/withdraw/out-request-no/{$out_request_no}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收付通平台查询预约提现状态(根据微信支付预约提现单号查询)(商户提现)
|
||||
* @param string $withdraw_id
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function queryMerchantFundWithdrawById($withdraw_id)
|
||||
{
|
||||
$pathinfo = "/v3/merchant/fund/withdraw/withdraw-id/{$withdraw_id}";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按日下载提现异常文件(商户提现)
|
||||
* @param $bill_type
|
||||
* @param array $param
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function fundWithdrawBill($bill_type, $param = [])
|
||||
{
|
||||
$pathinfo = "/v3/merchant/fund/withdraw/bill-type/{$bill_type}?" . http_build_query($param);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请交易账单(下载账单)
|
||||
* @param $bill_type
|
||||
* @param array $param
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function tradeBill($bill_type, $param = [])
|
||||
{
|
||||
$pathinfo = "/v3/bill/tradebill?" . http_build_query($param);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 申请资金账单(下载账单)
|
||||
* @param $bill_type
|
||||
* @param array $param
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function fundFlowBill($bill_type, $param = [])
|
||||
{
|
||||
$pathinfo = "/v3/bill/fundflowbill?" . http_build_query($param);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 申请分账账单(下载账单)
|
||||
* @param string $bill_type
|
||||
* @param array $param
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function profitsharingBill($bill_type, $param = [])
|
||||
{
|
||||
$pathinfo = "/v3/profitsharing/bills?" . http_build_query($param);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 申请二级商户资金账单(下载账单)
|
||||
* @param string $bill_type
|
||||
* @param array $param
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function subFundFlowBill($bill_type, $param = [])
|
||||
{
|
||||
$pathinfo = "/v3/ecommerce/bill/fundflowbill?" . http_build_query($param);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支持个人业务的银行列表
|
||||
* @param int $offset
|
||||
* @param int $limit
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function personalBanking($offset, $limit)
|
||||
{
|
||||
$pathinfo = "/v3/capital/capitallhh/banks/personal-banking?" . http_build_query(['offset' => $offset, 'limit' => $limit]);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询省份列表
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function provinces()
|
||||
{
|
||||
$pathinfo = "/v3/capital/capitallhh/areas/provinces";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询城市列表
|
||||
* @param int $code
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function cities($code)
|
||||
{
|
||||
$pathinfo = "/v3/capital/capitallhh/areas/provinces/{$code}/cities";
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支行列表
|
||||
* @param int $code
|
||||
* @param $city
|
||||
* @param $offset
|
||||
* @param $limit
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function branches($code, $city, $offset, $limit)
|
||||
{
|
||||
$pathinfo = "/v3/capital/capitallhh/banks/{$code}/branches?" . http_build_query(['city_code' => $city, 'offset' => $offset, 'limit' => $limit]);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支持对公业务的银行列表
|
||||
* @param int $offset
|
||||
* @param int $limit
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function corporateBanking($offset, $limit)
|
||||
{
|
||||
$pathinfo = "/v3/capital/capitallhh/banks/corporate-banking?" . http_build_query(['offset' => $offset, 'limit' => $limit]);
|
||||
return $this->doRequest('GET', $pathinfo, '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过支付预订单ID获取支付参数
|
||||
* @param string $prepay_id 支付预订单ID
|
||||
* @param string $type 类型
|
||||
* @return array
|
||||
*/
|
||||
public function getJsApiParameters($prepay_id, $type = 'jsapi')
|
||||
{
|
||||
// 支付参数签名
|
||||
$time = strval(time());
|
||||
$appid = $this->config['appid'];
|
||||
$nonceStr = Tools::createNoncestr();
|
||||
if ($type === Order::WXPAY_APP) {
|
||||
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, $prepay_id, '']));
|
||||
return ['partnerId' => $this->config['mch_id'], 'prepayId' => $prepay_id, 'package' => 'Sign=WXPay', 'nonceStr' => $nonceStr, 'timeStamp' => $time, 'sign' => $sign];
|
||||
} elseif ($type === Order::WXPAY_JSAPI) {
|
||||
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, "prepay_id={$prepay_id}", '']));
|
||||
return ['appId' => $appid, 'timestamp' => $time, 'timeStamp' => $time, 'nonceStr' => $nonceStr, 'package' => "prepay_id={$prepay_id}", 'signType' => 'RSA', 'paySign' => $sign];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
@ -64,10 +64,10 @@ class Order extends BasicWePay
|
||||
$time = strval(time());
|
||||
$appid = $this->config['appid'];
|
||||
$nonceStr = Tools::createNoncestr();
|
||||
if ($type === 'app') {
|
||||
if ($type === self::WXPAY_APP) {
|
||||
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, $result['prepay_id'], '']));
|
||||
return ['partnerId' => $this->config['mch_id'], 'prepayId' => $result['prepay_id'], 'package' => 'Sign=WXPay', 'nonceStr' => $nonceStr, 'timeStamp' => $time, 'sign' => $sign];
|
||||
} elseif ($type === 'jsapi') {
|
||||
return ['appId' => $appid, 'partnerId' => $this->config['mch_id'], 'prepayId' => $result['prepay_id'], 'package' => 'Sign=WXPay', 'nonceStr' => $nonceStr, 'timeStamp' => $time, 'sign' => $sign];
|
||||
} elseif ($type === self::WXPAY_JSAPI) {
|
||||
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, "prepay_id={$result['prepay_id']}", '']));
|
||||
return ['appId' => $appid, 'timestamp' => $time, 'timeStamp' => $time, 'nonceStr' => $nonceStr, 'package' => "prepay_id={$result['prepay_id']}", 'signType' => 'RSA', 'paySign' => $sign];
|
||||
} else {
|
||||
@ -104,11 +104,11 @@ class Order extends BasicWePay
|
||||
|
||||
/**
|
||||
* 支付通知解析
|
||||
* @param array $data
|
||||
* @param array|null $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidDecryptException
|
||||
*/
|
||||
public function notify(array $data = [])
|
||||
public function notify($data = [])
|
||||
{
|
||||
if (empty($data)) {
|
||||
$data = json_decode(Tools::getRawInput(), true);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
@ -31,13 +31,12 @@ class ProfitSharing extends BasicWePay
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function create($options)
|
||||
public function create(array $options)
|
||||
{
|
||||
$options['appid'] = $this->config['appid'];
|
||||
return $this->doRequest('POST', '/v3/profitsharing/orders', json_encode($options, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询分账结果
|
||||
* @param string $outOrderNo 商户分账单号
|
||||
@ -57,7 +56,7 @@ class ProfitSharing extends BasicWePay
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function unfreeze($options)
|
||||
public function unfreeze(array $options)
|
||||
{
|
||||
return $this->doRequest('POST', '/v3/profitsharing/orders/unfreeze', json_encode($options, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
@ -78,11 +77,15 @@ class ProfitSharing extends BasicWePay
|
||||
* 添加分账接收方
|
||||
* @param array $options
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidDecryptException
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function addReceiver($options)
|
||||
public function addReceiver(array $options)
|
||||
{
|
||||
$options['appid'] = $this->config['appid'];
|
||||
if (isset($options['name'])) {
|
||||
$options['name'] = $this->rsaEncode($options['name']);
|
||||
}
|
||||
return $this->doRequest('POST', "/v3/profitsharing/receivers/add", json_encode($options, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
@ -92,9 +95,21 @@ class ProfitSharing extends BasicWePay
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function deleteReceiver($options)
|
||||
public function deleteReceiver(array $options)
|
||||
{
|
||||
$options['appid'] = $this->config['appid'];
|
||||
return $this->doRequest('POST', "/v3/profitsharing/receivers/delete", json_encode($options, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求分账回退
|
||||
* @param array $options
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function backspace(array $options)
|
||||
{
|
||||
$options['appid'] = $this->config['appid'];
|
||||
return $this->doRequest('POST', "/v3/profitsharing/return-orders", json_encode($options, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
@ -25,6 +25,37 @@ use WePayV3\Contracts\BasicWePay;
|
||||
*/
|
||||
class Transfers extends BasicWePay
|
||||
{
|
||||
|
||||
/**
|
||||
* 新版商家转换到零钱
|
||||
* @param $body
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidDecryptException
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @link https://pay.weixin.qq.com/doc/v3/merchant/4012716434
|
||||
*/
|
||||
public function bills($body)
|
||||
{
|
||||
if (empty($body['appid'])) {
|
||||
$body['appid'] = $this->config['appid'];
|
||||
}
|
||||
if (!empty($body['user_name'])) {
|
||||
$body['user_name'] = $this->rsaEncode($body['user_name']);
|
||||
}
|
||||
return $this->doRequest('POST', '/v3/fund-app/mch-transfer/transfer-bills', json_encode($body, JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询转账结果
|
||||
* @param $out_bill_no
|
||||
* @return array|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
*/
|
||||
public function billsQuery($out_bill_no)
|
||||
{
|
||||
return $this->doRequest('GET', "/v3/fund-app/mch-transfer/transfer-bills/out-bill-no/{$out_bill_no}", '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起商家批量转账
|
||||
* @param array $body
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
|
||||
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://thinkadmin.top
|
||||
// +----------------------------------------------------------------------
|
||||
@ -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' => '',
|
||||
// 其他支付参数可以合并在这里
|
||||
// ...
|
||||
];
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user