fix:更新已知bug,优化代码

This commit is contained in:
Ying
2022-11-28 19:11:12 +08:00
parent f6aee95cfc
commit 9445b206a2
1378 changed files with 53759 additions and 20789 deletions

View File

@@ -17,7 +17,6 @@ use Yansongda\Supports\Str;
class CallbackPlugin implements PluginInterface
{
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidConfigException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
@@ -45,9 +44,8 @@ class CallbackPlugin implements PluginInterface
protected function formatPayload(Rocket $rocket): void
{
$payload = (new Collection($rocket->getParams()))->filter(function ($v, $k) {
return '' !== $v && !is_null($v) && 'sign' != $k && 'sign_type' != $k && !Str::startsWith($k, '_');
});
$payload = (new Collection($rocket->getParams()))
->filter(fn ($v, $k) => '' !== $v && !is_null($v) && 'sign' != $k && 'sign_type' != $k && !Str::startsWith($k, '_'));
$rocket->setPayload($payload);
}

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Data;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02fkbl
*/
class BillDownloadUrlQueryPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/029p6g
*/
class BillEreceiptApplyPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Data;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/029i7e
*/
class BillEreceiptQueryPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Ebpp;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02hd36
*/
class PdeductBillStatusPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02hd35
*/
class PdeductPayPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket

View File

@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02hd33
*/
class PdeductSignAddPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket

View File

@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02hd34
*/
class PdeductSignCancelPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket

View File

@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02byuq?scene=common
*/
class AccountQueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket

View File

@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02fkb9
*/
class AuthOrderFreezePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Fund;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02fkbc
*/
class AuthOrderUnfreezePlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Fund;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02byve
*/
class TransCommonQueryPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -6,6 +6,12 @@ namespace Yansongda\Pay\Plugin\Alipay\Fund;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* 老版本转账.
*
* @deprecated
* @see https://opendocs.alipay.com/support/01rfzo
*/
class TransOrderQueryPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -10,6 +10,9 @@ use Yansongda\Pay\Logger;
use Yansongda\Pay\Parser\ResponseParser;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/03rbye
*/
class TransPagePayPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket

View File

@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02byuo?scene=common
*/
class TransUniTransferPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket

View File

@@ -15,7 +15,6 @@ use Yansongda\Supports\Collection;
class LaunchPlugin implements PluginInterface
{
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidConfigException
* @throws \Yansongda\Pay\Exception\InvalidResponseException
@@ -44,7 +43,6 @@ class LaunchPlugin implements PluginInterface
}
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidConfigException
* @throws \Yansongda\Pay\Exception\InvalidResponseException

View File

@@ -14,7 +14,6 @@ use Yansongda\Pay\Rocket;
class PreparePlugin implements PluginInterface
{
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
* @throws \Yansongda\Pay\Exception\InvalidConfigException
@@ -31,7 +30,6 @@ class PreparePlugin implements PluginInterface
}
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
* @throws \Yansongda\Pay\Exception\InvalidConfigException
@@ -49,7 +47,7 @@ class PreparePlugin implements PluginInterface
'timestamp' => date('Y-m-d H:i:s'),
'version' => '1.0',
'notify_url' => $this->getNotifyUrl($params),
'app_auth_token' => '',
'app_auth_token' => $this->getAppAuthToken($params),
'app_cert_sn' => $this->getAppCertSn($params),
'alipay_root_cert_sn' => $this->getAlipayRootCertSn($params),
'biz_content' => [],
@@ -57,7 +55,6 @@ class PreparePlugin implements PluginInterface
}
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*/
@@ -71,7 +68,6 @@ class PreparePlugin implements PluginInterface
}
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*/
@@ -85,7 +81,19 @@ class PreparePlugin implements PluginInterface
}
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*/
protected function getAppAuthToken(array $params): string
{
if (!empty($params['_app_auth_token'])) {
return $params['_app_auth_token'];
}
return get_alipay_config($params)->get('app_auth_token', '');
}
/**
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
* @throws \Yansongda\Pay\Exception\InvalidConfigException
@@ -101,11 +109,14 @@ class PreparePlugin implements PluginInterface
$cert = file_get_contents($path);
$ssl = openssl_x509_parse($cert);
return $this->getCertSn($ssl['issuer'], $ssl['serialNumber']);
if (false === $ssl) {
throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Parse `app_public_cert_path` Error');
}
return $this->getCertSn($ssl['issuer'] ?? [], $ssl['serialNumber'] ?? '');
}
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidConfigException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
@@ -162,8 +173,8 @@ class PreparePlugin implements PluginInterface
protected function formatCert(array $ssl): array
{
if (0 === strpos($ssl['serialNumber'], '0x')) {
$ssl['serialNumber'] = $this->hex2dec($ssl['serialNumberHex']);
if (0 === strpos($ssl['serialNumber'] ?? '', '0x')) {
$ssl['serialNumber'] = $this->hex2dec($ssl['serialNumberHex'] ?? '');
}
return $ssl;

View File

@@ -18,7 +18,6 @@ class RadarPlugin implements PluginInterface
/**
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
@@ -32,7 +31,6 @@ class RadarPlugin implements PluginInterface
}
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*/
@@ -52,7 +50,6 @@ class RadarPlugin implements PluginInterface
}
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*/

View File

