Passed
Pull Request — master (#662)
by Songda
01:53
created

QueryPlugin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getUri() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Plugin\Unipay\QrCode;
6
7
use function Yansongda\Pay\get_unipay_config;
8
9
use Yansongda\Pay\Pay;
10
use Yansongda\Pay\Rocket;
11
12
/**
13
 * @see https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=792&apiservId=468&version=V2.2&bussType=0
14
 */
15
class QueryPlugin extends \Yansongda\Pay\Plugin\Unipay\OnlineGateway\QueryPlugin
16
{
17
    /**
18
     * @throws \Yansongda\Pay\Exception\ContainerException
19
     * @throws \Yansongda\Pay\Exception\ServiceNotFoundException
20
     */
21
    protected function getUri(Rocket $rocket): string
22
    {
23
        $config = get_unipay_config($rocket->getParams());
24
25
        if (Pay::MODE_SANDBOX === ($config['mode'] ?? Pay::MODE_NORMAL)) {
26
            return 'https://101.231.204.80:5000/gateway/api/backTransReq.do';
27
        }
28
29
        return parent::getUri($rocket);
30
    }
31
}
32