Passed
Push — master ( 94b775...2b460f )
by Songda
01:56
created

QueryPlugin::getUri()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 2
nc 2
nop 1
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