Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 3.1852 |
Changes | 0 |
1 | <?php |
||
25 | 3 | public function toPay(string $gateway, array $payload) : Response |
|
26 | { |
||
27 | 3 | $payload['trade_type'] = Constant::WX_PAY_WAP_TYPE; |
|
28 | 3 | $object = $this->prepare(Constant::WX_PAY_PREPARE, $payload); |
|
29 | $returnUrl = $this->config->get('return_url'); |
||
30 | $mwebUrl = $object->get('mweb_url'); |
||
31 | |||
32 | if (null === $returnUrl) { |
||
33 | $url = $mwebUrl; |
||
34 | } else { |
||
35 | $url = $mwebUrl . '&redirect_url=' . urlencode($returnUrl); |
||
36 | } |
||
37 | |||
38 | return RedirectResponse::create($url); |
||
39 | } |
||
41 |