4
4
5
5
use Omnipay \Alipay \Requests \AopCompletePurchaseRequest ;
6
6
use Omnipay \Alipay \Requests \AopTradeCancelRequest ;
7
- use Omnipay \Alipay \Requests \AopTradeOrderSettleRequest ;
8
7
use Omnipay \Alipay \Requests \AopTradeQueryRequest ;
9
8
use Omnipay \Alipay \Requests \AopTradeRefundQueryRequest ;
10
9
use Omnipay \Alipay \Requests \AopTradeRefundRequest ;
11
- use Omnipay \Alipay \Requests \DataServiceBillDownloadUrlQueryRequest ;
12
- use Omnipay \Common \AbstractGateway ;
10
+ use Omnipay \Alipay \Requests \AopTradeCloseRequest ;
13
11
use Omnipay \Common \Exception \InvalidRequestException ;
12
+
14
13
abstract class AbstractAopGateway extends \Omnipay \Common \AbstractGateway
15
14
{
16
15
protected $ endpoints = array ('production ' => 'https://openapi.alipay.com/gateway.do ' , 'sandbox ' => 'https://openapi.alipaydev.com/gateway.do ' );
16
+
17
17
public function getDefaultParameters ()
18
18
{
19
19
return array ('format ' => 'JSON ' , 'charset ' => 'UTF-8 ' , 'signType ' => 'RSA ' , 'version ' => '1.0 ' , 'timestamp ' => date ('Y-m-d H:i:s ' ), 'alipaySdk ' => 'lokielse/omnipay-alipay ' );
20
20
}
21
+
21
22
/**
22
23
* @return mixed
23
24
*/
24
25
public function getAppId ()
25
26
{
26
27
return $ this ->getParameter ('app_id ' );
27
28
}
29
+
28
30
/**
29
31
* @param $value
30
32
*
@@ -34,13 +36,15 @@ public function setAppId($value)
34
36
{
35
37
return $ this ->setParameter ('app_id ' , $ value );
36
38
}
39
+
37
40
/**
38
41
* @return mixed
39
42
*/
40
43
public function getFormat ()
41
44
{
42
45
return $ this ->getParameter ('format ' );
43
46
}
47
+
44
48
/**
45
49
* @param $value
46
50
*
@@ -50,13 +54,15 @@ public function setFormat($value)
50
54
{
51
55
return $ this ->setParameter ('format ' , $ value );
52
56
}
57
+
53
58
/**
54
59
* @return mixed
55
60
*/
56
61
public function getCharset ()
57
62
{
58
63
return $ this ->getParameter ('charset ' );
59
64
}
65
+
60
66
/**
61
67
* @param $value
62
68
*
@@ -66,13 +72,15 @@ public function setCharset($value)
66
72
{
67
73
return $ this ->setParameter ('charset ' , $ value );
68
74
}
75
+
69
76
/**
70
77
* @return mixed
71
78
*/
72
79
public function getSignType ()
73
80
{
74
81
return $ this ->getParameter ('sign_type ' );
75
82
}
83
+
76
84
/**
77
85
* @param $value
78
86
*
@@ -82,13 +90,15 @@ public function setSignType($value)
82
90
{
83
91
return $ this ->setParameter ('sign_type ' , $ value );
84
92
}
93
+
85
94
/**
86
95
* @return mixed
87
96
*/
88
97
public function getVersion ()
89
98
{
90
99
return $ this ->getParameter ('version ' );
91
100
}
101
+
92
102
/**
93
103
* @param $value
94
104
*
@@ -98,13 +108,15 @@ public function setVersion($value)
98
108
{
99
109
return $ this ->setParameter ('version ' , $ value );
100
110
}
111
+
101
112
/**
102
113
* @return mixed
103
114
*/
104
115
public function getPrivateKey ()
105
116
{
106
117
return $ this ->getParameter ('private_key ' );
107
118
}
119
+
108
120
/**
109
121
* @param $value
110
122
*
@@ -114,13 +126,15 @@ public function setPrivateKey($value)
114
126
{
115
127
return $ this ->setParameter ('private_key ' , $ value );
116
128
}
129
+
117
130
/**
118
131
* @return mixed
119
132
*/
120
133
public function getEncryptKey ()
121
134
{
122
135
return $ this ->getParameter ('encrypt_key ' );
123
136
}
137
+
124
138
/**
125
139
* @param $value
126
140
*
@@ -130,13 +144,15 @@ public function setEncryptKey($value)
130
144
{
131
145
return $ this ->setParameter ('encrypt_key ' , $ value );
132
146
}
147
+
133
148
/**
134
149
* @return mixed
135
150
*/
136
151
public function getNotifyUrl ()
137
152
{
138
153
return $ this ->getParameter ('notify_url ' );
139
154
}
155
+
140
156
/**
141
157
* @param $value
142
158
*
@@ -146,13 +162,15 @@ public function setNotifyUrl($value)
146
162
{
147
163
return $ this ->setParameter ('notify_url ' , $ value );
148
164
}
165
+
149
166
/**
150
167
* @return mixed
151
168
*/
152
169
public function getTimestamp ()
153
170
{
154
171
return $ this ->getParameter ('timestamp ' );
155
172
}
173
+
156
174
/**
157
175
* @param $value
158
176
*
@@ -162,13 +180,15 @@ public function setTimestamp($value)
162
180
{
163
181
return $ this ->setParameter ('timestamp ' , $ value );
164
182
}
183
+
165
184
/**
166
185
* @return mixed
167
186
*/
168
187
public function getAppAuthToken ()
169
188
{
170
189
return $ this ->getParameter ('app_auth_token ' );
171
190
}
191
+
172
192
/**
173
193
* @param $value
174
194
*
@@ -178,13 +198,15 @@ public function setAppAuthToken($value)
178
198
{
179
199
return $ this ->setParameter ('app_auth_token ' , $ value );
180
200
}
201
+
181
202
/**
182
203
* @return mixed
183
204
*/
184
205
public function getAlipayPublicKey ()
185
206
{
186
207
return $ this ->getParameter ('alipay_public_key ' );
187
208
}
209
+
188
210
/**
189
211
* @param $value
190
212
*
@@ -194,20 +216,23 @@ public function setAlipayPublicKey($value)
194
216
{
195
217
return $ this ->setParameter ('alipay_public_key ' , $ value );
196
218
}
219
+
197
220
/**
198
221
* @return mixed
199
222
*/
200
223
public function getEndpoint ()
201
224
{
202
225
return $ this ->getParameter ('endpoint ' );
203
226
}
227
+
204
228
/**
205
229
* @return mixed
206
230
*/
207
231
public function getAlipaySdk ()
208
232
{
209
233
return $ this ->getParameter ('alipay_sdk ' );
210
234
}
235
+
211
236
/**
212
237
* @param $value
213
238
*
@@ -217,14 +242,17 @@ public function setAlipaySdk($value)
217
242
{
218
243
return $ this ->setParameter ('alipay_sdk ' , $ value );
219
244
}
245
+
220
246
public function production ()
221
247
{
222
248
return $ this ->setEnvironment ('production ' );
223
249
}
250
+
224
251
/**
225
252
* @param $value
226
253
*
227
254
* @return $this
255
+ *
228
256
* @throws InvalidRequestException
229
257
*/
230
258
public function setEnvironment ($ value )
@@ -234,8 +262,10 @@ public function setEnvironment($value)
234
262
throw new \Omnipay \Common \Exception \InvalidRequestException ('The environment is invalid ' );
235
263
}
236
264
$ this ->setEndpoint ($ this ->endpoints [$ env ]);
265
+
237
266
return $ this ;
238
267
}
268
+
239
269
/**
240
270
* @param $value
241
271
*
@@ -245,20 +275,24 @@ public function setEndpoint($value)
245
275
{
246
276
return $ this ->setParameter ('endpoint ' , $ value );
247
277
}
278
+
248
279
public function sandbox ()
249
280
{
250
281
return $ this ->setEnvironment ('sandbox ' );
251
282
}
283
+
252
284
/**
253
285
* @param array $parameters
254
286
*
255
287
* @return AopCompletePurchaseRequest
288
+ *
256
289
* @throws InvalidRequestException
257
290
*/
258
291
public function completePurchase (array $ parameters = array ())
259
292
{
260
293
return $ this ->createRequest ('Omnipay \\Alipay \\Requests \\AopCompletePurchaseRequest ' , $ parameters );
261
294
}
295
+
262
296
/**
263
297
* Query Order Status
264
298
*
@@ -270,6 +304,7 @@ public function query(array $parameters = array())
270
304
{
271
305
return $ this ->createRequest ('Omnipay \\Alipay \\Requests \\AopTradeQueryRequest ' , $ parameters );
272
306
}
307
+
273
308
/**
274
309
* Refund
275
310
*
@@ -281,6 +316,7 @@ public function refund(array $parameters = array())
281
316
{
282
317
return $ this ->createRequest ('Omnipay \\Alipay \\Requests \\AopTradeRefundRequest ' , $ parameters );
283
318
}
319
+
284
320
/**
285
321
* Query Refund Status
286
322
*
@@ -292,6 +328,7 @@ public function refundQuery(array $parameters = array())
292
328
{
293
329
return $ this ->createRequest ('Omnipay \\Alipay \\Requests \\AopTradeRefundQueryRequest ' , $ parameters );
294
330
}
331
+
295
332
/**
296
333
* Cancel Order
297
334
*
@@ -303,6 +340,19 @@ public function cancel(array $parameters = array())
303
340
{
304
341
return $ this ->createRequest ('Omnipay \\Alipay \\Requests \\AopTradeCancelRequest ' , $ parameters );
305
342
}
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
+
306
356
/**
307
357
* Settle
308
358
*
@@ -314,6 +364,7 @@ public function settle(array $parameters = array())
314
364
{
315
365
return $ this ->createRequest ('Omnipay \\Alipay \\Requests \\AopTradeOrderSettleRequest ' , $ parameters );
316
366
}
367
+
317
368
/**
318
369
* @param array $parameters
319
370
*
@@ -323,4 +374,4 @@ public function queryBillDownloadUrl(array $parameters = array())
323
374
{
324
375
return $ this ->createRequest ('Omnipay \\Alipay \\Requests \\DataServiceBillDownloadUrlQueryRequest ' , $ parameters );
325
376
}
326
- }
377
+ }
0 commit comments