Skip to content

Commit d7e77c4

Browse files
支付宝关闭接口支持
1 parent 0bd24ae commit d7e77c4

File tree

3 files changed

+221
-7
lines changed

3 files changed

+221
-7
lines changed

src/AbstractAopGateway.php

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,29 @@
44

55
use Omnipay\Alipay\Requests\AopCompletePurchaseRequest;
66
use Omnipay\Alipay\Requests\AopTradeCancelRequest;
7-
use Omnipay\Alipay\Requests\AopTradeOrderSettleRequest;
87
use Omnipay\Alipay\Requests\AopTradeQueryRequest;
98
use Omnipay\Alipay\Requests\AopTradeRefundQueryRequest;
109
use Omnipay\Alipay\Requests\AopTradeRefundRequest;
11-
use Omnipay\Alipay\Requests\DataServiceBillDownloadUrlQueryRequest;
12-
use Omnipay\Common\AbstractGateway;
10+
use Omnipay\Alipay\Requests\AopTradeCloseRequest;
1311
use Omnipay\Common\Exception\InvalidRequestException;
12+
1413
abstract class AbstractAopGateway extends \Omnipay\Common\AbstractGateway
1514
{
1615
protected $endpoints = array('production' => 'https://openapi.alipay.com/gateway.do', 'sandbox' => 'https://openapi.alipaydev.com/gateway.do');
16+
1717
public function getDefaultParameters()
1818
{
1919
return array('format' => 'JSON', 'charset' => 'UTF-8', 'signType' => 'RSA', 'version' => '1.0', 'timestamp' => date('Y-m-d H:i:s'), 'alipaySdk' => 'lokielse/omnipay-alipay');
2020
}
21+
2122
/**
2223
* @return mixed
2324
*/
2425
public function getAppId()
2526
{
2627
return $this->getParameter('app_id');
2728
}
29+
2830
/**
2931
* @param $value
3032
*
@@ -34,13 +36,15 @@ public function setAppId($value)
3436
{
3537
return $this->setParameter('app_id', $value);
3638
}
39+
3740
/**
3841
* @return mixed
3942
*/
4043
public function getFormat()
4144
{
4245
return $this->getParameter('format');
4346
}
47+
4448
/**
4549
* @param $value
4650
*
@@ -50,13 +54,15 @@ public function setFormat($value)
5054
{
5155
return $this->setParameter('format', $value);
5256
}
57+
5358
/**
5459
* @return mixed
5560
*/
5661
public function getCharset()
5762
{
5863
return $this->getParameter('charset');
5964
}
65+
6066
/**
6167
* @param $value
6268
*
@@ -66,13 +72,15 @@ public function setCharset($value)
6672
{
6773
return $this->setParameter('charset', $value);
6874
}
75+
6976
/**
7077
* @return mixed
7178
*/
7279
public function getSignType()
7380
{
7481
return $this->getParameter('sign_type');
7582
}
83+
7684
/**
7785
* @param $value
7886
*
@@ -82,13 +90,15 @@ public function setSignType($value)
8290
{
8391
return $this->setParameter('sign_type', $value);
8492
}
93+
8594
/**
8695
* @return mixed
8796
*/
8897
public function getVersion()
8998
{
9099
return $this->getParameter('version');
91100
}
101+
92102
/**
93103
* @param $value
94104
*
@@ -98,13 +108,15 @@ public function setVersion($value)
98108
{
99109
return $this->setParameter('version', $value);
100110
}
111+
101112
/**
102113
* @return mixed
103114
*/
104115
public function getPrivateKey()
105116
{
106117
return $this->getParameter('private_key');
107118
}
119+
108120
/**
109121
* @param $value
110122
*
@@ -114,13 +126,15 @@ public function setPrivateKey($value)
114126
{
115127
return $this->setParameter('private_key', $value);
116128
}
129+
117130
/**
118131
* @return mixed
119132
*/
120133
public function getEncryptKey()
121134
{
122135
return $this->getParameter('encrypt_key');
123136
}
137+
124138
/**
125139
* @param $value
126140
*
@@ -130,13 +144,15 @@ public function setEncryptKey($value)
130144
{
131145
return $this->setParameter('encrypt_key', $value);
132146
}
147+
133148
/**
134149
* @return mixed
135150
*/
136151
public function getNotifyUrl()
137152
{
138153
return $this->getParameter('notify_url');
139154
}
155+
140156
/**
141157
* @param $value
142158
*
@@ -146,13 +162,15 @@ public function setNotifyUrl($value)
146162
{
147163
return $this->setParameter('notify_url', $value);
148164
}
165+
149166
/**
150167
* @return mixed
151168
*/
152169
public function getTimestamp()
153170
{
154171
return $this->getParameter('timestamp');
155172
}
173+
156174
/**
157175
* @param $value
158176
*
@@ -162,13 +180,15 @@ public function setTimestamp($value)
162180
{
163181
return $this->setParameter('timestamp', $value);
164182
}
183+
165184
/**
166185
* @return mixed
167186
*/
168187
public function getAppAuthToken()
169188
{
170189
return $this->getParameter('app_auth_token');
171190
}
191+
172192
/**
173193
* @param $value
174194
*
@@ -178,13 +198,15 @@ public function setAppAuthToken($value)
178198
{
179199
return $this->setParameter('app_auth_token', $value);
180200
}
201+
181202
/**
182203
* @return mixed
183204
*/
184205
public function getAlipayPublicKey()
185206
{
186207
return $this->getParameter('alipay_public_key');
187208
}
209+
188210
/**
189211
* @param $value
190212
*
@@ -194,20 +216,23 @@ public function setAlipayPublicKey($value)
194216
{
195217
return $this->setParameter('alipay_public_key', $value);
196218
}
219+
197220
/**
198221
* @return mixed
199222
*/
200223
public function getEndpoint()
201224
{
202225
return $this->getParameter('endpoint');
203226
}
227+
204228
/**
205229
* @return mixed
206230
*/
207231
public function getAlipaySdk()
208232
{
209233
return $this->getParameter('alipay_sdk');
210234
}
235+
211236
/**
212237
* @param $value
213238
*
@@ -217,14 +242,17 @@ public function setAlipaySdk($value)
217242
{
218243
return $this->setParameter('alipay_sdk', $value);
219244
}
245+
220246
public function production()
221247
{
222248
return $this->setEnvironment('production');
223249
}
250+
224251
/**
225252
* @param $value
226253
*
227254
* @return $this
255+
*
228256
* @throws InvalidRequestException
229257
*/
230258
public function setEnvironment($value)
@@ -234,8 +262,10 @@ public function setEnvironment($value)
234262
throw new \Omnipay\Common\Exception\InvalidRequestException('The environment is invalid');
235263
}
236264
$this->setEndpoint($this->endpoints[$env]);
265+
237266
return $this;
238267
}
268+
239269
/**
240270
* @param $value
241271
*
@@ -245,20 +275,24 @@ public function setEndpoint($value)
245275
{
246276
return $this->setParameter('endpoint', $value);
247277
}
278+
248279
public function sandbox()
249280
{
250281
return $this->setEnvironment('sandbox');
251282
}
283+
252284
/**
253285
* @param array $parameters
254286
*
255287
* @return AopCompletePurchaseRequest
288+
*
256289
* @throws InvalidRequestException
257290
*/
258291
public function completePurchase(array $parameters = array())
259292
{
260293
return $this->createRequest('Omnipay\\Alipay\\Requests\\AopCompletePurchaseRequest', $parameters);
261294
}
295+
262296
/**
263297
* Query Order Status
264298
*
@@ -270,6 +304,7 @@ public function query(array $parameters = array())
270304
{
271305
return $this->createRequest('Omnipay\\Alipay\\Requests\\AopTradeQueryRequest', $parameters);
272306
}
307+
273308
/**
274309
* Refund
275310
*
@@ -281,6 +316,7 @@ public function refund(array $parameters = array())
281316
{
282317
return $this->createRequest('Omnipay\\Alipay\\Requests\\AopTradeRefundRequest', $parameters);
283318
}
319+
284320
/**
285321
* Query Refund Status
286322
*
@@ -292,6 +328,7 @@ public function refundQuery(array $parameters = array())
292328
{
293329
return $this->createRequest('Omnipay\\Alipay\\Requests\\AopTradeRefundQueryRequest', $parameters);
294330
}
331+
295332
/**
296333
* Cancel Order
297334
*
@@ -303,6 +340,19 @@ public function cancel(array $parameters = array())
303340
{
304341
return $this->createRequest('Omnipay\\Alipay\\Requests\\AopTradeCancelRequest', $parameters);
305342
}
343+
344+
/**
345+
* Close Order
346+
*
347+
* @param array $parameters
348+
*
349+
* @return AopTradeCloseRequest
350+
*/
351+
public function close(array $parameters = array())
352+
{
353+
return $this->createRequest('Omnipay\\Alipay\\Requests\\AopTradeCloseRequest', $parameters);
354+
}
355+
306356
/**
307357
* Settle
308358
*
@@ -314,6 +364,7 @@ public function settle(array $parameters = array())
314364
{
315365
return $this->createRequest('Omnipay\\Alipay\\Requests\\AopTradeOrderSettleRequest', $parameters);
316366
}
367+
317368
/**
318369
* @param array $parameters
319370
*
@@ -323,4 +374,4 @@ public function queryBillDownloadUrl(array $parameters = array())
323374
{
324375
return $this->createRequest('Omnipay\\Alipay\\Requests\\DataServiceBillDownloadUrlQueryRequest', $parameters);
325376
}
326-
}
377+
}

0 commit comments

Comments
 (0)