Passed
Pull Request — master (#1120)
by Songda
03:30 queued 01:19
created

FileUploadPlugin::assembly()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 17
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Plugin\Alipay\V2\Merchant\Item;
6
7
use Closure;
8
use Yansongda\Artful\Contract\PluginInterface;
9
use Yansongda\Artful\Logger;
10
use Yansongda\Artful\Rocket;
11
12
/**
13
 * 上传商户商品文件.
14
 *
15
 * @see https://opendocs.alipay.com/mini/510d4a72_alipay.merchant.item.file.upload?scene=common&pathHash=c08922b1
16
 *
17
 * @date 2025-10-28
18
 */
19
class FileUploadPlugin implements PluginInterface
20
{
21
    public function assembly(Rocket $rocket, Closure $next): Rocket
22
    {
23
        Logger::debug('[Alipay][Merchant][Item][FileUploadPlugin] 插件开始装载', ['rocket' => $rocket]);
24
25
        $rocket->mergePayload(
26
            array_merge(
27
                [
28
                    'method' => 'alipay.merchant.item.file.upload',
29
                    'scene' => 'SYNC_ORDER',
30
                ],
31
                $rocket->getParams()
32
            )
33
        );
34
35
        Logger::info('[Alipay][Merchant][Item][FileUploadPlugin] 插件装载完毕', ['rocket' => $rocket]);
36
37
        return $next($rocket);
38
    }
39
}
40