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\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
|
|
|
* @param string|null $returnUrl |
28
|
|
|
* |
29
|
|
|
* @return string |
30
|
|
|
* |
31
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
32
|
|
|
*/ |
33
|
2 |
|
public function app(array $params, string $returnUrl = null) |
34
|
|
|
{ |
35
|
2 |
|
$method = 'alipay.trade.app.pay'; |
36
|
2 |
|
$params = array_merge([ |
37
|
2 |
|
'timeout_express' => '1c', |
38
|
|
|
'product_code' => 'QUICK_MSECURITY_PAY', |
39
|
2 |
|
], $params); |
40
|
|
|
|
41
|
2 |
|
$this->app->setEndpointConfig($method, [ |
42
|
2 |
|
'return_url' => $returnUrl ?: $this->app['config']->get('return_url'), |
43
|
2 |
|
'notify_url' => $this->app['config']->get('notify_url'), |
44
|
|
|
]); |
45
|
|
|
|
46
|
2 |
|
return $this->sdkExecute($method, [ |
47
|
2 |
|
'biz_content' => $params, |
48
|
|
|
]); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* alipay.trade.wap.pay(手机网站支付接口2.0). |
53
|
|
|
* |
54
|
|
|
* @param array $params |
55
|
|
|
* @param string $httpMethod |
56
|
|
|
* @param string|null $returnUrl |
57
|
|
|
* |
58
|
|
|
* @return string |
59
|
|
|
* |
60
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
61
|
|
|
*/ |
62
|
2 |
|
public function wap(array $params, string $httpMethod = 'POST', string $returnUrl = null) |
63
|
|
|
{ |
64
|
2 |
|
$method = 'alipay.trade.wap.pay'; |
65
|
2 |
|
$params = array_merge([ |
66
|
2 |
|
'timeout_express' => '1c', |
67
|
|
|
'product_code' => 'QUICK_WAP_WAY', |
68
|
2 |
|
], $params); |
69
|
|
|
|
70
|
2 |
|
$this->app->setEndpointConfig($method, [ |
71
|
2 |
|
'return_url' => $returnUrl ?: $this->app['config']->get('return_url'), |
72
|
2 |
|
'notify_url' => $this->app['config']->get('notify_url'), |
73
|
|
|
]); |
74
|
|
|
|
75
|
2 |
|
return $this->pageExecute($method, [ |
76
|
2 |
|
'biz_content' => $params, |
77
|
2 |
|
], $httpMethod); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* alipay.trade.page.pay(统一收单下单并支付页面接口). |
82
|
|
|
* |
83
|
|
|
* @param array $params |
84
|
|
|
* @param string $httpMethod |
85
|
|
|
* @param string|null $returnUrl |
86
|
|
|
* |
87
|
|
|
* @return string |
88
|
|
|
* |
89
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
90
|
|
|
*/ |
91
|
2 |
|
public function pc(array $params, string $httpMethod = 'POST', string $returnUrl = null) |
92
|
|
|
{ |
93
|
2 |
|
$method = 'alipay.trade.page.pay'; |
94
|
2 |
|
$params = array_merge([ |
95
|
2 |
|
'timeout_express' => '1c', |
96
|
|
|
'product_code' => 'FAST_INSTANT_TRADE_PAY', |
97
|
2 |
|
], $params); |
98
|
2 |
|
$this->app->setEndpointConfig($method, [ |
99
|
2 |
|
'return_url' => $returnUrl ?: $this->app['config']->get('return_url'), |
100
|
2 |
|
'notify_url' => $this->app['config']->get('notify_url'), |
101
|
|
|
]); |
102
|
|
|
|
103
|
2 |
|
return $this->pageExecute($method, [ |
104
|
2 |
|
'biz_content' => $params, |
105
|
2 |
|
], $httpMethod); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* zoloz.authentication.customer.smilepay.initialize(人脸初始化唤起zim). |
110
|
|
|
* |
111
|
|
|
* @param string $zimmetainfo |
112
|
|
|
* |
113
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
114
|
|
|
* |
115
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
116
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
117
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
118
|
|
|
*/ |
119
|
2 |
|
public function face(string $zimmetainfo) |
120
|
|
|
{ |
121
|
2 |
|
$method = 'zoloz.authentication.customer.smilepay.initialize'; |
122
|
|
|
$params = [ |
123
|
2 |
|
'zimmetainfo' => $zimmetainfo, |
124
|
|
|
]; |
125
|
|
|
|
126
|
2 |
|
return $this->request($method, [ |
127
|
2 |
|
'biz_content' => $params, |
128
|
|
|
]); |
129
|
|
|
} |
130
|
|
|
} |
131
|
|
|
|