├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── SECURITY.md ├── composer.json ├── phpstan.neon └── src ├── Contract └── ProviderInterface.php ├── Event ├── CallbackReceived.php ├── MethodCalled.php ├── PayEnd.php └── PayStart.php ├── Exception ├── DecryptException.php ├── Exception.php └── InvalidSignException.php ├── Functions.php ├── Pay.php ├── Plugin ├── Alipay │ └── V2 │ │ ├── AddPayloadSignaturePlugin.php │ │ ├── AddRadarPlugin.php │ │ ├── AppCallbackPlugin.php │ │ ├── CallbackPlugin.php │ │ ├── FormatPayloadBizContentPlugin.php │ │ ├── Fund │ │ ├── PCreditPayInstallment │ │ │ ├── AppPayPlugin.php │ │ │ ├── H5PayPlugin.php │ │ │ ├── PosPayPlugin.php │ │ │ └── ScanPayPlugin.php │ │ ├── Royalty │ │ │ ├── Query │ │ │ │ ├── OnsettlePlugin.php │ │ │ │ ├── RatePlugin.php │ │ │ │ └── SettlePlugin.php │ │ │ ├── Relation │ │ │ │ ├── BindPlugin.php │ │ │ │ ├── QueryPlugin.php │ │ │ │ └── UnbindPlugin.php │ │ │ └── Request │ │ │ │ └── SettleOrderPlugin.php │ │ └── Transfer │ │ │ ├── ApplyReceiptPlugin.php │ │ │ ├── Bill │ │ │ └── QueryUrlPlugin.php │ │ │ ├── Fund │ │ │ ├── QueryPlugin.php │ │ │ └── TransferPlugin.php │ │ │ ├── QueryAccountPlugin.php │ │ │ ├── QueryReceiptPlugin.php │ │ │ └── RefundPlugin.php │ │ ├── Marketing │ │ └── Redpack │ │ │ ├── AppPayPlugin.php │ │ │ └── WebPayPlugin.php │ │ ├── Member │ │ ├── Authorization │ │ │ ├── AuthPlugin.php │ │ │ ├── QueryPlugin.php │ │ │ └── TokenPlugin.php │ │ ├── Certification │ │ │ ├── CertifyPlugin.php │ │ │ ├── InitPlugin.php │ │ │ └── QueryPlugin.php │ │ ├── DetailPlugin.php │ │ ├── FaceCheck │ │ │ ├── AppInitPlugin.php │ │ │ └── AppQueryPlugin.php │ │ ├── FaceVerification │ │ │ ├── AppInitPlugin.php │ │ │ ├── AppQueryPlugin.php │ │ │ ├── H5InitPlugin.php │ │ │ ├── H5QueryPlugin.php │ │ │ ├── H5VerifyPlugin.php │ │ │ └── ServerVerifyPlugin.php │ │ └── Ocr │ │ │ ├── AppInitPlugin.php │ │ │ ├── DetectPlugin.php │ │ │ └── ServerDetectPlugin.php │ │ ├── Pay │ │ ├── Agreement │ │ │ ├── Bill │ │ │ │ └── QueryUrlPlugin.php │ │ │ ├── Pay │ │ │ │ ├── AppPayPlugin.php │ │ │ │ ├── CancelPlugin.php │ │ │ │ ├── ClosePlugin.php │ │ │ │ ├── PayPlugin.php │ │ │ │ ├── QueryPlugin.php │ │ │ │ └── RefundPlugin.php │ │ │ └── Sign │ │ │ │ ├── ModifyPlugin.php │ │ │ │ ├── QueryPlugin.php │ │ │ │ ├── SignPlugin.php │ │ │ │ └── UnsignPlugin.php │ │ ├── App │ │ │ ├── ClosePlugin.php │ │ │ ├── PayPlugin.php │ │ │ ├── QueryBillUrlPlugin.php │ │ │ ├── QueryPlugin.php │ │ │ ├── QueryRefundPlugin.php │ │ │ └── RefundPlugin.php │ │ ├── Authorization │ │ │ ├── Auth │ │ │ │ ├── AppFreezePlugin.php │ │ │ │ ├── CancelPlugin.php │ │ │ │ ├── PosFreezePlugin.php │ │ │ │ ├── QueryPlugin.php │ │ │ │ ├── ScanFreezePlugin.php │ │ │ │ └── UnfreezePlugin.php │ │ │ ├── Bill │ │ │ │ └── QueryUrlPlugin.php │ │ │ └── Pay │ │ │ │ ├── ClosePlugin.php │ │ │ │ ├── PayPlugin.php │ │ │ │ ├── QueryPlugin.php │ │ │ │ ├── QueryRefundPlugin.php │ │ │ │ ├── RefundPlugin.php │ │ │ │ └── SyncPlugin.php │ │ ├── Face │ │ │ ├── InitPlugin.php │ │ │ └── QueryPlugin.php │ │ ├── H5 │ │ │ ├── ClosePlugin.php │ │ │ ├── PayPlugin.php │ │ │ ├── QueryBillUrlPlugin.php │ │ │ ├── QueryPlugin.php │ │ │ ├── QueryRefundPlugin.php │ │ │ └── RefundPlugin.php │ │ ├── Mini │ │ │ ├── CancelPlugin.php │ │ │ ├── ClosePlugin.php │ │ │ ├── PayPlugin.php │ │ │ ├── QueryBillUrlPlugin.php │ │ │ ├── QueryPlugin.php │ │ │ ├── QueryRefundPlugin.php │ │ │ └── RefundPlugin.php │ │ ├── Pos │ │ │ ├── CancelPlugin.php │ │ │ ├── ClosePlugin.php │ │ │ ├── PayPlugin.php │ │ │ ├── QueryBillUrlPlugin.php │ │ │ ├── QueryPlugin.php │ │ │ ├── QueryRefundPlugin.php │ │ │ └── RefundPlugin.php │ │ ├── Scan │ │ │ ├── CancelPlugin.php │ │ │ ├── ClosePlugin.php │ │ │ ├── CreatePlugin.php │ │ │ ├── PayPlugin.php │ │ │ ├── QueryBillUrlPlugin.php │ │ │ ├── QueryPlugin.php │ │ │ ├── QueryRefundPlugin.php │ │ │ └── RefundPlugin.php │ │ └── Web │ │ │ ├── ClosePlugin.php │ │ │ ├── PayPlugin.php │ │ │ ├── QueryBillUrlPlugin.php │ │ │ ├── QueryPlugin.php │ │ │ ├── QueryRefundPlugin.php │ │ │ └── RefundPlugin.php │ │ ├── ResponseHtmlPlugin.php │ │ ├── ResponseInvokeStringPlugin.php │ │ ├── ResponsePlugin.php │ │ ├── StartPlugin.php │ │ └── VerifySignaturePlugin.php ├── Douyin │ └── V1 │ │ └── Pay │ │ ├── AddPayloadSignaturePlugin.php │ │ ├── AddRadarPlugin.php │ │ ├── CallbackPlugin.php │ │ ├── Mini │ │ ├── PayPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryRefundPlugin.php │ │ └── RefundPlugin.php │ │ └── ResponsePlugin.php ├── Jsb │ ├── AddPayloadSignPlugin.php │ ├── AddRadarPlugin.php │ ├── CallbackPlugin.php │ ├── Pay │ │ └── Scan │ │ │ ├── PayPlugin.php │ │ │ ├── QueryPlugin.php │ │ │ └── RefundPlugin.php │ ├── ResponsePlugin.php │ ├── StartPlugin.php │ └── VerifySignaturePlugin.php ├── Unipay │ ├── AddRadarPlugin.php │ ├── Open │ │ ├── AddPayloadSignaturePlugin.php │ │ ├── CallbackPlugin.php │ │ ├── Pay │ │ │ ├── H5 │ │ │ │ └── PayPlugin.php │ │ │ ├── QrCode │ │ │ │ ├── CancelPlugin.php │ │ │ │ ├── PosPlugin.php │ │ │ │ ├── PosPreAuthPlugin.php │ │ │ │ ├── QueryPlugin.php │ │ │ │ ├── RefundPlugin.php │ │ │ │ ├── ScanFeePlugin.php │ │ │ │ ├── ScanPlugin.php │ │ │ │ ├── ScanPreAuthPlugin.php │ │ │ │ └── ScanPreOrderPlugin.php │ │ │ └── Web │ │ │ │ ├── CancelPlugin.php │ │ │ │ ├── PayPlugin.php │ │ │ │ ├── QueryPlugin.php │ │ │ │ └── RefundPlugin.php │ │ ├── ResponseHtmlPlugin.php │ │ ├── StartPlugin.php │ │ └── VerifySignaturePlugin.php │ └── Qra │ │ ├── AddPayloadSignaturePlugin.php │ │ ├── CallbackPlugin.php │ │ ├── Pos │ │ ├── CancelPlugin.php │ │ ├── PayPlugin.php │ │ ├── QueryOpenIdPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryRefundPlugin.php │ │ └── RefundPlugin.php │ │ ├── Scan │ │ ├── ClosePlugin.php │ │ ├── PayPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryRefundPlugin.php │ │ └── RefundPlugin.php │ │ ├── StartPlugin.php │ │ └── VerifySignaturePlugin.php └── Wechat │ ├── AddRadarPlugin.php │ ├── ResponsePlugin.php │ ├── StartPlugin.php │ ├── V2 │ ├── AddPayloadSignaturePlugin.php │ ├── Papay │ │ └── Direct │ │ │ ├── ApplyPlugin.php │ │ │ ├── ContractOrderPlugin.php │ │ │ └── MiniOnlyContractPlugin.php │ ├── Pay │ │ ├── App │ │ │ └── InvokePlugin.php │ │ ├── Mini │ │ │ └── InvokePlugin.php │ │ ├── Pos │ │ │ ├── CancelPlugin.php │ │ │ ├── PayPlugin.php │ │ │ └── QueryPlugin.php │ │ └── Redpack │ │ │ └── SendPlugin.php │ └── VerifySignaturePlugin.php │ └── V3 │ ├── AddPayloadSignaturePlugin.php │ ├── CallbackPlugin.php │ ├── Extend │ ├── Complaints │ │ ├── CompletePlugin.php │ │ ├── DeleteCallbackPlugin.php │ │ ├── QueryCallbackPlugin.php │ │ ├── QueryDetailPlugin.php │ │ ├── QueryImagePlugin.php │ │ ├── QueryNegotiationPlugin.php │ │ ├── QueryPlugin.php │ │ ├── ResponsePlugin.php │ │ ├── SetCallbackPlugin.php │ │ ├── UpdateCallbackPlugin.php │ │ └── UpdateRefundPlugin.php │ └── ProfitSharing │ │ ├── AddReceiverPlugin.php │ │ ├── CreatePlugin.php │ │ ├── DeleteReceiverPlugin.php │ │ ├── DownloadBillPlugin.php │ │ ├── GetBillPlugin.php │ │ ├── QueryAmountsPlugin.php │ │ ├── QueryMerchantConfigsPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryReturnPlugin.php │ │ ├── ReturnPlugin.php │ │ └── UnfreezePlugin.php │ ├── Marketing │ ├── Coupon │ │ ├── Callback │ │ │ ├── QueryPlugin.php │ │ │ └── SetPlugin.php │ │ ├── Coupons │ │ │ ├── DetailPlugin.php │ │ │ ├── QueryUserPlugin.php │ │ │ └── SendPlugin.php │ │ └── Stock │ │ │ ├── CreatePlugin.php │ │ │ ├── PausePlugin.php │ │ │ ├── QueryDetailPlugin.php │ │ │ ├── QueryItemsPlugin.php │ │ │ ├── QueryMerchantsPlugin.php │ │ │ ├── QueryPlugin.php │ │ │ ├── QueryRefundFlowPlugin.php │ │ │ ├── QueryUseFlowPlugin.php │ │ │ ├── RestartPlugin.php │ │ │ └── StartPlugin.php │ ├── ECommerceBalance │ │ ├── QueryDayEndPlugin.php │ │ └── QueryPlugin.php │ ├── ECommerceRefund │ │ ├── ApplyPlugin.php │ │ ├── QueryByWxPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryReturnAdvancePlugin.php │ │ └── ReturnAdvancePlugin.php │ ├── Fapiao │ │ ├── Blockchain │ │ │ ├── CreatePlugin.php │ │ │ ├── DownloadPlugin.php │ │ │ ├── GetBaseInformationPlugin.php │ │ │ ├── GetDownloadInfoPlugin.php │ │ │ ├── GetTaxCodePlugin.php │ │ │ └── ReversePlugin.php │ │ ├── CreateCardTemplatePlugin.php │ │ ├── GetTitleUrlPlugin.php │ │ ├── QueryConfigPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryUserTitlePlugin.php │ │ └── UpdateConfigPlugin.php │ ├── MchTransfer │ │ ├── CancelPlugin.php │ │ ├── CreatePlugin.php │ │ ├── InvokeAndroidPlugin.php │ │ ├── InvokeIosPlugin.php │ │ ├── InvokeJsapiPlugin.php │ │ ├── QueryByWxPlugin.php │ │ └── QueryPlugin.php │ └── Transfer │ │ ├── Batch │ │ ├── QueryByWxPlugin.php │ │ └── QueryPlugin.php │ │ ├── CreatePlugin.php │ │ ├── Detail │ │ ├── QueryByWxPlugin.php │ │ └── QueryPlugin.php │ │ ├── DownloadReceiptPlugin.php │ │ ├── Receipt │ │ ├── CreatePlugin.php │ │ └── QueryPlugin.php │ │ └── ReceiptDetail │ │ ├── CreatePlugin.php │ │ └── QueryPlugin.php │ ├── Pay │ ├── App │ │ ├── ClosePlugin.php │ │ ├── DownloadBillPlugin.php │ │ ├── GetFundBillPlugin.php │ │ ├── GetTradeBillPlugin.php │ │ ├── InvokePlugin.php │ │ ├── PayPlugin.php │ │ ├── QueryByWxPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryRefundPlugin.php │ │ └── RefundPlugin.php │ ├── Bill │ │ ├── DownloadPlugin.php │ │ ├── GetFundPlugin.php │ │ └── GetTradePlugin.php │ ├── Combine │ │ ├── AppInvokePlugin.php │ │ ├── AppPayPlugin.php │ │ ├── ClosePlugin.php │ │ ├── DownloadBillPlugin.php │ │ ├── GetFundBillPlugin.php │ │ ├── GetTradeBillPlugin.php │ │ ├── H5PayPlugin.php │ │ ├── JsapiInvokePlugin.php │ │ ├── JsapiPayPlugin.php │ │ ├── MiniInvokePlugin.php │ │ ├── MiniPayPlugin.php │ │ ├── NativePayPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryRefundPlugin.php │ │ └── RefundPlugin.php │ ├── H5 │ │ ├── ClosePlugin.php │ │ ├── DownloadBillPlugin.php │ │ ├── GetFundBillPlugin.php │ │ ├── GetTradeBillPlugin.php │ │ ├── PayPlugin.php │ │ ├── QueryByWxPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryRefundPlugin.php │ │ └── RefundPlugin.php │ ├── Jsapi │ │ ├── ClosePlugin.php │ │ ├── DownloadBillPlugin.php │ │ ├── GetFundBillPlugin.php │ │ ├── GetTradeBillPlugin.php │ │ ├── InvokePlugin.php │ │ ├── PayPlugin.php │ │ ├── QueryByWxPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryRefundPlugin.php │ │ └── RefundPlugin.php │ ├── Mini │ │ ├── ClosePlugin.php │ │ ├── DownloadBillPlugin.php │ │ ├── GetFundBillPlugin.php │ │ ├── GetTradeBillPlugin.php │ │ ├── InvokePlugin.php │ │ ├── PayPlugin.php │ │ ├── QueryByWxPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryRefundPlugin.php │ │ └── RefundPlugin.php │ ├── Native │ │ ├── ClosePlugin.php │ │ ├── DownloadBillPlugin.php │ │ ├── GetFundBillPlugin.php │ │ ├── GetTradeBillPlugin.php │ │ ├── PayPlugin.php │ │ ├── QueryByWxPlugin.php │ │ ├── QueryPlugin.php │ │ ├── QueryRefundPlugin.php │ │ └── RefundPlugin.php │ ├── Pos │ │ ├── CancelPlugin.php │ │ └── PayPlugin.php │ └── Refund │ │ ├── QueryPlugin.php │ │ ├── RefundAbnormalPlugin.php │ │ └── RefundPlugin.php │ ├── VerifySignaturePlugin.php │ └── WechatPublicCertsPlugin.php ├── Provider ├── Alipay.php ├── Douyin.php ├── Jsb.php ├── Unipay.php └── Wechat.php ├── Service ├── AlipayServiceProvider.php ├── DouyinServiceProvider.php ├── JsbServiceProvider.php ├── UnipayServiceProvider.php └── WechatServiceProvider.php ├── Shortcut ├── Alipay │ ├── AppShortcut.php │ ├── CancelShortcut.php │ ├── CloseShortcut.php │ ├── H5Shortcut.php │ ├── MiniShortcut.php │ ├── PosShortcut.php │ ├── QueryShortcut.php │ ├── RefundShortcut.php │ ├── ScanShortcut.php │ ├── TransferShortcut.php │ └── WebShortcut.php ├── Douyin │ ├── MiniShortcut.php │ ├── QueryShortcut.php │ └── RefundShortcut.php ├── Jsb │ ├── QueryShortcut.php │ ├── RefundShortcut.php │ └── ScanShortcut.php ├── Unipay │ ├── CancelShortcut.php │ ├── H5Shortcut.php │ ├── PosShortcut.php │ ├── QueryShortcut.php │ ├── RefundShortcut.php │ ├── ScanShortcut.php │ └── WebShortcut.php └── Wechat │ ├── AppShortcut.php │ ├── CancelShortcut.php │ ├── CloseShortcut.php │ ├── H5Shortcut.php │ ├── MiniShortcut.php │ ├── MpShortcut.php │ ├── PapayShortcut.php │ ├── PosShortcut.php │ ├── QueryShortcut.php │ ├── RedpackShortcut.php │ ├── RefundShortcut.php │ ├── ScanShortcut.php │ └── TransferShortcut.php └── Traits └── SupportServiceProviderTrait.php /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 yansongda <me@yansongda.cn> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | PHP | Branch | Status | 9 | |:--------:|:--------:|:----------------------------------------------:|:------------:| 10 | | v3.5 | `>= 8.0` | master | 积极开发中 | 11 | | v3.4 | `>= 8.0` | master | EOL,停止维护 | 12 | | v3.0-3.3 | `>= 7.3` | master | EOL,停止维护 | 13 | | v2.x | `>= 7.0` | [v2](https://github.com/yansongda/pay/tree/v2) | 安全支持,不做新功能开发 | 14 | | v1.x | `>= 5.6` | [v1](https://github.com/yansongda/pay/tree/v1) | EOL,停止维护 | 15 | 16 | ## Reporting a Vulnerability 17 | 18 | Use this section to tell people how to report a vulnerability. 19 | 20 | Tell them where to go, how often they can expect to get an update on a 21 | reported vulnerability, what to expect if the vulnerability is accepted or 22 | declined, etc. 23 | -------------------------------------------------------------------------------- /phpstan.neon: -------------------------------------------------------------------------------- 1 | parameters: 2 | reportUnmatchedIgnoredErrors: false 3 | excludePaths: 4 | ignoreErrors: 5 | - '#.* Illuminate\\Container\\Container.*#' 6 | - '#.* Hyperf\\Utils\\ApplicationContext.*#' 7 | - '#.* think\\Container.*#' 8 | -------------------------------------------------------------------------------- /src/Contract/ProviderInterface.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Contract; 6 | 7 | use Psr\Http\Message\MessageInterface; 8 | use Psr\Http\Message\ResponseInterface; 9 | use Psr\Http\Message\ServerRequestInterface; 10 | use Yansongda\Artful\Rocket; 11 | use Yansongda\Supports\Collection; 12 | 13 | interface ProviderInterface 14 | { 15 | public function pay(array $plugins, array $params): null|Collection|MessageInterface|Rocket; 16 | 17 | public function query(array $order): Collection|Rocket; 18 | 19 | public function cancel(array $order): Collection|Rocket; 20 | 21 | public function close(array $order): Collection|Rocket; 22 | 23 | public function refund(array $order): Collection|Rocket; 24 | 25 | public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection|Rocket; 26 | 27 | public function success(): ResponseInterface; 28 | } 29 | -------------------------------------------------------------------------------- /src/Event/CallbackReceived.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Event; 6 | 7 | use Psr\Http\Message\ServerRequestInterface; 8 | use Yansongda\Artful\Event\Event; 9 | use Yansongda\Artful\Rocket; 10 | 11 | class CallbackReceived extends Event 12 | { 13 | public string $provider; 14 | 15 | public ?array $params = null; 16 | 17 | public null|array|ServerRequestInterface $contents; 18 | 19 | public function __construct(string $provider, null|array|ServerRequestInterface $contents, ?array $params = null, ?Rocket $rocket = null) 20 | { 21 | $this->provider = $provider; 22 | $this->contents = $contents; 23 | $this->params = $params; 24 | 25 | parent::__construct($rocket); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Event/MethodCalled.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Event; 6 | 7 | use Yansongda\Artful\Event\Event; 8 | use Yansongda\Artful\Rocket; 9 | 10 | class MethodCalled extends Event 11 | { 12 | public string $provider; 13 | 14 | public string $name; 15 | 16 | public array $params; 17 | 18 | public function __construct(string $provider, string $name, array $params, ?Rocket $rocket = null) 19 | { 20 | $this->provider = $provider; 21 | $this->name = $name; 22 | $this->params = $params; 23 | 24 | parent::__construct($rocket); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Event/PayEnd.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Event; 6 | 7 | use Yansongda\Artful\Event\Event; 8 | 9 | class PayEnd extends Event {} 10 | -------------------------------------------------------------------------------- /src/Event/PayStart.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Event; 6 | 7 | use Yansongda\Artful\Contract\PluginInterface; 8 | use Yansongda\Artful\Event\Event; 9 | use Yansongda\Artful\Rocket; 10 | 11 | class PayStart extends Event 12 | { 13 | /** 14 | * @var PluginInterface[] 15 | */ 16 | public array $plugins; 17 | 18 | public array $params; 19 | 20 | public function __construct(array $plugins, array $params, ?Rocket $rocket = null) 21 | { 22 | $this->plugins = $plugins; 23 | $this->params = $params; 24 | 25 | parent::__construct($rocket); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Exception/DecryptException.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Exception; 6 | 7 | use Throwable; 8 | 9 | class DecryptException extends Exception 10 | { 11 | public function __construct( 12 | int $code = self::DECRYPT_ERROR, 13 | string $message = '加解密异常', 14 | mixed $extra = null, 15 | ?Throwable $previous = null 16 | ) { 17 | parent::__construct($message, $code, $extra, $previous); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Exception/InvalidSignException.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Exception; 6 | 7 | use Throwable; 8 | 9 | class InvalidSignException extends Exception 10 | { 11 | public mixed $callback; 12 | 13 | public function __construct( 14 | int $code = self::SIGN_ERROR, 15 | string $message = '签名异常', 16 | mixed $extra = null, 17 | ?Throwable $previous = null 18 | ) { 19 | $this->callback = $extra; 20 | 21 | parent::__construct($message, $code, $extra, $previous); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/FormatPayloadBizContentPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | use function Yansongda\Artful\filter_params; 13 | 14 | class FormatPayloadBizContentPlugin implements PluginInterface 15 | { 16 | public function assembly(Rocket $rocket, Closure $next): Rocket 17 | { 18 | Logger::debug('[Alipay][FormatPayloadBizContentPlugin] 插件开始装载', ['rocket' => $rocket]); 19 | 20 | $payload = $rocket->getPayload(); 21 | 22 | $rocket->setPayload( 23 | filter_params($payload->all(), fn ($k, $v) => '' !== $v && 'sign' != $k) 24 | ->merge([ 25 | 'biz_content' => json_encode(filter_params($payload->get('biz_content', []))), 26 | ]) 27 | ); 28 | 29 | Logger::info('[Alipay][FormatPayloadBizContentPlugin] 插件装载完毕', ['rocket' => $rocket]); 30 | 31 | return $next($rocket); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/PCreditPayInstallment/AppPayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\PCreditPayInstallment; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\ResponseDirection; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | 13 | /** 14 | * @see https://opendocs.alipay.com/open/02np8z?pathHash=994a1e7d&ref=api 15 | */ 16 | class AppPayPlugin implements PluginInterface 17 | { 18 | public function assembly(Rocket $rocket, Closure $next): Rocket 19 | { 20 | Logger::debug('[Alipay][Fund][PCreditPayInstallment][AppPayPlugin] 插件开始装载', ['rocket' => $rocket]); 21 | 22 | $rocket->setDirection(ResponseDirection::class) 23 | ->mergePayload([ 24 | 'method' => 'alipay.trade.app.pay', 25 | 'biz_content' => $rocket->getParams(), 26 | ]); 27 | 28 | Logger::info('[Alipay][Fund][PCreditPayInstallment][AppPayPlugin] 插件装载完毕', ['rocket' => $rocket]); 29 | 30 | return $next($rocket); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/PCreditPayInstallment/PosPayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\PCreditPayInstallment; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\ServiceNotFoundException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Traits\SupportServiceProviderTrait; 14 | 15 | /** 16 | * @see https://opendocs.alipay.com/open/02np90?pathHash=d2a20943&ref=api&scene=32 17 | */ 18 | class PosPayPlugin implements PluginInterface 19 | { 20 | use SupportServiceProviderTrait; 21 | 22 | /** 23 | * @throws ContainerException 24 | * @throws ServiceNotFoundException 25 | */ 26 | public function assembly(Rocket $rocket, Closure $next): Rocket 27 | { 28 | Logger::debug('[Alipay][Fund][PCreditPayInstallment][PosPayPlugin] 插件开始装载', ['rocket' => $rocket]); 29 | 30 | $this->loadAlipayServiceProvider($rocket); 31 | 32 | $rocket->mergePayload([ 33 | 'method' => 'alipay.trade.pay', 34 | 'biz_content' => array_merge( 35 | [ 36 | 'product_code' => 'FACE_TO_FACE_PAYMENT', 37 | 'scene' => 'bar_code', 38 | ], 39 | $rocket->getParams(), 40 | ), 41 | ]); 42 | 43 | Logger::info('[Alipay][Fund][PCreditPayInstallment][PosPayPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/PCreditPayInstallment/ScanPayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\PCreditPayInstallment; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\ServiceNotFoundException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Traits\SupportServiceProviderTrait; 14 | 15 | /** 16 | * @see https://opendocs.alipay.com/open/02np92?pathHash=de4742e0&ref=api 17 | */ 18 | class ScanPayPlugin implements PluginInterface 19 | { 20 | use SupportServiceProviderTrait; 21 | 22 | /** 23 | * @throws ContainerException 24 | * @throws ServiceNotFoundException 25 | */ 26 | public function assembly(Rocket $rocket, Closure $next): Rocket 27 | { 28 | Logger::debug('[Alipay][Fund][PCreditPayInstallment][ScanPayPlugin] 插件开始装载', ['rocket' => $rocket]); 29 | 30 | $this->loadAlipayServiceProvider($rocket); 31 | 32 | $rocket->mergePayload([ 33 | 'method' => 'alipay.trade.precreate', 34 | 'biz_content' => $rocket->getParams(), 35 | ]); 36 | 37 | Logger::info('[Alipay][Fund][PCreditPayInstallment][ScanPayPlugin] 插件装载完毕', ['rocket' => $rocket]); 38 | 39 | return $next($rocket); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Royalty/Query/OnsettlePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Royalty\Query; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/d87dc009_alipay.trade.order.onsettle.query?pathHash=53466049&ref=api&scene=common 14 | */ 15 | class OnsettlePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Royalty][Query][OnsettlePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.order.onsettle.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Royalty][Query][OnsettlePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Royalty/Query/RatePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Royalty\Query; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/6f314ee9_alipay.trade.royalty.rate.query?pathHash=9118088a&ref=api&scene=common 14 | */ 15 | class RatePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Royalty][Query][RatePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.royalty.rate.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Royalty][Query][RatePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Royalty/Query/SettlePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Royalty\Query; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/9ef980b7_alipay.trade.order.settle.query?pathHash=688b1c13&ref=api&scene=common 14 | */ 15 | class SettlePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Royalty][Query][SettlePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.order.settle.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Royalty][Query][SettlePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Royalty/Relation/BindPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Royalty\Relation; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/c21931d6_alipay.trade.royalty.relation.bind?pathHash=08a24dae&ref=api&scene=common 14 | */ 15 | class BindPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Royalty][Relation][BindPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.royalty.relation.bind', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Royalty][Relation][BindPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Royalty/Relation/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Royalty\Relation; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/1860be54_alipay.trade.royalty.relation.batchquery?pathHash=2f733e2d&ref=api&scene=common 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Royalty][Relation][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.royalty.relation.batchquery', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Royalty][Relation][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Royalty/Relation/UnbindPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Royalty\Relation; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/3613f4e1_alipay.trade.royalty.relation.unbind?pathHash=5a880175&ref=api&scene=common 14 | */ 15 | class UnbindPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Royalty][Relation][UnbindPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.royalty.relation.unbind', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Royalty][Relation][UnbindPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Royalty/Request/SettleOrderPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Royalty\Request; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/c3b24498_alipay.trade.order.settle?pathHash=8e6acab4&ref=api&scene=common 14 | */ 15 | class SettleOrderPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Royalty][Request][SettleOrderPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.order.settle', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Royalty][Request][SettleOrderPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Transfer/ApplyReceiptPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Transfer; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/1aad1956_alipay.data.bill.ereceipt.apply?pathHash=a2527e9c&ref=api&scene=common 14 | */ 15 | class ApplyReceiptPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Transfer][ApplyReceiptPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.data.bill.ereceipt.apply', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Transfer][ApplyReceiptPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Transfer/Bill/QueryUrlPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Transfer\Bill; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/76606b11_alipay.data.dataservice.bill.downloadurl.query?pathHash=425f62c6&ref=api&scene=common 14 | */ 15 | class QueryUrlPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Transfer][Bill][QueryUrlPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.data.dataservice.bill.downloadurl.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Transfer][Bill][QueryUrlPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Transfer/Fund/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Transfer\Fund; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/58a29899_alipay.fund.trans.common.query?pathHash=aad07c6d&ref=api&scene=f9fece54d41f49cbbd00dc73655a01a4 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Transfer][Fund][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.fund.trans.common.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Transfer][Fund][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Transfer/Fund/TransferPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Transfer\Fund; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/62987723_alipay.fund.trans.uni.transfer?pathHash=66064890&ref=api&scene=ca56bca529e64125a2786703c6192d41 14 | * @see https://opendocs.alipay.com/open/02byvi?pathHash=b367173b&ref=api&scene=66dd06f5a923403393b85de68d3c0055 15 | */ 16 | class TransferPlugin implements PluginInterface 17 | { 18 | public function assembly(Rocket $rocket, Closure $next): Rocket 19 | { 20 | Logger::debug('[Alipay][Fund][Transfer][Fund][TransferPlugin] 插件开始装载', ['rocket' => $rocket]); 21 | 22 | $rocket->mergePayload([ 23 | 'method' => 'alipay.fund.trans.uni.transfer', 24 | 'biz_content' => array_merge( 25 | [ 26 | 'biz_scene' => 'DIRECT_TRANSFER', 27 | 'product_code' => 'TRANS_ACCOUNT_NO_PWD', 28 | ], 29 | $rocket->getParams(), 30 | ), 31 | ]); 32 | 33 | Logger::info('[Alipay][Fund][Transfer][Fund][TransferPlugin] 插件装载完毕', ['rocket' => $rocket]); 34 | 35 | return $next($rocket); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Transfer/QueryAccountPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Transfer; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/1b8a680c_alipay.fund.account.query?pathHash=ff8fc0e0&ref=api&scene=c76aa8f1c54e4b8b8ffecfafc4d3c31c 14 | */ 15 | class QueryAccountPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Transfer][QueryAccountPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.fund.account.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Transfer][QueryAccountPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Transfer/QueryReceiptPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Transfer; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/30b94a2f_alipay.data.bill.ereceipt.query?pathHash=bfe1c3f4&ref=api&scene=common 14 | */ 15 | class QueryReceiptPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Transfer][QueryReceiptPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.data.bill.ereceipt.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Transfer][QueryReceiptPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Fund/Transfer/RefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Fund\Transfer; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02byvd?pathHash=2dceb6d2&ref=api&scene=common 14 | */ 15 | class RefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Fund][Transfer][RefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.fund.trans.refund', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Fund][Transfer][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Marketing/Redpack/AppPayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Marketing\Redpack; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\ResponseDirection; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | 13 | /** 14 | * @see https://opendocs.alipay.com/open/03rbyf?pathHash=76643847&ref=api&scene=common 15 | */ 16 | class AppPayPlugin implements PluginInterface 17 | { 18 | public function assembly(Rocket $rocket, Closure $next): Rocket 19 | { 20 | Logger::debug('[Alipay][Marketing][Redpack][AppPayPlugin] 插件开始装载', ['rocket' => $rocket]); 21 | 22 | $rocket->setDirection(ResponseDirection::class) 23 | ->mergePayload([ 24 | 'method' => 'alipay.fund.trans.app.pay', 25 | 'biz_content' => array_merge( 26 | [ 27 | 'product_code' => 'STD_RED_PACKET', 28 | 'biz_scene' => 'PERSONAL_PAY', 29 | ], 30 | $rocket->getParams(), 31 | ), 32 | ]); 33 | 34 | Logger::info('[Alipay][Marketing][Redpack][AppPayPlugin] 插件装载完毕', ['rocket' => $rocket]); 35 | 36 | return $next($rocket); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Marketing/Redpack/WebPayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Marketing\Redpack; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\ResponseDirection; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | 13 | /** 14 | * @see https://opendocs.alipay.com/open/03rbye?pathHash=1c8d9fcb&ref=api&scene=common 15 | */ 16 | class WebPayPlugin implements PluginInterface 17 | { 18 | public function assembly(Rocket $rocket, Closure $next): Rocket 19 | { 20 | Logger::debug('[Alipay][Marketing][Redpack][WebPayPlugin] 插件开始装载', ['rocket' => $rocket]); 21 | 22 | $rocket->setDirection(ResponseDirection::class) 23 | ->mergePayload([ 24 | 'method' => 'alipay.fund.trans.page.pay', 25 | 'biz_content' => array_merge( 26 | [ 27 | 'product_code' => 'STD_APP_TRANSFER', 28 | ], 29 | $rocket->getParams() 30 | ), 31 | ]); 32 | 33 | Logger::info('[Alipay][Marketing][Redpack][WebPayPlugin] 插件装载完毕', ['rocket' => $rocket]); 34 | 35 | return $next($rocket); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/Authorization/AuthPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\Authorization; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02aile?pathHash=4efd837f&ref=api&scene=common 14 | */ 15 | class AuthPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][Authorization][AuthPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.user.info.auth', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Member][Authorization][AuthPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/Authorization/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\Authorization; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/6b97edd1_alipay.open.auth.userauth.relationship.query?pathHash=ac4a364e&ref=api&scene=common 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][Authorization][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.open.auth.userauth.relationship.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Member][Authorization][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/Authorization/TokenPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\Authorization; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/84bc7352_alipay.system.oauth.token?pathHash=fe1502d5&ref=api&scene=common 14 | */ 15 | class TokenPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][Authorization][TokenPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload(array_merge( 22 | [ 23 | 'method' => 'alipay.system.oauth.token', 24 | ], 25 | $rocket->getParams(), 26 | )); 27 | 28 | Logger::info('[Alipay][Member][Authorization][TokenPlugin] 插件装载完毕', ['rocket' => $rocket]); 29 | 30 | return $next($rocket); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/Certification/CertifyPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\Certification; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02ahk0?pathHash=b485c65c&ref=api&scene=common 14 | */ 15 | class CertifyPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][Certification][CertifyPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.user.certify.open.certify', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Member][Certification][CertifyPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/Certification/InitPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\Certification; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02ahjy?pathHash=ed72e8ea&ref=api&scene=common 14 | */ 15 | class InitPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][Certification][AppInitPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.user.certify.open.initialize', 23 | 'biz_content' => array_merge( 24 | [ 25 | 'product_code' => 'FACE', 26 | ], 27 | $rocket->getParams(), 28 | ), 29 | ]); 30 | 31 | Logger::info('[Alipay][Member][Certification][AppInitPlugin] 插件装载完毕', ['rocket' => $rocket]); 32 | 33 | return $next($rocket); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/Certification/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\Certification; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02ahjw?pathHash=a3efadb6&ref=api&scene=common 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][Certification][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.user.certify.open.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Member][Certification][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/DetailPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/a74a7068_alipay.user.info.share?pathHash=af2476d4&ref=api&scene=common 14 | */ 15 | class DetailPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][DetailPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $params = $rocket->getParams(); 22 | 23 | $rocket->mergePayload([ 24 | 'auth_token' => $params['auth_token'] ?? $params['_auth_token'] ?? '', 25 | 'method' => 'alipay.user.info.share', 26 | 'biz_content' => [], 27 | ]); 28 | 29 | Logger::info('[Alipay][Member][DetailPlugin] 插件装载完毕', ['rocket' => $rocket]); 30 | 31 | return $next($rocket); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/FaceCheck/AppInitPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\FaceCheck; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/03nisu?pathHash=43fcb08b&ref=api&scene=common 14 | */ 15 | class AppInitPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][FaceCheck][AppInitPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'datadigital.fincloud.generalsaas.face.check.initialize', 23 | 'biz_content' => array_merge( 24 | [ 25 | 'biz_code' => 'DATA_DIGITAL_BIZ_CODE_FACE_CHECK_LIVE', 26 | ], 27 | $rocket->getParams(), 28 | ), 29 | ]); 30 | 31 | Logger::info('[Alipay][Member][FaceCheck][AppInitPlugin] 插件装载完毕', ['rocket' => $rocket]); 32 | 33 | return $next($rocket); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/FaceCheck/AppQueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\FaceCheck; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/03nisv?pathHash=3f259e83&ref=api&scene=common 14 | */ 15 | class AppQueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][FaceCheck][AppQueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'datadigital.fincloud.generalsaas.face.check.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Member][FaceCheck][AppQueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/FaceVerification/AppInitPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\FaceVerification; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/04jg6r?pathHash=0572cc86&ref=api&scene=common 14 | */ 15 | class AppInitPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][FaceVerification][AppInitPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'datadigital.fincloud.generalsaas.face.verification.initialize', 23 | 'biz_content' => array_merge( 24 | [ 25 | 'biz_code' => 'DATA_DIGITAL_BIZ_CODE_FACE_VERIFICATION', 26 | 'identity_type' => 'CERT_INFO', 27 | ], 28 | $rocket->getParams(), 29 | ), 30 | ]); 31 | 32 | Logger::info('[Alipay][Member][FaceVerification][AppInitPlugin] 插件装载完毕', ['rocket' => $rocket]); 33 | 34 | return $next($rocket); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/FaceVerification/AppQueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\FaceVerification; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/04jg6s?pathHash=1608a398&ref=api&scene=common 14 | */ 15 | class AppQueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][FaceVerification][AppQueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'datadigital.fincloud.generalsaas.face.verification.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Member][FaceVerification][AppQueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/FaceVerification/H5InitPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\FaceVerification; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02zloa?pathHash=b0b7fece&ref=api&scene=common 14 | */ 15 | class H5InitPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][FaceVerification][H5InitPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'datadigital.fincloud.generalsaas.face.certify.initialize', 23 | 'biz_content' => array_merge( 24 | [ 25 | 'biz_code' => 'FUTURE_TECH_BIZ_FACE_SDK', 26 | ], 27 | $rocket->getParams(), 28 | ), 29 | ]); 30 | 31 | Logger::info('[Alipay][Member][FaceVerification][H5InitPlugin] 插件装载完毕', ['rocket' => $rocket]); 32 | 33 | return $next($rocket); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/FaceVerification/H5QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\FaceVerification; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02zloc?pathHash=b1141506&ref=api&scene=common 14 | */ 15 | class H5QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][FaceVerification][H5QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'datadigital.fincloud.generalsaas.face.certify.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Member][FaceVerification][H5QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/FaceVerification/H5VerifyPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\FaceVerification; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02zlob?pathHash=20eba12a&ref=api&scene=common 14 | */ 15 | class H5VerifyPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][FaceVerification][H5VerifyPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'datadigital.fincloud.generalsaas.face.certify.verify', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Member][FaceVerification][H5VerifyPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/FaceVerification/ServerVerifyPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\FaceVerification; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/04pxq6?pathHash=f421977b&ref=api&scene=common 14 | */ 15 | class ServerVerifyPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][FaceVerification][ServerVerifyPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'datadigital.fincloud.generalsaas.face.source.certify', 23 | 'biz_content' => array_merge( 24 | [ 25 | 'cert_type' => 'IDENTITY_CARD', 26 | ], 27 | $rocket->getParams() 28 | ), 29 | ]); 30 | 31 | Logger::info('[Alipay][Member][FaceVerification][ServerVerifyPlugin] 插件装载完毕', ['rocket' => $rocket]); 32 | 33 | return $next($rocket); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/Ocr/AppInitPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\Ocr; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/043ksf?pathHash=ea0482cd&ref=api&scene=common 14 | */ 15 | class AppInitPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][Ocr][AppInitPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'datadigital.fincloud.generalsaas.ocr.mobile.initialize', 23 | 'biz_content' => array_merge( 24 | [ 25 | 'biz_code' => 'DATA_DIGITAL_BIZ_CODE_OCR', 26 | ], 27 | $rocket->getParams(), 28 | ), 29 | ]); 30 | 31 | Logger::info('[Alipay][Member][Ocr][AppInitPlugin] 插件装载完毕', ['rocket' => $rocket]); 32 | 33 | return $next($rocket); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/Ocr/DetectPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\Ocr; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/0aggs5?pathHash=084101d3&ref=api 14 | */ 15 | class DetectPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][Ocr][DetectPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'datadigital.fincloud.generalsaas.ocr.common.detect', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Member][Ocr][DetectPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Member/Ocr/ServerDetectPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Member\Ocr; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/05ut8h?pathHash=8cc2aaf1&ref=api&scene=common 14 | */ 15 | class ServerDetectPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Member][Ocr][ServerDetectPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'datadigital.fincloud.generalsaas.ocr.server.detect', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Member][Ocr][ServerDetectPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Agreement/Bill/QueryUrlPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Agreement\Bill; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/1523f88d_alipay.data.dataservice.bill.downloadurl.query?pathHash=6a78e19b&ref=api&scene=common 14 | */ 15 | class QueryUrlPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Agreement][Bill][QueryUrlPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.data.dataservice.bill.downloadurl.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Agreement][Bill][QueryUrlPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Agreement/Pay/AppPayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Agreement\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\ResponseDirection; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | 13 | /** 14 | * @see https://opendocs.alipay.com/open/e65d4f60_alipay.trade.app.pay?pathHash=d2d3578f&ref=api&scene=f235566281d54f96942a44b84640a918 15 | */ 16 | class AppPayPlugin implements PluginInterface 17 | { 18 | public function assembly(Rocket $rocket, Closure $next): Rocket 19 | { 20 | Logger::debug('[Alipay][Pay][Agreement][Pay][AppPayPlugin] 插件开始装载', ['rocket' => $rocket]); 21 | 22 | $rocket->setDirection(ResponseDirection::class) 23 | ->mergePayload([ 24 | 'method' => 'alipay.trade.app.pay', 25 | 'biz_content' => $rocket->getParams(), 26 | ]); 27 | 28 | Logger::info('[Alipay][Pay][Agreement][Pay][AppPayPlugin] 插件装载完毕', ['rocket' => $rocket]); 29 | 30 | return $next($rocket); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Agreement/Pay/CancelPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Agreement\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/83a5f6d3_alipay.trade.cancel?pathHash=f27672eb&ref=api&scene=common 14 | */ 15 | class CancelPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Agreement][Pay][CancelPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.cancel', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Agreement][Pay][CancelPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Agreement/Pay/ClosePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Agreement\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/24a75394_alipay.trade.close?pathHash=7bf94ec4&ref=api&scene=common 14 | */ 15 | class ClosePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Agreement][Pay][ClosePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.close', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Agreement][Pay][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Agreement/Pay/PayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Agreement\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\ServiceNotFoundException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Traits\SupportServiceProviderTrait; 14 | 15 | /** 16 | * @see https://opendocs.alipay.com/open/38d751b1_alipay.trade.pay?pathHash=0a98c4e0&ref=api&scene=b4d9c9906e14451b99c8de390ae20fea 17 | */ 18 | class PayPlugin implements PluginInterface 19 | { 20 | use SupportServiceProviderTrait; 21 | 22 | /** 23 | * @throws ContainerException 24 | * @throws ServiceNotFoundException 25 | */ 26 | public function assembly(Rocket $rocket, Closure $next): Rocket 27 | { 28 | Logger::debug('[Alipay][Pay][Agreement][Pay][PayPlugin] 插件开始装载', ['rocket' => $rocket]); 29 | 30 | $this->loadAlipayServiceProvider($rocket); 31 | 32 | $rocket->mergePayload([ 33 | 'method' => 'alipay.trade.pay', 34 | 'biz_content' => array_merge( 35 | [ 36 | 'product_code' => 'GENERAL_WITHHOLDING', 37 | ], 38 | $rocket->getParams(), 39 | ), 40 | ]); 41 | 42 | Logger::info('[Alipay][Pay][Agreement][Pay][PayPlugin] 插件装载完毕', ['rocket' => $rocket]); 43 | 44 | return $next($rocket); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Agreement/Pay/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Agreement\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/07005f5c_alipay.trade.query?pathHash=aa8ed91c&ref=api&scene=common 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Agreement][Pay][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Agreement][Pay][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Agreement/Pay/RefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Agreement\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/de34d4fa_alipay.trade.refund?pathHash=46ea3fea&ref=api&scene=common 14 | */ 15 | class RefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Agreement][Pay][RefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.refund', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Agreement][Pay][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Agreement/Sign/ModifyPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Agreement\Sign; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/ed428330_alipay.user.agreement.executionplan.modify?pathHash=13c30e39&ref=api&scene=common 14 | */ 15 | class ModifyPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Agreement][Sign][ModifyPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.user.agreement.executionplan.modify', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Agreement][Sign][ModifyPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Agreement/Sign/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Agreement\Sign; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/3dab71bc_alipay.user.agreement.query?pathHash=6706b504&ref=api&scene=common 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Agreement][Sign][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.user.agreement.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Agreement][Sign][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Agreement/Sign/SignPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Agreement\Sign; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\ResponseDirection; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | 13 | /** 14 | * @see https://opendocs.alipay.com/open/8bccfa0b_alipay.user.agreement.page.sign?pathHash=725a0634&ref=api&scene=common 15 | */ 16 | class SignPlugin implements PluginInterface 17 | { 18 | public function assembly(Rocket $rocket, Closure $next): Rocket 19 | { 20 | Logger::debug('[Alipay][Pay][Agreement][Sign][SignPlugin] 插件开始装载', ['rocket' => $rocket]); 21 | 22 | $rocket->setDirection(ResponseDirection::class) 23 | ->mergePayload([ 24 | 'method' => 'alipay.user.agreement.page.sign', 25 | 'biz_content' => $rocket->getParams(), 26 | ]); 27 | 28 | Logger::info('[Alipay][Pay][Agreement][Sign][SignPlugin] 插件装载完毕', ['rocket' => $rocket]); 29 | 30 | return $next($rocket); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Agreement/Sign/UnsignPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Agreement\Sign; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/b841da1f_alipay.user.agreement.unsign?pathHash=6d2d4910&ref=api&scene=common 14 | */ 15 | class UnsignPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Agreement][Sign][UnsignPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.user.agreement.unsign', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Agreement][Sign][UnsignPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/App/ClosePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\App; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/ce0b4954_alipay.trade.close?pathHash=7b0fdae1&ref=api&scene=common 14 | */ 15 | class ClosePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][App][ClosePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.close', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][App][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/App/PayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\App; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\ResponseDirection; 10 | use Yansongda\Artful\Exception\ContainerException; 11 | use Yansongda\Artful\Exception\ServiceNotFoundException; 12 | use Yansongda\Artful\Logger; 13 | use Yansongda\Artful\Rocket; 14 | use Yansongda\Pay\Traits\SupportServiceProviderTrait; 15 | 16 | /** 17 | * @see https://opendocs.alipay.com/open/cd12c885_alipay.trade.app.pay?pathHash=c0e35284&ref=api&scene=20 18 | */ 19 | class PayPlugin implements PluginInterface 20 | { 21 | use SupportServiceProviderTrait; 22 | 23 | /** 24 | * @throws ContainerException 25 | * @throws ServiceNotFoundException 26 | */ 27 | public function assembly(Rocket $rocket, Closure $next): Rocket 28 | { 29 | Logger::debug('[Alipay][Pay][App][PayPlugin] 插件开始装载', ['rocket' => $rocket]); 30 | 31 | $this->loadAlipayServiceProvider($rocket); 32 | 33 | $rocket->setDirection(ResponseDirection::class) 34 | ->mergePayload([ 35 | 'method' => 'alipay.trade.app.pay', 36 | 'biz_content' => $rocket->getParams(), 37 | ]); 38 | 39 | Logger::info('[Alipay][Pay][App][PayPlugin] 插件装载完毕', ['rocket' => $rocket]); 40 | 41 | return $next($rocket); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/App/QueryBillUrlPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\App; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/b5c20219_alipay.data.dataservice.bill.downloadurl.query?pathHash=5a085da8&ref=api&scene=common 14 | */ 15 | class QueryBillUrlPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][App][QueryBillUrlPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.data.dataservice.bill.downloadurl.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][App][QueryBillUrlPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/App/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\App; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/82ea786a_alipay.trade.query?pathHash=0745ecea&ref=api&scene=23 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][App][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][App][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/App/QueryRefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\App; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/8c776df6_alipay.trade.fastpay.refund.query?pathHash=fb6e1894&ref=api&scene=common 14 | */ 15 | class QueryRefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][App][QueryRefundPlugin] 通用插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.fastpay.refund.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][App][QueryRefundPlugin] 通用插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/App/RefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\App; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/6c0cdd7d_alipay.trade.refund?pathHash=4081e89c&ref=api&scene=common 14 | */ 15 | class RefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][App][RefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.refund', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][App][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Auth/AppFreezePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Auth; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\ResponseDirection; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | 13 | /** 14 | * @see https://opendocs.alipay.com/open/064jhe?pathHash=629fa9a5&ref=api&scene=2a9ad7e9012248b0acd5edd04c9f31b6 15 | */ 16 | class AppFreezePlugin implements PluginInterface 17 | { 18 | public function assembly(Rocket $rocket, Closure $next): Rocket 19 | { 20 | Logger::debug('[Alipay][Pay][Authorization][Auth][AppFreezePlugin] 插件开始装载', ['rocket' => $rocket]); 21 | 22 | $rocket->setDirection(ResponseDirection::class) 23 | ->mergePayload([ 24 | 'method' => 'alipay.fund.auth.order.app.freeze', 25 | 'biz_content' => array_merge( 26 | [ 27 | 'product_code' => 'PREAUTH_PAY', 28 | ], 29 | $rocket->getParams() 30 | ), 31 | ]); 32 | 33 | Logger::info('[Alipay][Pay][Authorization][Auth][AppFreezePlugin] 插件装载完毕', ['rocket' => $rocket]); 34 | 35 | return $next($rocket); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Auth/CancelPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Auth; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/064jhh?pathHash=1cfd43b0&ref=api&scene=common 14 | */ 15 | class CancelPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Authorization][Auth][CancelPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.fund.auth.operation.cancel', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Authorization][Auth][CancelPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Auth/PosFreezePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Auth; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/09bk7c?pathHash=d86258e3&ref=api&scene=9453b93a5f93490893e7ea5d19d754c9 14 | */ 15 | class PosFreezePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Authorization][Auth][PosFreezePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.fund.auth.order.freeze', 23 | 'biz_content' => array_merge( 24 | [ 25 | 'auth_code_type' => 'bar_code', 26 | 'product_code' => 'PREAUTH_PAY', 27 | ], 28 | $rocket->getParams() 29 | ), 30 | ]); 31 | 32 | Logger::info('[Alipay][Pay][Authorization][Auth][PosFreezePlugin] 插件装载完毕', ['rocket' => $rocket]); 33 | 34 | return $next($rocket); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Auth/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Auth; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/064jhg?pathHash=44be9c20&ref=api&scene=common 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Authorization][Auth][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.fund.auth.operation.detail.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Authorization][Auth][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Auth/ScanFreezePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Auth; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/09bj50?pathHash=9c577eb9&ref=api&scene=b58198cdbff342edad810bfee704489a 14 | */ 15 | class ScanFreezePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Authorization][Auth][ScanFreezePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.fund.auth.order.voucher.create', 23 | 'biz_content' => array_merge( 24 | [ 25 | 'product_code' => 'PREAUTH_PAY', 26 | ], 27 | $rocket->getParams() 28 | ), 29 | ]); 30 | 31 | Logger::info('[Alipay][Pay][Authorization][Auth][ScanFreezePlugin] 插件装载完毕', ['rocket' => $rocket]); 32 | 33 | return $next($rocket); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Auth/UnfreezePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Auth; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/064jhi?pathHash=7435c8fd&ref=api&scene=common 14 | */ 15 | class UnfreezePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Authorization][Auth][AppFreezePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.fund.auth.order.unfreeze', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Authorization][Auth][AppFreezePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Bill/QueryUrlPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Bill; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/064jhr?pathHash=f6a9e642&ref=api&scene=common 14 | */ 15 | class QueryUrlPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Authorization][Bill][QueryUrlPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.data.dataservice.bill.downloadurl.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Authorization][Bill][QueryUrlPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Pay/ClosePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/064jhl?pathHash=22f195b5&ref=api&scene=common 14 | */ 15 | class ClosePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Authorization][Pay][ClosePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.close', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Authorization][Pay][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Pay/PayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\ServiceNotFoundException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Traits\SupportServiceProviderTrait; 14 | 15 | /** 16 | * @see https://opendocs.alipay.com/open/064jhk?pathHash=1c57dd00&ref=api&scene=32f92b62c19b44cfaf3bf4d974fcbcf3 17 | */ 18 | class PayPlugin implements PluginInterface 19 | { 20 | use SupportServiceProviderTrait; 21 | 22 | /** 23 | * @throws ContainerException 24 | * @throws ServiceNotFoundException 25 | */ 26 | public function assembly(Rocket $rocket, Closure $next): Rocket 27 | { 28 | Logger::debug('[Alipay][Pay][Authorization][Pay][PayPlugin] 插件开始装载', ['rocket' => $rocket]); 29 | 30 | $this->loadAlipayServiceProvider($rocket); 31 | 32 | $rocket->mergePayload([ 33 | 'method' => 'alipay.trade.pay', 34 | 'biz_content' => array_merge( 35 | [ 36 | 'product_code' => 'PREAUTH_PAY', 37 | ], 38 | $rocket->getParams(), 39 | ), 40 | ]); 41 | 42 | Logger::info('[Alipay][Pay][Authorization][Pay][PayPlugin] 插件装载完毕', ['rocket' => $rocket]); 43 | 44 | return $next($rocket); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Pay/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/064jhn?pathHash=7c131156&ref=api&scene=common 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Authorization][Pay][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Authorization][Pay][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Pay/QueryRefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/064jhm?pathHash=b36fd1d4&ref=api&scene=common 14 | */ 15 | class QueryRefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Authorization][Pay][QueryRefundPlugin] 通用插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.fastpay.refund.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Authorization][Pay][QueryRefundPlugin] 通用插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Pay/RefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/064jho?pathHash=1e92f707&ref=api&scene=common 14 | */ 15 | class RefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Authorization][Pay][RefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.refund', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Authorization][Pay][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Authorization/Pay/SyncPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Authorization\Pay; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/2c9c00e8_alipay.trade.orderinfo.sync?pathHash=bc74615a&ref=api&scene=common 14 | */ 15 | class SyncPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Authorization][Pay][SyncPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.orderinfo.sync', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Authorization][Pay][SyncPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Face/InitPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Face; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/2f7c1d5f_zoloz.authentication.smilepay.initialize?pathHash=24de8b36&ref=api&scene=common 14 | */ 15 | class InitPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Face][InitPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'zoloz.authentication.smilepay.initialize', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Face][InitPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Face/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Face; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/c8e4d285_zoloz.authentication.customer.ftoken.query?pathHash=4cba522d&ref=api&scene=common 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Face][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'zoloz.authentication.customer.ftoken.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Face][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/H5/ClosePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\H5; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/a62e8677_alipay.trade.close?pathHash=0801e763&ref=api&scene=common 14 | */ 15 | class ClosePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][H5][ClosePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.close', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][H5][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/H5/PayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\H5; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\ResponseDirection; 10 | use Yansongda\Artful\Exception\ContainerException; 11 | use Yansongda\Artful\Exception\ServiceNotFoundException; 12 | use Yansongda\Artful\Logger; 13 | use Yansongda\Artful\Rocket; 14 | use Yansongda\Pay\Traits\SupportServiceProviderTrait; 15 | 16 | /** 17 | * @see https://opendocs.alipay.com/open/29ae8cb6_alipay.trade.wap.pay?pathHash=0a6313c7&ref=api&scene=21 18 | */ 19 | class PayPlugin implements PluginInterface 20 | { 21 | use SupportServiceProviderTrait; 22 | 23 | /** 24 | * @throws ContainerException 25 | * @throws ServiceNotFoundException 26 | */ 27 | public function assembly(Rocket $rocket, Closure $next): Rocket 28 | { 29 | Logger::debug('[Alipay][Pay][H5][PayPlugin] 插件开始装载', ['rocket' => $rocket]); 30 | 31 | $this->loadAlipayServiceProvider($rocket); 32 | 33 | $rocket->setDirection(ResponseDirection::class) 34 | ->mergePayload([ 35 | 'method' => 'alipay.trade.wap.pay', 36 | 'biz_content' => $rocket->getParams(), 37 | ]); 38 | 39 | Logger::info('[Alipay][Pay][H5][PayPlugin] 插件装载完毕', ['rocket' => $rocket]); 40 | 41 | return $next($rocket); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/H5/QueryBillUrlPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\H5; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/3c9f1bcf_alipay.data.dataservice.bill.downloadurl.query?pathHash=97357e8b&ref=api&scene=common 14 | */ 15 | class QueryBillUrlPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][H5][QueryBillUrlPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.data.dataservice.bill.downloadurl.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][H5][QueryBillUrlPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/H5/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\H5; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/4e2d51d1_alipay.trade.query?pathHash=8abc6ffe&ref=api&scene=common 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][H5][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][H5][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/H5/QueryRefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\H5; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/7be83133_alipay.trade.fastpay.refund.query?pathHash=7cf4fed5&ref=api&scene=common 14 | */ 15 | class QueryRefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][H5][QueryRefundPlugin] 通用插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.fastpay.refund.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][H5][QueryRefundPlugin] 通用插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/H5/RefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\H5; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/4b7cc5db_alipay.trade.refund?pathHash=d98b006d&ref=api&scene=common 14 | */ 15 | class RefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][H5][RefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.refund', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][H5][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Mini/CancelPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Mini; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/mini/05xunj?pathHash=ca2a9ea6&ref=api&scene=common 14 | */ 15 | class CancelPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Mini][CancelPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.cancel', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Mini][CancelPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Mini/ClosePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Mini; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/mini/05xhst?pathHash=f30ab879&ref=api&scene=common 14 | */ 15 | class ClosePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Mini][ClosePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.close', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Mini][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Mini/PayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Mini; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\ServiceNotFoundException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Traits\SupportServiceProviderTrait; 14 | 15 | /** 16 | * @see https://opendocs.alipay.com/mini/05x9kv?pathHash=779dc517&ref=api&scene=de4d6a1e0c6e423b9eefa7c3a6dcb7a5 17 | */ 18 | class PayPlugin implements PluginInterface 19 | { 20 | use SupportServiceProviderTrait; 21 | 22 | /** 23 | * @throws ContainerException 24 | * @throws ServiceNotFoundException 25 | */ 26 | public function assembly(Rocket $rocket, Closure $next): Rocket 27 | { 28 | Logger::debug('[Alipay][Pay][Mini][PayPlugin] 插件开始装载', ['rocket' => $rocket]); 29 | 30 | $this->loadAlipayServiceProvider($rocket); 31 | 32 | $rocket->mergePayload([ 33 | 'method' => 'alipay.trade.create', 34 | 'biz_content' => array_merge( 35 | [ 36 | 'product_code' => 'JSAPI_PAY', 37 | ], 38 | $rocket->getParams(), 39 | ), 40 | ]); 41 | 42 | Logger::info('[Alipay][Pay][Mini][PayPlugin] 插件装载完毕', ['rocket' => $rocket]); 43 | 44 | return $next($rocket); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Mini/QueryBillUrlPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Mini; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/mini/05xr1m?pathHash=3522e59a&ref=api&scene=common 14 | */ 15 | class QueryBillUrlPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Mini][QueryBillUrlPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.data.dataservice.bill.downloadurl.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Mini][QueryBillUrlPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Mini/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Mini; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/6f534d7f_alipay.trade.query?pathHash=98c03720&ref=api&scene=23 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Mini][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Mini][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Mini/QueryRefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Mini; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/mini/4a0fb7bf_alipay.trade.fastpay.refund.query?pathHash=2e6cbb7c&ref=api&scene=common 14 | */ 15 | class QueryRefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Mini][QueryRefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.fastpay.refund.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Mini][QueryRefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Mini/RefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Mini; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/mini/05xskz?pathHash=b18b975d&ref=api&scene=common 14 | */ 15 | class RefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Mini][RefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.refund', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Mini][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Pos/CancelPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Pos; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/13399511_alipay.trade.cancel?pathHash=b0a8222c&ref=api&scene=common 14 | */ 15 | class CancelPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Pos][CancelPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.cancel', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Pos][CancelPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Pos/ClosePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Pos; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/e84f0d79_alipay.trade.close?pathHash=b25c3fc7&ref=api&scene=common 14 | */ 15 | class ClosePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Pos][ClosePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.close', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Pos][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Pos/PayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Pos; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\ServiceNotFoundException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Traits\SupportServiceProviderTrait; 14 | 15 | /** 16 | * @see https://opendocs.alipay.com/open/1f1fe18c_alipay.trade.pay?pathHash=29c9a9ba&ref=api&scene=32 17 | */ 18 | class PayPlugin implements PluginInterface 19 | { 20 | use SupportServiceProviderTrait; 21 | 22 | /** 23 | * @throws ContainerException 24 | * @throws ServiceNotFoundException 25 | */ 26 | public function assembly(Rocket $rocket, Closure $next): Rocket 27 | { 28 | Logger::debug('[Alipay][Pay][Pos][PayPlugin] 插件开始装载', ['rocket' => $rocket]); 29 | 30 | $this->loadAlipayServiceProvider($rocket); 31 | 32 | $rocket->mergePayload([ 33 | 'method' => 'alipay.trade.pay', 34 | 'biz_content' => array_merge( 35 | [ 36 | 'scene' => 'bar_code', 37 | ], 38 | $rocket->getParams(), 39 | ), 40 | ]); 41 | 42 | Logger::info('[Alipay][Pay][Pos][PayPlugin] 插件装载完毕', ['rocket' => $rocket]); 43 | 44 | return $next($rocket); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Pos/QueryBillUrlPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Pos; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/e81ed5f1_alipay.data.dataservice.bill.downloadurl.query?pathHash=3dde2faa&ref=api&scene=common 14 | */ 15 | class QueryBillUrlPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Pos][QueryBillUrlPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.data.dataservice.bill.downloadurl.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Pos][QueryBillUrlPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Pos/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Pos; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/6f534d7f_alipay.trade.query?pathHash=98c03720&ref=api&scene=23 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Pos][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Pos][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Pos/QueryRefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Pos; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/c1cb8815_alipay.trade.fastpay.refund.query?pathHash=6557d527&ref=api&scene=common 14 | */ 15 | class QueryRefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Pos][QueryRefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.fastpay.refund.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Pos][QueryRefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Pos/RefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Pos; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/3aea9b48_alipay.trade.refund?pathHash=04122275&ref=api&scene=common 14 | */ 15 | class RefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Pos][RefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.refund', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Pos][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Scan/CancelPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Scan; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02ekfi?pathHash=45b45d97&ref=api&scene=common 14 | */ 15 | class CancelPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Scan][CancelPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.cancel', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Scan][CancelPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Scan/ClosePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Scan; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02o6e7?pathHash=7a011fc5&ref=api&scene=common 14 | */ 15 | class ClosePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Scan][ClosePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.close', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Scan][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Scan/CreatePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Scan; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\ServiceNotFoundException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Traits\SupportServiceProviderTrait; 14 | 15 | /** 16 | * @see https://opendocs.alipay.com/open/f72f0792_alipay.trade.create?pathHash=8919111c&ref=api&scene=2d8d65b1350f44bfa394347f06700c4f 17 | */ 18 | class CreatePlugin implements PluginInterface 19 | { 20 | use SupportServiceProviderTrait; 21 | 22 | /** 23 | * @throws ContainerException 24 | * @throws ServiceNotFoundException 25 | */ 26 | public function assembly(Rocket $rocket, Closure $next): Rocket 27 | { 28 | Logger::debug('[Alipay][Pay][Scan][CreatePlugin] 插件开始装载', ['rocket' => $rocket]); 29 | 30 | $this->loadAlipayServiceProvider($rocket); 31 | 32 | $rocket->mergePayload([ 33 | 'method' => 'alipay.trade.create', 34 | 'biz_content' => $rocket->getParams(), 35 | ]); 36 | 37 | Logger::info('[Alipay][Pay][Scan][CreatePlugin] 插件装载完毕', ['rocket' => $rocket]); 38 | 39 | return $next($rocket); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Scan/PayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Scan; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\ServiceNotFoundException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Traits\SupportServiceProviderTrait; 14 | 15 | /** 16 | * @see https://opendocs.alipay.com/open/f540afd8_alipay.trade.precreate?pathHash=d3c84596&ref=api&scene=19 17 | */ 18 | class PayPlugin implements PluginInterface 19 | { 20 | use SupportServiceProviderTrait; 21 | 22 | /** 23 | * @throws ContainerException 24 | * @throws ServiceNotFoundException 25 | */ 26 | public function assembly(Rocket $rocket, Closure $next): Rocket 27 | { 28 | Logger::debug('[Alipay][Pay][Scan][PayPlugin] 插件开始装载', ['rocket' => $rocket]); 29 | 30 | $this->loadAlipayServiceProvider($rocket); 31 | 32 | $rocket->mergePayload([ 33 | 'method' => 'alipay.trade.precreate', 34 | 'biz_content' => $rocket->getParams(), 35 | ]); 36 | 37 | Logger::info('[Alipay][Pay][Scan][PayPlugin] 插件装载完毕', ['rocket' => $rocket]); 38 | 39 | return $next($rocket); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Scan/QueryBillUrlPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Scan; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02ekfm?pathHash=950726c8&ref=api&scene=common 14 | */ 15 | class QueryBillUrlPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Scan][QueryBillUrlPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.data.dataservice.bill.downloadurl.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Scan][QueryBillUrlPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Scan/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Scan; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02ekfh?pathHash=925e7dfc&ref=api&scene=23 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Scan][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Scan][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Scan/QueryRefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Scan; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02ekfl?pathHash=a223936b&ref=api&scene=common 14 | */ 15 | class QueryRefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Scan][QueryRefundPlugin] 通用插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.fastpay.refund.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Scan][QueryRefundPlugin] 通用插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Scan/RefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Scan; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/02ekfk?pathHash=b45b14f7&ref=api&scene=common 14 | */ 15 | class RefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Scan][RefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.refund', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Scan][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Web/ClosePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Web; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/8dc9ebb3_alipay.trade.close?pathHash=0c042d2b&ref=api&scene=common 14 | */ 15 | class ClosePlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Web][ClosePlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.close', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Web][ClosePlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Web/PayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Web; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\ResponseDirection; 10 | use Yansongda\Artful\Exception\ContainerException; 11 | use Yansongda\Artful\Exception\ServiceNotFoundException; 12 | use Yansongda\Artful\Logger; 13 | use Yansongda\Artful\Rocket; 14 | use Yansongda\Pay\Traits\SupportServiceProviderTrait; 15 | 16 | /** 17 | * @see https://opendocs.alipay.com/open/59da99d0_alipay.trade.page.pay?pathHash=8e24911d&ref=api&scene=22 18 | */ 19 | class PayPlugin implements PluginInterface 20 | { 21 | use SupportServiceProviderTrait; 22 | 23 | /** 24 | * @throws ContainerException 25 | * @throws ServiceNotFoundException 26 | */ 27 | public function assembly(Rocket $rocket, Closure $next): Rocket 28 | { 29 | Logger::debug('[Alipay][Pay][Web][PayPlugin] 插件开始装载', ['rocket' => $rocket]); 30 | 31 | $this->loadAlipayServiceProvider($rocket); 32 | 33 | $rocket->setDirection(ResponseDirection::class) 34 | ->mergePayload([ 35 | 'method' => 'alipay.trade.page.pay', 36 | 'biz_content' => array_merge( 37 | [ 38 | 'product_code' => 'FAST_INSTANT_TRADE_PAY', 39 | ], 40 | $rocket->getParams() 41 | ), 42 | ]); 43 | 44 | Logger::info('[Alipay][Pay][Web][PayPlugin] 插件装载完毕', ['rocket' => $rocket]); 45 | 46 | return $next($rocket); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Web/QueryBillUrlPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Web; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/e099d91f_alipay.data.dataservice.bill.downloadurl.query?pathHash=2319d4ee&ref=api&scene=common 14 | */ 15 | class QueryBillUrlPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Web][QueryBillUrlPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.data.dataservice.bill.downloadurl.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Web][QueryBillUrlPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Web/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Web; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/bff76748_alipay.trade.query?pathHash=e3ddce1d&ref=api&scene=23 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Web][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Web][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Web/QueryRefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Web; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/357441a2_alipay.trade.fastpay.refund.query?pathHash=01981dca&ref=api&scene=common 14 | */ 15 | class QueryRefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Web][QueryRefundPlugin] 通用插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.fastpay.refund.query', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Web][QueryRefundPlugin] 通用插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/Pay/Web/RefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2\Pay\Web; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://opendocs.alipay.com/open/f60979b3_alipay.trade.refund?pathHash=e4c921a7&ref=api&scene=common 14 | */ 15 | class RefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Alipay][Pay][Web][RefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'method' => 'alipay.trade.refund', 23 | 'biz_content' => $rocket->getParams(), 24 | ]); 25 | 26 | Logger::info('[Alipay][Pay][Web][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Alipay/V2/ResponseInvokeStringPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Alipay\V2; 6 | 7 | use Closure; 8 | use GuzzleHttp\Psr7\Response; 9 | use Yansongda\Artful\Contract\PluginInterface; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Supports\Arr; 13 | 14 | class ResponseInvokeStringPlugin implements PluginInterface 15 | { 16 | public function assembly(Rocket $rocket, Closure $next): Rocket 17 | { 18 | /* @var Rocket $rocket */ 19 | $rocket = $next($rocket); 20 | 21 | Logger::debug('[Alipay][ResponseInvokeStringPlugin] 插件开始装载', ['rocket' => $rocket]); 22 | 23 | $response = new Response(200, [], Arr::query($rocket->getPayload()->all())); 24 | 25 | $rocket->setDestination($response); 26 | 27 | Logger::info('[Alipay][ResponseInvokeStringPlugin] 插件装载完毕', ['rocket' => $rocket]); 28 | 29 | return $rocket; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Plugin/Jsb/Pay/Scan/PayPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Jsb\Pay\Scan; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\InvalidConfigException; 11 | use Yansongda\Artful\Exception\ServiceNotFoundException; 12 | use Yansongda\Artful\Logger; 13 | use Yansongda\Artful\Rocket; 14 | use Yansongda\Pay\Exception\Exception; 15 | 16 | use function Yansongda\Pay\get_provider_config; 17 | 18 | /** 19 | * @see https://github.com/yansongda/pay/pull/1002 20 | */ 21 | class PayPlugin implements PluginInterface 22 | { 23 | /** 24 | * @throws InvalidConfigException 25 | * @throws ServiceNotFoundException 26 | * @throws ContainerException 27 | */ 28 | public function assembly(Rocket $rocket, Closure $next): Rocket 29 | { 30 | Logger::debug('[Jsb][Pay][Scan][PayPlugin] 插件开始装载', ['rocket' => $rocket]); 31 | 32 | $params = $rocket->getParams(); 33 | $config = get_provider_config('jsb', $params); 34 | $backUrl = $rocket->getPayload()['notify_url'] ?? $config['notify_url'] ?? null; 35 | 36 | if (!$backUrl) { 37 | throw new InvalidConfigException(Exception::CONFIG_JSB_INVALID, '配置异常: 缺少配置参数 -- [notify_url]'); 38 | } 39 | 40 | $rocket->mergePayload([ 41 | 'service' => 'atPay', 42 | 'backUrl' => $backUrl, 43 | ]); 44 | 45 | Logger::info('[Jsb][Pay][Scan][PayPlugin] 插件装载完毕', ['rocket' => $rocket]); 46 | 47 | return $next($rocket); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Plugin/Jsb/Pay/Scan/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Jsb\Pay\Scan; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://github.com/yansongda/pay/pull/1002 14 | */ 15 | class QueryPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Jsb][Pay][Scan][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'deviceNo' => '1234567890', 23 | 'service' => 'payCheck', 24 | ]); 25 | 26 | Logger::info('[Jsb][Pay][Scan][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Jsb/Pay/Scan/RefundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Jsb\Pay\Scan; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://github.com/yansongda/pay/pull/1002 14 | */ 15 | class RefundPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Jsb][Pay][Scan][RefundPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | 'deviceNo' => '1234567890', 23 | 'service' => 'payRefund', 24 | ]); 25 | 26 | Logger::info('[Jsb][Pay][Scan][RefundPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Unipay/Qra/StartPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Unipay\Qra; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | class StartPlugin implements PluginInterface 13 | { 14 | public function assembly(Rocket $rocket, Closure $next): Rocket 15 | { 16 | Logger::debug('[Unipay][Qra][StartPlugin] 插件开始装载', ['rocket' => $rocket]); 17 | 18 | $params = $rocket->getParams(); 19 | 20 | $rocket->mergePayload($params); 21 | 22 | Logger::info('[Unipay][Qra][StartPlugin] 插件装载完毕', ['rocket' => $rocket]); 23 | 24 | return $next($rocket); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Plugin/Unipay/Qra/VerifySignaturePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Unipay\Qra; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\InvalidConfigException; 11 | use Yansongda\Artful\Exception\ServiceNotFoundException; 12 | use Yansongda\Artful\Logger; 13 | use Yansongda\Artful\Rocket; 14 | use Yansongda\Pay\Exception\InvalidSignException; 15 | 16 | use function Yansongda\Artful\should_do_http_request; 17 | use function Yansongda\Pay\get_provider_config; 18 | use function Yansongda\Pay\verify_unipay_sign_qra; 19 | 20 | class VerifySignaturePlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws ContainerException 24 | * @throws InvalidConfigException 25 | * @throws InvalidSignException 26 | * @throws ServiceNotFoundException 27 | */ 28 | public function assembly(Rocket $rocket, Closure $next): Rocket 29 | { 30 | /* @var Rocket $rocket */ 31 | $rocket = $next($rocket); 32 | 33 | Logger::debug('[Unipay][Qra][VerifySignaturePlugin] 插件开始装载', ['rocket' => $rocket]); 34 | 35 | $config = get_provider_config('unipay', $rocket->getParams()); 36 | 37 | if (!should_do_http_request($rocket->getDirection())) { 38 | return $rocket; 39 | } 40 | 41 | verify_unipay_sign_qra($config, $rocket->getDestination()?->all() ?? []); 42 | 43 | Logger::info('[Unipay][Qra][VerifySignaturePlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $rocket; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/ResponsePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat; 6 | 7 | use Closure; 8 | use Psr\Http\Message\ResponseInterface; 9 | use Yansongda\Artful\Contract\PluginInterface; 10 | use Yansongda\Artful\Exception\InvalidResponseException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Exception\Exception; 14 | 15 | class ResponsePlugin implements PluginInterface 16 | { 17 | /** 18 | * @throws InvalidResponseException 19 | */ 20 | public function assembly(Rocket $rocket, Closure $next): Rocket 21 | { 22 | /* @var Rocket $rocket */ 23 | $rocket = $next($rocket); 24 | 25 | Logger::debug('[Wechat][ResponsePlugin] 插件开始装载', ['rocket' => $rocket]); 26 | 27 | $this->validateResponse($rocket); 28 | 29 | Logger::info('[Wechat][ResponsePlugin] 插件装载完毕', ['rocket' => $rocket]); 30 | 31 | return $rocket; 32 | } 33 | 34 | /** 35 | * @throws InvalidResponseException 36 | */ 37 | protected function validateResponse(Rocket $rocket): void 38 | { 39 | $response = $rocket->getDestinationOrigin(); 40 | 41 | if ($response instanceof ResponseInterface 42 | && ($response->getStatusCode() < 200 || $response->getStatusCode() >= 300)) { 43 | throw new InvalidResponseException(Exception::RESPONSE_CODE_WRONG, '微信返回状态码异常,请检查参数是否错误', $rocket->getDestination()); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/StartPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat; 6 | 7 | use Closure; 8 | use JetBrains\PhpStorm\Deprecated; 9 | use Yansongda\Artful\Contract\PluginInterface; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | 13 | #[Deprecated(reason: '自 v3.7.5 版本已废弃', replacement: '`yansongda/artful` 包中的 `Yansongda\Artful\Plugin\StartPlugin`')] 14 | class StartPlugin implements PluginInterface 15 | { 16 | public function assembly(Rocket $rocket, Closure $next): Rocket 17 | { 18 | Logger::debug('[Wechat][StartPlugin] 插件开始装载', ['rocket' => $rocket]); 19 | 20 | $rocket->mergePayload($rocket->getParams()); 21 | 22 | Logger::info('[Wechat][StartPlugin] 插件装载完毕', ['rocket' => $rocket]); 23 | 24 | return $next($rocket); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V2/AddPayloadSignaturePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V2; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\InvalidConfigException; 11 | use Yansongda\Artful\Exception\ServiceNotFoundException; 12 | use Yansongda\Artful\Logger; 13 | use Yansongda\Artful\Rocket; 14 | 15 | use function Yansongda\Artful\filter_params; 16 | use function Yansongda\Pay\get_provider_config; 17 | use function Yansongda\Pay\get_wechat_sign_v2; 18 | 19 | class AddPayloadSignaturePlugin implements PluginInterface 20 | { 21 | /** 22 | * @throws ContainerException 23 | * @throws InvalidConfigException 24 | * @throws ServiceNotFoundException 25 | */ 26 | public function assembly(Rocket $rocket, Closure $next): Rocket 27 | { 28 | Logger::debug('[Wechat][V2][AddPayloadSignaturePlugin] 插件开始装载', ['rocket' => $rocket]); 29 | 30 | $config = get_provider_config('wechat', $rocket->getParams()); 31 | 32 | $rocket->mergePayload([ 33 | 'sign' => get_wechat_sign_v2($config, filter_params($rocket->getPayload())->all()), 34 | ]); 35 | 36 | Logger::info('[Wechat][V2][AddPayloadSignaturePlugin] 插件装载完毕', ['rocket' => $rocket]); 37 | 38 | return $next($rocket); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V2/VerifySignaturePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V2; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\InvalidConfigException; 11 | use Yansongda\Artful\Exception\ServiceNotFoundException; 12 | use Yansongda\Artful\Logger; 13 | use Yansongda\Artful\Rocket; 14 | use Yansongda\Pay\Exception\InvalidSignException; 15 | 16 | use function Yansongda\Artful\should_do_http_request; 17 | use function Yansongda\Pay\get_provider_config; 18 | use function Yansongda\Pay\verify_wechat_sign_v2; 19 | 20 | class VerifySignaturePlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws ContainerException 24 | * @throws InvalidConfigException 25 | * @throws ServiceNotFoundException 26 | * @throws InvalidSignException 27 | */ 28 | public function assembly(Rocket $rocket, Closure $next): Rocket 29 | { 30 | /* @var Rocket $rocket */ 31 | $rocket = $next($rocket); 32 | 33 | Logger::debug('[Wechat][V2][VerifySignaturePlugin] 插件开始装载', ['rocket' => $rocket]); 34 | 35 | $config = get_provider_config('wechat', $rocket->getParams()); 36 | 37 | if (!should_do_http_request($rocket->getDirection())) { 38 | return $rocket; 39 | } 40 | 41 | verify_wechat_sign_v2($config, $rocket->getDestination()?->all() ?? []); 42 | 43 | Logger::info('[Wechat][V2][VerifySignaturePlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $rocket; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Extend/Complaints/DeleteCallbackPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Extend\Complaints; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://pay.weixin.qq.com/docs/merchant/apis/consumer-complaint/complaint-notifications/delete-complaint-notifications.html 14 | * @see https://pay.weixin.qq.com/docs/partner/apis/consumer-complaint/complaint-notifications/delete-complaint-notifications.html 15 | */ 16 | class DeleteCallbackPlugin implements PluginInterface 17 | { 18 | public function assembly(Rocket $rocket, Closure $next): Rocket 19 | { 20 | Logger::debug('[Wechat][Extend][Complaints][DeleteCallbackPlugin] 插件开始装载', ['rocket' => $rocket]); 21 | 22 | $rocket->setPayload([ 23 | '_method' => 'DELETE', 24 | '_url' => 'v3/merchant-service/complaint-notifications', 25 | '_service_url' => 'v3/merchant-service/complaint-notifications', 26 | ]); 27 | 28 | Logger::info('[Wechat][Extend][Complaints][DeleteCallbackPlugin] 插件装载完毕', ['rocket' => $rocket]); 29 | 30 | return $next($rocket); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Extend/Complaints/QueryCallbackPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Extend\Complaints; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://pay.weixin.qq.com/docs/merchant/apis/consumer-complaint/complaint-notifications/query-complaint-notifications.html 14 | * @see https://pay.weixin.qq.com/docs/partner/apis/consumer-complaint/complaint-notifications/query-complaint-notifications.html 15 | */ 16 | class QueryCallbackPlugin implements PluginInterface 17 | { 18 | public function assembly(Rocket $rocket, Closure $next): Rocket 19 | { 20 | Logger::debug('[Wechat][Extend][Complaints][QueryCallbackPlugin] 插件开始装载', ['rocket' => $rocket]); 21 | 22 | $rocket->setPayload([ 23 | '_method' => 'GET', 24 | '_url' => 'v3/merchant-service/complaint-notifications', 25 | '_service_url' => 'v3/merchant-service/complaint-notifications', 26 | ]); 27 | 28 | Logger::info('[Wechat][Extend][Complaints][QueryCallbackPlugin] 插件装载完毕', ['rocket' => $rocket]); 29 | 30 | return $next($rocket); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Extend/Complaints/QueryImagePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Extend\Complaints; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | /** 15 | * @see https://pay.weixin.qq.com/docs/merchant/apis/consumer-complaint/images/query-images.html 16 | * @see https://pay.weixin.qq.com/docs/partner/apis/consumer-complaint/images/query-images.html 17 | */ 18 | class QueryImagePlugin implements PluginInterface 19 | { 20 | /** 21 | * @throws InvalidParamsException 22 | */ 23 | public function assembly(Rocket $rocket, Closure $next): Rocket 24 | { 25 | Logger::debug('[Wechat][Extend][Complaints][QueryImagePlugin] 插件开始装载', ['rocket' => $rocket]); 26 | 27 | $mediaId = $rocket->getPayload()?->get('media_id') ?? null; 28 | 29 | if (empty($mediaId)) { 30 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 图片请求接口,参数缺少 `media_id`'); 31 | } 32 | 33 | $rocket->setPayload([ 34 | '_method' => 'GET', 35 | '_url' => 'v3/merchant-service/images/'.$mediaId, 36 | '_service_url' => 'v3/merchant-service/images/'.$mediaId, 37 | ]); 38 | 39 | Logger::info('[Wechat][Extend][Complaints][QueryImagePlugin] 插件装载完毕', ['rocket' => $rocket]); 40 | 41 | return $next($rocket); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Extend/Complaints/SetCallbackPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Extend\Complaints; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://pay.weixin.qq.com/docs/merchant/apis/consumer-complaint/complaint-notifications/create-complaint-notifications.html 14 | * @see https://pay.weixin.qq.com/docs/partner/apis/consumer-complaint/complaint-notifications/create-complaint-notifications.html 15 | */ 16 | class SetCallbackPlugin implements PluginInterface 17 | { 18 | public function assembly(Rocket $rocket, Closure $next): Rocket 19 | { 20 | Logger::debug('[Wechat][Extend][Complaints][SetCallbackPlugin] 插件开始装载', ['rocket' => $rocket]); 21 | 22 | $payload = $rocket->getPayload(); 23 | 24 | $rocket->setPayload([ 25 | '_method' => 'POST', 26 | '_url' => 'v3/merchant-service/complaint-notifications', 27 | '_service_url' => 'v3/merchant-service/complaint-notifications', 28 | 'url' => $payload?->get('url', '') ?? '', 29 | ]); 30 | 31 | Logger::info('[Wechat][Extend][Complaints][SetCallbackPlugin] 插件装载完毕', ['rocket' => $rocket]); 32 | 33 | return $next($rocket); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Extend/Complaints/UpdateCallbackPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Extend\Complaints; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://pay.weixin.qq.com/docs/merchant/apis/consumer-complaint/complaint-notifications/update-complaint-notifications.html 14 | * @see https://pay.weixin.qq.com/docs/partner/apis/consumer-complaint/complaint-notifications/update-complaint-notifications.html 15 | */ 16 | class UpdateCallbackPlugin implements PluginInterface 17 | { 18 | public function assembly(Rocket $rocket, Closure $next): Rocket 19 | { 20 | Logger::debug('[Wechat][Extend][Complaints][UpdateCallbackPlugin] 插件开始装载', ['rocket' => $rocket]); 21 | 22 | $payload = $rocket->getPayload(); 23 | 24 | $rocket->setPayload([ 25 | '_method' => 'PUT', 26 | '_url' => 'v3/merchant-service/complaint-notifications', 27 | '_service_url' => 'v3/merchant-service/complaint-notifications', 28 | 'url' => $payload?->get('url', '') ?? '', 29 | ]); 30 | 31 | Logger::info('[Wechat][Extend][Complaints][UpdateCallbackPlugin] 插件装载完毕', ['rocket' => $rocket]); 32 | 33 | return $next($rocket); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Marketing/Coupon/Stock/QueryRefundFlowPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Coupon\Stock; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | /** 15 | * @see https://pay.weixin.qq.com/docs/merchant/apis/cash-coupons/stock/refund-flow.html 16 | * @see https://pay.weixin.qq.com/docs/partner/apis/cash-coupons/stock/refund-flow.html 17 | */ 18 | class QueryRefundFlowPlugin implements PluginInterface 19 | { 20 | /** 21 | * @throws InvalidParamsException 22 | */ 23 | public function assembly(Rocket $rocket, Closure $next): Rocket 24 | { 25 | Logger::debug('[Wechat][V3][Marketing][Coupon][Stock][QueryRefundFlowPlugin] 插件开始装载', ['rocket' => $rocket]); 26 | 27 | $stockId = $rocket->getPayload()?->get('stock_id') ?? null; 28 | 29 | if (empty($stockId)) { 30 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 下载批次退款明细,参数缺少 `stock_id`'); 31 | } 32 | 33 | $rocket->setPayload([ 34 | '_method' => 'GET', 35 | '_url' => 'v3/marketing/favor/stocks/'.$stockId.'/refund-flow', 36 | '_service_url' => 'v3/marketing/favor/stocks/'.$stockId.'/refund-flow', 37 | ]); 38 | 39 | Logger::info('[Wechat][V3][Marketing][Coupon][Stock][QueryRefundFlowPlugin] 插件装载完毕', ['rocket' => $rocket]); 40 | 41 | return $next($rocket); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Marketing/Coupon/Stock/QueryUseFlowPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Coupon\Stock; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | /** 15 | * @see https://pay.weixin.qq.com/docs/merchant/apis/cash-coupons/stock/use-flow.html 16 | * @see https://pay.weixin.qq.com/docs/partner/apis/cash-coupons/stock/use-flow.html 17 | */ 18 | class QueryUseFlowPlugin implements PluginInterface 19 | { 20 | /** 21 | * @throws InvalidParamsException 22 | */ 23 | public function assembly(Rocket $rocket, Closure $next): Rocket 24 | { 25 | Logger::debug('[Wechat][V3][Marketing][Coupon][Stock][QueryUseFlowPlugin] 插件开始装载', ['rocket' => $rocket]); 26 | 27 | $stockId = $rocket->getPayload()?->get('stock_id') ?? null; 28 | 29 | if (empty($stockId)) { 30 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 下载批次核销明细,参数缺少 `stock_id`'); 31 | } 32 | 33 | $rocket->setPayload([ 34 | '_method' => 'GET', 35 | '_url' => 'v3/marketing/favor/stocks/'.$stockId.'/use-flow', 36 | '_service_url' => 'v3/marketing/favor/stocks/'.$stockId.'/use-flow', 37 | ]); 38 | 39 | Logger::info('[Wechat][V3][Marketing][Coupon][Stock][QueryUseFlowPlugin] 插件装载完毕', ['rocket' => $rocket]); 40 | 41 | return $next($rocket); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Marketing/Fapiao/Blockchain/GetBaseInformationPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-merchant/get-merchant-info.html 14 | */ 15 | class GetBaseInformationPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Wechat][V3][Marketing][Fapiao][Blockchain][GetBaseInformationPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->setPayload([ 22 | '_method' => 'GET', 23 | '_url' => 'v3/new-tax-control-fapiao/merchant/base-information', 24 | ]); 25 | 26 | Logger::info('[Wechat][V3][Marketing][Fapiao][Blockchain][GetBaseInformationPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Marketing/Fapiao/Blockchain/GetTaxCodePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | /** 15 | * @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-merchant/list-merchant-tax-codes.html 16 | */ 17 | class GetTaxCodePlugin implements PluginInterface 18 | { 19 | /** 20 | * @throws InvalidParamsException 21 | */ 22 | public function assembly(Rocket $rocket, Closure $next): Rocket 23 | { 24 | Logger::debug('[Wechat][V3][Marketing][Fapiao][Blockchain][GetTaxCodePlugin] 插件开始装载', ['rocket' => $rocket]); 25 | 26 | $payload = $rocket->getPayload(); 27 | $offset = $payload?->get('offset') ?? null; 28 | $limit = $payload?->get('limit') ?? null; 29 | 30 | if (empty($offset) || empty($limit)) { 31 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 获取商户可开具的商品和服务税收分类编码对照表,缺少 `offset` 或 `limit` 参数'); 32 | } 33 | 34 | $rocket->setPayload([ 35 | '_method' => 'GET', 36 | '_url' => 'v3/new-tax-control-fapiao/merchant/tax-codes?offset='.$offset.'&limit='.$limit, 37 | ]); 38 | 39 | Logger::info('[Wechat][V3][Marketing][Fapiao][Blockchain][GetTaxCodePlugin] 插件装载完毕', ['rocket' => $rocket]); 40 | 41 | return $next($rocket); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Marketing/Fapiao/CreateCardTemplatePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\ContainerException; 10 | use Yansongda\Artful\Exception\ServiceNotFoundException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | 14 | use function Yansongda\Pay\get_provider_config; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/products/fapiao/apilist.html 18 | */ 19 | class CreateCardTemplatePlugin implements PluginInterface 20 | { 21 | /** 22 | * @throws ContainerException 23 | * @throws ServiceNotFoundException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][V3][Marketing][Fapiao][CreateCardTemplatePlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $params = $rocket->getParams(); 30 | $config = get_provider_config('wechat', $params); 31 | $payload = $rocket->getPayload(); 32 | 33 | $rocket->mergePayload([ 34 | '_method' => 'POST', 35 | '_url' => 'v3/new-tax-control-fapiao/card-template', 36 | 'card_appid' => $payload?->get('card_appid') ?? $config['mp_app_id'], 37 | ]); 38 | 39 | Logger::info('[Wechat][V3][Marketing][Fapiao][CreateCardTemplatePlugin] 插件装载完毕', ['rocket' => $rocket]); 40 | 41 | return $next($rocket); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Marketing/Fapiao/QueryConfigPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-merchant/query-development-config.html 14 | */ 15 | class QueryConfigPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Wechat][V3][Marketing][Fapiao][QueryConfigPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->setPayload([ 22 | '_method' => 'GET', 23 | '_url' => 'v3/new-tax-control-fapiao/merchant/development-config', 24 | ]); 25 | 26 | Logger::info('[Wechat][V3][Marketing][Fapiao][QueryConfigPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Marketing/Fapiao/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | /** 15 | * @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-applications/get-fapiao-applications.html 16 | */ 17 | class QueryPlugin implements PluginInterface 18 | { 19 | /** 20 | * @throws InvalidParamsException 21 | */ 22 | public function assembly(Rocket $rocket, Closure $next): Rocket 23 | { 24 | Logger::debug('[Wechat][V3][Marketing][Fapiao][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 25 | 26 | $payload = $rocket->getPayload(); 27 | $applyId = $payload?->get('fapiao_apply_id') ?? null; 28 | $fapiaoId = $payload?->get('fapiao_id') ?? null; 29 | 30 | if (empty($applyId)) { 31 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 查询电子发票,参数缺少 `fapiao_apply_id`'); 32 | } 33 | 34 | $rocket->setPayload([ 35 | '_method' => 'GET', 36 | '_url' => 'v3/new-tax-control-fapiao/fapiao-applications/'.$applyId.(empty($fapiaoId) ? '' : '?fapiao_id='.$fapiaoId), 37 | ]); 38 | 39 | Logger::info('[Wechat][V3][Marketing][Fapiao][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 40 | 41 | return $next($rocket); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Marketing/Fapiao/QueryUserTitlePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/user-title/get-user-title.html 18 | */ 19 | class QueryUserTitlePlugin implements PluginInterface 20 | { 21 | /** 22 | * @throws InvalidParamsException 23 | */ 24 | public function assembly(Rocket $rocket, Closure $next): Rocket 25 | { 26 | Logger::debug('[Wechat][V3][Marketing][Fapiao][QueryUserTitlePlugin] 插件开始装载', ['rocket' => $rocket]); 27 | 28 | $payload = $rocket->getPayload(); 29 | 30 | if (empty($payload)) { 31 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 获取用户填写的抬头,缺少必要参数'); 32 | } 33 | 34 | $rocket->setPayload([ 35 | '_method' => 'GET', 36 | '_url' => 'v3/new-tax-control-fapiao/user-title?'.filter_params($payload)->query(), 37 | ]); 38 | 39 | Logger::info('[Wechat][V3][Marketing][Fapiao][QueryUserTitlePlugin] 插件装载完毕', ['rocket' => $rocket]); 40 | 41 | return $next($rocket); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Marketing/Fapiao/UpdateConfigPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | /** 13 | * @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-merchant/update-development-config.html 14 | */ 15 | class UpdateConfigPlugin implements PluginInterface 16 | { 17 | public function assembly(Rocket $rocket, Closure $next): Rocket 18 | { 19 | Logger::debug('[Wechat][V3][Marketing][Fapiao][UpdateConfigPlugin] 插件开始装载', ['rocket' => $rocket]); 20 | 21 | $rocket->mergePayload([ 22 | '_method' => 'PATCH', 23 | '_url' => 'v3/new-tax-control-fapiao/merchant/development-config', 24 | ]); 25 | 26 | Logger::info('[Wechat][V3][Marketing][Fapiao][UpdateConfigPlugin] 插件装载完毕', ['rocket' => $rocket]); 27 | 28 | return $next($rocket); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/App/DownloadBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\App; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\OriginResponseDirection; 10 | use Yansongda\Artful\Exception\InvalidParamsException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Exception\Exception; 14 | 15 | /** 16 | * @see https://pay.weixin.qq.com/docs/merchant/apis/in-app-payment/download-bill.html 17 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-in-app-payment/download-bill.html 18 | */ 19 | class DownloadBillPlugin implements PluginInterface 20 | { 21 | /** 22 | * @throws InvalidParamsException 23 | */ 24 | public function assembly(Rocket $rocket, Closure $next): Rocket 25 | { 26 | Logger::debug('[Wechat][V3][Pay][App][DownloadBillPlugin] 插件开始装载', ['rocket' => $rocket]); 27 | 28 | $downloadUrl = $rocket->getPayload()?->get('download_url') ?? null; 29 | 30 | if (empty($downloadUrl)) { 31 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: App 下载交易对账单,参数缺少 `download_url`'); 32 | } 33 | 34 | $rocket->setDirection(OriginResponseDirection::class) 35 | ->setPayload([ 36 | '_method' => 'GET', 37 | '_url' => $downloadUrl, 38 | '_service_url' => $downloadUrl, 39 | ]); 40 | 41 | Logger::info('[Wechat][V3][Pay][App][DownloadBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 42 | 43 | return $next($rocket); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/App/GetFundBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\App; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/in-app-payment/get-fund-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-in-app-payment/get-fund-bill.html 19 | */ 20 | class GetFundBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][V3][Pay][App][GetFundBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: App 申请资金账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/fundflowbill?'.$query, 40 | '_service_url' => 'v3/bill/fundflowbill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][V3][Pay][App][GetFundBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/App/GetTradeBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\App; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/in-app-payment/get-trade-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-in-app-payment/get-trade-bill.html 19 | */ 20 | class GetTradeBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][V3][Pay][App][GetTradeBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: App 申请交易账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/tradebill?'.$query, 40 | '_service_url' => 'v3/bill/tradebill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][V3][Pay][App][GetTradeBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Bill/DownloadPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Bill; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\OriginResponseDirection; 10 | use Yansongda\Artful\Exception\InvalidParamsException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Exception\Exception; 14 | 15 | /** 16 | * @see https://pay.weixin.qq.com/docs/merchant/apis/bill-download/download-bill.html 17 | * @see https://pay.weixin.qq.com/docs/partner/apis/bill-download/download-bill.html 18 | */ 19 | class DownloadPlugin implements PluginInterface 20 | { 21 | /** 22 | * @throws InvalidParamsException 23 | */ 24 | public function assembly(Rocket $rocket, Closure $next): Rocket 25 | { 26 | Logger::debug('[Wechat][V3][Pay][Bill][DownloadPlugin] 插件开始装载', ['rocket' => $rocket]); 27 | 28 | $downloadUrl = $rocket->getPayload()?->get('download_url') ?? null; 29 | 30 | if (empty($downloadUrl)) { 31 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: App 下载交易对账单,参数缺少 `download_url`'); 32 | } 33 | 34 | $rocket->setDirection(OriginResponseDirection::class) 35 | ->setPayload([ 36 | '_method' => 'GET', 37 | '_url' => $downloadUrl, 38 | '_service_url' => $downloadUrl, 39 | ]); 40 | 41 | Logger::info('[Wechat][V3][Pay][Bill][DownloadPlugin] 插件装载完毕', ['rocket' => $rocket]); 42 | 43 | return $next($rocket); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Bill/GetFundPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Bill; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/bill-download/fund-bill/get-fund-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/bill-download/fund-bill/get-fund-bill.html 19 | */ 20 | class GetFundPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][V3][Pay][Bill][GetFundPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: App 申请资金账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/fundflowbill?'.$query, 40 | '_service_url' => 'v3/bill/fundflowbill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][V3][Pay][Bill][GetFundPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Bill/GetTradePlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Bill; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/bill-download/trade-bill/get-trade-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/bill-download/trade-bill/get-trade-bill.html 19 | */ 20 | class GetTradePlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][V3][Pay][Bill][GetTradePlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: App 申请交易账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/tradebill?'.$query, 40 | '_service_url' => 'v3/bill/tradebill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][V3][Pay][Bill][GetTradePlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Combine/GetFundBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Combine; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/combine-payment/bill-download/get-fund-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/combine-payment/bill-download/get-fund-bill.html 19 | */ 20 | class GetFundBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][Pay][Combine][GetFundBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 合单 申请资金账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/fundflowbill?'.$query, 40 | '_service_url' => 'v3/bill/fundflowbill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][Pay][Combine][GetFundBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Combine/GetTradeBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Combine; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/combine-payment/bill-download/get-trade-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/combine-payment/bill-download/get-trade-bill.html 19 | */ 20 | class GetTradeBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][Pay][Combine][GetTradeBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 合单 申请交易账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/tradebill?'.$query, 40 | '_service_url' => 'v3/bill/tradebill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][Pay][Combine][GetTradeBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Combine/QueryPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Combine; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | /** 15 | * @see https://pay.weixin.qq.com/docs/merchant/apis/combine-payment/orders/query-order.html 16 | * @see https://pay.weixin.qq.com/docs/partner/apis/combine-payment/orders/query-order.html 17 | */ 18 | class QueryPlugin implements PluginInterface 19 | { 20 | /** 21 | * @throws InvalidParamsException 22 | */ 23 | public function assembly(Rocket $rocket, Closure $next): Rocket 24 | { 25 | Logger::debug('[Wechat][Pay][Combine][QueryPlugin] 插件开始装载', ['rocket' => $rocket]); 26 | 27 | $combineOutTradeNo = $rocket->getPayload()?->get('combine_out_trade_no') ?? null; 28 | 29 | if (empty($combineOutTradeNo)) { 30 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 合单查询,参数缺少 `combine_out_trade_no`'); 31 | } 32 | 33 | $rocket->setPayload([ 34 | '_method' => 'GET', 35 | '_url' => 'v3/combine-transactions/out-trade-no/'.$combineOutTradeNo, 36 | '_service_url' => 'v3/combine-transactions/out-trade-no/'.$combineOutTradeNo, 37 | ]); 38 | 39 | Logger::info('[Wechat][Pay][Combine][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]); 40 | 41 | return $next($rocket); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/H5/DownloadBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\H5; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\OriginResponseDirection; 10 | use Yansongda\Artful\Exception\InvalidParamsException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Exception\Exception; 14 | 15 | /** 16 | * @see https://pay.weixin.qq.com/docs/merchant/apis/h5-payment/download-bill.html 17 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-h5-payment/download-bill.html 18 | */ 19 | class DownloadBillPlugin implements PluginInterface 20 | { 21 | /** 22 | * @throws InvalidParamsException 23 | */ 24 | public function assembly(Rocket $rocket, Closure $next): Rocket 25 | { 26 | Logger::debug('[Wechat][V3][Pay][H5][DownloadBillPlugin] 插件开始装载', ['rocket' => $rocket]); 27 | 28 | $downloadUrl = $rocket->getPayload()?->get('download_url') ?? null; 29 | 30 | if (empty($downloadUrl)) { 31 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: H5 下载交易对账单,参数缺少 `download_url`'); 32 | } 33 | 34 | $rocket->setDirection(OriginResponseDirection::class) 35 | ->setPayload([ 36 | '_method' => 'GET', 37 | '_url' => $downloadUrl, 38 | '_service_url' => $downloadUrl, 39 | ]); 40 | 41 | Logger::info('[Wechat][V3][Pay][H5][DownloadBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 42 | 43 | return $next($rocket); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/H5/GetFundBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\H5; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/h5-payment/get-fund-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-h5-payment/get-fund-bill.html 19 | */ 20 | class GetFundBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][V3][Pay][H5][GetFundBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: H5 申请资金账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/fundflowbill?'.$query, 40 | '_service_url' => 'v3/bill/fundflowbill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][V3][Pay][H5][GetFundBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/H5/GetTradeBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\H5; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/h5-payment/get-trade-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-h5-payment/get-trade-bill.html 19 | */ 20 | class GetTradeBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][V3][Pay][H5][GetTradeBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: H5 申请交易账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/tradebill?'.$query, 40 | '_service_url' => 'v3/bill/tradebill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][V3][Pay][H5][GetTradeBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Jsapi/DownloadBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Direction\OriginResponseDirection; 10 | use Yansongda\Artful\Exception\InvalidParamsException; 11 | use Yansongda\Artful\Logger; 12 | use Yansongda\Artful\Rocket; 13 | use Yansongda\Pay\Exception\Exception; 14 | 15 | /** 16 | * @see https://pay.weixin.qq.com/docs/merchant/apis/jsapi-payment/download-bill.html 17 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-jsapi-payment/download-bill.html 18 | */ 19 | class DownloadBillPlugin implements PluginInterface 20 | { 21 | /** 22 | * @throws InvalidParamsException 23 | */ 24 | public function assembly(Rocket $rocket, Closure $next): Rocket 25 | { 26 | Logger::debug('[Wechat][Pay][Jsapi][DownloadBillPlugin] 插件开始装载', ['rocket' => $rocket]); 27 | 28 | $downloadUrl = $rocket->getPayload()?->get('download_url') ?? null; 29 | 30 | if (empty($downloadUrl)) { 31 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Jsapi 下载交易对账单,参数缺少 `download_url`'); 32 | } 33 | 34 | $rocket->setDirection(OriginResponseDirection::class) 35 | ->setPayload([ 36 | '_method' => 'GET', 37 | '_url' => $downloadUrl, 38 | '_service_url' => $downloadUrl, 39 | ]); 40 | 41 | Logger::info('[Wechat][Pay][Jsapi][DownloadBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 42 | 43 | return $next($rocket); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Jsapi/GetFundBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/jsapi-payment/get-fund-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-jsapi-payment/get-fund-bill.html 19 | */ 20 | class GetFundBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][Pay][Jsapi][GetFundBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Jsapi 申请资金账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/fundflowbill?'.$query, 40 | '_service_url' => 'v3/bill/fundflowbill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][Pay][Jsapi][GetFundBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Jsapi/GetTradeBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/jsapi-payment/get-trade-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-jsapi-payment/get-trade-bill.html 19 | */ 20 | class GetTradeBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][Pay][Jsapi][GetTradeBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Jsapi 申请交易账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/tradebill?'.$query, 40 | '_service_url' => 'v3/bill/tradebill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][Pay][Jsapi][GetTradeBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Mini/GetFundBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/mini-program-payment/get-fund-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-mini-program-payment/get-fund-bill.html 19 | */ 20 | class GetFundBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][Pay][Mini][GetFundBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Mini 申请资金账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/fundflowbill?'.$query, 40 | '_service_url' => 'v3/bill/fundflowbill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][Pay][Mini][GetFundBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Mini/GetTradeBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/mini-program-payment/get-trade-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-mini-program-payment/get-trade-bill.html 19 | */ 20 | class GetTradeBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][Pay][Mini][GetTradeBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Mini 申请交易账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/tradebill?'.$query, 40 | '_service_url' => 'v3/bill/tradebill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][Pay][Mini][GetTradeBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Native/GetFundBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Native; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/native-payment/get-fund-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-native-payment/get-fund-bill.html 19 | */ 20 | class GetFundBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][V3][Pay][Native][GetFundBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Native 申请资金账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/fundflowbill?'.$query, 40 | '_service_url' => 'v3/bill/fundflowbill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][V3][Pay][Native][GetFundBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/Pay/Native/GetTradeBillPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Native; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Exception\InvalidParamsException; 10 | use Yansongda\Artful\Logger; 11 | use Yansongda\Artful\Rocket; 12 | use Yansongda\Pay\Exception\Exception; 13 | 14 | use function Yansongda\Artful\filter_params; 15 | 16 | /** 17 | * @see https://pay.weixin.qq.com/docs/merchant/apis/native-payment/get-trade-bill.html 18 | * @see https://pay.weixin.qq.com/docs/partner/apis/partner-native-payment/get-trade-bill.html 19 | */ 20 | class GetTradeBillPlugin implements PluginInterface 21 | { 22 | /** 23 | * @throws InvalidParamsException 24 | */ 25 | public function assembly(Rocket $rocket, Closure $next): Rocket 26 | { 27 | Logger::debug('[Wechat][Pay][Native][GetTradeBillPlugin] 插件开始装载', ['rocket' => $rocket]); 28 | 29 | $payload = $rocket->getPayload(); 30 | 31 | if (is_null($payload)) { 32 | throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Native 申请交易账单,参数为空'); 33 | } 34 | 35 | $query = filter_params($payload)->query(); 36 | 37 | $rocket->setPayload([ 38 | '_method' => 'GET', 39 | '_url' => 'v3/bill/tradebill?'.$query, 40 | '_service_url' => 'v3/bill/tradebill?'.$query, 41 | ]); 42 | 43 | Logger::info('[Wechat][Pay][Native][GetTradeBillPlugin] 插件装载完毕', ['rocket' => $rocket]); 44 | 45 | return $next($rocket); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Plugin/Wechat/V3/WechatPublicCertsPlugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Plugin\Wechat\V3; 6 | 7 | use Closure; 8 | use Yansongda\Artful\Contract\PluginInterface; 9 | use Yansongda\Artful\Logger; 10 | use Yansongda\Artful\Rocket; 11 | 12 | class WechatPublicCertsPlugin implements PluginInterface 13 | { 14 | public function assembly(Rocket $rocket, Closure $next): Rocket 15 | { 16 | Logger::debug('[Wechat][V3][WechatPublicCertsPlugin] 插件开始装载', ['rocket' => $rocket]); 17 | 18 | $rocket->setPayload([ 19 | '_method' => 'GET', 20 | '_url' => 'v3/certificates', 21 | ]); 22 | 23 | Logger::info('[Wechat][V3][WechatPublicCertsPlugin] 插件装载完毕', ['rocket' => $rocket]); 24 | 25 | return $next($rocket); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Service/AlipayServiceProvider.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Service; 6 | 7 | use Yansongda\Artful\Contract\ServiceProviderInterface; 8 | use Yansongda\Artful\Exception\ContainerException; 9 | use Yansongda\Pay\Pay; 10 | use Yansongda\Pay\Provider\Alipay; 11 | 12 | class AlipayServiceProvider implements ServiceProviderInterface 13 | { 14 | /** 15 | * @throws ContainerException 16 | */ 17 | public function register(mixed $data = null): void 18 | { 19 | $service = new Alipay(); 20 | 21 | Pay::set(Alipay::class, $service); 22 | Pay::set('alipay', $service); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Service/DouyinServiceProvider.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Service; 6 | 7 | use Yansongda\Artful\Contract\ServiceProviderInterface; 8 | use Yansongda\Artful\Exception\ContainerException; 9 | use Yansongda\Pay\Pay; 10 | use Yansongda\Pay\Provider\Douyin; 11 | 12 | class DouyinServiceProvider implements ServiceProviderInterface 13 | { 14 | /** 15 | * @throws ContainerException 16 | */ 17 | public function register(mixed $data = null): void 18 | { 19 | $service = new Douyin(); 20 | 21 | Pay::set(Douyin::class, $service); 22 | Pay::set('douyin', $service); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Service/JsbServiceProvider.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Service; 6 | 7 | use Yansongda\Artful\Contract\ServiceProviderInterface; 8 | use Yansongda\Artful\Exception\ContainerException; 9 | use Yansongda\Pay\Pay; 10 | use Yansongda\Pay\Provider\Jsb; 11 | 12 | class JsbServiceProvider implements ServiceProviderInterface 13 | { 14 | /** 15 | * @throws ContainerException 16 | */ 17 | public function register(mixed $data = null): void 18 | { 19 | $service = new Jsb(); 20 | 21 | Pay::set(Jsb::class, $service); 22 | Pay::set('jsb', $service); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Service/UnipayServiceProvider.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Service; 6 | 7 | use Yansongda\Artful\Contract\ServiceProviderInterface; 8 | use Yansongda\Artful\Exception\ContainerException; 9 | use Yansongda\Pay\Pay; 10 | use Yansongda\Pay\Provider\Unipay; 11 | 12 | class UnipayServiceProvider implements ServiceProviderInterface 13 | { 14 | /** 15 | * @throws ContainerException 16 | */ 17 | public function register(mixed $data = null): void 18 | { 19 | $service = new Unipay(); 20 | 21 | Pay::set(Unipay::class, $service); 22 | Pay::set('unipay', $service); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Service/WechatServiceProvider.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Service; 6 | 7 | use Yansongda\Artful\Contract\ServiceProviderInterface; 8 | use Yansongda\Artful\Exception\ContainerException; 9 | use Yansongda\Pay\Pay; 10 | use Yansongda\Pay\Provider\Wechat; 11 | 12 | class WechatServiceProvider implements ServiceProviderInterface 13 | { 14 | /** 15 | * @throws ContainerException 16 | */ 17 | public function register(mixed $data = null): void 18 | { 19 | $service = new Wechat(); 20 | 21 | Pay::set(Wechat::class, $service); 22 | Pay::set('wechat', $service); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Shortcut/Alipay/AppShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Alipay; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\ParserPlugin; 9 | use Yansongda\Pay\Plugin\Alipay\V2\AddPayloadSignaturePlugin; 10 | use Yansongda\Pay\Plugin\Alipay\V2\FormatPayloadBizContentPlugin; 11 | use Yansongda\Pay\Plugin\Alipay\V2\Pay\App\PayPlugin; 12 | use Yansongda\Pay\Plugin\Alipay\V2\ResponseInvokeStringPlugin; 13 | use Yansongda\Pay\Plugin\Alipay\V2\StartPlugin; 14 | 15 | class AppShortcut implements ShortcutInterface 16 | { 17 | public function getPlugins(array $params): array 18 | { 19 | return [ 20 | StartPlugin::class, 21 | PayPlugin::class, 22 | FormatPayloadBizContentPlugin::class, 23 | AddPayloadSignaturePlugin::class, 24 | ResponseInvokeStringPlugin::class, 25 | ParserPlugin::class, 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Shortcut/Alipay/H5Shortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Alipay; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\ParserPlugin; 9 | use Yansongda\Pay\Plugin\Alipay\V2\AddPayloadSignaturePlugin; 10 | use Yansongda\Pay\Plugin\Alipay\V2\AddRadarPlugin; 11 | use Yansongda\Pay\Plugin\Alipay\V2\FormatPayloadBizContentPlugin; 12 | use Yansongda\Pay\Plugin\Alipay\V2\Pay\H5\PayPlugin; 13 | use Yansongda\Pay\Plugin\Alipay\V2\ResponseHtmlPlugin; 14 | use Yansongda\Pay\Plugin\Alipay\V2\StartPlugin; 15 | 16 | class H5Shortcut implements ShortcutInterface 17 | { 18 | public function getPlugins(array $params): array 19 | { 20 | return [ 21 | StartPlugin::class, 22 | PayPlugin::class, 23 | FormatPayloadBizContentPlugin::class, 24 | AddPayloadSignaturePlugin::class, 25 | AddRadarPlugin::class, 26 | ResponseHtmlPlugin::class, 27 | ParserPlugin::class, 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Shortcut/Alipay/MiniShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Alipay; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\ParserPlugin; 9 | use Yansongda\Pay\Plugin\Alipay\V2\AddPayloadSignaturePlugin; 10 | use Yansongda\Pay\Plugin\Alipay\V2\AddRadarPlugin; 11 | use Yansongda\Pay\Plugin\Alipay\V2\FormatPayloadBizContentPlugin; 12 | use Yansongda\Pay\Plugin\Alipay\V2\Pay\Mini\PayPlugin; 13 | use Yansongda\Pay\Plugin\Alipay\V2\ResponsePlugin; 14 | use Yansongda\Pay\Plugin\Alipay\V2\StartPlugin; 15 | use Yansongda\Pay\Plugin\Alipay\V2\VerifySignaturePlugin; 16 | 17 | class MiniShortcut implements ShortcutInterface 18 | { 19 | public function getPlugins(array $params): array 20 | { 21 | return [ 22 | StartPlugin::class, 23 | PayPlugin::class, 24 | FormatPayloadBizContentPlugin::class, 25 | AddPayloadSignaturePlugin::class, 26 | AddRadarPlugin::class, 27 | VerifySignaturePlugin::class, 28 | ResponsePlugin::class, 29 | ParserPlugin::class, 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Shortcut/Alipay/PosShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Alipay; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\ParserPlugin; 9 | use Yansongda\Pay\Plugin\Alipay\V2\AddPayloadSignaturePlugin; 10 | use Yansongda\Pay\Plugin\Alipay\V2\AddRadarPlugin; 11 | use Yansongda\Pay\Plugin\Alipay\V2\FormatPayloadBizContentPlugin; 12 | use Yansongda\Pay\Plugin\Alipay\V2\Pay\Pos\PayPlugin; 13 | use Yansongda\Pay\Plugin\Alipay\V2\ResponsePlugin; 14 | use Yansongda\Pay\Plugin\Alipay\V2\StartPlugin; 15 | use Yansongda\Pay\Plugin\Alipay\V2\VerifySignaturePlugin; 16 | 17 | class PosShortcut implements ShortcutInterface 18 | { 19 | public function getPlugins(array $params): array 20 | { 21 | return [ 22 | StartPlugin::class, 23 | PayPlugin::class, 24 | FormatPayloadBizContentPlugin::class, 25 | AddPayloadSignaturePlugin::class, 26 | AddRadarPlugin::class, 27 | VerifySignaturePlugin::class, 28 | ResponsePlugin::class, 29 | ParserPlugin::class, 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Shortcut/Alipay/ScanShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Alipay; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\ParserPlugin; 9 | use Yansongda\Pay\Plugin\Alipay\V2\AddPayloadSignaturePlugin; 10 | use Yansongda\Pay\Plugin\Alipay\V2\AddRadarPlugin; 11 | use Yansongda\Pay\Plugin\Alipay\V2\FormatPayloadBizContentPlugin; 12 | use Yansongda\Pay\Plugin\Alipay\V2\Pay\Scan\PayPlugin; 13 | use Yansongda\Pay\Plugin\Alipay\V2\ResponsePlugin; 14 | use Yansongda\Pay\Plugin\Alipay\V2\StartPlugin; 15 | use Yansongda\Pay\Plugin\Alipay\V2\VerifySignaturePlugin; 16 | 17 | class ScanShortcut implements ShortcutInterface 18 | { 19 | public function getPlugins(array $params): array 20 | { 21 | return [ 22 | StartPlugin::class, 23 | PayPlugin::class, 24 | FormatPayloadBizContentPlugin::class, 25 | AddPayloadSignaturePlugin::class, 26 | AddRadarPlugin::class, 27 | VerifySignaturePlugin::class, 28 | ResponsePlugin::class, 29 | ParserPlugin::class, 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Shortcut/Alipay/TransferShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Alipay; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\ParserPlugin; 9 | use Yansongda\Pay\Plugin\Alipay\V2\AddPayloadSignaturePlugin; 10 | use Yansongda\Pay\Plugin\Alipay\V2\AddRadarPlugin; 11 | use Yansongda\Pay\Plugin\Alipay\V2\FormatPayloadBizContentPlugin; 12 | use Yansongda\Pay\Plugin\Alipay\V2\Fund\Transfer\Fund\TransferPlugin; 13 | use Yansongda\Pay\Plugin\Alipay\V2\ResponsePlugin; 14 | use Yansongda\Pay\Plugin\Alipay\V2\StartPlugin; 15 | use Yansongda\Pay\Plugin\Alipay\V2\VerifySignaturePlugin; 16 | 17 | class TransferShortcut implements ShortcutInterface 18 | { 19 | public function getPlugins(array $params): array 20 | { 21 | return [ 22 | StartPlugin::class, 23 | TransferPlugin::class, 24 | FormatPayloadBizContentPlugin::class, 25 | AddPayloadSignaturePlugin::class, 26 | AddRadarPlugin::class, 27 | VerifySignaturePlugin::class, 28 | ResponsePlugin::class, 29 | ParserPlugin::class, 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Shortcut/Alipay/WebShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Alipay; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\ParserPlugin; 9 | use Yansongda\Pay\Plugin\Alipay\V2\AddPayloadSignaturePlugin; 10 | use Yansongda\Pay\Plugin\Alipay\V2\AddRadarPlugin; 11 | use Yansongda\Pay\Plugin\Alipay\V2\FormatPayloadBizContentPlugin; 12 | use Yansongda\Pay\Plugin\Alipay\V2\Pay\Web\PayPlugin; 13 | use Yansongda\Pay\Plugin\Alipay\V2\ResponseHtmlPlugin; 14 | use Yansongda\Pay\Plugin\Alipay\V2\StartPlugin; 15 | 16 | class WebShortcut implements ShortcutInterface 17 | { 18 | public function getPlugins(array $params): array 19 | { 20 | return [ 21 | StartPlugin::class, 22 | PayPlugin::class, 23 | FormatPayloadBizContentPlugin::class, 24 | AddPayloadSignaturePlugin::class, 25 | AddRadarPlugin::class, 26 | ResponseHtmlPlugin::class, 27 | ParserPlugin::class, 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Shortcut/Douyin/MiniShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Douyin; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\AddPayloadBodyPlugin; 9 | use Yansongda\Artful\Plugin\ParserPlugin; 10 | use Yansongda\Artful\Plugin\StartPlugin; 11 | use Yansongda\Pay\Plugin\Douyin\V1\Pay\AddPayloadSignaturePlugin; 12 | use Yansongda\Pay\Plugin\Douyin\V1\Pay\AddRadarPlugin; 13 | use Yansongda\Pay\Plugin\Douyin\V1\Pay\Mini\PayPlugin; 14 | use Yansongda\Pay\Plugin\Douyin\V1\Pay\ResponsePlugin; 15 | 16 | class MiniShortcut implements ShortcutInterface 17 | { 18 | public function getPlugins(array $params): array 19 | { 20 | return [ 21 | StartPlugin::class, 22 | PayPlugin::class, 23 | AddPayloadSignaturePlugin::class, 24 | AddPayloadBodyPlugin::class, 25 | AddRadarPlugin::class, 26 | ResponsePlugin::class, 27 | ParserPlugin::class, 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Shortcut/Jsb/QueryShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Jsb; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\ParserPlugin; 9 | use Yansongda\Pay\Plugin\Jsb\AddPayloadSignPlugin; 10 | use Yansongda\Pay\Plugin\Jsb\AddRadarPlugin; 11 | use Yansongda\Pay\Plugin\Jsb\Pay\Scan\QueryPlugin; 12 | use Yansongda\Pay\Plugin\Jsb\ResponsePlugin; 13 | use Yansongda\Pay\Plugin\Jsb\StartPlugin; 14 | use Yansongda\Pay\Plugin\Jsb\VerifySignaturePlugin; 15 | 16 | class QueryShortcut implements ShortcutInterface 17 | { 18 | public function getPlugins(array $params): array 19 | { 20 | return [ 21 | StartPlugin::class, 22 | QueryPlugin::class, 23 | AddPayloadSignPlugin::class, 24 | AddRadarPlugin::class, 25 | VerifySignaturePlugin::class, 26 | ResponsePlugin::class, 27 | ParserPlugin::class, 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Shortcut/Jsb/RefundShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Jsb; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\ParserPlugin; 9 | use Yansongda\Pay\Plugin\Jsb\AddPayloadSignPlugin; 10 | use Yansongda\Pay\Plugin\Jsb\AddRadarPlugin; 11 | use Yansongda\Pay\Plugin\Jsb\Pay\Scan\RefundPlugin; 12 | use Yansongda\Pay\Plugin\Jsb\ResponsePlugin; 13 | use Yansongda\Pay\Plugin\Jsb\StartPlugin; 14 | use Yansongda\Pay\Plugin\Jsb\VerifySignaturePlugin; 15 | 16 | class RefundShortcut implements ShortcutInterface 17 | { 18 | public function getPlugins(array $params): array 19 | { 20 | return [ 21 | StartPlugin::class, 22 | RefundPlugin::class, 23 | AddPayloadSignPlugin::class, 24 | AddRadarPlugin::class, 25 | VerifySignaturePlugin::class, 26 | ResponsePlugin::class, 27 | ParserPlugin::class, 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Shortcut/Jsb/ScanShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Jsb; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\ParserPlugin; 9 | use Yansongda\Pay\Plugin\Jsb\AddPayloadSignPlugin; 10 | use Yansongda\Pay\Plugin\Jsb\AddRadarPlugin; 11 | use Yansongda\Pay\Plugin\Jsb\Pay\Scan\PayPlugin; 12 | use Yansongda\Pay\Plugin\Jsb\ResponsePlugin; 13 | use Yansongda\Pay\Plugin\Jsb\StartPlugin; 14 | use Yansongda\Pay\Plugin\Jsb\VerifySignaturePlugin; 15 | 16 | class ScanShortcut implements ShortcutInterface 17 | { 18 | public function getPlugins(array $params): array 19 | { 20 | return [ 21 | StartPlugin::class, 22 | PayPlugin::class, 23 | AddPayloadSignPlugin::class, 24 | AddRadarPlugin::class, 25 | VerifySignaturePlugin::class, 26 | ResponsePlugin::class, 27 | ParserPlugin::class, 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Shortcut/Unipay/H5Shortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Unipay; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\AddPayloadBodyPlugin; 9 | use Yansongda\Artful\Plugin\ParserPlugin; 10 | use Yansongda\Pay\Plugin\Unipay\AddRadarPlugin; 11 | use Yansongda\Pay\Plugin\Unipay\Open\AddPayloadSignaturePlugin; 12 | use Yansongda\Pay\Plugin\Unipay\Open\Pay\H5\PayPlugin; 13 | use Yansongda\Pay\Plugin\Unipay\Open\ResponseHtmlPlugin; 14 | use Yansongda\Pay\Plugin\Unipay\Open\StartPlugin; 15 | 16 | class H5Shortcut implements ShortcutInterface 17 | { 18 | public function getPlugins(array $params): array 19 | { 20 | return [ 21 | StartPlugin::class, 22 | PayPlugin::class, 23 | AddPayloadSignaturePlugin::class, 24 | AddPayloadBodyPlugin::class, 25 | AddRadarPlugin::class, 26 | ResponseHtmlPlugin::class, 27 | ParserPlugin::class, 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Shortcut/Unipay/WebShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Unipay; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\AddPayloadBodyPlugin; 9 | use Yansongda\Artful\Plugin\ParserPlugin; 10 | use Yansongda\Pay\Plugin\Unipay\AddRadarPlugin; 11 | use Yansongda\Pay\Plugin\Unipay\Open\AddPayloadSignaturePlugin; 12 | use Yansongda\Pay\Plugin\Unipay\Open\Pay\Web\PayPlugin; 13 | use Yansongda\Pay\Plugin\Unipay\Open\ResponseHtmlPlugin; 14 | use Yansongda\Pay\Plugin\Unipay\Open\StartPlugin; 15 | 16 | class WebShortcut implements ShortcutInterface 17 | { 18 | public function getPlugins(array $params): array 19 | { 20 | return [ 21 | StartPlugin::class, 22 | PayPlugin::class, 23 | AddPayloadSignaturePlugin::class, 24 | AddPayloadBodyPlugin::class, 25 | AddRadarPlugin::class, 26 | ResponseHtmlPlugin::class, 27 | ParserPlugin::class, 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Shortcut/Wechat/AppShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Wechat; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\AddPayloadBodyPlugin; 9 | use Yansongda\Artful\Plugin\ParserPlugin; 10 | use Yansongda\Artful\Plugin\StartPlugin; 11 | use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; 12 | use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; 13 | use Yansongda\Pay\Plugin\Wechat\V3\AddPayloadSignaturePlugin; 14 | use Yansongda\Pay\Plugin\Wechat\V3\Pay\App\InvokePlugin; 15 | use Yansongda\Pay\Plugin\Wechat\V3\Pay\App\PayPlugin; 16 | use Yansongda\Pay\Plugin\Wechat\V3\VerifySignaturePlugin; 17 | 18 | class AppShortcut implements ShortcutInterface 19 | { 20 | public function getPlugins(array $params): array 21 | { 22 | return [ 23 | StartPlugin::class, 24 | PayPlugin::class, 25 | AddPayloadBodyPlugin::class, 26 | AddPayloadSignaturePlugin::class, 27 | AddRadarPlugin::class, 28 | InvokePlugin::class, 29 | VerifySignaturePlugin::class, 30 | ResponsePlugin::class, 31 | ParserPlugin::class, 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Shortcut/Wechat/H5Shortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Wechat; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\AddPayloadBodyPlugin; 9 | use Yansongda\Artful\Plugin\ParserPlugin; 10 | use Yansongda\Artful\Plugin\StartPlugin; 11 | use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; 12 | use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; 13 | use Yansongda\Pay\Plugin\Wechat\V3\AddPayloadSignaturePlugin; 14 | use Yansongda\Pay\Plugin\Wechat\V3\Pay\H5\PayPlugin; 15 | use Yansongda\Pay\Plugin\Wechat\V3\VerifySignaturePlugin; 16 | 17 | class H5Shortcut implements ShortcutInterface 18 | { 19 | public function getPlugins(array $params): array 20 | { 21 | return [ 22 | StartPlugin::class, 23 | PayPlugin::class, 24 | AddPayloadBodyPlugin::class, 25 | AddPayloadSignaturePlugin::class, 26 | AddRadarPlugin::class, 27 | VerifySignaturePlugin::class, 28 | ResponsePlugin::class, 29 | ParserPlugin::class, 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Shortcut/Wechat/MiniShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Wechat; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\AddPayloadBodyPlugin; 9 | use Yansongda\Artful\Plugin\ParserPlugin; 10 | use Yansongda\Artful\Plugin\StartPlugin; 11 | use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; 12 | use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; 13 | use Yansongda\Pay\Plugin\Wechat\V3\AddPayloadSignaturePlugin; 14 | use Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini\InvokePlugin; 15 | use Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini\PayPlugin; 16 | use Yansongda\Pay\Plugin\Wechat\V3\VerifySignaturePlugin; 17 | 18 | class MiniShortcut implements ShortcutInterface 19 | { 20 | public function getPlugins(array $params): array 21 | { 22 | return [ 23 | StartPlugin::class, 24 | PayPlugin::class, 25 | AddPayloadBodyPlugin::class, 26 | AddPayloadSignaturePlugin::class, 27 | AddRadarPlugin::class, 28 | InvokePlugin::class, 29 | VerifySignaturePlugin::class, 30 | ResponsePlugin::class, 31 | ParserPlugin::class, 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Shortcut/Wechat/MpShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Wechat; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\AddPayloadBodyPlugin; 9 | use Yansongda\Artful\Plugin\ParserPlugin; 10 | use Yansongda\Artful\Plugin\StartPlugin; 11 | use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; 12 | use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; 13 | use Yansongda\Pay\Plugin\Wechat\V3\AddPayloadSignaturePlugin; 14 | use Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi\InvokePlugin; 15 | use Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi\PayPlugin; 16 | use Yansongda\Pay\Plugin\Wechat\V3\VerifySignaturePlugin; 17 | 18 | class MpShortcut implements ShortcutInterface 19 | { 20 | public function getPlugins(array $params): array 21 | { 22 | return [ 23 | StartPlugin::class, 24 | PayPlugin::class, 25 | AddPayloadBodyPlugin::class, 26 | AddPayloadSignaturePlugin::class, 27 | AddRadarPlugin::class, 28 | InvokePlugin::class, 29 | VerifySignaturePlugin::class, 30 | ResponsePlugin::class, 31 | ParserPlugin::class, 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Shortcut/Wechat/PosShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Wechat; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\AddPayloadBodyPlugin; 9 | use Yansongda\Artful\Plugin\ParserPlugin; 10 | use Yansongda\Artful\Plugin\StartPlugin; 11 | use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; 12 | use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; 13 | use Yansongda\Pay\Plugin\Wechat\V3\AddPayloadSignaturePlugin; 14 | use Yansongda\Pay\Plugin\Wechat\V3\Pay\Pos\PayPlugin; 15 | use Yansongda\Pay\Plugin\Wechat\V3\VerifySignaturePlugin; 16 | 17 | class PosShortcut implements ShortcutInterface 18 | { 19 | public function getPlugins(array $params): array 20 | { 21 | return [ 22 | StartPlugin::class, 23 | PayPlugin::class, 24 | AddPayloadBodyPlugin::class, 25 | AddPayloadSignaturePlugin::class, 26 | AddRadarPlugin::class, 27 | VerifySignaturePlugin::class, 28 | ResponsePlugin::class, 29 | ParserPlugin::class, 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Shortcut/Wechat/RedpackShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Wechat; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\AddPayloadBodyPlugin; 9 | use Yansongda\Artful\Plugin\ParserPlugin; 10 | use Yansongda\Artful\Plugin\StartPlugin; 11 | use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; 12 | use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; 13 | use Yansongda\Pay\Plugin\Wechat\V2\AddPayloadSignaturePlugin; 14 | use Yansongda\Pay\Plugin\Wechat\V2\Pay\Redpack\SendPlugin; 15 | use Yansongda\Pay\Plugin\Wechat\V2\VerifySignaturePlugin; 16 | 17 | class RedpackShortcut implements ShortcutInterface 18 | { 19 | public function getPlugins(array $params): array 20 | { 21 | return [ 22 | StartPlugin::class, 23 | SendPlugin::class, 24 | AddPayloadSignaturePlugin::class, 25 | AddPayloadBodyPlugin::class, 26 | AddRadarPlugin::class, 27 | VerifySignaturePlugin::class, 28 | ResponsePlugin::class, 29 | ParserPlugin::class, 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Shortcut/Wechat/ScanShortcut.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Shortcut\Wechat; 6 | 7 | use Yansongda\Artful\Contract\ShortcutInterface; 8 | use Yansongda\Artful\Plugin\AddPayloadBodyPlugin; 9 | use Yansongda\Artful\Plugin\ParserPlugin; 10 | use Yansongda\Artful\Plugin\StartPlugin; 11 | use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; 12 | use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; 13 | use Yansongda\Pay\Plugin\Wechat\V3\AddPayloadSignaturePlugin; 14 | use Yansongda\Pay\Plugin\Wechat\V3\Pay\Native\PayPlugin; 15 | use Yansongda\Pay\Plugin\Wechat\V3\VerifySignaturePlugin; 16 | 17 | class ScanShortcut implements ShortcutInterface 18 | { 19 | public function getPlugins(array $params): array 20 | { 21 | return [ 22 | StartPlugin::class, 23 | PayPlugin::class, 24 | AddPayloadBodyPlugin::class, 25 | AddPayloadSignaturePlugin::class, 26 | AddRadarPlugin::class, 27 | VerifySignaturePlugin::class, 28 | ResponsePlugin::class, 29 | ParserPlugin::class, 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Traits/SupportServiceProviderTrait.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | declare(strict_types=1); 4 | 5 | namespace Yansongda\Pay\Traits; 6 | 7 | use Yansongda\Artful\Exception\ContainerException; 8 | use Yansongda\Artful\Exception\ServiceNotFoundException; 9 | use Yansongda\Artful\Rocket; 10 | use Yansongda\Pay\Pay; 11 | 12 | use function Yansongda\Pay\get_provider_config; 13 | 14 | trait SupportServiceProviderTrait 15 | { 16 | /** 17 | * @throws ContainerException 18 | * @throws ServiceNotFoundException 19 | */ 20 | protected function loadAlipayServiceProvider(Rocket $rocket): void 21 | { 22 | $params = $rocket->getParams(); 23 | $config = get_provider_config('alipay', $params); 24 | $serviceProviderId = $config['service_provider_id'] ?? null; 25 | 26 | if (Pay::MODE_SERVICE !== ($config['mode'] ?? Pay::MODE_NORMAL) 27 | || empty($serviceProviderId)) { 28 | return; 29 | } 30 | 31 | $rocket->mergeParams([ 32 | 'extend_params' => array_merge($params['extend_params'] ?? [], ['sys_service_provider_id' => $serviceProviderId]), 33 | ]); 34 | } 35 | } 36 | --------------------------------------------------------------------------------