|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of the wannanbigpig/alipay-sdk-php. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) wannanbigpig <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* This source file is subject to the MIT license that is bundled |
|
8
|
|
|
* with this source code in the file LICENSE. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace EasyAlipay\Tripartite\Agent; |
|
12
|
|
|
|
|
13
|
|
|
use EasyAlipay\Kernel\Support\Support; |
|
14
|
|
|
|
|
15
|
|
|
class Client extends Support |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* alipay.open.agent.create(开启代商户签约、创建应用事务). |
|
19
|
|
|
* |
|
20
|
|
|
* @param string $account |
|
21
|
|
|
* @param array $contactInfo |
|
22
|
|
|
* @param string $orderTicket |
|
23
|
|
|
* |
|
24
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
|
25
|
|
|
* |
|
26
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
27
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
28
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
29
|
|
|
*/ |
|
30
|
|
|
public function create(string $account, array $contactInfo, string $orderTicket) |
|
31
|
|
|
{ |
|
32
|
|
|
$method = 'alipay.open.agent.create'; |
|
33
|
|
|
$params = array_filter([ |
|
34
|
|
|
'account' => $account, |
|
35
|
|
|
'contact_info' => $contactInfo, |
|
36
|
|
|
'order_ticket' => $orderTicket, |
|
37
|
|
|
], function ($value) { |
|
38
|
|
|
return !($this->checkEmpty($value)); |
|
39
|
|
|
}); |
|
40
|
|
|
|
|
41
|
|
|
return $this->request($method, [ |
|
42
|
|
|
'biz_content' => $params, |
|
43
|
|
|
]); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* alipay.open.agent.confirm(提交代商户签约、创建应用事务). |
|
48
|
|
|
* |
|
49
|
|
|
* @param string $batchNo |
|
50
|
|
|
* |
|
51
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
|
52
|
|
|
* |
|
53
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
54
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
55
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
56
|
|
|
*/ |
|
57
|
|
|
public function confirm(string $batchNo) |
|
58
|
|
|
{ |
|
59
|
|
|
$method = 'alipay.open.agent.confirm'; |
|
60
|
|
|
$params = [ |
|
61
|
|
|
'batch_no' => $batchNo, |
|
62
|
|
|
]; |
|
63
|
|
|
|
|
64
|
|
|
return $this->request($method, [ |
|
65
|
|
|
'biz_content' => $params, |
|
66
|
|
|
]); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* alipay.open.agent.cancel(取消代商户签约、创建应用事务). |
|
71
|
|
|
* |
|
72
|
|
|
* @param string $batchNo |
|
73
|
|
|
* |
|
74
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
|
75
|
|
|
* |
|
76
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
77
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
78
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
79
|
|
|
*/ |
|
80
|
|
|
public function cancel(string $batchNo) |
|
81
|
|
|
{ |
|
82
|
|
|
$method = 'alipay.open.agent.cancel'; |
|
83
|
|
|
$params = [ |
|
84
|
|
|
'batch_no' => $batchNo, |
|
85
|
|
|
]; |
|
86
|
|
|
|
|
87
|
|
|
return $this->request($method, [ |
|
88
|
|
|
'biz_content' => $params, |
|
89
|
|
|
]); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* alipay.open.agent.order.query(查询申请单状态). |
|
94
|
|
|
* |
|
95
|
|
|
* @param string $batchNo |
|
96
|
|
|
* |
|
97
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
|
98
|
|
|
* |
|
99
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
100
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
101
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
102
|
|
|
*/ |
|
103
|
|
|
public function query(string $batchNo) |
|
104
|
|
|
{ |
|
105
|
|
|
$method = 'alipay.open.agent.order.query'; |
|
106
|
|
|
$params = [ |
|
107
|
|
|
'batch_no' => $batchNo, |
|
108
|
|
|
]; |
|
109
|
|
|
|
|
110
|
|
|
return $this->request($method, [ |
|
111
|
|
|
'biz_content' => $params, |
|
112
|
|
|
]); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* alipay.open.agent.signstatus.query(查询商户某个产品的签约状态). |
|
117
|
|
|
* |
|
118
|
|
|
* @param string $pid |
|
119
|
|
|
* @param string $productCodes |
|
120
|
|
|
* |
|
121
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
|
122
|
|
|
* |
|
123
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
124
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
125
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
126
|
|
|
*/ |
|
127
|
|
|
public function signStatus(string $pid, string $productCodes) |
|
128
|
|
|
{ |
|
129
|
|
|
$method = 'alipay.open.agent.signstatus.query'; |
|
130
|
|
|
$params = [ |
|
131
|
|
|
'pid' => $pid, |
|
132
|
|
|
'product_codes' => $productCodes, |
|
133
|
|
|
]; |
|
134
|
|
|
|
|
135
|
|
|
return $this->request($method, [ |
|
136
|
|
|
'biz_content' => $params, |
|
137
|
|
|
]); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* alipay.open.agent.mini.create(代商家创建小程序应用). |
|
142
|
|
|
* |
|
143
|
|
|
* @param string $params |
|
144
|
|
|
* |
|
145
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
|
146
|
|
|
* |
|
147
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
148
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
149
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
150
|
|
|
*/ |
|
151
|
|
|
public function miniCreate(string $params) |
|
152
|
|
|
{ |
|
153
|
|
|
$method = 'alipay.open.agent.create'; |
|
154
|
|
|
|
|
155
|
|
|
return $this->request($method, $params); |
|
|
|
|
|
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* alipay.open.agent.mobilepay.sign(代签约APP支付产品). |
|
160
|
|
|
* |
|
161
|
|
|
* @param string $params |
|
162
|
|
|
* |
|
163
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
|
164
|
|
|
* |
|
165
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
166
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
167
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
168
|
|
|
*/ |
|
169
|
|
|
public function appPayment(string $params) |
|
170
|
|
|
{ |
|
171
|
|
|
$method = 'alipay.open.agent.mobilepay.sign'; |
|
172
|
|
|
|
|
173
|
|
|
return $this->request($method, $params); |
|
|
|
|
|
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* alipay.open.agent.facetoface.sign(代签约当面付产品). |
|
178
|
|
|
* |
|
179
|
|
|
* @param string $params |
|
180
|
|
|
* |
|
181
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
|
182
|
|
|
* |
|
183
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
184
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
185
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
186
|
|
|
*/ |
|
187
|
|
|
public function faceToFace(string $params) |
|
188
|
|
|
{ |
|
189
|
|
|
$method = 'alipay.open.agent.facetoface.sign'; |
|
190
|
|
|
|
|
191
|
|
|
return $this->request($method, $params); |
|
|
|
|
|
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* alipay.open.agent.zhimabrief.sign(代签约芝麻信用(普惠版)产品). |
|
196
|
|
|
* |
|
197
|
|
|
* @param string $params |
|
198
|
|
|
* |
|
199
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
|
200
|
|
|
* |
|
201
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
202
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
203
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
204
|
|
|
*/ |
|
205
|
|
|
public function sesameCredit(string $params) |
|
206
|
|
|
{ |
|
207
|
|
|
$method = 'alipay.open.agent.zhimabrief.sign'; |
|
208
|
|
|
|
|
209
|
|
|
return $this->request($method, $params); |
|
|
|
|
|
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
/** |
|
213
|
|
|
* alipay.open.agent.offlinepayment.sign(代签约当面付快捷版产品) . |
|
214
|
|
|
* |
|
215
|
|
|
* @param string $params |
|
216
|
|
|
* |
|
217
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
|
218
|
|
|
* |
|
219
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
|
220
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
221
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
222
|
|
|
*/ |
|
223
|
|
|
public function offlinePayment(string $params) |
|
224
|
|
|
{ |
|
225
|
|
|
$method = 'alipay.open.agent.offlinepayment.sign'; |
|
226
|
|
|
|
|
227
|
|
|
return $this->request($method, $params); |
|
|
|
|
|
|
228
|
|
|
} |
|
229
|
|
|
} |
|
230
|
|
|
|