ScanPayPlugin   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A assembly() 0 14 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\PCreditPayInstallment;
6
7
use Closure;
8
use Yansongda\Artful\Contract\PluginInterface;
9
use Yansongda\Artful\Exception\ContainerException;
10
use Yansongda\Artful\Exception\ServiceNotFoundException;
11
use Yansongda\Artful\Logger;
12
use Yansongda\Artful\Rocket;
13
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
14
15
/**
16
 * @see https://opendocs.alipay.com/open/02np92?pathHash=de4742e0&ref=api
17
 */
18
class ScanPayPlugin implements PluginInterface
19
{
20
    use SupportServiceProviderTrait;
21
22
    /**
23
     * @throws ContainerException
24
     * @throws ServiceNotFoundException
25
     */
26
    public function assembly(Rocket $rocket, Closure $next): Rocket
27
    {
28
        Logger::debug('[Alipay][Fund][PCreditPayInstallment][ScanPayPlugin] 插件开始装载', ['rocket' => $rocket]);
29
30
        $this->loadAlipayServiceProvider($rocket);
31
32
        $rocket->mergePayload([
33
            'method' => 'alipay.trade.precreate',
34
            'biz_content' => $rocket->getParams(),
35
        ]);
36
37
        Logger::info('[Alipay][Fund][PCreditPayInstallment][ScanPayPlugin] 插件装载完毕', ['rocket' => $rocket]);
38
39
        return $next($rocket);
40
    }
41
}
42