@@ -15,7 +15,6 @@ use Yansongda\Supports\Str;
class SignPlugin implements PluginInterface
{
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidConfigException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
@@ -37,13 +36,9 @@ class SignPlugin implements PluginInterface
protected function formatPayload(Rocket $rocket): void
{
$payload = $rocket->getPayload()->filter(function ($v, $k) {
return '' !== $v && !is_null($v) && 'sign' != $k;
});
$payload = $rocket->getPayload()->filter(fn ($v, $k) => '' !== $v && !is_null($v) && 'sign' != $k);
$contents = array_filter($payload->get('biz_content', []), function ($v, $k) {
return !Str::startsWith(strval($k), '_');
}, ARRAY_FILTER_USE_BOTH);
$contents = array_filter($payload->get('biz_content', []), fn ($v, $k) => !Str::startsWith(strval($k), '_'), ARRAY_FILTER_USE_BOTH);
$rocket->setPayload(
$payload->merge(['biz_content' => json_encode($contents)])
@@ -51,7 +46,6 @@ class SignPlugin implements PluginInterface
}
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidConfigException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
@@ -64,22 +58,15 @@ class SignPlugin implements PluginInterface
openssl_sign($content, $sign, $privateKey, OPENSSL_ALGO_SHA256);
$sign = base64_encode($sign);
!is_resource($privateKey) ?: openssl_free_key($privateKey);
return $sign;
return base64_encode($sign);
}
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidConfigException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return resource|string
*/
protected function getPrivateKey(array $params)
protected function getPrivateKey(array $params): string
{
$privateKey = get_alipay_config($params)->get('app_secret_cert');
@@ -87,6 +74,6 @@ class SignPlugin implements PluginInterface
throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Missing Alipay Config -- [app_secret_cert]');
}
return get_public_or_private_cert($privateKey);
return get_private_cert($privateKey);
}
}

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Tools;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/isv/03l9c0
*/
class OpenAuthTokenAppPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Tools;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/isv/03l8ca
*/
class OpenAuthTokenAppQueryPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -7,6 +7,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Tools;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02ailc
*/
class SystemOauthTokenPlugin extends GeneralPlugin
{
protected function doSomethingBefore(Rocket $rocket): void

View File

@@ -11,12 +11,14 @@ use Yansongda\Pay\Parser\ResponseParser;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/02e7gq?scene=common
*/
class AppPayPlugin implements PluginInterface
{
use SupportServiceProviderTrait;
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*/

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02ekfi
*/
class CancelPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02o6e7
*/
class ClosePlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02ekfj
*/
class CreatePlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/028sma
*/
class FastRefundQueryPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/028xqz
*/
class OrderSettlePlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -11,12 +11,14 @@ use Yansongda\Pay\Parser\ResponseParser;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/028r8t?scene=22
*/
class PagePayPlugin implements PluginInterface
{
use SupportServiceProviderTrait;
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*/

View File

@@ -10,12 +10,14 @@ use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/02fkat?ref=api&scene=common
*/
class PayPlugin implements PluginInterface
{
use SupportServiceProviderTrait;
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*/

View File

@@ -8,12 +8,14 @@ use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/02ekfg?scene=common
*/
class PreCreatePlugin extends GeneralPlugin
{
use SupportServiceProviderTrait;
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*/

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02ekfh?scene=common
*/
class QueryPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02ekfk
*/
class RefundPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@@ -11,12 +11,14 @@ use Yansongda\Pay\Parser\ResponseParser;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/02ivbs?scene=common
*/
class WapPayPlugin implements PluginInterface
{
use SupportServiceProviderTrait;
/**
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*/

View File

@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\User;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02fkaq?ref=api
*/
class AgreementExecutionPlanModifyPlugin extends GeneralPlugin
{
protected function getMethod(): string
{
return 'alipay.user.agreement.executionplan.modify';
}
}

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\User;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Parser\ResponseParser;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02fkan?ref=api&scene=35
*/
class AgreementPageSignPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::info('[alipay][AgreementPageSignPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->setDirection(ResponseParser::class)
->mergePayload([
'method' => 'alipay.user.agreement.page.sign',
'biz_content' => array_merge(
['product_code' => 'CYCLE_PAY_AUTH'],
$rocket->getParams()
),
]);
Logger::info('[alipay][AgreementPageSignPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\User;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02fkao?ref=api&scene=8837b4183390497f84bb53783b488ecc
*/
class AgreementQueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::info('[alipay][AgreementQueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.user.agreement.query',
'biz_content' => array_merge(
['personal_product_code' => 'CYCLE_PAY_AUTH_P'],
$rocket->getParams()
),
]);
Logger::info('[alipay][AgreementQueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\User;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02fkar?ref=api
*/
class AgreementTransferPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::info('[alipay][AgreementTransferPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.user.agreement.transfer',
'biz_content' => array_merge(
['target_product_code' => 'CYCLE_PAY_AUTH_P'],
$rocket->getParams()
),
]);
Logger::info('[alipay][AgreementTransferPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\User;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02fkap?ref=api&scene=90766afb41f74df6ae1676e89625ebac
*/
class AgreementUnsignPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::info('[alipay][AgreementUnsignPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.user.agreement.unsign',
'biz_content' => array_merge(
['personal_product_code' => 'CYCLE_PAY_AUTH_P'],
$rocket->getParams()
),
]);
Logger::info('[alipay][AgreementUnsignPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02aild
*/
class InfoSharePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket