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\ServiceMarket; |
12
|
|
|
|
13
|
|
|
use EasyAlipay\Kernel\Support\Support; |
14
|
|
|
|
15
|
|
|
class Client extends Support |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* alipay.open.servicemarket.order.query(订购插件订单明细查询). |
19
|
|
|
* |
20
|
|
|
* @param string $commodityOrderId |
21
|
|
|
* @param int $startPage |
22
|
|
|
* |
23
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
24
|
|
|
* |
25
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
26
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
27
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
28
|
|
|
*/ |
29
|
2 |
|
public function orderQuery(string $commodityOrderId, int $startPage = 1) |
30
|
|
|
{ |
31
|
2 |
|
$method = 'alipay.open.servicemarket.order.query'; |
32
|
|
|
$params = [ |
33
|
2 |
|
'commodity_order_id' => $commodityOrderId, |
34
|
2 |
|
'start_page' => $startPage, |
35
|
|
|
]; |
36
|
|
|
|
37
|
2 |
|
return $this->request($method, [ |
38
|
2 |
|
'biz_content' => $params, |
39
|
|
|
]); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* alipay.open.servicemarket.order.accept(服务商接单操作). |
44
|
|
|
* |
45
|
|
|
* @param string $commodityOrderId |
46
|
|
|
* |
47
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
48
|
|
|
* |
49
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
50
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
51
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
52
|
|
|
*/ |
53
|
2 |
|
public function orderAccept(string $commodityOrderId) |
54
|
|
|
{ |
55
|
2 |
|
$method = 'alipay.open.servicemarket.order.accept'; |
56
|
|
|
$params = [ |
57
|
2 |
|
'commodity_order_id' => $commodityOrderId, |
58
|
|
|
]; |
59
|
|
|
|
60
|
2 |
|
return $this->request($method, [ |
61
|
2 |
|
'biz_content' => $params, |
62
|
|
|
]); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* alipay.open.servicemarket.order.item.complete(服务商完成订单内单个明细实施项). |
67
|
|
|
* |
68
|
|
|
* @param string $commodityOrderId |
69
|
|
|
* @param string $shopId |
70
|
|
|
* |
71
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
72
|
|
|
* |
73
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
74
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
75
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
76
|
|
|
*/ |
77
|
2 |
|
public function orderItemComplete(string $commodityOrderId, string $shopId = null) |
78
|
|
|
{ |
79
|
2 |
|
$method = 'alipay.open.servicemarket.order.item.complete'; |
80
|
2 |
|
$params = array_filter([ |
81
|
2 |
|
'commodity_order_id' => $commodityOrderId, |
82
|
2 |
|
'shop_id' => $shopId, |
83
|
2 |
|
], function ($value) { |
84
|
2 |
|
return !($this->checkEmpty($value)); |
85
|
2 |
|
}); |
86
|
|
|
|
87
|
2 |
|
return $this->request($method, [ |
88
|
2 |
|
'biz_content' => $params, |
89
|
|
|
]); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* alipay.open.servicemarket.order.item.confirm(服务商代商家确认实施完成). |
94
|
|
|
* |
95
|
|
|
* @param string $commodityOrderId |
96
|
|
|
* @param string|null $shopId |
97
|
|
|
* |
98
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
99
|
|
|
* |
100
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
101
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
102
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
103
|
|
|
*/ |
104
|
2 |
|
public function orderItemConfirm(string $commodityOrderId, string $shopId = null) |
105
|
|
|
{ |
106
|
2 |
|
$method = 'alipay.open.servicemarket.order.item.confirm'; |
107
|
2 |
|
$params = array_filter([ |
108
|
2 |
|
'commodity_order_id' => $commodityOrderId, |
109
|
2 |
|
'shop_id' => $shopId, |
110
|
2 |
|
], function ($value) { |
111
|
2 |
|
return !($this->checkEmpty($value)); |
112
|
2 |
|
}); |
113
|
|
|
|
114
|
2 |
|
return $this->request($method, [ |
115
|
2 |
|
'biz_content' => $params, |
116
|
|
|
]); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* alipay.open.servicemarket.commodity.shop.offline(门店插件下架操作). |
121
|
|
|
* |
122
|
|
|
* @param string $commodityId |
123
|
|
|
* @param string $shopId |
124
|
|
|
* |
125
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
126
|
|
|
* |
127
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
128
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
129
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
130
|
|
|
*/ |
131
|
2 |
|
public function commodityShopOffline(string $commodityId, string $shopId) |
132
|
|
|
{ |
133
|
2 |
|
$method = 'alipay.open.servicemarket.commodity.shop.offline'; |
134
|
|
|
$params = [ |
135
|
2 |
|
'commodity_id' => $commodityId, |
136
|
2 |
|
'shop_id' => $shopId, |
137
|
|
|
]; |
138
|
|
|
|
139
|
2 |
|
return $this->request($method, [ |
140
|
2 |
|
'biz_content' => $params, |
141
|
|
|
]); |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* alipay.open.servicemarket.commodity.shop.online(门店插件上架操作). |
146
|
|
|
* |
147
|
|
|
* @param string $commodityId |
148
|
|
|
* @param string $shopId |
149
|
|
|
* |
150
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
151
|
|
|
* |
152
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
153
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
154
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
155
|
|
|
*/ |
156
|
2 |
|
public function commodityShopOnline(string $commodityId, string $shopId) |
157
|
|
|
{ |
158
|
2 |
|
$method = 'alipay.open.servicemarket.commodity.shop.online'; |
159
|
|
|
$params = [ |
160
|
2 |
|
'commodity_id' => $commodityId, |
161
|
2 |
|
'shop_id' => $shopId, |
162
|
|
|
]; |
163
|
|
|
|
164
|
2 |
|
return $this->request($method, [ |
165
|
2 |
|
'biz_content' => $params, |
166
|
|
|
]); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* alipay.open.servicemarket.order.reject(服务商拒绝接单). |
171
|
|
|
* |
172
|
|
|
* @param string $commodityOrderId |
173
|
|
|
* @param string $rejectReason |
174
|
|
|
* |
175
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
176
|
|
|
* |
177
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
178
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
179
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
180
|
|
|
*/ |
181
|
2 |
|
public function orderReject(string $commodityOrderId, string $rejectReason) |
182
|
|
|
{ |
183
|
2 |
|
$method = 'alipay.open.servicemarket.order.reject'; |
184
|
|
|
$params = [ |
185
|
2 |
|
'commodity_order_id' => $commodityOrderId, |
186
|
2 |
|
'reject_reason' => $rejectReason, |
187
|
|
|
]; |
188
|
|
|
|
189
|
2 |
|
return $this->request($method, [ |
190
|
2 |
|
'biz_content' => $params, |
191
|
|
|
]); |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* alipay.open.servicemarket.order.item.cancel(服务订单明细实施项单项取消). |
196
|
|
|
* |
197
|
|
|
* @param string $commodityOrderId |
198
|
|
|
* @param string $shopId |
199
|
|
|
* @param string $cancelReason |
200
|
|
|
* |
201
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
202
|
|
|
* |
203
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
204
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
205
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
206
|
|
|
*/ |
207
|
2 |
|
public function orderItemCancel(string $commodityOrderId, string $shopId, string $cancelReason) |
208
|
|
|
{ |
209
|
2 |
|
$method = 'alipay.open.servicemarket.order.item.cancel'; |
210
|
|
|
$params = [ |
211
|
2 |
|
'commodity_order_id' => $commodityOrderId, |
212
|
2 |
|
'shop_id' => $shopId, |
213
|
2 |
|
'cancel_reason' => $cancelReason, |
214
|
|
|
]; |
215
|
|
|
|
216
|
2 |
|
return $this->request($method, [ |
217
|
2 |
|
'biz_content' => $params, |
218
|
|
|
]); |
219
|
|
|
} |
220
|
|
|
} |
221
|
|
|
|