Compare commits

...

8 Commits

Author SHA1 Message Date
邹景立
5b6b09b955 feat: 添加获取开卡插件参数 2024-11-18 22:10:27 +08:00
邹景立
4a624380ea fix: 修复接口并增加完善 2024-11-08 20:50:57 +08:00
邹景立
1701ad0e48 格式化代码 2024-11-07 22:17:20 +08:00
邹景立
bd5b36373c fix: 增加小程序运费险 2024-11-07 22:16:24 +08:00
邹景立
6e349d997d fix: 调整代码去除不需要的代码 2024-10-17 16:15:06 +08:00
邹景立
c909d97e12 fix: 代码使用 php5.4 格式化 2024-10-17 16:09:27 +08:00
邹景立
ff8a0eacf0
Merge pull request #88 from fxiaotao/master
新增通商户消费者投诉2.0
2024-10-17 16:03:49 +08:00
承诺
4eec331f7f
新增通商户消费者投诉2.0 2024-10-17 12:01:29 +08:00
5 changed files with 433 additions and 6 deletions

View File

@ -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);
}
}

209
WeMini/Insurance.php Normal file
View File

@ -0,0 +1,209 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2024 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);
}
}

View File

@ -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);
}
}

147
WePayV3/Complaints.php Normal file
View 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);
}
}

View File

@ -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);
}
}