Passed
Push — master ( bd56ba...e02069 )
by Songda
09:11 queued 07:22
created

AgreementPageSignPlugin   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A assembly() 0 16 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Plugin\Alipay\User;
6
7
use Closure;
8
use Yansongda\Pay\Contract\PluginInterface;
9
use Yansongda\Pay\Logger;
10
use Yansongda\Pay\Parser\ResponseParser;
11
use Yansongda\Pay\Rocket;
12
13
/**
14
 * @see https://opendocs.alipay.com/open/02fkan?ref=api&scene=35
15
 */
16
class AgreementPageSignPlugin implements PluginInterface
17
{
18
    public function assembly(Rocket $rocket, Closure $next): Rocket
19
    {
20
        Logger::info('[alipay][AgreementPageSignPlugin] 插件开始装载', ['rocket' => $rocket]);
21
22
        $rocket->setDirection(ResponseParser::class)
23
            ->mergePayload([
24
                'method' => 'alipay.user.agreement.page.sign',
25
                'biz_content' => array_merge(
26
                    ['product_code' => 'CYCLE_PAY_AUTH'],
27
                    $rocket->getParams()
28
                ),
29
            ]);
30
31
        Logger::info('[alipay][AgreementPageSignPlugin] 插件装载完毕', ['rocket' => $rocket]);
32
33
        return $next($rocket);
34
    }
35
}
36