feat: 增加微信发票插件 (#927)

This commit is contained in:
yansongda 2024-01-13 21:46:15 +08:00 committed by GitHub
parent ad4c5dddb8
commit 439d1b13a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
88 changed files with 1325 additions and 65 deletions

View File

@ -10,6 +10,7 @@
- feat: 增加 `HttpClientFactoryInterface` 方法用于工厂模式创建 http client(#921)
- feat: 增加银联 `条码支付综合前置平台-被扫支付` 刷卡支付插件(#922)
- feat: 增加小程序虚拟支付签名、用户签名方法(#924)
- feat: 增加微信发票插件(#927)
### changed

View File

@ -22,7 +22,7 @@
"ext-libxml": "*",
"ext-json": "*",
"ext-bcmath": "*",
"yansongda/artful": "~1.0.7",
"yansongda/artful": "~1.0.8",
"yansongda/supports": "~4.0.9"
},
"require-dev": {

View File

@ -147,7 +147,7 @@ function get_wechat_url(array $config, ?Collection $payload): string
/**
* @throws InvalidParamsException
*/
function get_wechat_body(?Collection $payload): string
function get_wechat_body(?Collection $payload): mixed
{
$body = get_radar_body($payload);

View File

@ -12,6 +12,8 @@ use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Supports\Collection;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/consumer-complaint/complaints/query-negotiation-history-v2.html
* @see https://pay.weixin.qq.com/docs/partner/apis/consumer-complaint/complaints/query-negotiation-history-v2.html
@ -47,7 +49,7 @@ class QueryNegotiationPlugin implements PluginInterface
protected function normal(Collection $payload): string
{
$query = $payload->except('complaint_id')->query();
$query = filter_params($payload)->except('complaint_id')->query();
return empty($query) ? '' : '?'.$query;
}

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/consumer-complaint/complaints/list-complaints-v2.html
* @see https://pay.weixin.qq.com/docs/partner/apis/consumer-complaint/complaints/list-complaints-v2.html
@ -30,7 +32,7 @@ class QueryPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 查询投诉单列表,缺少必要参数');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -6,6 +6,7 @@ namespace Yansongda\Pay\Plugin\Wechat\V3\Extend\ProfitSharing;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
@ -30,7 +31,8 @@ class DownloadBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 下载电子回单,参数缺少 `download_url`');
}
$rocket->setPayload([
$rocket->setDirection(OriginResponseDirection::class)
->setPayload([
'_method' => 'GET',
'_url' => $downloadUrl,
'_service_url' => $downloadUrl,

View File

@ -14,6 +14,7 @@ use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Supports\Collection;
use function Yansongda\Artful\filter_params;
use function Yansongda\Pay\get_wechat_config;
use function Yansongda\Pay\get_wechat_type_key;
@ -60,6 +61,6 @@ class QueryUserCouponsPlugin implements PluginInterface
$payload->set('appid', $config[get_wechat_type_key($params)] ?? '');
}
return $payload->except('openid')->query();
return filter_params($payload)->except('openid')->query();
}
}

View File

@ -14,6 +14,7 @@ use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Supports\Collection;
use function Yansongda\Artful\filter_params;
use function Yansongda\Pay\get_wechat_config;
/**
@ -59,6 +60,6 @@ class QueryItemsPlugin implements PluginInterface
$payload->set('stock_creator_mchid', $config['mch_id'] ?? '');
}
return $payload->except('stock_id')->query();
return filter_params($payload)->except('stock_id')->query();
}
}

View File

@ -14,6 +14,7 @@ use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Supports\Collection;
use function Yansongda\Artful\filter_params;
use function Yansongda\Pay\get_wechat_config;
/**
@ -59,6 +60,6 @@ class QueryMerchantsPlugin implements PluginInterface
$payload->set('stock_creator_mchid', $config['mch_id'] ?? '');
}
return $payload->except('stock_id')->query();
return filter_params($payload)->except('stock_id')->query();
}
}

View File

@ -14,6 +14,7 @@ use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Supports\Collection;
use function Yansongda\Artful\filter_params;
use function Yansongda\Pay\get_wechat_config;
/**
@ -58,6 +59,6 @@ class QueryPlugin implements PluginInterface
$payload->set('stock_creator_mchid', $config['mch_id'] ?? '');
}
return $payload->query();
return filter_params($payload)->query();
}
}

View File

@ -15,6 +15,7 @@ use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Pay;
use Yansongda\Supports\Collection;
use function Yansongda\Artful\filter_params;
use function Yansongda\Pay\get_wechat_config;
/**
@ -55,7 +56,7 @@ class QueryDayEndPlugin implements PluginInterface
protected function service(Collection $payload): string
{
$query = $payload->except('account_type');
$query = filter_params($payload)->except('account_type');
if ($query->isEmpty()) {
return '';

View File

@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Exception\ContainerException;
use Yansongda\Artful\Exception\InvalidConfigException;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Exception\ServiceNotFoundException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\DecryptException;
use Yansongda\Supports\Collection;
use function Yansongda\Pay\encrypt_wechat_contents;
use function Yansongda\Pay\get_wechat_config;
use function Yansongda\Pay\get_wechat_public_key;
use function Yansongda\Pay\get_wechat_serial_no;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-applications/issue-fapiao-applications.html
*/
class CreatePlugin implements PluginInterface
{
/**
* @throws ContainerException
* @throws DecryptException
* @throws InvalidConfigException
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][Blockchain][CreatePlugin] 插件开始装载', ['rocket' => $rocket]);
$params = $rocket->getParams();
$payload = $rocket->getPayload();
$config = get_wechat_config($params);
$rocket->mergePayload(array_merge([
'_method' => 'POST',
'_url' => 'v3/new-tax-control-fapiao/fapiao-applications',
], $this->encryptSensitiveData($payload, $params, $config)));
Logger::info('[Wechat][V3][Marketing][Fapiao][Blockchain][CreatePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
/**
* @throws ContainerException
* @throws InvalidConfigException
* @throws InvalidParamsException
* @throws ServiceNotFoundException
* @throws DecryptException
*/
protected function encryptSensitiveData(?Collection $payload, array $params, array $config): array
{
$data['_serial_no'] = get_wechat_serial_no($params);
$publicKey = get_wechat_public_key($config, $data['_serial_no']);
$phone = $payload?->get('buyer_information.phone') ?? null;
$email = $payload?->get('buyer_information.email') ?? null;
if (!is_null($phone)) {
$data['buyer_information']['phone'] = encrypt_wechat_contents($phone, $publicKey);
}
if (!is_null($email)) {
$data['buyer_information']['email'] = encrypt_wechat_contents($email, $publicKey);
}
return $data;
}
}

View File

@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-applications/download-invoice-file.html
*/
class DownloadPlugin implements PluginInterface
{
/**
* @throws InvalidParamsException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][Blockchain][DownloadPlugin] 插件开始装载', ['rocket' => $rocket]);
$payload = $rocket->getPayload();
$downloadUrl = $payload?->get('download_url') ?? null;
if (empty($downloadUrl)) {
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 下载发票文件,缺少 `download_url` 参数');
}
$rocket->setDirection(OriginResponseDirection::class)
->setPayload([
'_method' => 'GET',
'_url' => $downloadUrl.'&'.filter_params($payload)->except('download_url')->query(),
]);
Logger::info('[Wechat][V3][Marketing][Fapiao][Blockchain][DownloadPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-merchant/get-merchant-info.html
*/
class GetBaseInformationPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][Blockchain][GetBaseInformationPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->setPayload([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/merchant/base-information',
]);
Logger::info('[Wechat][V3][Marketing][Fapiao][Blockchain][GetBaseInformationPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-applications/get-fapiao-file-download-info.html
*/
class GetDownloadInfoPlugin implements PluginInterface
{
/**
* @throws InvalidParamsException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][GetDownloadInfoPlugin] 插件开始装载', ['rocket' => $rocket]);
$payload = $rocket->getPayload();
$applyId = $payload?->get('fapiao_apply_id') ?? null;
$fapiaoId = $payload?->get('fapiao_id') ?? null;
if (empty($applyId)) {
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 查询电子发票,参数缺少 `fapiao_apply_id`');
}
$rocket->setPayload([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/fapiao-applications/'.$applyId.'/fapiao-files'.(empty($fapiaoId) ? '' : '?fapiao_id='.$fapiaoId),
]);
Logger::info('[Wechat][V3][Marketing][Fapiao][GetDownloadInfoPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-merchant/list-merchant-tax-codes.html
*/
class GetTaxCodePlugin implements PluginInterface
{
/**
* @throws InvalidParamsException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][Blockchain][GetTaxCodePlugin] 插件开始装载', ['rocket' => $rocket]);
$payload = $rocket->getPayload();
$offset = $payload?->get('offset') ?? null;
$limit = $payload?->get('limit') ?? null;
if (empty($offset) || empty($limit)) {
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 获取商户可开具的商品和服务税收分类编码对照表,缺少 `offset` 或 `limit` 参数');
}
$rocket->setPayload([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/merchant/tax-codes?offset='.$offset.'&limit='.$limit,
]);
Logger::info('[Wechat][V3][Marketing][Fapiao][Blockchain][GetTaxCodePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-applications/reverse-fapiao-applications.html
*/
class ReversePlugin implements PluginInterface
{
/**
* @throws InvalidParamsException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][Blockchain][ReversePlugin] 插件开始装载', ['rocket' => $rocket]);
$payload = $rocket->getPayload();
$applyId = $payload?->get('fapiao_apply_id') ?? null;
if (empty($applyId)) {
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 冲红电子发票,参数缺少 `fapiao_apply_id`');
}
$rocket->setPayload(array_merge(
[
'_method' => 'POST',
'_url' => 'v3/new-tax-control-fapiao/fapiao-applications/'.$applyId.'/reverse',
],
filter_params($payload)->except('fapiao_apply_id')->all(),
));
Logger::info('[Wechat][V3][Marketing][Fapiao][Blockchain][ReversePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Exception\ContainerException;
use Yansongda\Artful\Exception\ServiceNotFoundException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use function Yansongda\Pay\get_wechat_config;
/**
* @see https://pay.weixin.qq.com/docs/merchant/products/fapiao/apilist.html
*/
class CreateCardTemplatePlugin implements PluginInterface
{
/**
* @throws ContainerException
* @throws ServiceNotFoundException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][CreateCardTemplatePlugin] 插件开始装载', ['rocket' => $rocket]);
$params = $rocket->getParams();
$config = get_wechat_config($params);
$payload = $rocket->getPayload();
$rocket->mergePayload([
'_method' => 'POST',
'_url' => 'v3/new-tax-control-fapiao/card-template',
'card_appid' => $payload?->get('card_appid') ?? $config['mp_app_id'],
]);
Logger::info('[Wechat][V3][Marketing][Fapiao][CreateCardTemplatePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,64 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Exception\ContainerException;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Exception\ServiceNotFoundException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Supports\Collection;
use function Yansongda\Artful\filter_params;
use function Yansongda\Pay\get_wechat_config;
use function Yansongda\Pay\get_wechat_type_key;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/user-title/acquire-fapiao-title-url.html
*/
class GetTitleUrlPlugin implements PluginInterface
{
/**
* @throws ContainerException
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][GetTitleUrlPlugin] 插件开始装载', ['rocket' => $rocket]);
$params = $rocket->getParams();
$payload = $rocket->getPayload();
if (empty($payload)) {
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 获取抬头填写链接,缺少必要参数');
}
$rocket->setPayload([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/user-title/title-url?'.$this->getQuery($payload, $params)->query(),
]);
Logger::info('[Wechat][V3][Marketing][Fapiao][GetTitleUrlPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
/**
* @throws ContainerException
* @throws ServiceNotFoundException
*/
protected function getQuery(Collection $payload, array $params): Collection
{
$config = get_wechat_config($params);
return filter_params($payload)->merge([
'appid' => $payload->get('appid', $config[get_wechat_type_key($params)] ?? ''),
]);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-merchant/query-development-config.html
*/
class QueryConfigPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][QueryConfigPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->setPayload([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/merchant/development-config',
]);
Logger::info('[Wechat][V3][Marketing][Fapiao][QueryConfigPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-applications/get-fapiao-applications.html
*/
class QueryPlugin implements PluginInterface
{
/**
* @throws InvalidParamsException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][QueryPlugin] 插件开始装载', ['rocket' => $rocket]);
$payload = $rocket->getPayload();
$applyId = $payload?->get('fapiao_apply_id') ?? null;
$fapiaoId = $payload?->get('fapiao_id') ?? null;
if (empty($applyId)) {
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 查询电子发票,参数缺少 `fapiao_apply_id`');
}
$rocket->setPayload([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/fapiao-applications/'.$applyId.(empty($fapiaoId) ? '' : '?fapiao_id='.$fapiaoId),
]);
Logger::info('[Wechat][V3][Marketing][Fapiao][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/user-title/get-user-title.html
*/
class QueryUserTitlePlugin implements PluginInterface
{
/**
* @throws InvalidParamsException
*/
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][QueryUserTitlePlugin] 插件开始装载', ['rocket' => $rocket]);
$payload = $rocket->getPayload();
if (empty($payload)) {
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 获取用户填写的抬头,缺少必要参数');
}
$rocket->setPayload([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/user-title?'.filter_params($payload)->query(),
]);
Logger::info('[Wechat][V3][Marketing][Fapiao][QueryUserTitlePlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/fapiao/fapiao-merchant/update-development-config.html
*/
class UpdateConfigPlugin implements PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket
{
Logger::debug('[Wechat][V3][Marketing][Fapiao][UpdateConfigPlugin] 插件开始装载', ['rocket' => $rocket]);
$rocket->mergePayload([
'_method' => 'PATCH',
'_url' => 'v3/new-tax-control-fapiao/merchant/development-config',
]);
Logger::info('[Wechat][V3][Marketing][Fapiao][UpdateConfigPlugin] 插件装载完毕', ['rocket' => $rocket]);
return $next($rocket);
}
}

View File

@ -6,6 +6,7 @@ namespace Yansongda\Pay\Plugin\Wechat\V3\Marketing\Transfer;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Artful\Exception\ContainerException;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Exception\ServiceNotFoundException;
@ -41,7 +42,8 @@ class DownloadReceiptPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 下载电子回单,参数缺少 `download_url`');
}
$rocket->setPayload([
$rocket->setDirection(OriginResponseDirection::class)
->setPayload([
'_method' => 'GET',
'_url' => $downloadUrl,
]);

View File

@ -14,6 +14,7 @@ use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Pay;
use function Yansongda\Artful\filter_params;
use function Yansongda\Pay\get_wechat_config;
/**
@ -44,7 +45,7 @@ class QueryBatchByWxPlugin implements PluginInterface
$rocket->setPayload([
'_method' => 'GET',
'_url' => 'v3/transfer/batches/batch-id/'.$batchId.'?'.$payload->except('batch_id')->query(),
'_url' => 'v3/transfer/batches/batch-id/'.$batchId.'?'.filter_params($payload)->except('batch_id')->query(),
]);
Logger::info('[Wechat][Marketing][Transfer][QueryBatchByWxPlugin] 插件装载完毕', ['rocket' => $rocket]);

View File

@ -14,6 +14,7 @@ use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Pay;
use function Yansongda\Artful\filter_params;
use function Yansongda\Pay\get_wechat_config;
/**
@ -44,7 +45,7 @@ class QueryBatchPlugin implements PluginInterface
$rocket->setPayload([
'_method' => 'GET',
'_url' => 'v3/transfer/batches/out-batch-no/'.$outBatchNo.'?'.$payload->except('out_batch_no')->query(),
'_url' => 'v3/transfer/batches/out-batch-no/'.$outBatchNo.'?'.filter_params($payload)->except('out_batch_no')->query(),
]);
Logger::info('[Wechat][Marketing][Transfer][QueryBatchPlugin] 插件装载完毕', ['rocket' => $rocket]);

View File

@ -14,6 +14,7 @@ use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Pay;
use function Yansongda\Artful\filter_params;
use function Yansongda\Pay\get_wechat_config;
/**
@ -43,7 +44,7 @@ class QueryReceiptDetailPlugin implements PluginInterface
$rocket->setPayload([
'_method' => 'GET',
'_url' => 'v3/transfer-detail/electronic-receipts?'.$payload->query(),
'_url' => 'v3/transfer-detail/electronic-receipts?'.filter_params($payload)->query(),
]);
Logger::info('[Wechat][Marketing][Transfer][QueryReceiptDetailPlugin] 插件装载完毕', ['rocket' => $rocket]);

View File

@ -6,6 +6,7 @@ namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\App;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
@ -30,7 +31,8 @@ class DownloadBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: App 下载交易对账单,参数缺少 `download_url`');
}
$rocket->setPayload([
$rocket->setDirection(OriginResponseDirection::class)
->setPayload([
'_method' => 'GET',
'_url' => $downloadUrl,
'_service_url' => $downloadUrl,

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/in-app-payment/get-fund-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/partner-in-app-payment/get-fund-bill.html
@ -30,7 +32,7 @@ class GetFundBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: App 申请资金账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/in-app-payment/get-trade-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/partner-in-app-payment/get-trade-bill.html
@ -30,7 +32,7 @@ class GetTradeBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: App 申请交易账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -6,6 +6,7 @@ namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Combine;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
@ -30,7 +31,8 @@ class DownloadBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 合单 下载交易对账单,参数缺少 `download_url`');
}
$rocket->setPayload([
$rocket->setDirection(OriginResponseDirection::class)
->setPayload([
'_method' => 'GET',
'_url' => $downloadUrl,
'_service_url' => $downloadUrl,

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/combine-payment/bill-download/get-fund-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/combine-payment/bill-download/get-fund-bill.html
@ -30,7 +32,7 @@ class GetFundBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 合单 申请资金账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/combine-payment/bill-download/get-trade-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/combine-payment/bill-download/get-trade-bill.html
@ -30,7 +32,7 @@ class GetTradeBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: 合单 申请交易账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -6,6 +6,7 @@ namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\H5;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
@ -30,7 +31,8 @@ class DownloadBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: H5 下载交易对账单,参数缺少 `download_url`');
}
$rocket->setPayload([
$rocket->setDirection(OriginResponseDirection::class)
->setPayload([
'_method' => 'GET',
'_url' => $downloadUrl,
'_service_url' => $downloadUrl,

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/h5-payment/get-fund-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/partner-h5-payment/get-fund-bill.html
@ -30,7 +32,7 @@ class GetFundBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: H5 申请资金账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/h5-payment/get-trade-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/partner-h5-payment/get-trade-bill.html
@ -30,7 +32,7 @@ class GetTradeBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: H5 申请交易账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -6,6 +6,7 @@ namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
@ -30,7 +31,8 @@ class DownloadBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Jsapi 下载交易对账单,参数缺少 `download_url`');
}
$rocket->setPayload([
$rocket->setDirection(OriginResponseDirection::class)
->setPayload([
'_method' => 'GET',
'_url' => $downloadUrl,
'_service_url' => $downloadUrl,

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/jsapi-payment/get-fund-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/partner-jsapi-payment/get-fund-bill.html
@ -30,7 +32,7 @@ class GetFundBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Jsapi 申请资金账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/jsapi-payment/get-trade-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/partner-jsapi-payment/get-trade-bill.html
@ -30,7 +32,7 @@ class GetTradeBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Jsapi 申请交易账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -6,6 +6,7 @@ namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
@ -30,7 +31,8 @@ class DownloadBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Mini 下载交易对账单,参数缺少 `download_url`');
}
$rocket->setPayload([
$rocket->setDirection(OriginResponseDirection::class)
->setPayload([
'_method' => 'GET',
'_url' => $downloadUrl,
'_service_url' => $downloadUrl,

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/mini-program-payment/get-fund-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/partner-mini-program-payment/get-fund-bill.html
@ -30,7 +32,7 @@ class GetFundBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Mini 申请资金账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/mini-program-payment/get-trade-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/partner-mini-program-payment/get-trade-bill.html
@ -30,7 +32,7 @@ class GetTradeBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Mini 申请交易账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -6,6 +6,7 @@ namespace Yansongda\Pay\Plugin\Wechat\V3\Pay\Native;
use Closure;
use Yansongda\Artful\Contract\PluginInterface;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
@ -30,7 +31,8 @@ class DownloadBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Native 下载交易对账单,参数缺少 `download_url`');
}
$rocket->setPayload([
$rocket->setDirection(OriginResponseDirection::class)
->setPayload([
'_method' => 'GET',
'_url' => $downloadUrl,
'_service_url' => $downloadUrl,

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/native-payment/get-fund-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/partner-native-payment/get-fund-bill.html
@ -30,7 +32,7 @@ class GetFundBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Native 申请资金账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -11,6 +11,8 @@ use Yansongda\Artful\Logger;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use function Yansongda\Artful\filter_params;
/**
* @see https://pay.weixin.qq.com/docs/merchant/apis/native-payment/get-trade-bill.html
* @see https://pay.weixin.qq.com/docs/partner/apis/partner-native-payment/get-trade-bill.html
@ -30,7 +32,7 @@ class GetTradeBillPlugin implements PluginInterface
throw new InvalidParamsException(Exception::PARAMS_NECESSARY_PARAMS_MISSING, '参数异常: Native 申请交易账单,参数为空');
}
$query = $payload->query();
$query = filter_params($payload)->query();
$rocket->setPayload([
'_method' => 'GET',

View File

@ -35,6 +35,7 @@ class QueryNegotiationPluginTest extends TestCase
{
$payload = [
"complaint_id" => "yansongda",
'_t' => 'a',
];
$rocket = new Rocket();
@ -55,6 +56,7 @@ class QueryNegotiationPluginTest extends TestCase
"complaint_id" => "yansongda",
'limit' => 2,
'offset' => 3,
'_t' => 'a',
];
$rocket = new Rocket();

View File

@ -38,6 +38,7 @@ class QueryPluginTest extends TestCase
'offset' => 3,
'begin_date' => '2021-06-06',
'end_date' => '2021-06-07',
'_t' => 'a',
];
$rocket = new Rocket();

View File

@ -2,6 +2,7 @@
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Extend\ProfitSharing;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\V3\Extend\ProfitSharing\DownloadBillPlugin;
@ -40,6 +41,7 @@ class DownloadBillPluginTest extends TestCase
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
self::assertEquals([
'_method' => 'GET',
'_url' => 'yansongda',

View File

@ -37,6 +37,7 @@ class QueryUserCouponsPluginTest extends TestCase
$rocket->setPayload(new Collection( [
"openid" => "111",
'appid' => '222',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
@ -53,6 +54,7 @@ class QueryUserCouponsPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"openid" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -37,6 +37,7 @@ class QueryItemsPluginTest extends TestCase
$rocket->setPayload(new Collection([
"stock_id" => "111",
'stock_creator_mchid' => '222',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
@ -53,6 +54,7 @@ class QueryItemsPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"stock_id" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -37,6 +37,7 @@ class QueryMerchantsPluginTest extends TestCase
$rocket->setPayload(new Collection( [
"stock_id" => "111",
'stock_creator_mchid' => '222',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
@ -53,6 +54,7 @@ class QueryMerchantsPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"stock_id" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -37,6 +37,7 @@ class QueryPluginTest extends TestCase
$rocket->setPayload(new Collection( [
"stock_id" => "111",
'stock_creator_mchid' => '222',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
@ -53,6 +54,7 @@ class QueryPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"stock_id" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -50,6 +50,7 @@ class QueryDayEndPluginTest extends TestCase
->setPayload(new Collection( [
"account_type" => "111",
'aaa' => '222',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
@ -66,6 +67,7 @@ class QueryDayEndPluginTest extends TestCase
$rocket->setParams(['_config' => 'service_provider'])
->setPayload(new Collection( [
"account_type" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -0,0 +1,58 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain\CreatePlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class CreatePluginTest extends TestCase
{
protected CreatePlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new CreatePlugin();
}
public function testNormalWithoutName()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"test" => "yansongda",
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
$payload = $result->getPayload()->all();
self::assertEquals('POST', $payload['_method']);
self::assertEquals('v3/new-tax-control-fapiao/fapiao-applications', $payload['_url']);
self::assertEquals('yansongda', $payload['test']);
self::assertArrayHasKey('_serial_no', $payload);
}
public function testNormalWithSensitiveData()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"test" => "yansongda",
'buyer_information' => [
'phone' => '123',
'email' => '456',
]
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
$payload = $result->getPayload()->all();
self::assertEquals('POST', $payload['_method']);
self::assertEquals('v3/new-tax-control-fapiao/fapiao-applications', $payload['_url']);
self::assertEquals('yansongda', $payload['test']);
self::assertArrayHasKey('_serial_no', $payload);
self::assertNotEquals('123', $payload['buyer_information']['phone']);
self::assertNotEquals('456', $payload['buyer_information']['email']);
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain\DownloadPlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class DownloadPluginTest extends TestCase
{
protected DownloadPlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new DownloadPlugin();
}
public function testEmptyPayload()
{
$rocket = new Rocket();
self::expectException(InvalidParamsException::class);
self::expectExceptionCode(Exception::PARAMS_NECESSARY_PARAMS_MISSING);
self::expectExceptionMessage('参数异常: 下载发票文件,缺少 `download_url` 参数');
$this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
}
public function testNormalParams()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "https://pay.yansongda.cn?token=123",
'appid' => '1111',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'GET',
'_url' => 'https://pay.yansongda.cn?token=123&appid=1111',
], $result->getPayload()->all());
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain\GetBaseInformationPlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class GetBaseInformationPluginTest extends TestCase
{
protected GetBaseInformationPlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new GetBaseInformationPlugin();
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"test" => "yansongda",
'appid' => '1111',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/merchant/base-information',
], $result->getPayload()->all());
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain\GetDownloadInfoPlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class GetDownloadInfoPluginTest extends TestCase
{
protected GetDownloadInfoPlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new GetDownloadInfoPlugin();
}
public function testEmptyPayload()
{
$rocket = new Rocket();
self::expectException(InvalidParamsException::class);
self::expectExceptionCode(Exception::PARAMS_NECESSARY_PARAMS_MISSING);
self::expectExceptionMessage('参数异常: 查询电子发票,参数缺少 `fapiao_apply_id`');
$this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
}
public function testNormalParams()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"fapiao_id" => "yansongda",
'fapiao_apply_id' => '111',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/fapiao-applications/111/fapiao-files?fapiao_id=yansongda',
], $result->getPayload()->all());
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
'fapiao_apply_id' => '111',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/fapiao-applications/111/fapiao-files',
], $result->getPayload()->all());
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain\GetTaxCodePlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class GetTaxCodePluginTest extends TestCase
{
protected GetTaxCodePlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new GetTaxCodePlugin();
}
public function testEmptyPayload()
{
$rocket = new Rocket();
self::expectException(InvalidParamsException::class);
self::expectExceptionCode(Exception::PARAMS_NECESSARY_PARAMS_MISSING);
self::expectExceptionMessage('参数异常: 获取商户可开具的商品和服务税收分类编码对照表,缺少 `offset` 或 `limit` 参数');
$this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"offset" => "yansongda",
'limit' => '111',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/merchant/tax-codes?offset=yansongda&limit=111',
], $result->getPayload()->all());
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\Blockchain\ReversePlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class ReversePluginTest extends TestCase
{
protected ReversePlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new ReversePlugin();
}
public function testEmptyPayload()
{
$rocket = new Rocket();
self::expectException(InvalidParamsException::class);
self::expectExceptionCode(Exception::PARAMS_NECESSARY_PARAMS_MISSING);
self::expectExceptionMessage('参数异常: 冲红电子发票,参数缺少 `fapiao_apply_id`');
$this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
'fapiao_apply_id' => '111',
'reason' => '222',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'POST',
'_url' => 'v3/new-tax-control-fapiao/fapiao-applications/111/reverse',
'reason' => '222',
], $result->getPayload()->all());
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\CreateCardTemplatePlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class CreateCardTemplatePluginTest extends TestCase
{
protected CreateCardTemplatePlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new CreateCardTemplatePlugin();
}
public function testNormalParams()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"test" => "yansongda",
'card_appid' => '1111',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'POST',
'_url' => 'v3/new-tax-control-fapiao/card-template',
'test' => 'yansongda',
'card_appid' => '1111',
], $result->getPayload()->all());
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"test" => "yansongda",
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'POST',
'_url' => 'v3/new-tax-control-fapiao/card-template',
'test' => 'yansongda',
'card_appid' => 'wx55955316af4ef13',
], $result->getPayload()->all());
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\GetTitleUrlPlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class GetTitleUrlPluginTest extends TestCase
{
protected GetTitleUrlPlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new GetTitleUrlPlugin();
}
public function testEmptyPayload()
{
$rocket = new Rocket();
self::expectException(InvalidParamsException::class);
self::expectExceptionCode(Exception::PARAMS_NECESSARY_PARAMS_MISSING);
self::expectExceptionMessage('参数异常: 获取抬头填写链接,缺少必要参数');
$this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
}
public function testNormalParams()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"test" => "yansongda",
'appid' => '1111',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/user-title/title-url?test=yansongda&appid=1111',
], $result->getPayload()->all());
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"test" => "yansongda",
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/user-title/title-url?test=yansongda&appid=wx55955316af4ef13',
], $result->getPayload()->all());
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\QueryConfigPlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class QueryConfigPluginTest extends TestCase
{
protected QueryConfigPlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new QueryConfigPlugin();
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"test" => "yansongda",
'appid' => '1111',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/merchant/development-config',
], $result->getPayload()->all());
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\QueryPlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class QueryPluginTest extends TestCase
{
protected QueryPlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new QueryPlugin();
}
public function testEmptyPayload()
{
$rocket = new Rocket();
self::expectException(InvalidParamsException::class);
self::expectExceptionCode(Exception::PARAMS_NECESSARY_PARAMS_MISSING);
self::expectExceptionMessage('参数异常: 查询电子发票,参数缺少 `fapiao_apply_id`');
$this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
}
public function testNormalParams()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"fapiao_id" => "yansongda",
'fapiao_apply_id' => '111',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/fapiao-applications/111?fapiao_id=yansongda',
], $result->getPayload()->all());
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
'fapiao_apply_id' => '111',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/fapiao-applications/111',
], $result->getPayload()->all());
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\QueryUserTitlePlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class QueryUserTitlePluginTest extends TestCase
{
protected QueryUserTitlePlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new QueryUserTitlePlugin();
}
public function testEmptyPayload()
{
$rocket = new Rocket();
self::expectException(InvalidParamsException::class);
self::expectExceptionCode(Exception::PARAMS_NECESSARY_PARAMS_MISSING);
self::expectExceptionMessage('参数异常: 获取用户填写的抬头,缺少必要参数');
$this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
}
public function testNormalParams()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"test" => "yansongda",
'appid' => '1111',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'GET',
'_url' => 'v3/new-tax-control-fapiao/user-title?test=yansongda&appid=1111'
], $result->getPayload()->all());
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Fapiao;
use Yansongda\Artful\Rocket;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Fapiao\UpdateConfigPlugin;
use Yansongda\Pay\Tests\TestCase;
use Yansongda\Supports\Collection;
class UpdateConfigPluginTest extends TestCase
{
protected UpdateConfigPlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new UpdateConfigPlugin();
}
public function testNormalParams()
{
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"test" => "yansongda",
'card_appid' => '1111',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals([
'_method' => 'PATCH',
'_url' => 'v3/new-tax-control-fapiao/merchant/development-config',
"test" => "yansongda",
'card_appid' => '1111',
], $result->getPayload()->all());
}
}

View File

@ -38,7 +38,7 @@ class CreatePluginTest extends TestCase
self::expectException(InvalidParamsException::class);
self::expectExceptionCode(Exception::PARAMS_NECESSARY_PARAMS_MISSING);
self::expectExceptionMessage('发起商家转账参数,参数缺失');
self::expectExceptionMessage('参数异常: 发起商家转账参数,参数缺失');
$this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
}

View File

@ -2,6 +2,7 @@
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Marketing\Transfer;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Transfer\DownloadReceiptPlugin;
@ -52,6 +53,7 @@ class DownloadReceiptPluginTest extends TestCase
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
self::assertEquals([
'_method' => 'GET',
'_url' => 'yansongda',

View File

@ -49,6 +49,7 @@ class QueryBatchByWxPluginTest extends TestCase
$rocket->setPayload(new Collection( [
"batch_id" => "111",
'detail_id' => '222',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -49,6 +49,7 @@ class QueryBatchPluginTest extends TestCase
$rocket->setPayload(new Collection( [
"out_batch_no" => "111",
'detail_id' => '222',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -49,6 +49,7 @@ class QueryReceiptDetailPluginTest extends TestCase
$rocket->setPayload(new Collection( [
"out_batch_no" => "111",
'out_detail_no' => '222',
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -2,6 +2,7 @@
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Pay\App;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\App\DownloadBillPlugin;
@ -40,6 +41,7 @@ class DownloadBillPluginTest extends TestCase
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
self::assertEquals([
'_method' => 'GET',
'_url' => '111',

View File

@ -36,6 +36,7 @@ class GetFundBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -36,6 +36,7 @@ class GetTradeBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -2,6 +2,7 @@
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Pay\Combine;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Combine\DownloadBillPlugin;
@ -40,6 +41,7 @@ class DownloadBillPluginTest extends TestCase
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
self::assertEquals([
'_method' => 'GET',
'_url' => '111',

View File

@ -36,6 +36,7 @@ class GetFundBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -36,6 +36,7 @@ class GetTradeBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -2,6 +2,7 @@
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Pay\H5;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\H5\DownloadBillPlugin;
@ -40,6 +41,7 @@ class DownloadBillPluginTest extends TestCase
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
self::assertEquals([
'_method' => 'GET',
'_url' => '111',

View File

@ -36,6 +36,7 @@ class GetFundBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -36,6 +36,7 @@ class GetTradeBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -2,6 +2,7 @@
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Pay\Jsapi;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi\DownloadBillPlugin;
@ -40,6 +41,7 @@ class DownloadBillPluginTest extends TestCase
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
self::assertEquals([
'_method' => 'GET',
'_url' => '111',

View File

@ -36,6 +36,7 @@ class GetFundBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -36,6 +36,7 @@ class GetTradeBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -2,6 +2,7 @@
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Pay\Mini;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini\DownloadBillPlugin;
@ -40,6 +41,7 @@ class DownloadBillPluginTest extends TestCase
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
self::assertEquals([
'_method' => 'GET',
'_url' => '111',

View File

@ -36,6 +36,7 @@ class GetFundBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -36,6 +36,7 @@ class GetTradeBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -2,6 +2,7 @@
namespace Yansongda\Pay\Tests\Plugin\Wechat\V3\Pay\Native;
use Yansongda\Artful\Direction\OriginResponseDirection;
use Yansongda\Pay\Exception\Exception;
use Yansongda\Artful\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Native\DownloadBillPlugin;
@ -40,6 +41,7 @@ class DownloadBillPluginTest extends TestCase
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
self::assertEquals([
'_method' => 'GET',
'_url' => '111',

View File

@ -36,6 +36,7 @@ class GetFundBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

View File

@ -36,6 +36,7 @@ class GetTradeBillPluginTest extends TestCase
$rocket = new Rocket();
$rocket->setPayload(new Collection( [
"download_url" => "111",
'_t' => 'a',
]));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });