|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of the wannanbigpig/alipay. |
|
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\Payment\Pay; |
|
12
|
|
|
|
|
13
|
|
|
use EasyAlipay\Payment\Kernel\BaseClient; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Class Client |
|
17
|
|
|
* |
|
18
|
|
|
* @author liuml <[email protected]> |
|
19
|
|
|
* @DateTime 2019-07-22 14:36 |
|
20
|
|
|
*/ |
|
21
|
|
|
class Client extends BaseClient |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* alipay.trade.app.pay(app支付接口2.0). |
|
25
|
|
|
* |
|
26
|
|
|
* @param array $params |
|
27
|
|
|
* |
|
28
|
|
|
* @return string |
|
29
|
|
|
* |
|
30
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
31
|
|
|
*/ |
|
32
|
1 |
|
public function app(array $params) |
|
33
|
|
|
{ |
|
34
|
1 |
|
$method = 'alipay.trade.app.pay'; |
|
35
|
1 |
|
$params['timeout_express'] = $params['timeout_express'] ?? '1c'; |
|
36
|
1 |
|
$this->app->setEndpointConfig($method, [ |
|
37
|
1 |
|
'return_url' => $this->app['config']->get('return_url'), |
|
38
|
1 |
|
'notify_url' => $this->app['config']->get('notify_url'), |
|
39
|
|
|
]); |
|
40
|
|
|
|
|
41
|
1 |
|
return $this->sdkExecute($method, [ |
|
42
|
1 |
|
'biz_content' => $params, |
|
43
|
|
|
]); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* alipay.trade.wap.pay(手机网站支付接口2.0). |
|
48
|
|
|
* |
|
49
|
|
|
* @param array $params |
|
50
|
|
|
* @param string $httpMethod |
|
51
|
|
|
* |
|
52
|
|
|
* @return string |
|
53
|
|
|
* |
|
54
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
55
|
|
|
*/ |
|
56
|
1 |
|
public function wap(array $params, string $httpMethod = 'POST') |
|
57
|
|
|
{ |
|
58
|
1 |
|
$method = 'alipay.trade.wap.pay'; |
|
59
|
1 |
|
$params['timeout_express'] = $params['timeout_express'] ?? '1c'; |
|
60
|
1 |
|
$this->app->setEndpointConfig($method, [ |
|
61
|
1 |
|
'return_url' => $this->app['config']->get('return_url'), |
|
62
|
1 |
|
'notify_url' => $this->app['config']->get('notify_url'), |
|
63
|
|
|
]); |
|
64
|
|
|
|
|
65
|
1 |
|
return $this->pageExecute($method, [ |
|
66
|
1 |
|
'biz_content' => $params, |
|
67
|
1 |
|
], $httpMethod); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* alipay.trade.page.pay(统一收单下单并支付页面接口). |
|
72
|
|
|
* |
|
73
|
|
|
* @param array $params |
|
74
|
|
|
* @param string $httpMethod |
|
75
|
|
|
* |
|
76
|
|
|
* @return string |
|
77
|
|
|
* |
|
78
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
|
79
|
|
|
*/ |
|
80
|
1 |
|
public function pc(array $params, string $httpMethod = 'POST') |
|
81
|
|
|
{ |
|
82
|
1 |
|
$method = 'alipay.trade.page.pay'; |
|
83
|
1 |
|
$params = array_merge([ |
|
84
|
1 |
|
'timeout_express' => $params['timeout_express'] ?? '1c', |
|
85
|
1 |
|
'product_code' => 'FAST_INSTANT_TRADE_PAY', |
|
86
|
1 |
|
], $params); |
|
87
|
1 |
|
$this->app->setEndpointConfig($method, [ |
|
88
|
1 |
|
'return_url' => $this->app['config']->get('return_url'), |
|
89
|
1 |
|
'notify_url' => $this->app['config']->get('notify_url'), |
|
90
|
|
|
]); |
|
91
|
|
|
|
|
92
|
1 |
|
return $this->pageExecute($method, [ |
|
93
|
1 |
|
'biz_content' => $params, |
|
94
|
1 |
|
], $httpMethod); |
|
95
|
|
|
} |
|
96
|
|
|
} |
|
97
|
|
|
|