fix:更新已知bug,优化代码
This commit is contained in:
99
vendor/yansongda/pay/CHANGELOG.md
vendored
99
vendor/yansongda/pay/CHANGELOG.md
vendored
@@ -1,6 +1,103 @@
|
||||
## v3.1.12
|
||||
|
||||
### fixed
|
||||
|
||||
- fix: 微信代金券详情 url 不正确(#663)
|
||||
|
||||
### refactor
|
||||
|
||||
- refactor: 优化代码 (#661)
|
||||
|
||||
## v3.1.11
|
||||
|
||||
### added
|
||||
|
||||
- feat: 微信退款自动增加回调url(#649)
|
||||
|
||||
## v3.1.10
|
||||
|
||||
### added
|
||||
|
||||
- feat: 支付宝周期扣款签约接口(#644)
|
||||
|
||||
## v3.1.9
|
||||
|
||||
### fixed
|
||||
|
||||
- fix: 微信服务商模式预下单存在子商户appid时,invoke 时也应该为子商户 appid (#638)
|
||||
|
||||
## v3.1.8
|
||||
|
||||
### fixed
|
||||
|
||||
- fix: 提前读取响应数据造成数据错误的问题(#633, #634)
|
||||
|
||||
## v3.1.7
|
||||
|
||||
### fixed
|
||||
|
||||
- fix: 微信内网页支付供应商模式 sub_appid 非必填(#628)
|
||||
|
||||
## v3.1.6
|
||||
|
||||
### fixed
|
||||
|
||||
- fix: 微信注释中返回类型错误(#630)
|
||||
|
||||
## v3.1.5
|
||||
|
||||
### added
|
||||
|
||||
- feat: 微信服务商退款及查询退款支持自动 sub_mchid 参数(#619)
|
||||
|
||||
## v3.1.4
|
||||
|
||||
### added
|
||||
|
||||
- feat: 支持微信投诉API (#614)
|
||||
|
||||
## v3.1.3
|
||||
|
||||
### added
|
||||
|
||||
- feat: 配置文件增加第三方应用授权token的支持 (#602)
|
||||
|
||||
## v3.1.2
|
||||
|
||||
### fixed
|
||||
|
||||
- fix: alipay 中 event dispatch provider 是 wechat 的问题 #595
|
||||
|
||||
## v3.1.1
|
||||
|
||||
### fixed
|
||||
|
||||
- fix: 设置 container,强制更新 config 后 container 不是设置的 container 的问题 #591
|
||||
|
||||
## v3.1.0
|
||||
|
||||
兼容 v3.0 版本,推荐升级(#579)
|
||||
|
||||
### dependency
|
||||
|
||||
- delete: 移除 `php-di/php-di` 依赖。如果您使用的框架非 `hyperf`, `laravel` 或 没有指定 `ContainerInterface`,仍需手动安装 `composer require php-di/php-di`
|
||||
- delete: 移除 `guzzlehttp/guzzle` 依赖。如果没有指定 `\Yansongda\Pay\Contract\HttpClientInterface` 仍需手动安装 `composer require guzzlehttp/guzzle`
|
||||
- upgrade: 升级 `yansongda/supports` 到 `~v3.2.0`
|
||||
- upgrade: 升级 `php` 最低版本到 `7.4.0`
|
||||
|
||||
### fixed
|
||||
|
||||
- fix: 解决 php8.1 下 deprecated 的提示
|
||||
|
||||
### kernel
|
||||
|
||||
- refactor: 自动识别 `hyperf`, `laravel` 框架,使用相应的 `container` 减少内存占用
|
||||
- refactor: 完全支持 `psr11`,可手动传入 `ContainerInterface` 使用
|
||||
- changed: `Pay::config(array $config = [], $container = null)` 方法第二个参数增加为 $container,可手动传入 `ContainerInterface`/`Closure`。注意 `Closure` 需最终返回一个 `ContainerInterface` 的实例。
|
||||
|
||||
## v3.0.27
|
||||
|
||||
### fix
|
||||
### fixed
|
||||
|
||||
- fix: 添加分账接受人姓名加密字段错误 (#566)
|
||||
|
||||
|
||||
4
vendor/yansongda/pay/LICENSE
vendored
4
vendor/yansongda/pay/LICENSE
vendored
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) yansongda <me@yansongda.cn>
|
||||
Copyright (c) 2017 yansongda <me@yansongda.cn>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -17,4 +17,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
9
vendor/yansongda/pay/README.md
vendored
9
vendor/yansongda/pay/README.md
vendored
@@ -1,8 +1,9 @@
|
||||
<p align="center">
|
||||
<a href="https://pay.yansongda.cn" target="_blank" rel="noopener noreferrer"><img width="200" src="https://cdn.jsdelivr.net/gh/yansongda/pay-site/.vuepress/public/images/logo.png" alt="Logo"></a>
|
||||
<a href="https://pay.yansongda.cn" target="_blank" rel="noopener noreferrer"><img width="200" src="https://pay.yansongda.cn/images/logo.png" alt="Logo"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://codecov.io/gh/yansongda/pay" ><img src="https://codecov.io/gh/yansongda/pay/branch/master/graph/badge.svg?token=tYMV0YT5jj"/></a>
|
||||
<a href="https://scrutinizer-ci.com/g/yansongda/pay/?branch=master"><img src="https://scrutinizer-ci.com/g/yansongda/pay/badges/quality-score.png?b=master" alt="scrutinizer"></a>
|
||||
<a href="https://github.com/yansongda/pay/actions"><img src="https://github.com/yansongda/pay/workflows/Linter/badge.svg" alt="Linter Status"></a>
|
||||
<a href="https://github.com/yansongda/pay/actions"><img src="https://github.com/yansongda/pay/workflows/Tester/badge.svg" alt="Tester Status"></a>
|
||||
@@ -38,10 +39,10 @@ yii 扩展包请 [传送至这里](https://github.com/guanguans/yii-pay)
|
||||
- 文件结构清晰易理解,可以随心所欲添加本项目中没有的支付网关
|
||||
- 方法使用更优雅,不必再去研究那些奇怪的的方法名或者类名是做啥用的
|
||||
- 内置自动获取微信公共证书方法,再也不用再费劲去考虑第一次获取证书的的问题了
|
||||
- 符合 PSR2、PSR3、PSR4、PSR7、PSR11、PSR14 等各项标准,你可以各种方便的与你的框架集成
|
||||
- 符合 PSR2、PSR3、PSR4、PSR7、PSR11、PSR14、PSR18 等各项标准,你可以各种方便的与你的框架集成
|
||||
|
||||
## 运行环境
|
||||
- PHP 7.3+
|
||||
- PHP 7.3+ (v3.1.0 开始需 7.4+)
|
||||
- composer
|
||||
|
||||
## 详细文档
|
||||
@@ -79,7 +80,7 @@ yansongda/pay 100% 兼容 支付宝/微信 所有功能(包括服务商功能
|
||||
|
||||
## 安装
|
||||
```shell
|
||||
composer require yansongda/pay:~3.0.0 -vvv
|
||||
composer require yansongda/pay:~3.1.0 -vvv
|
||||
```
|
||||
|
||||
## 深情一撇
|
||||
|
||||
19
vendor/yansongda/pay/composer.json
vendored
19
vendor/yansongda/pay/composer.json
vendored
@@ -16,7 +16,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.3",
|
||||
"php": ">=7.4",
|
||||
"ext-openssl": "*",
|
||||
"ext-simplexml":"*",
|
||||
"ext-libxml": "*",
|
||||
@@ -27,9 +27,7 @@
|
||||
"psr/container": "^1.1 | ^2.0",
|
||||
"psr/http-client": "^1.0",
|
||||
"psr/http-message": "^1.0",
|
||||
"php-di/php-di": "~6.3.0",
|
||||
"yansongda/supports": "~3.1.0",
|
||||
"guzzlehttp/guzzle": "^7.0"
|
||||
"yansongda/supports": "~3.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.0",
|
||||
@@ -40,7 +38,8 @@
|
||||
"symfony/var-dumper": "^5.1",
|
||||
"symfony/http-foundation": "^5.2.0",
|
||||
"symfony/event-dispatcher": "^5.2.0",
|
||||
"symfony/psr-http-message-bridge": "^2.1"
|
||||
"symfony/psr-http-message-bridge": "^2.1",
|
||||
"guzzlehttp/guzzle": "^7.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -55,14 +54,14 @@
|
||||
"Yansongda\\Pay\\Tests\\": "tests"
|
||||
}
|
||||
},
|
||||
"suggest": {
|
||||
"illuminate/container": "Laravel 框架下使用 SDK,请安装",
|
||||
"hyperf/utils": "Hyperf 框架下使用 SDK,请安装",
|
||||
"php-di/php-di": "其它/无框架下使用 SDK,请安装"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "./vendor/bin/phpunit -c phpunit.xml --colors=always",
|
||||
"cs-fix": "php-cs-fixer fix --dry-run --diff 1>&2",
|
||||
"analyse": "phpstan analyse --memory-limit 300M -l 5 -c phpstan.neon ./src"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "v3.0-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/yansongda/pay/phpstan.neon
vendored
2
vendor/yansongda/pay/phpstan.neon
vendored
@@ -1,3 +1,5 @@
|
||||
parameters:
|
||||
reportUnmatchedIgnoredErrors: false
|
||||
excludePaths:
|
||||
- src/Service/ContainerServiceProvider.php
|
||||
ignoreErrors:
|
||||
|
||||
@@ -18,5 +18,5 @@ interface ConfigInterface
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function set(string $key, $value);
|
||||
public function set(string $key, $value): void;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,19 @@ declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
use DI\FactoryInterface;
|
||||
use Invoker\InvokerInterface;
|
||||
|
||||
interface ContainerInterface extends \Psr\Container\ContainerInterface, FactoryInterface, InvokerInterface
|
||||
interface ContainerInterface extends \Psr\Container\ContainerInterface
|
||||
{
|
||||
/**
|
||||
* factory make.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function make(string $name, array $parameters = []);
|
||||
|
||||
/**
|
||||
* @param mixed $entry
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function set(string $name, $entry);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
use GuzzleHttp\ClientInterface;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
|
||||
interface HttpClientInterface extends ClientInterface, \Psr\Http\Client\ClientInterface
|
||||
interface HttpClientInterface extends ClientInterface
|
||||
{
|
||||
}
|
||||
|
||||
@@ -12,12 +12,11 @@ interface ProviderInterface
|
||||
/**
|
||||
* pay.
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*
|
||||
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
|
||||
*/
|
||||
public function pay(array $plugins, array $params);
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Contract;
|
||||
|
||||
use Yansongda\Pay\Pay;
|
||||
|
||||
interface ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* register the service.
|
||||
* @param mixed $data
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
*/
|
||||
public function register(Pay $pay, ?array $data = null): void;
|
||||
public function register($data = null): void;
|
||||
}
|
||||
|
||||
1
vendor/yansongda/pay/src/Event.php
vendored
1
vendor/yansongda/pay/src/Event.php
vendored
@@ -13,7 +13,6 @@ use Yansongda\Pay\Exception\InvalidConfigException;
|
||||
class Event
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
|
||||
@@ -8,10 +8,9 @@ use Yansongda\Pay\Rocket;
|
||||
|
||||
class CallbackReceived extends Event
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $provider;
|
||||
public string $provider;
|
||||
|
||||
public ?array $params = null;
|
||||
|
||||
/**
|
||||
* @var array|\Psr\Http\Message\ServerRequestInterface|null
|
||||
@@ -19,16 +18,9 @@ class CallbackReceived extends Event
|
||||
public $contents;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
public $params;
|
||||
|
||||
/**
|
||||
* Bootstrap.
|
||||
*
|
||||
* @param array|\Psr\Http\Message\ServerRequestInterface|null $contents
|
||||
*/
|
||||
public function __construct(string $provider, $contents, ?array $params, ?Rocket $rocket)
|
||||
public function __construct(string $provider, $contents, ?array $params = null, ?Rocket $rocket = null)
|
||||
{
|
||||
$this->provider = $provider;
|
||||
$this->contents = $contents;
|
||||
|
||||
10
vendor/yansongda/pay/src/Event/Event.php
vendored
10
vendor/yansongda/pay/src/Event/Event.php
vendored
@@ -8,15 +8,9 @@ use Yansongda\Pay\Rocket;
|
||||
|
||||
class Event
|
||||
{
|
||||
/**
|
||||
* @var \Yansongda\Pay\Rocket|null
|
||||
*/
|
||||
public $rocket;
|
||||
public ?Rocket $rocket = null;
|
||||
|
||||
/**
|
||||
* Bootstrap.
|
||||
*/
|
||||
public function __construct(?Rocket $rocket)
|
||||
public function __construct(?Rocket $rocket = null)
|
||||
{
|
||||
$this->rocket = $rocket;
|
||||
}
|
||||
|
||||
17
vendor/yansongda/pay/src/Event/MethodCalled.php
vendored
17
vendor/yansongda/pay/src/Event/MethodCalled.php
vendored
@@ -8,22 +8,13 @@ use Yansongda\Pay\Rocket;
|
||||
|
||||
class MethodCalled extends Event
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $provider;
|
||||
public string $provider;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
public string $name;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $params;
|
||||
public array $params;
|
||||
|
||||
public function __construct(string $provider, string $name, array $params, ?Rocket $rocket)
|
||||
public function __construct(string $provider, string $name, array $params, ?Rocket $rocket = null)
|
||||
{
|
||||
$this->provider = $provider;
|
||||
$this->name = $name;
|
||||
|
||||
@@ -11,14 +11,11 @@ class PayStarted extends Event
|
||||
/**
|
||||
* @var \Yansongda\Pay\Contract\PluginInterface[]
|
||||
*/
|
||||
public $plugins;
|
||||
public array $plugins;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $params;
|
||||
public array $params;
|
||||
|
||||
public function __construct(array $plugins, array $params, ?Rocket $rocket)
|
||||
public function __construct(array $plugins, array $params, ?Rocket $rocket = null)
|
||||
{
|
||||
$this->plugins = $plugins;
|
||||
$this->params = $params;
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Exception;
|
||||
|
||||
use Throwable;
|
||||
|
||||
class ContainerDependencyException extends ContainerException
|
||||
{
|
||||
/**
|
||||
* Bootstrap.
|
||||
*
|
||||
* @param mixed $extra
|
||||
*/
|
||||
public function __construct(string $message = 'Dependency Resolve Error', int $code = self::CONTAINER_DEPENDENCY_ERROR, $extra = null, Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $extra, $previous);
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,7 @@ class Exception extends \Exception
|
||||
|
||||
public const CONTAINER_NOT_FOUND = 1001;
|
||||
|
||||
public const CONTAINER_DEPENDENCY_ERROR = 1002;
|
||||
|
||||
public const CONTAINER_NOT_FOUND_ENTRY = 1003;
|
||||
public const CONTAINER_NOT_FOUND_ENTRY = 1002;
|
||||
|
||||
/**
|
||||
* 关于容器的服务.
|
||||
|
||||
@@ -8,10 +8,7 @@ use Throwable;
|
||||
|
||||
class InvalidResponseException extends Exception
|
||||
{
|
||||
/**
|
||||
* @var \Throwable|null
|
||||
*/
|
||||
public $exception = null;
|
||||
public ?Throwable $exception = null;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
|
||||
58
vendor/yansongda/pay/src/Functions.php
vendored
58
vendor/yansongda/pay/src/Functions.php
vendored
@@ -29,7 +29,6 @@ if (!function_exists('should_do_http_request')) {
|
||||
|
||||
if (!function_exists('get_alipay_config')) {
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
@@ -43,22 +42,18 @@ if (!function_exists('get_alipay_config')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_public_or_private_cert')) {
|
||||
/**
|
||||
* @param bool $publicKey 是否公钥
|
||||
*
|
||||
* @return resource|string
|
||||
*/
|
||||
function get_public_or_private_cert(string $key, bool $publicKey = false)
|
||||
if (!function_exists('get_public_cert')) {
|
||||
function get_public_cert(string $key): string
|
||||
{
|
||||
if ($publicKey) {
|
||||
return Str::endsWith($key, ['.cer', '.crt', '.pem']) ? file_get_contents($key) : $key;
|
||||
}
|
||||
return Str::endsWith($key, ['.cer', '.crt', '.pem']) ? file_get_contents($key) : $key;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_private_cert')) {
|
||||
function get_private_cert(string $key): string
|
||||
{
|
||||
if (Str::endsWith($key, ['.crt', '.pem'])) {
|
||||
return openssl_pkey_get_private(
|
||||
Str::startsWith($key, 'file://') ? $key : 'file://'.$key
|
||||
);
|
||||
return file_get_contents($key);
|
||||
}
|
||||
|
||||
return "-----BEGIN RSA PRIVATE KEY-----\n".
|
||||
@@ -71,7 +66,6 @@ if (!function_exists('verify_alipay_sign')) {
|
||||
/**
|
||||
* @param string $sign base64decode 之后的
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
@@ -88,7 +82,7 @@ if (!function_exists('verify_alipay_sign')) {
|
||||
$result = 1 === openssl_verify(
|
||||
$contents,
|
||||
$sign,
|
||||
get_public_or_private_cert($public, true),
|
||||
get_public_cert($public),
|
||||
OPENSSL_ALGO_SHA256);
|
||||
|
||||
if (!$result) {
|
||||
@@ -99,7 +93,6 @@ if (!function_exists('verify_alipay_sign')) {
|
||||
|
||||
if (!function_exists('get_wechat_config')) {
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
@@ -115,7 +108,6 @@ if (!function_exists('get_wechat_config')) {
|
||||
|
||||
if (!function_exists('get_wechat_base_uri')) {
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
@@ -129,7 +121,6 @@ if (!function_exists('get_wechat_base_uri')) {
|
||||
|
||||
if (!function_exists('get_wechat_authorization')) {
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
@@ -143,7 +134,7 @@ if (!function_exists('get_wechat_authorization')) {
|
||||
throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Missing Wechat Config -- [mch_public_cert_path]');
|
||||
}
|
||||
|
||||
$ssl = openssl_x509_parse(get_public_or_private_cert($mchPublicCertPath, true));
|
||||
$ssl = openssl_x509_parse(get_public_cert($mchPublicCertPath));
|
||||
|
||||
if (empty($ssl['serialNumberHex'])) {
|
||||
throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Parse [mch_public_cert_path] Serial Number Error');
|
||||
@@ -164,7 +155,6 @@ if (!function_exists('get_wechat_authorization')) {
|
||||
|
||||
if (!function_exists('get_wechat_sign')) {
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
@@ -177,15 +167,11 @@ if (!function_exists('get_wechat_sign')) {
|
||||
throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Missing Wechat Config -- [mch_secret_cert]');
|
||||
}
|
||||
|
||||
$privateKey = get_public_or_private_cert($privateKey);
|
||||
$privateKey = get_private_cert($privateKey);
|
||||
|
||||
openssl_sign($contents, $sign, $privateKey, 'sha256WithRSAEncryption');
|
||||
|
||||
$sign = base64_encode($sign);
|
||||
|
||||
!is_resource($privateKey) ?: openssl_free_key($privateKey);
|
||||
|
||||
return $sign;
|
||||
return base64_encode($sign);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +179,6 @@ if (!function_exists('verify_wechat_sign')) {
|
||||
/**
|
||||
* @param \Psr\Http\Message\ServerRequestInterface|\Psr\Http\Message\ResponseInterface $message
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidResponseException
|
||||
@@ -210,7 +195,7 @@ if (!function_exists('verify_wechat_sign')) {
|
||||
$timestamp = $message->getHeaderLine('Wechatpay-Timestamp');
|
||||
$random = $message->getHeaderLine('Wechatpay-Nonce');
|
||||
$sign = $message->getHeaderLine('Wechatpay-Signature');
|
||||
$body = $message->getBody()->getContents();
|
||||
$body = (string) $message->getBody();
|
||||
|
||||
$content = $timestamp."\n".$random."\n".$body."\n";
|
||||
$public = get_wechat_config($params)->get('wechat_public_cert_path.'.$wechatSerial);
|
||||
@@ -219,15 +204,14 @@ if (!function_exists('verify_wechat_sign')) {
|
||||
throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, '', ['headers' => $message->getHeaders(), 'body' => $body]);
|
||||
}
|
||||
|
||||
$public = get_public_or_private_cert(
|
||||
empty($public) ? reload_wechat_public_certs($params, $wechatSerial) : $public,
|
||||
true
|
||||
$public = get_public_cert(
|
||||
empty($public) ? reload_wechat_public_certs($params, $wechatSerial) : $public
|
||||
);
|
||||
|
||||
$result = 1 === openssl_verify(
|
||||
$content,
|
||||
base64_decode($sign),
|
||||
get_public_or_private_cert($public, true),
|
||||
$public,
|
||||
'sha256WithRSAEncryption'
|
||||
);
|
||||
|
||||
@@ -240,7 +224,7 @@ if (!function_exists('verify_wechat_sign')) {
|
||||
if (!function_exists('encrypt_wechat_contents')) {
|
||||
function encrypt_wechat_contents(string $contents, string $publicKey): ?string
|
||||
{
|
||||
if (openssl_public_encrypt($contents, $encrypted, get_public_or_private_cert($publicKey, true), OPENSSL_PKCS1_OAEP_PADDING)) {
|
||||
if (openssl_public_encrypt($contents, $encrypted, get_public_cert($publicKey), OPENSSL_PKCS1_OAEP_PADDING)) {
|
||||
return base64_encode($encrypted);
|
||||
}
|
||||
|
||||
@@ -250,7 +234,6 @@ if (!function_exists('encrypt_wechat_contents')) {
|
||||
|
||||
if (!function_exists('reload_wechat_public_certs')) {
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
@@ -285,7 +268,6 @@ if (!function_exists('reload_wechat_public_certs')) {
|
||||
|
||||
if (!function_exists('decrypt_wechat_resource')) {
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidResponseException
|
||||
@@ -318,9 +300,9 @@ if (!function_exists('decrypt_wechat_resource')) {
|
||||
|
||||
if (!function_exists('decrypt_wechat_resource_aes_256_gcm')) {
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\InvalidResponseException
|
||||
*
|
||||
* @return array|string
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\InvalidResponseException
|
||||
*/
|
||||
function decrypt_wechat_resource_aes_256_gcm(string $ciphertext, string $secret, string $nonce, string $associatedData)
|
||||
{
|
||||
|
||||
1
vendor/yansongda/pay/src/Logger.php
vendored
1
vendor/yansongda/pay/src/Logger.php
vendored
@@ -22,7 +22,6 @@ use Yansongda\Pay\Exception\InvalidConfigException;
|
||||
class Logger
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
|
||||
@@ -20,7 +20,7 @@ class ArrayParser implements ParserInterface
|
||||
throw new InvalidResponseException(Exception::RESPONSE_NONE);
|
||||
}
|
||||
|
||||
$contents = $response->getBody()->getContents();
|
||||
$contents = (string) $response->getBody();
|
||||
|
||||
$result = json_decode($contents, true);
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ use Yansongda\Supports\Collection;
|
||||
class CollectionParser implements ParserInterface
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
178
vendor/yansongda/pay/src/Pay.php
vendored
178
vendor/yansongda/pay/src/Pay.php
vendored
@@ -4,14 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay;
|
||||
|
||||
use DI\Container;
|
||||
use DI\ContainerBuilder;
|
||||
use DI\DependencyException;
|
||||
use DI\NotFoundException;
|
||||
use Closure;
|
||||
use Illuminate\Container\Container as LaravelContainer;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Throwable;
|
||||
use Yansongda\Pay\Contract\ContainerInterface;
|
||||
use Yansongda\Pay\Contract\ServiceProviderInterface;
|
||||
use Yansongda\Pay\Exception\ContainerDependencyException;
|
||||
use Yansongda\Pay\Exception\ContainerException;
|
||||
use Yansongda\Pay\Exception\ContainerNotFoundException;
|
||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||
@@ -19,14 +17,15 @@ use Yansongda\Pay\Provider\Alipay;
|
||||
use Yansongda\Pay\Provider\Wechat;
|
||||
use Yansongda\Pay\Service\AlipayServiceProvider;
|
||||
use Yansongda\Pay\Service\ConfigServiceProvider;
|
||||
use Yansongda\Pay\Service\ContainerServiceProvider;
|
||||
use Yansongda\Pay\Service\EventServiceProvider;
|
||||
use Yansongda\Pay\Service\HttpServiceProvider;
|
||||
use Yansongda\Pay\Service\LoggerServiceProvider;
|
||||
use Yansongda\Pay\Service\WechatServiceProvider;
|
||||
|
||||
/**
|
||||
* @method static Alipay alipay(array $config = [])
|
||||
* @method static Wechat wechat(array $config = [])
|
||||
* @method static Alipay alipay(array $config = [], $container = null)
|
||||
* @method static Wechat wechat(array $config = [], $container = null)
|
||||
*/
|
||||
class Pay
|
||||
{
|
||||
@@ -48,7 +47,7 @@ class Pay
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected $service = [
|
||||
protected array $service = [
|
||||
AlipayServiceProvider::class,
|
||||
WechatServiceProvider::class,
|
||||
];
|
||||
@@ -56,7 +55,8 @@ class Pay
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $coreService = [
|
||||
private array $coreService = [
|
||||
ContainerServiceProvider::class,
|
||||
ConfigServiceProvider::class,
|
||||
LoggerServiceProvider::class,
|
||||
EventServiceProvider::class,
|
||||
@@ -64,31 +64,25 @@ class Pay
|
||||
];
|
||||
|
||||
/**
|
||||
* @var \DI\Container|null
|
||||
* @var \Closure|\Psr\Container\ContainerInterface|null
|
||||
*/
|
||||
private static $container = null;
|
||||
|
||||
/**
|
||||
* Bootstrap.
|
||||
* @param \Closure|\Psr\Container\ContainerInterface|null $container
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
private function __construct(array $config)
|
||||
private function __construct(array $config, $container = null)
|
||||
{
|
||||
$this->initContainer();
|
||||
$this->registerServices($config);
|
||||
$this->registerServices($config, $container);
|
||||
}
|
||||
|
||||
/**
|
||||
* __callStatic.
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function __callStatic(string $service, array $config)
|
||||
{
|
||||
@@ -100,77 +94,99 @@ class Pay
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化容器、配置等信息.
|
||||
* @param \Closure|\Psr\Container\ContainerInterface|null $container
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
public static function config(array $config = []): Pay
|
||||
public static function config(array $config = [], $container = null): bool
|
||||
{
|
||||
if (self::hasContainer() && !($config['_force'] ?? false)) {
|
||||
return self::get(Pay::class);
|
||||
return false;
|
||||
}
|
||||
|
||||
return new self($config);
|
||||
new self($config, $container);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
*/
|
||||
public static function set(string $name, $value): void
|
||||
{
|
||||
Pay::getContainer()->set($name, $value);
|
||||
try {
|
||||
$container = Pay::getContainer();
|
||||
|
||||
// laravel
|
||||
// @phpstan-ignore-next-line
|
||||
if ($container instanceof LaravelContainer) {
|
||||
// @phpstan-ignore-next-line
|
||||
$container->singleton($name, $value instanceof Closure ? $value : static fn () => $value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (method_exists($container, 'set')) {
|
||||
$container->set(...func_get_args());
|
||||
|
||||
return;
|
||||
}
|
||||
} catch (ContainerNotFoundException $e) {
|
||||
throw $e;
|
||||
} catch (Throwable $e) {
|
||||
throw new ContainerException($e->getMessage());
|
||||
}
|
||||
|
||||
throw new ContainerException('Current container does NOT support `set` method');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
*/
|
||||
public static function make(string $service, array $parameters = [])
|
||||
{
|
||||
try {
|
||||
return Pay::getContainer()->make(...func_get_args());
|
||||
} catch (NotFoundException $e) {
|
||||
throw new ServiceNotFoundException($e->getMessage());
|
||||
} catch (DependencyException $e) {
|
||||
throw new ContainerDependencyException($e->getMessage());
|
||||
$container = Pay::getContainer();
|
||||
|
||||
if (method_exists($container, 'make')) {
|
||||
return $container->make(...func_get_args());
|
||||
}
|
||||
} catch (ContainerNotFoundException $e) {
|
||||
throw $e;
|
||||
} catch (Throwable $e) {
|
||||
throw new ContainerException($e->getMessage());
|
||||
}
|
||||
|
||||
$parameters = array_values($parameters);
|
||||
|
||||
return new $service(...$parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务.
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get(string $service)
|
||||
{
|
||||
try {
|
||||
return Pay::getContainer()->get($service);
|
||||
} catch (NotFoundException $e) {
|
||||
} catch (NotFoundExceptionInterface $e) {
|
||||
throw new ServiceNotFoundException($e->getMessage());
|
||||
} catch (DependencyException $e) {
|
||||
throw new ContainerDependencyException($e->getMessage());
|
||||
} catch (ContainerNotFoundException $e) {
|
||||
throw $e;
|
||||
} catch (Throwable $e) {
|
||||
throw new ContainerException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerNotFoundException
|
||||
*/
|
||||
public static function has(string $service): bool
|
||||
{
|
||||
@@ -178,84 +194,62 @@ class Pay
|
||||
}
|
||||
|
||||
/**
|
||||
* getContainer.
|
||||
*
|
||||
* @param \Closure|\Psr\Container\ContainerInterface|null $container
|
||||
*/
|
||||
public static function setContainer($container): void
|
||||
{
|
||||
self::$container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerNotFoundException
|
||||
*/
|
||||
public static function getContainer(): Container
|
||||
public static function getContainer(): ContainerInterface
|
||||
{
|
||||
if (self::hasContainer()) {
|
||||
if (self::$container instanceof ContainerInterface) {
|
||||
return self::$container;
|
||||
}
|
||||
|
||||
throw new ContainerNotFoundException('You should init/config PAY first', Exception\Exception::CONTAINER_NOT_FOUND);
|
||||
if (self::$container instanceof Closure) {
|
||||
return (self::$container)();
|
||||
}
|
||||
|
||||
throw new ContainerNotFoundException('`getContainer()` failed! Maybe you should `setContainer()` first', Exception\Exception::CONTAINER_NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* has Container.
|
||||
*/
|
||||
public static function hasContainer(): bool
|
||||
{
|
||||
return isset(self::$container) && self::$container instanceof Container;
|
||||
return self::$container instanceof ContainerInterface || self::$container instanceof Closure;
|
||||
}
|
||||
|
||||
/**
|
||||
* clear.
|
||||
*/
|
||||
public static function clear(): void
|
||||
{
|
||||
self::$container = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册服务.
|
||||
* @param mixed $data
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
public static function registerService(string $service, array $config): void
|
||||
public static function registerService(string $service, $data): void
|
||||
{
|
||||
$var = self::get($service);
|
||||
$var = new $service();
|
||||
|
||||
if ($var instanceof ServiceProviderInterface) {
|
||||
$var->register(self::get(Pay::class), $config);
|
||||
$var->register($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* initContainer.
|
||||
* @param \Closure|\Psr\Container\ContainerInterface|null $container
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
*/
|
||||
private function initContainer(): void
|
||||
{
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->useAnnotations(false);
|
||||
|
||||
try {
|
||||
$container = $builder->build();
|
||||
$container->set(ContainerInterface::class, $container);
|
||||
$container->set(\Psr\Container\ContainerInterface::class, $container);
|
||||
$container->set(Pay::class, $this);
|
||||
|
||||
self::$container = $container;
|
||||
} catch (Throwable $e) {
|
||||
throw new ContainerException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* register services.
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
private function registerServices(array $config): void
|
||||
private function registerServices(array $config, $container = null): void
|
||||
{
|
||||
foreach (array_merge($this->coreService, $this->service) as $service) {
|
||||
self::registerService($service, $config);
|
||||
self::registerService($service, ContainerServiceProvider::class == $service ? $container : $config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ use Yansongda\Supports\Str;
|
||||
class CallbackPlugin implements PluginInterface
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
@@ -45,9 +44,8 @@ class CallbackPlugin implements PluginInterface
|
||||
|
||||
protected function formatPayload(Rocket $rocket): void
|
||||
{
|
||||
$payload = (new Collection($rocket->getParams()))->filter(function ($v, $k) {
|
||||
return '' !== $v && !is_null($v) && 'sign' != $k && 'sign_type' != $k && !Str::startsWith($k, '_');
|
||||
});
|
||||
$payload = (new Collection($rocket->getParams()))
|
||||
->filter(fn ($v, $k) => '' !== $v && !is_null($v) && 'sign' != $k && 'sign_type' != $k && !Str::startsWith($k, '_'));
|
||||
|
||||
$rocket->setPayload($payload);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Data;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02fkbl
|
||||
*/
|
||||
class BillDownloadUrlQueryPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/029p6g
|
||||
*/
|
||||
class BillEreceiptApplyPlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Data;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/029i7e
|
||||
*/
|
||||
class BillEreceiptQueryPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Ebpp;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02hd36
|
||||
*/
|
||||
class PdeductBillStatusPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02hd35
|
||||
*/
|
||||
class PdeductPayPlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02hd33
|
||||
*/
|
||||
class PdeductSignAddPlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02hd34
|
||||
*/
|
||||
class PdeductSignCancelPlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02byuq?scene=common
|
||||
*/
|
||||
class AccountQueryPlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02fkb9
|
||||
*/
|
||||
class AuthOrderFreezePlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Fund;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02fkbc
|
||||
*/
|
||||
class AuthOrderUnfreezePlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Fund;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02byve
|
||||
*/
|
||||
class TransCommonQueryPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -6,6 +6,12 @@ namespace Yansongda\Pay\Plugin\Alipay\Fund;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* 老版本转账.
|
||||
*
|
||||
* @deprecated
|
||||
* @see https://opendocs.alipay.com/support/01rfzo
|
||||
*/
|
||||
class TransOrderQueryPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -10,6 +10,9 @@ use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Parser\ResponseParser;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/03rbye
|
||||
*/
|
||||
class TransPagePayPlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02byuo?scene=common
|
||||
*/
|
||||
class TransUniTransferPlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
|
||||
@@ -15,7 +15,6 @@ use Yansongda\Supports\Collection;
|
||||
class LaunchPlugin implements PluginInterface
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidResponseException
|
||||
@@ -44,7 +43,6 @@ class LaunchPlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidResponseException
|
||||
|
||||
@@ -14,7 +14,6 @@ use Yansongda\Pay\Rocket;
|
||||
class PreparePlugin implements PluginInterface
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
@@ -31,7 +30,6 @@ class PreparePlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
@@ -49,7 +47,7 @@ class PreparePlugin implements PluginInterface
|
||||
'timestamp' => date('Y-m-d H:i:s'),
|
||||
'version' => '1.0',
|
||||
'notify_url' => $this->getNotifyUrl($params),
|
||||
'app_auth_token' => '',
|
||||
'app_auth_token' => $this->getAppAuthToken($params),
|
||||
'app_cert_sn' => $this->getAppCertSn($params),
|
||||
'alipay_root_cert_sn' => $this->getAlipayRootCertSn($params),
|
||||
'biz_content' => [],
|
||||
@@ -57,7 +55,6 @@ class PreparePlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
@@ -71,7 +68,6 @@ class PreparePlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
@@ -85,7 +81,19 @@ class PreparePlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
protected function getAppAuthToken(array $params): string
|
||||
{
|
||||
if (!empty($params['_app_auth_token'])) {
|
||||
return $params['_app_auth_token'];
|
||||
}
|
||||
|
||||
return get_alipay_config($params)->get('app_auth_token', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
@@ -101,11 +109,14 @@ class PreparePlugin implements PluginInterface
|
||||
$cert = file_get_contents($path);
|
||||
$ssl = openssl_x509_parse($cert);
|
||||
|
||||
return $this->getCertSn($ssl['issuer'], $ssl['serialNumber']);
|
||||
if (false === $ssl) {
|
||||
throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Parse `app_public_cert_path` Error');
|
||||
}
|
||||
|
||||
return $this->getCertSn($ssl['issuer'] ?? [], $ssl['serialNumber'] ?? '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
@@ -162,8 +173,8 @@ class PreparePlugin implements PluginInterface
|
||||
|
||||
protected function formatCert(array $ssl): array
|
||||
{
|
||||
if (0 === strpos($ssl['serialNumber'], '0x')) {
|
||||
$ssl['serialNumber'] = $this->hex2dec($ssl['serialNumberHex']);
|
||||
if (0 === strpos($ssl['serialNumber'] ?? '', '0x')) {
|
||||
$ssl['serialNumber'] = $this->hex2dec($ssl['serialNumberHex'] ?? '');
|
||||
}
|
||||
|
||||
return $ssl;
|
||||
|
||||
@@ -18,7 +18,6 @@ class RadarPlugin implements PluginInterface
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
*/
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
{
|
||||
@@ -32,7 +31,6 @@ class RadarPlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
@@ -52,7 +50,6 @@ class RadarPlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,6 @@ use Yansongda\Supports\Str;
|
||||
class SignPlugin implements PluginInterface
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
@@ -37,13 +36,9 @@ class SignPlugin implements PluginInterface
|
||||
|
||||
protected function formatPayload(Rocket $rocket): void
|
||||
{
|
||||
$payload = $rocket->getPayload()->filter(function ($v, $k) {
|
||||
return '' !== $v && !is_null($v) && 'sign' != $k;
|
||||
});
|
||||
$payload = $rocket->getPayload()->filter(fn ($v, $k) => '' !== $v && !is_null($v) && 'sign' != $k);
|
||||
|
||||
$contents = array_filter($payload->get('biz_content', []), function ($v, $k) {
|
||||
return !Str::startsWith(strval($k), '_');
|
||||
}, ARRAY_FILTER_USE_BOTH);
|
||||
$contents = array_filter($payload->get('biz_content', []), fn ($v, $k) => !Str::startsWith(strval($k), '_'), ARRAY_FILTER_USE_BOTH);
|
||||
|
||||
$rocket->setPayload(
|
||||
$payload->merge(['biz_content' => json_encode($contents)])
|
||||
@@ -51,7 +46,6 @@ class SignPlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
@@ -64,22 +58,15 @@ class SignPlugin implements PluginInterface
|
||||
|
||||
openssl_sign($content, $sign, $privateKey, OPENSSL_ALGO_SHA256);
|
||||
|
||||
$sign = base64_encode($sign);
|
||||
|
||||
!is_resource($privateKey) ?: openssl_free_key($privateKey);
|
||||
|
||||
return $sign;
|
||||
return base64_encode($sign);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*
|
||||
* @return resource|string
|
||||
*/
|
||||
protected function getPrivateKey(array $params)
|
||||
protected function getPrivateKey(array $params): string
|
||||
{
|
||||
$privateKey = get_alipay_config($params)->get('app_secret_cert');
|
||||
|
||||
@@ -87,6 +74,6 @@ class SignPlugin implements PluginInterface
|
||||
throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Missing Alipay Config -- [app_secret_cert]');
|
||||
}
|
||||
|
||||
return get_public_or_private_cert($privateKey);
|
||||
return get_private_cert($privateKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Tools;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/isv/03l9c0
|
||||
*/
|
||||
class OpenAuthTokenAppPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Tools;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/isv/03l8ca
|
||||
*/
|
||||
class OpenAuthTokenAppQueryPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -7,6 +7,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Tools;
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02ailc
|
||||
*/
|
||||
class SystemOauthTokenPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function doSomethingBefore(Rocket $rocket): void
|
||||
|
||||
@@ -11,12 +11,14 @@ use Yansongda\Pay\Parser\ResponseParser;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02e7gq?scene=common
|
||||
*/
|
||||
class AppPayPlugin implements PluginInterface
|
||||
{
|
||||
use SupportServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02ekfi
|
||||
*/
|
||||
class CancelPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02o6e7
|
||||
*/
|
||||
class ClosePlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02ekfj
|
||||
*/
|
||||
class CreatePlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/028sma
|
||||
*/
|
||||
class FastRefundQueryPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/028xqz
|
||||
*/
|
||||
class OrderSettlePlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -11,12 +11,14 @@ use Yansongda\Pay\Parser\ResponseParser;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/028r8t?scene=22
|
||||
*/
|
||||
class PagePayPlugin implements PluginInterface
|
||||
{
|
||||
use SupportServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
@@ -10,12 +10,14 @@ use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02fkat?ref=api&scene=common
|
||||
*/
|
||||
class PayPlugin implements PluginInterface
|
||||
{
|
||||
use SupportServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
@@ -8,12 +8,14 @@ use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02ekfg?scene=common
|
||||
*/
|
||||
class PreCreatePlugin extends GeneralPlugin
|
||||
{
|
||||
use SupportServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02ekfh?scene=common
|
||||
*/
|
||||
class QueryPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02ekfk
|
||||
*/
|
||||
class RefundPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -11,12 +11,14 @@ use Yansongda\Pay\Parser\ResponseParser;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02ivbs?scene=common
|
||||
*/
|
||||
class WapPayPlugin implements PluginInterface
|
||||
{
|
||||
use SupportServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
18
vendor/yansongda/pay/src/Plugin/Alipay/User/AgreementExecutionPlanModifyPlugin.php
vendored
Normal file
18
vendor/yansongda/pay/src/Plugin/Alipay/User/AgreementExecutionPlanModifyPlugin.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Plugin\Alipay\User;
|
||||
|
||||
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02fkaq?ref=api
|
||||
*/
|
||||
class AgreementExecutionPlanModifyPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
{
|
||||
return 'alipay.user.agreement.executionplan.modify';
|
||||
}
|
||||
}
|
||||
35
vendor/yansongda/pay/src/Plugin/Alipay/User/AgreementPageSignPlugin.php
vendored
Normal file
35
vendor/yansongda/pay/src/Plugin/Alipay/User/AgreementPageSignPlugin.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Plugin\Alipay\User;
|
||||
|
||||
use Closure;
|
||||
use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Parser\ResponseParser;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02fkan?ref=api&scene=35
|
||||
*/
|
||||
class AgreementPageSignPlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
{
|
||||
Logger::info('[alipay][AgreementPageSignPlugin] 插件开始装载', ['rocket' => $rocket]);
|
||||
|
||||
$rocket->setDirection(ResponseParser::class)
|
||||
->mergePayload([
|
||||
'method' => 'alipay.user.agreement.page.sign',
|
||||
'biz_content' => array_merge(
|
||||
['product_code' => 'CYCLE_PAY_AUTH'],
|
||||
$rocket->getParams()
|
||||
),
|
||||
]);
|
||||
|
||||
Logger::info('[alipay][AgreementPageSignPlugin] 插件装载完毕', ['rocket' => $rocket]);
|
||||
|
||||
return $next($rocket);
|
||||
}
|
||||
}
|
||||
33
vendor/yansongda/pay/src/Plugin/Alipay/User/AgreementQueryPlugin.php
vendored
Normal file
33
vendor/yansongda/pay/src/Plugin/Alipay/User/AgreementQueryPlugin.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Plugin\Alipay\User;
|
||||
|
||||
use Closure;
|
||||
use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02fkao?ref=api&scene=8837b4183390497f84bb53783b488ecc
|
||||
*/
|
||||
class AgreementQueryPlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
{
|
||||
Logger::info('[alipay][AgreementQueryPlugin] 插件开始装载', ['rocket' => $rocket]);
|
||||
|
||||
$rocket->mergePayload([
|
||||
'method' => 'alipay.user.agreement.query',
|
||||
'biz_content' => array_merge(
|
||||
['personal_product_code' => 'CYCLE_PAY_AUTH_P'],
|
||||
$rocket->getParams()
|
||||
),
|
||||
]);
|
||||
|
||||
Logger::info('[alipay][AgreementQueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
|
||||
|
||||
return $next($rocket);
|
||||
}
|
||||
}
|
||||
33
vendor/yansongda/pay/src/Plugin/Alipay/User/AgreementTransferPlugin.php
vendored
Normal file
33
vendor/yansongda/pay/src/Plugin/Alipay/User/AgreementTransferPlugin.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Plugin\Alipay\User;
|
||||
|
||||
use Closure;
|
||||
use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02fkar?ref=api
|
||||
*/
|
||||
class AgreementTransferPlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
{
|
||||
Logger::info('[alipay][AgreementTransferPlugin] 插件开始装载', ['rocket' => $rocket]);
|
||||
|
||||
$rocket->mergePayload([
|
||||
'method' => 'alipay.user.agreement.transfer',
|
||||
'biz_content' => array_merge(
|
||||
['target_product_code' => 'CYCLE_PAY_AUTH_P'],
|
||||
$rocket->getParams()
|
||||
),
|
||||
]);
|
||||
|
||||
Logger::info('[alipay][AgreementTransferPlugin] 插件装载完毕', ['rocket' => $rocket]);
|
||||
|
||||
return $next($rocket);
|
||||
}
|
||||
}
|
||||
33
vendor/yansongda/pay/src/Plugin/Alipay/User/AgreementUnsignPlugin.php
vendored
Normal file
33
vendor/yansongda/pay/src/Plugin/Alipay/User/AgreementUnsignPlugin.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Plugin\Alipay\User;
|
||||
|
||||
use Closure;
|
||||
use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02fkap?ref=api&scene=90766afb41f74df6ae1676e89625ebac
|
||||
*/
|
||||
class AgreementUnsignPlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
{
|
||||
Logger::info('[alipay][AgreementUnsignPlugin] 插件开始装载', ['rocket' => $rocket]);
|
||||
|
||||
$rocket->mergePayload([
|
||||
'method' => 'alipay.user.agreement.unsign',
|
||||
'biz_content' => array_merge(
|
||||
['personal_product_code' => 'CYCLE_PAY_AUTH_P'],
|
||||
$rocket->getParams()
|
||||
),
|
||||
]);
|
||||
|
||||
Logger::info('[alipay][AgreementUnsignPlugin] 插件装载完毕', ['rocket' => $rocket]);
|
||||
|
||||
return $next($rocket);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://opendocs.alipay.com/open/02aild
|
||||
*/
|
||||
class InfoSharePlugin implements PluginInterface
|
||||
{
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
|
||||
@@ -17,7 +17,6 @@ class ParserPlugin implements PluginInterface
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
*/
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
@@ -34,7 +33,6 @@ class ParserPlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
|
||||
@@ -18,7 +18,6 @@ use Yansongda\Supports\Collection;
|
||||
class CallbackPlugin implements PluginInterface
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
@@ -34,7 +33,7 @@ class CallbackPlugin implements PluginInterface
|
||||
/* @phpstan-ignore-next-line */
|
||||
verify_wechat_sign($rocket->getDestinationOrigin(), $rocket->getParams());
|
||||
|
||||
$body = json_decode($rocket->getDestination()->getBody()->getContents(), true);
|
||||
$body = json_decode((string) $rocket->getDestination()->getBody(), true);
|
||||
|
||||
$rocket->setDirection(NoHttpRequestParser::class)->setPayload(new Collection($body));
|
||||
|
||||
@@ -58,7 +57,7 @@ class CallbackPlugin implements PluginInterface
|
||||
throw new InvalidParamsException(Exception::REQUEST_NULL_ERROR);
|
||||
}
|
||||
|
||||
$contents = $request->getBody()->getContents();
|
||||
$contents = (string) $request->getBody();
|
||||
|
||||
$rocket->setDestination($request->withBody(Utils::streamFor($contents)))
|
||||
->setDestinationOrigin($request->withBody(Utils::streamFor($contents)))
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_6_1.shtml
|
||||
*/
|
||||
class ApplyPlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
@@ -25,7 +28,6 @@ class ApplyPlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_6_2.shtml
|
||||
*/
|
||||
class FindPlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
@@ -20,7 +23,6 @@ class FindPlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_6_5.shtml
|
||||
*/
|
||||
class FindReturnAdvancePlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
@@ -20,7 +23,6 @@ class FindReturnAdvancePlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
|
||||
@@ -10,6 +10,9 @@ use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Supports\Collection;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_6_4.shtml
|
||||
*/
|
||||
class ReturnAdvancePlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
@@ -35,7 +38,6 @@ class ReturnAdvancePlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
@@ -10,12 +10,14 @@ use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Pay\Traits\HasWechatEncryption;
|
||||
use Yansongda\Supports\Collection;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_8.shtml
|
||||
*/
|
||||
class AddReceiverPlugin extends GeneralPlugin
|
||||
{
|
||||
use HasWechatEncryption;
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
@@ -59,7 +61,6 @@ class AddReceiverPlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
|
||||
@@ -10,12 +10,14 @@ use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Pay\Traits\HasWechatEncryption;
|
||||
use Yansongda\Supports\Collection;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_1.shtml
|
||||
*/
|
||||
class CreatePlugin extends GeneralPlugin
|
||||
{
|
||||
use HasWechatEncryption;
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
@@ -40,7 +42,6 @@ class CreatePlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
@@ -60,7 +61,6 @@ class CreatePlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
|
||||
@@ -8,10 +8,12 @@ use Yansongda\Pay\Pay;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_9.shtml
|
||||
*/
|
||||
class DeleteReceiverPlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
43
vendor/yansongda/pay/src/Plugin/Wechat/Fund/Profitsharing/DownloadBillPlugin.php
vendored
Normal file
43
vendor/yansongda/pay/src/Plugin/Wechat/Fund/Profitsharing/DownloadBillPlugin.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yansongda\Pay\Plugin\Wechat\Fund\Profitsharing;
|
||||
|
||||
use Yansongda\Pay\Exception\Exception;
|
||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_12.shtml
|
||||
*/
|
||||
class DownloadBillPlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
*/
|
||||
protected function getUri(Rocket $rocket): string
|
||||
{
|
||||
$payload = $rocket->getPayload();
|
||||
|
||||
if (is_null($payload->get('download_url'))) {
|
||||
throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS);
|
||||
}
|
||||
|
||||
return $payload->get('download_url');
|
||||
}
|
||||
|
||||
protected function getMethod(): string
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
|
||||
protected function doSomething(Rocket $rocket): void
|
||||
{
|
||||
$rocket->setDirection(OriginResponseParser::class);
|
||||
|
||||
$rocket->setPayload(null);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_6.shtml
|
||||
*/
|
||||
class QueryAmountsPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -10,6 +10,9 @@ use Yansongda\Pay\Pay;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_7.shtml
|
||||
*/
|
||||
class QueryMerchantConfigsPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
@@ -23,7 +26,6 @@ class QueryMerchantConfigsPlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
|
||||
@@ -10,6 +10,9 @@ use Yansongda\Pay\Pay;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_2.shtml
|
||||
*/
|
||||
class QueryPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
@@ -23,7 +26,6 @@ class QueryPlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
|
||||
@@ -10,6 +10,9 @@ use Yansongda\Pay\Pay;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_4.shtml
|
||||
*/
|
||||
class QueryReturnPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
@@ -23,7 +26,6 @@ class QueryReturnPlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
|
||||
@@ -8,10 +8,12 @@ use Yansongda\Pay\Pay;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_3.shtml
|
||||
*/
|
||||
class ReturnPlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
@@ -8,10 +8,12 @@ use Yansongda\Pay\Pay;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_5.shtml
|
||||
*/
|
||||
class UnfreezePlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_7.shtml
|
||||
*/
|
||||
class CreateBillReceiptPlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_9.shtml
|
||||
*/
|
||||
class CreateDetailReceiptPlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -10,12 +10,14 @@ use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Pay\Traits\HasWechatEncryption;
|
||||
use Yansongda\Supports\Collection;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_1.shtml
|
||||
*/
|
||||
class CreatePlugin extends GeneralPlugin
|
||||
{
|
||||
use HasWechatEncryption;
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
@@ -49,7 +51,6 @@ class CreatePlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
@@ -76,7 +77,6 @@ class CreatePlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
|
||||
@@ -10,6 +10,9 @@ use Yansongda\Pay\Parser\OriginResponseParser;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_11.shtml
|
||||
*/
|
||||
class DownloadReceiptPlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_3.shtml
|
||||
*/
|
||||
class QueryBatchDetailIdPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
@@ -38,6 +41,9 @@ class QueryBatchDetailIdPlugin extends GeneralPlugin
|
||||
$payload->get('detail_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
*/
|
||||
protected function getPartnerUri(Rocket $rocket): string
|
||||
{
|
||||
$payload = $rocket->getPayload();
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_2.shtml
|
||||
*/
|
||||
class QueryBatchIdPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_8.shtml
|
||||
*/
|
||||
class QueryBillReceiptPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_10.shtml
|
||||
*/
|
||||
class QueryDetailReceiptPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_6.shtml
|
||||
*/
|
||||
class QueryOutBatchDetailNoPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_5.shtml
|
||||
*/
|
||||
class QueryOutBatchNoPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -17,7 +17,6 @@ abstract class GeneralPlugin implements PluginInterface
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
*/
|
||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||
{
|
||||
@@ -32,7 +31,6 @@ abstract class GeneralPlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
@@ -51,7 +49,6 @@ abstract class GeneralPlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
*/
|
||||
@@ -68,7 +65,7 @@ abstract class GeneralPlugin implements PluginInterface
|
||||
{
|
||||
return [
|
||||
'Accept' => 'application/json, text/plain, application/x-gzip',
|
||||
'User-Agent' => 'yansongda/pay-v3.0',
|
||||
'User-Agent' => 'yansongda/pay-v3',
|
||||
'Content-Type' => 'application/json; charset=utf-8',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ use Yansongda\Pay\Rocket;
|
||||
class LaunchPlugin implements PluginInterface
|
||||
{
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidConfigException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidResponseException
|
||||
@@ -41,9 +40,9 @@ class LaunchPlugin implements PluginInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\InvalidResponseException
|
||||
*
|
||||
* @return array|\Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|null
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\InvalidResponseException
|
||||
*/
|
||||
protected function validateResponse(Rocket $rocket)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Marketing\Coupon;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_1.shtml
|
||||
*/
|
||||
class CreatePlugin extends GeneralPlugin
|
||||
{
|
||||
protected function doSomething(Rocket $rocket): void
|
||||
|
||||
@@ -10,6 +10,9 @@ use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Supports\Collection;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_13.shtml
|
||||
*/
|
||||
class PausePlugin extends GeneralPlugin
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_9.shtml
|
||||
*/
|
||||
class QueryCouponDetailPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
@@ -22,7 +25,6 @@ class QueryCouponDetailPlugin extends GeneralPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerDependencyException
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
* @throws \Yansongda\Pay\Exception\InvalidParamsException
|
||||
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
||||
@@ -39,7 +41,7 @@ class QueryCouponDetailPlugin extends GeneralPlugin
|
||||
|
||||
return 'v3/marketing/favor/users/'.
|
||||
$payload->get('openid').
|
||||
'coupons/'.$payload->get('coupon_id').
|
||||
'/coupons/'.$payload->get('coupon_id').
|
||||
'?appid='.$appid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_5.shtml
|
||||
*/
|
||||
class QueryStockDetailPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_8.shtml
|
||||
*/
|
||||
class QueryStockItemsPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_7.shtml
|
||||
*/
|
||||
class QueryStockMerchantsPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_11.shtml
|
||||
*/
|
||||
class QueryStockRefundFlowPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_10.shtml
|
||||
*/
|
||||
class QueryStockUseFlowPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
@@ -7,6 +7,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Marketing\Coupon;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
/**
|
||||
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_4.shtml
|
||||
*/
|
||||
class QueryStocksPlugin extends GeneralPlugin
|
||||
{
|
||||
protected function getMethod(): string
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user