change(internal): 按场景对支付宝插件进行分类 (#894)

This commit is contained in:
yansongda 2023-12-22 14:59:06 +08:00 committed by GitHub
parent 3fa8d49d42
commit e4a200dc43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
327 changed files with 9021 additions and 2287 deletions

View File

@ -3,6 +3,7 @@
### changed
- change(internal): shortcut 完整标明各个插件,不使用 commonPlugin(#886)
- change(internal): 按场景对支付宝插件进行分类(#894)
## v3.5.3

View File

@ -0,0 +1,72 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Exception\ContainerException;
use Yansongda\Pay\Exception\ServiceNotFoundException;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Pay;
use Yansongda\Pay\Provider\Alipay;
use Yansongda\Pay\Request;
use Yansongda\Pay\Rocket;
use Yansongda\Supports\Collection;
use function Yansongda\Pay\get_alipay_config;
class AddRadarPlugin implements PluginInterface
{
/**
* @throws ContainerException
* @throws ServiceNotFoundException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][AddRadarPlugin] 插件开始装载', ['rocket' => $rocket]);
$params = $rocket->getParams();
$rocket->setRadar(new Request(
$this->getMethod($params),
$this->getUrl($params),
$this->getHeaders(),
$this->getBody($rocket->getPayload()),
));
Logger::info('[Alipay][AddRadarPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
protected function getMethod(array $params): string
{
return strtoupper($params['_method'] ?? 'POST');
}
/**
* @throws ContainerException
* @throws ServiceNotFoundException
*/
protected function getUrl(array $params): string
{
$config = get_alipay_config($params);
return Alipay::URL[$config['mode'] ?? Pay::MODE_NORMAL];
}
protected function getHeaders(): array
{
return [
'Content-Type' => 'application/x-www-form-urlencoded',
'User-Agent' => 'yansongda/pay-v3',
];
}
protected function getBody(Collection $payload): string
{
return $payload->query();
}
}

View File

@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Exception\ContainerException;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Exception\InvalidConfigException;
use Yansongda\Pay\Exception\ServiceNotFoundException;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
use function Yansongda\Pay\get_alipay_config;
use function Yansongda\Pay\get_private_cert;
class AddSignaturePlugin implements PluginInterface
{
/**
* @throws ContainerException
* @throws InvalidConfigException
* @throws ServiceNotFoundException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][AddSignaturePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload(['sign' => $this->getSign($rocket)]);
Logger::info('[Alipay][AddSignaturePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
/**
* @throws ContainerException
* @throws InvalidConfigException
* @throws ServiceNotFoundException
*/
protected function getSign(Rocket $rocket): string
{
$privateKey = $this->getPrivateKey($rocket->getParams());
$content = $rocket->getPayload()->sortKeys()->toString();
openssl_sign($content, $sign, $privateKey, OPENSSL_ALGO_SHA256);
return base64_encode($sign);
}
/**
* @throws ContainerException
* @throws InvalidConfigException
* @throws ServiceNotFoundException
*/
protected function getPrivateKey(array $params): string
{
$privateKey = get_alipay_config($params)['app_secret_cert'] ?? null;
if (is_null($privateKey)) {
throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Missing Alipay Config -- [app_secret_cert]');
}
return get_private_cert($privateKey);
}
}

View File

@ -29,13 +29,13 @@ class CallbackPlugin implements PluginInterface
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[alipay][CallbackPlugin] 插件开始装载', ['rocket' => $rocket]);
Logger::debug('[Alipay][CallbackPlugin] 插件开始装载', ['rocket' => $rocket]);
$this->formatPayload($rocket);
$sign = $rocket->getParams()['sign'] ?? false;
if (!$sign) {
throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, '', $rocket->getParams());
throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, 'Callback Empty Sign', $rocket->getParams());
}
verify_alipay_sign($rocket->getParams(), $this->getSignContent($rocket->getPayload()), $sign);
@ -43,7 +43,7 @@ class CallbackPlugin implements PluginInterface
$rocket->setDirection(NoHttpRequestDirection::class)
->setDestination($rocket->getPayload());
Logger::info('[alipay][CallbackPlugin] 插件装载完毕', ['rocket' => $rocket]);
Logger::info('[Alipay][CallbackPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}

View File

@ -1,18 +0,0 @@
<?php
declare(strict_types=1);
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
{
return 'alipay.data.dataservice.bill.downloadurl.query';
}
}

View File

@ -1,35 +0,0 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Data;
use Closure;
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
{
Logger::debug('[alipay][BillEreceiptApplyPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.data.bill.ereceipt.apply',
'biz_content' => array_merge(
[
'type' => 'FUND_DETAIL',
],
$rocket->getParams(),
),
]);
Logger::info('[alipay][BillEreceiptApplyPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -1,18 +0,0 @@
<?php
declare(strict_types=1);
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
{
return 'alipay.data.bill.ereceipt.query';
}
}

View File

@ -1,18 +0,0 @@
<?php
declare(strict_types=1);
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
{
return 'alipay.ebpp.pdeduct.bill.pay.status';
}
}

