diff --git a/ProfitSharing.php b/ProfitSharing.php deleted file mode 100644 index aa2e405..0000000 --- a/ProfitSharing.php +++ /dev/null @@ -1,114 +0,0 @@ -config['appid']; - return $this->doRequest('POST', '/v3/profitsharing/orders', json_encode($options, JSON_UNESCAPED_UNICODE), true); - } - - - /** - * 查询分账结果 - * @param string $outOrderNo 商户分账单号 - * @param string $transactionId 微信订单号 - * @return array - * @throws \WeChat\Exceptions\InvalidResponseException - */ - public function query(string $outOrderNo, string $transactionId) - { - $pathinfo = "/v3/profitsharing/orders/{$outOrderNo}?&transaction_id={$transactionId}"; - return $this->doRequest('GET', $pathinfo, '', true); - } - - /** - * 解冻剩余资金 - * @param array $options - * @return array - * @throws \WeChat\Exceptions\InvalidResponseException - */ - public function unfreeze(array $options) - { - return $this->doRequest('POST', '/v3/profitsharing/orders/unfreeze', json_encode($options, JSON_UNESCAPED_UNICODE), true); - } - - /** - * 查询剩余待分金额 - * @param string $transactionId 微信订单号 - * @return array - * @throws \WeChat\Exceptions\InvalidResponseException - */ - public function amounts(string $transactionId) - { - $pathinfo = "/v3/profitsharing/transactions/{$transactionId}/amounts"; - return $this->doRequest('GET', $pathinfo, '', true); - } - - /** - * 添加分账接收方 - * @param array $options - * @return array - * @throws \WeChat\Exceptions\InvalidResponseException - */ - 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); - } - - /** - * 删除分账接收方 - * @param array $options - * @return array - * @throws \WeChat\Exceptions\InvalidResponseException - */ - 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); - } -} diff --git a/Complaints.php b/WePayV3/Complaints.php similarity index 96% rename from Complaints.php rename to WePayV3/Complaints.php index 4a90437..0ec281c 100644 --- a/Complaints.php +++ b/WePayV3/Complaints.php @@ -1,147 +1,147 @@ -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); - } +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); + } } \ No newline at end of file diff --git a/WePayV3/ProfitSharing.php b/WePayV3/ProfitSharing.php index f64d34b..cf8aeb1 100644 --- a/WePayV3/ProfitSharing.php +++ b/WePayV3/ProfitSharing.php @@ -20,7 +20,7 @@ use WePayV3\Contracts\BasicWePay; /** * 普通商户商家分账 - * @class ProfitSharing + * Class Profitsharing * @package WePayV3 */ class ProfitSharing extends BasicWePay @@ -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); + } }