1 | <?php |
||
16 | class Payment |
||
17 | { |
||
18 | /** |
||
19 | * Scheme base path. |
||
20 | */ |
||
21 | const SCHEME_PATH = 'weixin://wxpay/bizpayurl'; |
||
22 | |||
23 | /** |
||
24 | * @var API |
||
25 | */ |
||
26 | protected $api; |
||
27 | |||
28 | /** |
||
29 | * Merchant instance. |
||
30 | * |
||
31 | * @var \EntWeChat\Payment\Merchant |
||
32 | */ |
||
33 | protected $merchant; |
||
34 | |||
35 | /** |
||
36 | * Constructor. |
||
37 | * |
||
38 | * @param Merchant $merchant |
||
39 | */ |
||
40 | public function __construct(Merchant $merchant) |
||
44 | |||
45 | /** |
||
46 | * Build payment scheme for product. |
||
47 | * |
||
48 | * @param string $productId |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | public function scheme($productId) |
||
66 | |||
67 | /** |
||
68 | * Handle payment notify. |
||
69 | * |
||
70 | * @param callable $callback |
||
71 | * |
||
72 | * @return Response |
||
73 | */ |
||
74 | public function handleNotify(callable $callback) |
||
101 | |||
102 | /** |
||
103 | * Handle native scan notify. |
||
104 | * https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4 |
||
105 | * The callback shall return string of prepay_id or throw an exception. |
||
106 | * |
||
107 | * @param callable $callback |
||
108 | * |
||
109 | * @return Response |
||
110 | */ |
||
111 | public function handleScanNotify(callable $callback) |
||
143 | |||
144 | /** |
||
145 | * [WeixinJSBridge] Generate js config for payment. |
||
146 | * |
||
147 | * <pre> |
||
148 | * WeixinJSBridge.invoke( |
||
149 | * 'getBrandWCPayRequest', |
||
150 | * ... |
||
151 | * ); |
||
152 | * </pre> |
||
153 | * |
||
154 | * @param string $prepayId |
||
155 | * @param bool $json |
||
156 | * |
||
157 | * @return string|array |
||
158 | */ |
||
159 | public function configForPayment($prepayId, $json = true) |
||
173 | |||
174 | /** |
||
175 | * [JSSDK] Generate js config for payment. |
||
176 | * |
||
177 | * <pre> |
||
178 | * wx.chooseWXPay({...}); |
||
179 | * </pre> |
||
180 | * |
||
181 | * @param string $prepayId |
||
182 | * |
||
183 | * @return array|string |
||
184 | */ |
||
185 | public function configForJSSDKPayment($prepayId) |
||
194 | |||
195 | /** |
||
196 | * Generate app payment parameters. |
||
197 | * |
||
198 | * @param string $prepayId |
||
199 | * |
||
200 | * @return array |
||
201 | */ |
||
202 | public function configForAppPayment($prepayId) |
||
217 | |||
218 | /** |
||
219 | * Generate js config for share user address. |
||
220 | * |
||
221 | * @param string|\Overtrue\Socialite\AccessTokenInterface $accessToken |
||
222 | * @param bool $json |
||
223 | * |
||
224 | * @return string|array |
||
225 | */ |
||
226 | public function configForShareAddress($accessToken, $json = true) |
||
254 | |||
255 | /** |
||
256 | * Merchant setter. |
||
257 | * |
||
258 | * @param Merchant $merchant |
||
259 | */ |
||
260 | public function setMerchant(Merchant $merchant) |
||
264 | |||
265 | /** |
||
266 | * Merchant getter. |
||
267 | * |
||
268 | * @return Merchant |
||
269 | */ |
||
270 | public function getMerchant() |
||
274 | |||
275 | /** |
||
276 | * Return Notify instance. |
||
277 | * |
||
278 | * @return \EntWeChat\Payment\Notify |
||
279 | */ |
||
280 | public function getNotify() |
||
284 | |||
285 | /** |
||
286 | * API setter. |
||
287 | * |
||
288 | * @param API $api |
||
289 | */ |
||
290 | public function setAPI(API $api) |
||
294 | |||
295 | /** |
||
296 | * Return API instance. |
||
297 | * |
||
298 | * @return API |
||
299 | */ |
||
300 | public function getAPI() |
||
304 | |||
305 | /** |
||
306 | * Magic call. |
||
307 | * |
||
308 | * @param string $method |
||
309 | * @param array $args |
||
310 | * |
||
311 | * @return mixed |
||
312 | * |
||
313 | * @codeCoverageIgnore |
||
314 | */ |
||
315 | public function __call($method, $args) |
||
321 | } |
||
322 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.