Passed
Push — master ( 1dfbea...9713c0 )
by Songda
02:53 queued 51s
created

QueryPlugin::getUri()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Plugin\Unipay\OnlineGateway;
6
7
use Closure;
8
use Yansongda\Pay\Contract\PluginInterface;
9
use Yansongda\Pay\Logger;
10
use Yansongda\Pay\Rocket;
11
12
/**
13
 * @see https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=757&apiservId=448&version=V2.2&bussType=0
14
 */
15
class QueryPlugin implements PluginInterface
16
{
17
    public function assembly(Rocket $rocket, Closure $next): Rocket
18
    {
19
        Logger::debug('[Unipay][OnlineGateway][QueryPlugin] 插件开始装载', ['rocket' => $rocket]);
20
21
        $payload = $rocket->getPayload();
22
23
        $rocket->mergePayload([
24
            '_url' => 'gateway/api/queryTrans.do',
25
            'accessType' => $payload?->get('accessType') ?? '0',
26
            'bizType' => $payload?->get('bizType') ?? '000000',
27
            'txnType' => $payload?->get('txnType') ?? '00',
28
            'txnSubType' => $payload?->get('txnSubType') ?? '00',
29
        ]);
30
31
        Logger::info('[Unipay][OnlineGateway][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
32
33
        return $next($rocket);
34
    }
35
}
36