1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the overtrue/wechat. |
5
|
|
|
* |
6
|
|
|
* (c) overtrue <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the MIT license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace EasyWeChat\Payment\Merchant; |
13
|
|
|
|
14
|
|
|
use EasyWeChat\Payment\Kernel\BaseClient; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class Client. |
18
|
|
|
* |
19
|
|
|
* @author mingyoung <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
class Client extends BaseClient |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* Add sub-merchant. |
25
|
|
|
* |
26
|
|
|
* @param array $params |
27
|
|
|
* |
28
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
29
|
|
|
*/ |
30
|
|
|
public function addSubMerchant(array $params) |
31
|
|
|
{ |
32
|
|
|
return $this->manage($params, ['action' => 'add']); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Query sub-merchant by merchant id. |
37
|
|
|
* |
38
|
|
|
* @param string $id |
39
|
|
|
* |
40
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
41
|
|
|
*/ |
42
|
|
|
public function querySubMerchantByMerchantId(string $id) |
43
|
|
|
{ |
44
|
|
|
$params = [ |
45
|
|
|
'micro_mch_id' => $id, |
46
|
|
|
]; |
47
|
|
|
|
48
|
|
|
return $this->manage($params, ['action' => 'query']); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Query sub-merchant by wechat id. |
53
|
|
|
* |
54
|
|
|
* @param string $id |
55
|
|
|
* |
56
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
57
|
|
|
*/ |
58
|
|
|
public function querySubMerchantByWeChatId(string $id) |
59
|
|
|
{ |
60
|
|
|
$params = [ |
61
|
|
|
'recipient_wechatid' => $id, |
62
|
|
|
]; |
63
|
|
|
|
64
|
|
|
return $this->manage($params, ['action' => 'query']); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param array $params |
69
|
|
|
* @param array $query |
70
|
|
|
* |
71
|
|
|
*@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
72
|
|
|
*/ |
73
|
|
|
protected function manage(array $params, array $query) |
74
|
|
|
{ |
75
|
|
|
return $this->safeRequest('secapi/mch/submchmanage', $params, 'post', compact('query')); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|