View File

@ -1,35 +0,0 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Ebpp;
use Closure;
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
{
Logger::debug('[alipay][PdeductPayPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.ebpp.pdeduct.pay',
'biz_content' => array_merge(
[
'agent_channel' => 'PUBLICFORM',
],
$rocket->getParams(),
),
]);
Logger::info('[alipay][PdeductPayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -1,37 +0,0 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Ebpp;
use Closure;
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
{
Logger::debug('[alipay][PdeductSignAddPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.ebpp.pdeduct.sign.add',
'biz_content' => array_merge(
[
'charge_inst' => 'CQCENTERELECTRIC',
'agent_channel' => 'PUBLICPLATFORM',
'deduct_prod_code' => 'INST_DIRECT_DEDUCT',
],
$rocket->getParams(),
),
]);
Logger::info('[alipay][PdeductSignAddPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -1,35 +0,0 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Ebpp;
use Closure;
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
{
Logger::debug('[alipay][PdeductSignCancelPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.ebpp.pdeduct.sign.cancel',
'biz_content' => array_merge(
[
'agent_channel' => 'PUBLICPLATFORM',
],
$rocket->getParams(),
),
]);
Logger::info('[alipay][PdeductSignCancelPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
use Yansongda\Supports\Str;
class FormatBizContentPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][FormatBizContentPlugin] 插件开始装载', ['rocket' => $rocket]);
$payload = $rocket->getPayload()->filter(fn ($v, $k) => '' !== $v && !is_null($v) && 'sign' != $k);
$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)])
);
Logger::info('[Alipay][FormatBizContentPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -1,35 +0,0 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund;
use Closure;
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
{
Logger::debug('[alipay][AccountQueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.account.query',
'biz_content' => array_merge(
[
'product_code' => 'TRANS_ACCOUNT_NO_PWD',
],
$rocket->getParams(),
),
]);
Logger::info('[alipay][AccountQueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -1,35 +0,0 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund;
use Closure;
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
{
Logger::debug('[alipay][AuthOrderFreezePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.auth.order.freeze',
'biz_content' => array_merge(
[
'product_code' => 'PRE_AUTH',
],
$rocket->getParams()
),
]);
Logger::info('[alipay][AuthOrderFreezePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -1,18 +0,0 @@
<?php
declare(strict_types=1);
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
{
return 'alipay.fund.auth.order.unfreeze';
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\PCreditPayInstallment;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Direction\ResponseDirection;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02np8z?pathHash=994a1e7d&ref=api
*/
class AppPayPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][PCreditPayInstallment][AppPayPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->setDirection(ResponseDirection::class)
->mergePayload([
'method' => 'alipay.trade.app.pay',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][PCreditPayInstallment][AppPayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\PCreditPayInstallment;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Exception\ContainerException;
use Yansongda\Pay\Exception\ServiceNotFoundException;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/02np90?pathHash=d2a20943&ref=api&scene=32
*/
class PosPayPlugin implements PluginInterface
{
use SupportServiceProviderTrait;
/**
* @throws ContainerException
* @throws ServiceNotFoundException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][PCreditPayInstallment][PosPayPlugin] 插件开始装载', ['rocket' => $rocket]);
$this->loadAlipayServiceProvider($rocket);
$rocket->mergePayload([
'method' => 'alipay.trade.pay',
'biz_content' => array_merge(
[
'product_code' => 'FACE_TO_FACE_PAYMENT',
'scene' => 'bar_code',
],
$rocket->getParams(),
),
]);
Logger::info('[Alipay][Fund][PCreditPayInstallment][PosPayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\PCreditPayInstallment;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Exception\ContainerException;
use Yansongda\Pay\Exception\ServiceNotFoundException;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/02np92?pathHash=de4742e0&ref=api
*/
class ScanPayPlugin implements PluginInterface
{
use SupportServiceProviderTrait;
/**
* @throws ContainerException
* @throws ServiceNotFoundException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][PCreditPayInstallment][ScanPayPlugin] 插件开始装载', ['rocket' => $rocket]);
$this->loadAlipayServiceProvider($rocket);
$rocket->mergePayload([
'method' => 'alipay.trade.precreate',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][PCreditPayInstallment][ScanPayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Trade;
namespace Yansongda\Pay\Plugin\Alipay\Fund\PCreditPayInstallment;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
@ -14,7 +14,7 @@ use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/02ivbs?scene=common
* @see https://opendocs.alipay.com/open/02np8y?pathHash=718b8786&ref=api
*/
class WapPayPlugin implements PluginInterface
{
@ -26,7 +26,7 @@ class WapPayPlugin implements PluginInterface
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[alipay][WapPayPlugin] 插件开始装载', ['rocket' => $rocket]);
Logger::debug('[Alipay][Fund][PCreditPayInstallment][WapPayPlugin] 插件开始装载', ['rocket' => $rocket]);
$this->loadAlipayServiceProvider($rocket);
@ -35,13 +35,13 @@ class WapPayPlugin implements PluginInterface
'method' => 'alipay.trade.wap.pay',
'biz_content' => array_merge(
[
'product_code' => 'QUICK_WAP_PAY',
'product_code' => 'QUICK_WAP_WAY',
],
$rocket->getParams(),
),
]);
Logger::info('[alipay][WapPayPlugin] 插件装载完毕', ['rocket' => $rocket]);
Logger::info('[Alipay][Fund][PCreditPayInstallment][WapPayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Royalty;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/c21931d6_alipay.trade.royalty.relation.bind?pathHash=08a24dae&ref=api&scene=common
*/
class BindRelationPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Royalty][BindRelationPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.royalty.relation.bind',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Royalty][BindRelationPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Royalty;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/d87dc009_alipay.trade.order.onsettle.query?pathHash=53466049&ref=api&scene=common
*/
class QueryOnsettlePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Royalty][QueryOnsettlePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.order.onsettle.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Royalty][QueryOnsettlePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Royalty;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/6f314ee9_alipay.trade.royalty.rate.query?pathHash=9118088a&ref=api&scene=common
*/
class QueryRatePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Royalty][QueryRatePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.royalty.rate.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Royalty][QueryRatePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Royalty;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/1860be54_alipay.trade.royalty.relation.batchquery?pathHash=2f733e2d&ref=api&scene=common
*/
class QueryRelationPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Royalty][QueryRelationPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.royalty.relation.batchquery',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Royalty][QueryRelationPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Royalty;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/9ef980b7_alipay.trade.order.settle.query?pathHash=688b1c13&ref=api&scene=common
*/
class QuerySettlePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Royalty][QuerySettlePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.order.settle.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Royalty][QuerySettlePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Royalty;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/c3b24498_alipay.trade.order.settle?pathHash=8e6acab4&ref=api&scene=common
*/
class SettleOrderPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Royalty][SettleOrderPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.order.settle',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Royalty][SettleOrderPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Royalty;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/3613f4e1_alipay.trade.royalty.relation.unbind?pathHash=5a880175&ref=api&scene=common
*/
class UnbindRelationPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Royalty][UnbindRelationPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.royalty.relation.unbind',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Royalty][UnbindRelationPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -1,36 +0,0 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02byve
*/
class TransCommonQueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[alipay][TransCommonQueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.trans.common.query',
'biz_content' => array_merge(
[
'product_code' => 'TRANS_ACCOUNT_NO_PWD',
'biz_scene' => 'DIRECT_TRANSFER',
],
$rocket->getParams(),
),
]);
Logger::info('[alipay][TransCommonQueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -1,32 +0,0 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Direction\ResponseDirection;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/03rbye
*/
class TransPagePayPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[alipay][TransPagePayPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->setDirection(ResponseDirection::class)
->mergePayload([
'method' => 'alipay.fund.trans.page.pay',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[alipay][TransPagePayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -1,15 +0,0 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
class TransTobankTransferPlugin extends GeneralPlugin
{
protected function getMethod(): string
{
return 'alipay.fund.trans.tobank.transfer';
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Transfer;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/1aad1956_alipay.data.bill.ereceipt.apply?pathHash=a2527e9c&ref=api&scene=common
*/
class ApplyReceiptPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Transfer][ApplyReceiptPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.data.bill.ereceipt.apply',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Transfer][ApplyReceiptPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Transfer;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/1b8a680c_alipay.fund.account.query?pathHash=ff8fc0e0&ref=api&scene=c76aa8f1c54e4b8b8ffecfafc4d3c31c
*/
class QueryAccountPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Transfer][QueryAccountPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.account.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Transfer][QueryAccountPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Transfer;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/76606b11_alipay.data.dataservice.bill.downloadurl.query?pathHash=425f62c6&ref=api&scene=common
*/
class QueryBillUrlPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Transfer][QueryBillUrlPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.data.dataservice.bill.downloadurl.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Transfer][QueryBillUrlPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Transfer;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/58a29899_alipay.fund.trans.common.query?pathHash=aad07c6d&ref=api&scene=f9fece54d41f49cbbd00dc73655a01a4
*/
class QueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Transfer][QueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.trans.common.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Transfer][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Transfer;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/30b94a2f_alipay.data.bill.ereceipt.query?pathHash=bfe1c3f4&ref=api&scene=common
*/
class QueryReceiptPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Transfer][QueryReceiptPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.data.bill.ereceipt.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Transfer][QueryReceiptPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund\Transfer;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02byvd?pathHash=2dceb6d2&ref=api&scene=common
*/
class RefundPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Fund][Transfer][RefundPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.trans.refund',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Fund][Transfer][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Fund;
namespace Yansongda\Pay\Plugin\Alipay\Fund\Transfer;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
@ -10,13 +10,14 @@ use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02byuo?scene=common
* @see https://opendocs.alipay.com/open/62987723_alipay.fund.trans.uni.transfer?pathHash=66064890&ref=api&scene=ca56bca529e64125a2786703c6192d41
* @see https://opendocs.alipay.com/open/02byvi?pathHash=b367173b&ref=api&scene=66dd06f5a923403393b85de68d3c0055
*/
class TransUniTransferPlugin implements PluginInterface
class TransferPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[alipay][TransUniTransferPlugin] 插件开始装载', ['rocket' => $rocket]);
Logger::debug('[Alipay][Fund][Transfer][TransferPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.trans.uni.transfer',
@ -29,7 +30,7 @@ class TransUniTransferPlugin implements PluginInterface
),
]);
Logger::info('[alipay][TransUniTransferPlugin] 插件装载完毕', ['rocket' => $rocket]);
Logger::info('[Alipay][Fund][Transfer][TransferPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
abstract class GeneralPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[alipay][GeneralPlugin] 通用插件开始装载', ['rocket' => $rocket]);
$this->doSomethingBefore($rocket);
$rocket->mergePayload([
'method' => $this->getMethod(),
'biz_content' => $rocket->getParams(),
]);
Logger::info('[alipay][GeneralPlugin] 通用插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
protected function doSomethingBefore(Rocket $rocket): void {}
abstract protected function getMethod(): string;
}

View File

@ -1,73 +0,0 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Exception\ContainerException;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Exception\InvalidConfigException;
use Yansongda\Pay\Exception\InvalidResponseException;
use Yansongda\Pay\Exception\ServiceNotFoundException;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
use Yansongda\Supports\Collection;
use function Yansongda\Pay\should_do_http_request;
use function Yansongda\Pay\verify_alipay_sign;
class LaunchPlugin implements PluginInterface
{
/**
* @throws ContainerException
* @throws InvalidConfigException
* @throws InvalidResponseException
* @throws ServiceNotFoundException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
/* @var Rocket $rocket */
$rocket = $next($rocket);
Logger::debug('[alipay][LaunchPlugin] 插件开始装载', ['rocket' => $rocket]);
if (should_do_http_request($rocket->getDirection())) {
$response = Collection::wrap($rocket->getDestination());
$result = $response->get($this->getResultKey($rocket->getPayload()));
$this->verifySign($rocket->getParams(), $response, $result);
$rocket->setDestination(Collection::wrap($result));
}
Logger::info('[alipay][LaunchPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $rocket;
}
/**
* @throws ContainerException
* @throws InvalidConfigException
* @throws InvalidResponseException
* @throws ServiceNotFoundException
*/
protected function verifySign(array $params, Collection $response, ?array $result): void
{
$sign = $response->get('sign', '');
if ('' === $sign || is_null($result)) {
throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, 'Verify Alipay Response Sign Failed: sign is empty', $response);
}
verify_alipay_sign($params, json_encode($result, JSON_UNESCAPED_UNICODE), $sign);
}
protected function getResultKey(Collection $payload): string
{
$method = $payload->get('method');
return str_replace('.', '_', $method).'_response';
}
}

View File

@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Marketing\Redpack;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Direction\ResponseDirection;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/03rbyf?pathHash=76643847&ref=api&scene=common
*/
class AppPayPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Marketing][Redpack][AppPayPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->setDirection(ResponseDirection::class)
->mergePayload([
'method' => 'alipay.fund.trans.app.pay',
'biz_content' => array_merge(
[
'product_code' => 'STD_RED_PACKET',
'biz_scene' => 'PERSONAL_PAY',
],
$rocket->getParams(),
),
]);
Logger::info('[Alipay][Marketing][Redpack][AppPayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Marketing\Redpack;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Direction\ResponseDirection;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/03rbye?pathHash=1c8d9fcb&ref=api&scene=common
*/
class WebPayPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Marketing][Redpack][WebPayPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->setDirection(ResponseDirection::class)
->mergePayload([
'method' => 'alipay.fund.trans.page.pay',
'biz_content' => array_merge(
[
'product_code' => 'STD_APP_TRANSFER',
],
$rocket->getParams()
),
]);
Logger::info('[Alipay][Marketing][Redpack][WebPayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02aile?pathHash=4efd837f&ref=api&scene=common
*/
class AuthPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][Authorization][AuthPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.user.info.auth',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Member][Authorization][AuthPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/6b97edd1_alipay.open.auth.userauth.relationship.query?pathHash=ac4a364e&ref=api&scene=common
*/
class QueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][Authorization][QueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.open.auth.userauth.relationship.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Member][Authorization][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/84bc7352_alipay.system.oauth.token?pathHash=fe1502d5&ref=api&scene=common
*/
class TokenPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][Authorization][TokenPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.system.oauth.token',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Member][Authorization][TokenPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\Certification;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02ahk0?pathHash=b485c65c&ref=api&scene=common
*/
class CertifyPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][Certification][CertifyPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.user.certify.open.certify',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Member][Certification][CertifyPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\Certification;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02ahjy?pathHash=ed72e8ea&ref=api&scene=common
*/
class InitPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][Certification][AppInitPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.user.certify.open.initialize',
'biz_content' => array_merge(
[
'product_code' => 'FACE',
],
$rocket->getParams(),
),
]);
Logger::info('[Alipay][Member][Certification][AppInitPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\Certification;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02ahjw?pathHash=a3efadb6&ref=api&scene=common
*/
class QueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][Certification][QueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.user.certify.open.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Member][Certification][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/a74a7068_alipay.user.info.share?pathHash=af2476d4&ref=api&scene=common
*/
class DetailPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][DetailPlugin] 插件开始装载', ['rocket' => $rocket]);
$params = $rocket->getParams();
$rocket->mergePayload([
'auth_token' => $params['auth_token'] ?? $params['_auth_token'] ?? '',
'method' => 'alipay.user.info.share',
'biz_content' => [],
]);
Logger::info('[Alipay][Member][DetailPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\FaceCheck;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/03nisu?pathHash=43fcb08b&ref=api&scene=common
*/
class AppInitPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][FaceCheck][AppInitPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'datadigital.fincloud.generalsaas.face.check.initialize',
'biz_content' => array_merge(
[
'biz_code' => 'DATA_DIGITAL_BIZ_CODE_FACE_CHECK_LIVE',
],
$rocket->getParams(),
),
]);
Logger::info('[Alipay][Member][FaceCheck][AppInitPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\FaceCheck;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/03nisv?pathHash=3f259e83&ref=api&scene=common
*/
class AppQueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][FaceCheck][AppQueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'datadigital.fincloud.generalsaas.face.check.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Member][FaceCheck][AppQueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\FaceVerification;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/04jg6r?pathHash=0572cc86&ref=api&scene=common
*/
class AppInitPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][FaceVerification][AppInitPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'datadigital.fincloud.generalsaas.face.verification.initialize',
'biz_content' => array_merge(
[
'biz_code' => 'DATA_DIGITAL_BIZ_CODE_FACE_VERIFICATION',
'identity_type' => 'CERT_INFO',
],
$rocket->getParams(),
),
]);
Logger::info('[Alipay][Member][FaceVerification][AppInitPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\FaceVerification;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/04jg6s?pathHash=1608a398&ref=api&scene=common
*/
class AppQueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][FaceVerification][AppQueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'datadigital.fincloud.generalsaas.face.verification.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Member][FaceVerification][AppQueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\FaceVerification;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/04pxq6?pathHash=f421977b&ref=api&scene=common
*/
class ServerVerifyPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][FaceVerification][ServerVerifyPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'datadigital.fincloud.generalsaas.face.source.certify',
'biz_content' => array_merge(
[
'cert_type' => 'IDENTITY_CARD',
],
$rocket->getParams()
),
]);
Logger::info('[Alipay][Member][FaceVerification][ServerVerifyPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\FaceVerification;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02zloa?pathHash=b0b7fece&ref=api&scene=common
*/
class WapInitPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][FaceVerification][WapInitPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'datadigital.fincloud.generalsaas.face.certify.initialize',
'biz_content' => array_merge(
[
'biz_code' => 'FUTURE_TECH_BIZ_FACE_SDK',
],
$rocket->getParams(),
),
]);
Logger::info('[Alipay][Member][FaceVerification][WapInitPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\FaceVerification;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02zloc?pathHash=b1141506&ref=api&scene=common
*/
class WapQueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][FaceVerification][WapQueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'datadigital.fincloud.generalsaas.face.certify.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Member][FaceVerification][WapQueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\FaceVerification;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/02zlob?pathHash=20eba12a&ref=api&scene=common
*/
class WapVerifyPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][FaceVerification][WapVerifyPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'datadigital.fincloud.generalsaas.face.certify.verify',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Member][FaceVerification][WapVerifyPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\Ocr;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/043ksf?pathHash=ea0482cd&ref=api&scene=common
*/
class AppInitPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][Ocr][AppInitPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'datadigital.fincloud.generalsaas.ocr.mobile.initialize',
'biz_content' => array_merge(
[
'biz_code' => 'DATA_DIGITAL_BIZ_CODE_OCR',
],
$rocket->getParams(),
),
]);
Logger::info('[Alipay][Member][Ocr][AppInitPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\Ocr;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/0aggs5?pathHash=084101d3&ref=api
*/
class DetectPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][Ocr][DetectPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'datadigital.fincloud.generalsaas.ocr.common.detect',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Member][Ocr][DetectPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Member\Ocr;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/05ut8h?pathHash=8cc2aaf1&ref=api&scene=common
*/
class ServerDetectPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Member][Ocr][ServerDetectPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'datadigital.fincloud.generalsaas.ocr.server.detect',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Member][Ocr][ServerDetectPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Agreement;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Direction\ResponseDirection;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/e65d4f60_alipay.trade.app.pay?pathHash=d2d3578f&ref=api&scene=f235566281d54f96942a44b84640a918
*/
class AppPayPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Agreement][PayPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->setDirection(ResponseDirection::class)
->mergePayload([
'method' => 'alipay.trade.app.pay',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Agreement][PayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Agreement;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/83a5f6d3_alipay.trade.cancel?pathHash=f27672eb&ref=api&scene=common
*/
class CancelPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Agreement][CancelPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.cancel',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Agreement][CancelPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Agreement;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/24a75394_alipay.trade.close?pathHash=7bf94ec4&ref=api&scene=common
*/
class ClosePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Agreement][ClosePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.close',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Agreement][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Agreement;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/3dab71bc_alipay.user.agreement.query?pathHash=6706b504&ref=api&scene=common
*/
class DetailPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Agreement][DetailPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.user.agreement.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Agreement][DetailPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Agreement;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/ed428330_alipay.user.agreement.executionplan.modify?pathHash=13c30e39&ref=api&scene=common
*/
class ModifyPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Agreement][ModifyPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.user.agreement.executionplan.modify',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Agreement][ModifyPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Agreement;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Exception\ContainerException;
use Yansongda\Pay\Exception\ServiceNotFoundException;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/38d751b1_alipay.trade.pay?pathHash=0a98c4e0&ref=api&scene=b4d9c9906e14451b99c8de390ae20fea
*/
class PayPlugin implements PluginInterface
{
use SupportServiceProviderTrait;
/**
* @throws ContainerException
* @throws ServiceNotFoundException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Agreement][PayPlugin] 插件开始装载', ['rocket' => $rocket]);
$this->loadAlipayServiceProvider($rocket);
$rocket->mergePayload([
'method' => 'alipay.trade.pay',
'biz_content' => array_merge(
[
'product_code' => 'GENERAL_WITHHOLDING',
],
$rocket->getParams(),
),
]);
Logger::info('[Alipay][Pay][Agreement][PayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Agreement;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/1523f88d_alipay.data.dataservice.bill.downloadurl.query?pathHash=6a78e19b&ref=api&scene=common
*/
class QueryBillUrlPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Agreement][QueryBillUrlPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.data.dataservice.bill.downloadurl.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Agreement][QueryBillUrlPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Agreement;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/07005f5c_alipay.trade.query?pathHash=aa8ed91c&ref=api&scene=common
*/
class QueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Agreement][QueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Agreement][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Agreement;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/de34d4fa_alipay.trade.refund?pathHash=46ea3fea&ref=api&scene=common
*/
class RefundPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Agreement][RefundPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.refund',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Agreement][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Agreement;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Direction\ResponseDirection;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/8bccfa0b_alipay.user.agreement.page.sign?pathHash=725a0634&ref=api&scene=common
*/
class SignPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Agreement][AddSignaturePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->setDirection(ResponseDirection::class)
->mergePayload([
'method' => 'alipay.user.agreement.page.sign',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Agreement][AddSignaturePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Agreement;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/b841da1f_alipay.user.agreement.unsign?pathHash=6d2d4910&ref=api&scene=common
*/
class UnsignPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Agreement][UnsignPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.user.agreement.unsign',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Agreement][UnsignPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\App;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/ce0b4954_alipay.trade.close?pathHash=7b0fdae1&ref=api&scene=common
*/
class ClosePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][App][ClosePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.close',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][App][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Trade;
namespace Yansongda\Pay\Plugin\Alipay\Pay\App;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
@ -14,9 +14,9 @@ use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/02e7gq?scene=common
* @see https://opendocs.alipay.com/open/cd12c885_alipay.trade.app.pay?pathHash=c0e35284&ref=api&scene=20
*/
class AppPayPlugin implements PluginInterface
class PayPlugin implements PluginInterface
{
use SupportServiceProviderTrait;
@ -26,20 +26,17 @@ class AppPayPlugin implements PluginInterface
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[alipay][AppPayPlugin] 插件开始装载', ['rocket' => $rocket]);
Logger::debug('[Alipay][Pay][App][PayPlugin] 插件开始装载', ['rocket' => $rocket]);
$this->loadAlipayServiceProvider($rocket);
$rocket->setDirection(ResponseDirection::class)
->mergePayload([
'method' => 'alipay.trade.app.pay',
'biz_content' => array_merge(
['product_code' => 'QUICK_MSECURITY_PAY'],
$rocket->getParams(),
),
'biz_content' => $rocket->getParams(),
]);
Logger::info('[alipay][AppPayPlugin] 插件装载完毕', ['rocket' => $rocket]);
Logger::info('[Alipay][Pay][App][PayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\App;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/b5c20219_alipay.data.dataservice.bill.downloadurl.query?pathHash=5a085da8&ref=api&scene=common
*/
class QueryBillUrlPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][App][QueryBillUrlPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.data.dataservice.bill.downloadurl.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][App][QueryBillUrlPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\App;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/82ea786a_alipay.trade.query?pathHash=0745ecea&ref=api&scene=23
*/
class QueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][App][QueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][App][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\App;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/8c776df6_alipay.trade.fastpay.refund.query?pathHash=fb6e1894&ref=api&scene=common
*/
class QueryRefundPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][App][QueryRefundPlugin] 通用插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.fastpay.refund.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][App][QueryRefundPlugin] 通用插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\App;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/6c0cdd7d_alipay.trade.refund?pathHash=4081e89c&ref=api&scene=common
*/
class RefundPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][App][RefundPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.refund',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][App][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Direction\ResponseDirection;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/064jhe?pathHash=629fa9a5&ref=api&scene=2a9ad7e9012248b0acd5edd04c9f31b6
*/
class AppFreezePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][AppFreezePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->setDirection(ResponseDirection::class)
->mergePayload([
'method' => 'alipay.fund.auth.order.app.freeze',
'biz_content' => array_merge(
[
'product_code' => 'PREAUTH_PAY',
],
$rocket->getParams()
),
]);
Logger::info('[Alipay][Pay][Authorization][AppFreezePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/064jhh?pathHash=1cfd43b0&ref=api&scene=common
*/
class CancelPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][CancelPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.auth.operation.cancel',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Authorization][CancelPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/064jhl?pathHash=22f195b5&ref=api&scene=common
*/
class ClosePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][ClosePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.close',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Authorization][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/064jhg?pathHash=44be9c20&ref=api&scene=common
*/
class DetailPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][DetailPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.auth.operation.detail.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Authorization][DetailPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Exception\ContainerException;
use Yansongda\Pay\Exception\ServiceNotFoundException;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/064jhk?pathHash=1c57dd00&ref=api&scene=32f92b62c19b44cfaf3bf4d974fcbcf3
*/
class PayPlugin implements PluginInterface
{
use SupportServiceProviderTrait;
/**
* @throws ContainerException
* @throws ServiceNotFoundException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][PayPlugin] 插件开始装载', ['rocket' => $rocket]);
$this->loadAlipayServiceProvider($rocket);
$rocket->mergePayload([
'method' => 'alipay.trade.pay',
'biz_content' => array_merge(
[
'product_code' => 'PREAUTH_PAY',
],
$rocket->getParams(),
),
]);
Logger::info('[Alipay][Pay][Authorization][PayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/09bk7c?pathHash=d86258e3&ref=api&scene=9453b93a5f93490893e7ea5d19d754c9
*/
class PosFreezePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][PosFreezePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.auth.order.freeze',
'biz_content' => array_merge(
[
'auth_code_type' => 'bar_code',
'product_code' => 'PREAUTH_PAY',
],
$rocket->getParams()
),
]);
Logger::info('[Alipay][Pay][Authorization][PosFreezePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/064jhr?pathHash=f6a9e642&ref=api&scene=common
*/
class QueryBillUrlPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][QueryBillUrlPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.data.dataservice.bill.downloadurl.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Authorization][QueryBillUrlPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/064jhn?pathHash=7c131156&ref=api&scene=common
*/
class QueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][QueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Authorization][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/064jhm?pathHash=b36fd1d4&ref=api&scene=common
*/
class QueryRefundPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][QueryRefundPlugin] 通用插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.fastpay.refund.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Authorization][QueryRefundPlugin] 通用插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/064jho?pathHash=1e92f707&ref=api&scene=common
*/
class RefundPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][RefundPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.refund',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Authorization][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/09bj50?pathHash=9c577eb9&ref=api&scene=b58198cdbff342edad810bfee704489a
*/
class ScanFreezePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][ScanFreezePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.auth.order.voucher.create',
'biz_content' => array_merge(
[
'product_code' => 'PREAUTH_PAY',
],
$rocket->getParams()
),
]);
Logger::info('[Alipay][Pay][Authorization][ScanFreezePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/2c9c00e8_alipay.trade.orderinfo.sync?pathHash=bc74615a&ref=api&scene=common
*/
class SyncPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][SyncPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.orderinfo.sync',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Authorization][SyncPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Authorization;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/064jhi?pathHash=7435c8fd&ref=api&scene=common
*/
class UnfreezePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Authorization][AppFreezePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.fund.auth.order.unfreeze',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Authorization][AppFreezePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Face;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/2f7c1d5f_zoloz.authentication.smilepay.initialize?pathHash=24de8b36&ref=api&scene=common
*/
class InitPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Face][InitPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'zoloz.authentication.smilepay.initialize',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Face][InitPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Face;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/c8e4d285_zoloz.authentication.customer.ftoken.query?pathHash=4cba522d&ref=api&scene=common
*/
class QueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Face][QueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'zoloz.authentication.customer.ftoken.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Face][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Mini;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/mini/05xunj?pathHash=ca2a9ea6&ref=api&scene=common
*/
class CancelPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Mini][CancelPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.cancel',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Mini][CancelPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Mini;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/mini/05xhst?pathHash=f30ab879&ref=api&scene=common
*/
class ClosePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Mini][ClosePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.close',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Mini][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Mini;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Exception\ContainerException;
use Yansongda\Pay\Exception\ServiceNotFoundException;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/mini/05x9kv?pathHash=779dc517&ref=api&scene=de4d6a1e0c6e423b9eefa7c3a6dcb7a5
*/
class PayPlugin implements PluginInterface
{
use SupportServiceProviderTrait;
/**
* @throws ContainerException
* @throws ServiceNotFoundException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Mini][PayPlugin] 插件开始装载', ['rocket' => $rocket]);
$this->loadAlipayServiceProvider($rocket);
$rocket->mergePayload([
'method' => 'alipay.trade.create',
'biz_content' => array_merge(
[
'product_code' => 'JSAPI_PAY',
],
$rocket->getParams(),
),
]);
Logger::info('[Alipay][Pay][Mini][PayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Mini;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/mini/05xr1m?pathHash=3522e59a&ref=api&scene=common
*/
class QueryBillUrlPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Mini][QueryBillUrlPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.data.dataservice.bill.downloadurl.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Mini][QueryBillUrlPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Mini;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/6f534d7f_alipay.trade.query?pathHash=98c03720&ref=api&scene=23
*/
class QueryPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Mini][QueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Mini][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Mini;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/mini/4a0fb7bf_alipay.trade.fastpay.refund.query?pathHash=2e6cbb7c&ref=api&scene=common
*/
class QueryRefundPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Mini][QueryRefundPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.fastpay.refund.query',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Mini][QueryRefundPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Mini;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/mini/05xskz?pathHash=b18b975d&ref=api&scene=common
*/
class RefundPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Mini][RefundPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.refund',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Mini][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Pos;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/13399511_alipay.trade.cancel?pathHash=b0a8222c&ref=api&scene=common
*/
class CancelPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Pos][CancelPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.cancel',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Pos][CancelPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Pay\Pos;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
use Yansongda\Pay\Logger;
use Yansongda\Pay\Rocket;
/**
* @see https://opendocs.alipay.com/open/e84f0d79_alipay.trade.close?pathHash=b25c3fc7&ref=api&scene=common
*/
class ClosePlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Alipay][Pay][Pos][ClosePlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'method' => 'alipay.trade.close',
'biz_content' => $rocket->getParams(),
]);
Logger::info('[Alipay][Pay][Pos][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Trade;
namespace Yansongda\Pay\Plugin\Alipay\Pay\Pos;
use Closure;
use Yansongda\Pay\Contract\PluginInterface;
@ -13,7 +13,7 @@ use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
/**
* @see https://opendocs.alipay.com/open/02fkat?ref=api&scene=common
* @see https://opendocs.alipay.com/open/1f1fe18c_alipay.trade.pay?pathHash=29c9a9ba&ref=api&scene=32
*/
class PayPlugin implements PluginInterface
{
@ -25,7 +25,7 @@ class PayPlugin implements PluginInterface
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[alipay][PayPlugin] 插件开始装载', ['rocket' => $rocket]);
Logger::debug('[Alipay][Pay][Pos][PayPlugin] 插件开始装载', ['rocket' => $rocket]);
$this->loadAlipayServiceProvider($rocket);
@ -33,14 +33,13 @@ class PayPlugin implements PluginInterface
'method' => 'alipay.trade.pay',
'biz_content' => array_merge(
[
'product_code' => 'FACE_TO_FACE_PAYMENT',
'scene' => 'bar_code',
],
$rocket->getParams(),
),
]);
Logger::info('[alipay][PayPlugin] 插件装载完毕', ['rocket' => $rocket]);
Logger::info('[Alipay][Pay][Pos][PayPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}

Some files were not shown because too many files have changed in this diff Show More