Passed
Pull Request — master (#913)
by Songda
01:55
created

H5PayPlugin::assembly()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 17
rs 9.9
cc 1
nc 1
nop 2
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\Direction\ResponseDirection;
10
use Yansongda\Pay\Logger;
11
use Yansongda\Pay\Rocket;
12
13
/**
14
 * @see https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=754&apiservId=448&version=V2.2&bussType=0
15
 */
16
class H5PayPlugin implements PluginInterface
17
{
18
    public function assembly(Rocket $rocket, Closure $next): Rocket
19
    {
20
        Logger::debug('[Unipay][OnlineGateway][H5PayPlugin] 插件开始装载', ['rocket' => $rocket]);
21
22
        $rocket->setDirection(ResponseDirection::class)
23
            ->mergePayload([
24
                '_url' => 'gateway/api/frontTransReq.do',
25
                'accessType' => '0',
26
                'bizType' => '000201',
27
                'txnType' => '01',
28
                'txnSubType' => '01',
29
                'channelType' => '08',
30
            ]);
31
32
        Logger::info('[Unipay][OnlineGateway][H5PayPlugin] 插件装载完毕', ['rocket' => $rocket]);
33
34
        return $next($rocket);
35
    }
36
}
37