Passed
Pull Request — master (#679)
by
unknown
01:48
created

PrepayPlugin::getConfigKey()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
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 8
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Plugin\Wechat\Pay\Native;
6
7
use Yansongda\Pay\Rocket;
8
9
/**
10
 * @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_1.shtml
11
 */
12
class PrepayPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\PrepayPlugin
13
{
14
    protected function getUri(Rocket $rocket): string
15
    {
16
        return 'v3/pay/transactions/native';
17
    }
18
19
    protected function getPartnerUri(Rocket $rocket): string
20
    {
21
        return 'v3/pay/partner/transactions/native';
22
    }
23
    
24
    protected function getConfigKey(array $params): string
25
    {
26
        $key = ($params['_type'] ?? 'mp').'_app_id';
27
        if ('app_app_id' === $key) {
28
            $key = 'app_id';
29
        }
30
31
        return $key;
32
    }
33
}
34