mirror of
https://gitee.com/yansongda/pay.git
synced 2024-11-29 18:58:38 +08:00
change: 所有 Parser
更名为 Direction
(#770)
This commit is contained in:
parent
7ef1e68663
commit
041b4f0f83
@ -22,6 +22,7 @@
|
|||||||
- change: 插件开始装载日志由 `info` 调整为 `debug`(#755)
|
- change: 插件开始装载日志由 `info` 调整为 `debug`(#755)
|
||||||
- change: ParserInterface 签名由 `?ResponseInterface $response` 变更为 `PackerInterface $packer, ?ResponseInterface $response`(#754)
|
- change: ParserInterface 签名由 `?ResponseInterface $response` 变更为 `PackerInterface $packer, ?ResponseInterface $response`(#754)
|
||||||
- change: \Yansongda\Pay\Plugin\Wechat\RadarSignPlugin 增加 `__construct(JsonPacker $jsonPacker, XmlPacker $xmlPacker)` 方法(#753)
|
- change: \Yansongda\Pay\Plugin\Wechat\RadarSignPlugin 增加 `__construct(JsonPacker $jsonPacker, XmlPacker $xmlPacker)` 方法(#753)
|
||||||
|
- change: 所有 `Parser` 更名为 `Direction`(#770)
|
||||||
|
|
||||||
## v3.2.14
|
## v3.2.14
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Yansongda\Pay\Parser;
|
namespace Yansongda\Pay\Direction;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Yansongda\Pay\Contract\PackerInterface;
|
use Yansongda\Pay\Contract\PackerInterface;
|
||||||
@ -10,7 +10,7 @@ use Yansongda\Pay\Contract\ParserInterface;
|
|||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
|
|
||||||
class ArrayParser implements ParserInterface
|
class ArrayDirection implements ParserInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @throws InvalidResponseException
|
* @throws InvalidResponseException
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Yansongda\Pay\Parser;
|
namespace Yansongda\Pay\Direction;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Yansongda\Pay\Contract\PackerInterface;
|
use Yansongda\Pay\Contract\PackerInterface;
|
||||||
@ -12,7 +12,7 @@ use Yansongda\Pay\Exception\ServiceNotFoundException;
|
|||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Supports\Collection;
|
use Yansongda\Supports\Collection;
|
||||||
|
|
||||||
class CollectionParser implements ParserInterface
|
class CollectionDirection implements ParserInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @throws ContainerException
|
* @throws ContainerException
|
||||||
@ -21,7 +21,7 @@ class CollectionParser implements ParserInterface
|
|||||||
public function parse(PackerInterface $packer, ?ResponseInterface $response): Collection
|
public function parse(PackerInterface $packer, ?ResponseInterface $response): Collection
|
||||||
{
|
{
|
||||||
return new Collection(
|
return new Collection(
|
||||||
Pay::get(ArrayParser::class)->parse($packer, $response)
|
Pay::get(ArrayDirection::class)->parse($packer, $response)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Yansongda\Pay\Parser;
|
namespace Yansongda\Pay\Direction;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Yansongda\Pay\Contract\PackerInterface;
|
use Yansongda\Pay\Contract\PackerInterface;
|
||||||
use Yansongda\Pay\Contract\ParserInterface;
|
use Yansongda\Pay\Contract\ParserInterface;
|
||||||
|
|
||||||
class NoHttpRequestParser implements ParserInterface
|
class NoHttpRequestDirection implements ParserInterface
|
||||||
{
|
{
|
||||||
public function parse(PackerInterface $packer, ?ResponseInterface $response): ?ResponseInterface
|
public function parse(PackerInterface $packer, ?ResponseInterface $response): ?ResponseInterface
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Yansongda\Pay\Parser;
|
namespace Yansongda\Pay\Direction;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Yansongda\Pay\Contract\PackerInterface;
|
use Yansongda\Pay\Contract\PackerInterface;
|
||||||
@ -10,7 +10,7 @@ use Yansongda\Pay\Contract\ParserInterface;
|
|||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
|
|
||||||
class OriginResponseParser implements ParserInterface
|
class OriginResponseDirection implements ParserInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @throws InvalidResponseException
|
* @throws InvalidResponseException
|
9
src/Direction/ResponseDirection.php
Normal file
9
src/Direction/ResponseDirection.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Yansongda\Pay\Direction;
|
||||||
|
|
||||||
|
class ResponseDirection extends NoHttpRequestDirection
|
||||||
|
{
|
||||||
|
}
|
@ -8,13 +8,13 @@ use Psr\Http\Message\MessageInterface;
|
|||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Yansongda\Pay\Contract\ConfigInterface;
|
use Yansongda\Pay\Contract\ConfigInterface;
|
||||||
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidConfigException;
|
use Yansongda\Pay\Exception\InvalidConfigException;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
|
||||||
use Yansongda\Pay\Plugin\ParserPlugin;
|
use Yansongda\Pay\Plugin\ParserPlugin;
|
||||||
use Yansongda\Pay\Plugin\Wechat\PreparePlugin;
|
use Yansongda\Pay\Plugin\Wechat\PreparePlugin;
|
||||||
use Yansongda\Pay\Plugin\Wechat\RadarSignPlugin;
|
use Yansongda\Pay\Plugin\Wechat\RadarSignPlugin;
|
||||||
@ -25,8 +25,8 @@ use Yansongda\Supports\Str;
|
|||||||
if (!function_exists('should_do_http_request')) {
|
if (!function_exists('should_do_http_request')) {
|
||||||
function should_do_http_request(string $direction): bool
|
function should_do_http_request(string $direction): bool
|
||||||
{
|
{
|
||||||
return NoHttpRequestParser::class !== $direction
|
return NoHttpRequestDirection::class !== $direction
|
||||||
&& !in_array(NoHttpRequestParser::class, class_parents($direction));
|
&& !in_array(NoHttpRequestDirection::class, class_parents($direction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Yansongda\Pay\Parser;
|
|
||||||
|
|
||||||
class ResponseParser extends NoHttpRequestParser
|
|
||||||
{
|
|
||||||
}
|
|
@ -12,11 +12,11 @@ use Throwable;
|
|||||||
use Yansongda\Pay\Contract\PackerInterface;
|
use Yansongda\Pay\Contract\PackerInterface;
|
||||||
use Yansongda\Pay\Contract\ParserInterface;
|
use Yansongda\Pay\Contract\ParserInterface;
|
||||||
use Yansongda\Pay\Contract\ServiceProviderInterface;
|
use Yansongda\Pay\Contract\ServiceProviderInterface;
|
||||||
|
use Yansongda\Pay\Direction\CollectionDirection;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\ContainerNotFoundException;
|
use Yansongda\Pay\Exception\ContainerNotFoundException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Packer\JsonPacker;
|
use Yansongda\Pay\Packer\JsonPacker;
|
||||||
use Yansongda\Pay\Parser\CollectionParser;
|
|
||||||
use Yansongda\Pay\Provider\Alipay;
|
use Yansongda\Pay\Provider\Alipay;
|
||||||
use Yansongda\Pay\Provider\Unipay;
|
use Yansongda\Pay\Provider\Unipay;
|
||||||
use Yansongda\Pay\Provider\Wechat;
|
use Yansongda\Pay\Provider\Wechat;
|
||||||
@ -85,7 +85,7 @@ class Pay
|
|||||||
{
|
{
|
||||||
$this->registerServices($config, $container);
|
$this->registerServices($config, $container);
|
||||||
|
|
||||||
Pay::set(ParserInterface::class, CollectionParser::class);
|
Pay::set(ParserInterface::class, CollectionDirection::class);
|
||||||
Pay::set(PackerInterface::class, JsonPacker::class);
|
Pay::set(PackerInterface::class, JsonPacker::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@ namespace Yansongda\Pay\Plugin\Alipay;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidConfigException;
|
use Yansongda\Pay\Exception\InvalidConfigException;
|
||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Logger;
|
use Yansongda\Pay\Logger;
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Supports\Collection;
|
use Yansongda\Supports\Collection;
|
||||||
use Yansongda\Supports\Str;
|
use Yansongda\Supports\Str;
|
||||||
@ -40,7 +40,7 @@ class CallbackPlugin implements PluginInterface
|
|||||||
|
|
||||||
verify_alipay_sign($rocket->getParams(), $this->getSignContent($rocket->getPayload()), $sign);
|
verify_alipay_sign($rocket->getParams(), $this->getSignContent($rocket->getPayload()), $sign);
|
||||||
|
|
||||||
$rocket->setDirection(NoHttpRequestParser::class)
|
$rocket->setDirection(NoHttpRequestDirection::class)
|
||||||
->setDestination($rocket->getPayload())
|
->setDestination($rocket->getPayload())
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ namespace Yansongda\Pay\Plugin\Alipay\Fund;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Logger;
|
use Yansongda\Pay\Logger;
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,7 +19,7 @@ class TransPagePayPlugin implements PluginInterface
|
|||||||
{
|
{
|
||||||
Logger::debug('[alipay][TransPagePayPlugin] 插件开始装载', ['rocket' => $rocket]);
|
Logger::debug('[alipay][TransPagePayPlugin] 插件开始装载', ['rocket' => $rocket]);
|
||||||
|
|
||||||
$rocket->setDirection(ResponseParser::class)
|
$rocket->setDirection(ResponseDirection::class)
|
||||||
->mergePayload([
|
->mergePayload([
|
||||||
'method' => 'alipay.fund.trans.page.pay',
|
'method' => 'alipay.fund.trans.page.pay',
|
||||||
'biz_content' => $rocket->getParams(),
|
'biz_content' => $rocket->getParams(),
|
||||||
|
@ -6,10 +6,10 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Logger;
|
use Yansongda\Pay\Logger;
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
|
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ class AppPayPlugin implements PluginInterface
|
|||||||
|
|
||||||
$this->loadAlipayServiceProvider($rocket);
|
$this->loadAlipayServiceProvider($rocket);
|
||||||
|
|
||||||
$rocket->setDirection(ResponseParser::class)
|
$rocket->setDirection(ResponseDirection::class)
|
||||||
->mergePayload([
|
->mergePayload([
|
||||||
'method' => 'alipay.trade.app.pay',
|
'method' => 'alipay.trade.app.pay',
|
||||||
'biz_content' => array_merge(
|
'biz_content' => array_merge(
|
||||||
|
@ -6,10 +6,10 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Logger;
|
use Yansongda\Pay\Logger;
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
|
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ class PagePayPlugin implements PluginInterface
|
|||||||
|
|
||||||
$this->loadAlipayServiceProvider($rocket);
|
$this->loadAlipayServiceProvider($rocket);
|
||||||
|
|
||||||
$rocket->setDirection(ResponseParser::class)
|
$rocket->setDirection(ResponseDirection::class)
|
||||||
->mergePayload([
|
->mergePayload([
|
||||||
'method' => 'alipay.trade.page.pay',
|
'method' => 'alipay.trade.page.pay',
|
||||||
'biz_content' => array_merge(
|
'biz_content' => array_merge(
|
||||||
|
@ -6,8 +6,8 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Logger;
|
use Yansongda\Pay\Logger;
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
class PageRefundPlugin implements PluginInterface
|
class PageRefundPlugin implements PluginInterface
|
||||||
@ -16,7 +16,7 @@ class PageRefundPlugin implements PluginInterface
|
|||||||
{
|
{
|
||||||
Logger::debug('[alipay][PageRefundPlugin] 插件开始装载', ['rocket' => $rocket]);
|
Logger::debug('[alipay][PageRefundPlugin] 插件开始装载', ['rocket' => $rocket]);
|
||||||
|
|
||||||
$rocket->setDirection(ResponseParser::class)
|
$rocket->setDirection(ResponseDirection::class)
|
||||||
->mergePayload([
|
->mergePayload([
|
||||||
'method' => 'alipay.trade.page.refund',
|
'method' => 'alipay.trade.page.refund',
|
||||||
'biz_content' => $rocket->getParams(),
|
'biz_content' => $rocket->getParams(),
|
||||||
|
@ -6,10 +6,10 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Logger;
|
use Yansongda\Pay\Logger;
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
|
use Yansongda\Pay\Traits\SupportServiceProviderTrait;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ class WapPayPlugin implements PluginInterface
|
|||||||
|
|
||||||
$this->loadAlipayServiceProvider($rocket);
|
$this->loadAlipayServiceProvider($rocket);
|
||||||
|
|
||||||
$rocket->setDirection(ResponseParser::class)
|
$rocket->setDirection(ResponseDirection::class)
|
||||||
->mergePayload([
|
->mergePayload([
|
||||||
'method' => 'alipay.trade.wap.pay',
|
'method' => 'alipay.trade.wap.pay',
|
||||||
'biz_content' => array_merge(
|
'biz_content' => array_merge(
|
||||||
|
@ -6,8 +6,8 @@ namespace Yansongda\Pay\Plugin\Alipay\User;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Logger;
|
use Yansongda\Pay\Logger;
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,7 +19,7 @@ class AgreementPageSignPlugin implements PluginInterface
|
|||||||
{
|
{
|
||||||
Logger::debug('[alipay][AgreementPageSignPlugin] 插件开始装载', ['rocket' => $rocket]);
|
Logger::debug('[alipay][AgreementPageSignPlugin] 插件开始装载', ['rocket' => $rocket]);
|
||||||
|
|
||||||
$rocket->setDirection(ResponseParser::class)
|
$rocket->setDirection(ResponseDirection::class)
|
||||||
->mergePayload([
|
->mergePayload([
|
||||||
'method' => 'alipay.user.agreement.page.sign',
|
'method' => 'alipay.user.agreement.page.sign',
|
||||||
'biz_content' => array_merge(
|
'biz_content' => array_merge(
|
||||||
|
@ -6,13 +6,13 @@ namespace Yansongda\Pay\Plugin\Unipay;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidConfigException;
|
use Yansongda\Pay\Exception\InvalidConfigException;
|
||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Logger;
|
use Yansongda\Pay\Logger;
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Supports\Collection;
|
use Yansongda\Supports\Collection;
|
||||||
use Yansongda\Supports\Str;
|
use Yansongda\Supports\Str;
|
||||||
@ -42,7 +42,7 @@ class CallbackPlugin implements PluginInterface
|
|||||||
|
|
||||||
verify_unipay_sign($params, $rocket->getPayload()->sortKeys()->toString(), $signature);
|
verify_unipay_sign($params, $rocket->getPayload()->sortKeys()->toString(), $signature);
|
||||||
|
|
||||||
$rocket->setDirection(NoHttpRequestParser::class)
|
$rocket->setDirection(NoHttpRequestDirection::class)
|
||||||
->setDestination($rocket->getPayload())
|
->setDestination($rocket->getPayload())
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Plugin\Unipay\OnlineGateway;
|
namespace Yansongda\Pay\Plugin\Unipay\OnlineGateway;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Unipay\GeneralPlugin;
|
use Yansongda\Pay\Plugin\Unipay\GeneralPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ class PagePayPlugin extends GeneralPlugin
|
|||||||
|
|
||||||
protected function doSomething(Rocket $rocket): void
|
protected function doSomething(Rocket $rocket): void
|
||||||
{
|
{
|
||||||
$rocket->setDirection(ResponseParser::class)
|
$rocket->setDirection(ResponseDirection::class)
|
||||||
->mergePayload([
|
->mergePayload([
|
||||||
'bizType' => '000201',
|
'bizType' => '000201',
|
||||||
'txnType' => '01',
|
'txnType' => '01',
|
||||||
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Plugin\Unipay\OnlineGateway;
|
namespace Yansongda\Pay\Plugin\Unipay\OnlineGateway;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Unipay\GeneralPlugin;
|
use Yansongda\Pay\Plugin\Unipay\GeneralPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ class WapPayPlugin extends GeneralPlugin
|
|||||||
|
|
||||||
protected function doSomething(Rocket $rocket): void
|
protected function doSomething(Rocket $rocket): void
|
||||||
{
|
{
|
||||||
$rocket->setDirection(ResponseParser::class)
|
$rocket->setDirection(ResponseDirection::class)
|
||||||
->mergePayload([
|
->mergePayload([
|
||||||
'bizType' => '000201',
|
'bizType' => '000201',
|
||||||
'txnType' => '01',
|
'txnType' => '01',
|
||||||
|
@ -7,6 +7,7 @@ namespace Yansongda\Pay\Plugin\Wechat;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidConfigException;
|
use Yansongda\Pay\Exception\InvalidConfigException;
|
||||||
@ -14,7 +15,6 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
|||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Logger;
|
use Yansongda\Pay\Logger;
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Supports\Collection;
|
use Yansongda\Supports\Collection;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ class CallbackPlugin implements PluginInterface
|
|||||||
|
|
||||||
$body = json_decode((string) $rocket->getDestination()->getBody(), true);
|
$body = json_decode((string) $rocket->getDestination()->getBody(), true);
|
||||||
|
|
||||||
$rocket->setDirection(NoHttpRequestParser::class)->setPayload(new Collection($body));
|
$rocket->setDirection(NoHttpRequestDirection::class)->setPayload(new Collection($body));
|
||||||
|
|
||||||
$body['resource'] = decrypt_wechat_resource($body['resource'] ?? [], $rocket->getParams());
|
$body['resource'] = decrypt_wechat_resource($body['resource'] ?? [], $rocket->getParams());
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Plugin\Wechat\Fund\Profitsharing;
|
namespace Yansongda\Pay\Plugin\Wechat\Fund\Profitsharing;
|
||||||
|
|
||||||
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
|
||||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ class DownloadBillPlugin extends GeneralPlugin
|
|||||||
|
|
||||||
protected function doSomething(Rocket $rocket): void
|
protected function doSomething(Rocket $rocket): void
|
||||||
{
|
{
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
|
|
||||||
$rocket->setPayload(null);
|
$rocket->setPayload(null);
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Plugin\Wechat\Fund\Transfer;
|
namespace Yansongda\Pay\Plugin\Wechat\Fund\Transfer;
|
||||||
|
|
||||||
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
|
||||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ class DownloadReceiptPlugin extends GeneralPlugin
|
|||||||
|
|
||||||
protected function doSomething(Rocket $rocket): void
|
protected function doSomething(Rocket $rocket): void
|
||||||
{
|
{
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
|
|
||||||
$rocket->setPayload(null);
|
$rocket->setPayload(null);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace Yansongda\Pay\Plugin\Wechat\Papay;
|
namespace Yansongda\Pay\Plugin\Wechat\Papay;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Plugin\Wechat\RadarSignPlugin;
|
use Yansongda\Pay\Plugin\Wechat\RadarSignPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ class OnlyContractPlugin extends RadarSignPlugin
|
|||||||
|
|
||||||
$rocket->setDestination($rocket->getPayload());
|
$rocket->setDestination($rocket->getPayload());
|
||||||
|
|
||||||
$rocket->setDirection(NoHttpRequestParser::class);
|
$rocket->setDirection(NoHttpRequestDirection::class);
|
||||||
|
|
||||||
return $next($rocket);
|
return $next($rocket);
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Plugin\Wechat\Pay\Common;
|
namespace Yansongda\Pay\Plugin\Wechat\Pay\Common;
|
||||||
|
|
||||||
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
@ -56,7 +56,7 @@ class ClosePlugin extends GeneralPlugin
|
|||||||
*/
|
*/
|
||||||
protected function doSomething(Rocket $rocket): void
|
protected function doSomething(Rocket $rocket): void
|
||||||
{
|
{
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
|
|
||||||
$config = get_wechat_config($rocket->getParams());
|
$config = get_wechat_config($rocket->getParams());
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Plugin\Wechat\Pay\Common;
|
namespace Yansongda\Pay\Plugin\Wechat\Pay\Common;
|
||||||
|
|
||||||
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
|
||||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ class DownloadBillPlugin extends GeneralPlugin
|
|||||||
|
|
||||||
protected function doSomething(Rocket $rocket): void
|
protected function doSomething(Rocket $rocket): void
|
||||||
{
|
{
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
|
|
||||||
$rocket->setPayload(null);
|
$rocket->setPayload(null);
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Plugin\Wechat\Risk\Complaints;
|
namespace Yansongda\Pay\Plugin\Wechat\Risk\Complaints;
|
||||||
|
|
||||||
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
|
||||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Supports\Collection;
|
use Yansongda\Supports\Collection;
|
||||||
@ -26,7 +26,7 @@ class CompleteComplaintPlugin extends GeneralPlugin
|
|||||||
*/
|
*/
|
||||||
protected function doSomething(Rocket $rocket): void
|
protected function doSomething(Rocket $rocket): void
|
||||||
{
|
{
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
|
|
||||||
$payload = $rocket->getPayload();
|
$payload = $rocket->getPayload();
|
||||||
$config = get_wechat_config($rocket->getParams());
|
$config = get_wechat_config($rocket->getParams());
|
||||||
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Plugin\Wechat\Risk\Complaints;
|
namespace Yansongda\Pay\Plugin\Wechat\Risk\Complaints;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ class DeleteCallbackPlugin extends GeneralPlugin
|
|||||||
|
|
||||||
protected function doSomething(Rocket $rocket): void
|
protected function doSomething(Rocket $rocket): void
|
||||||
{
|
{
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
|
|
||||||
$rocket->setPayload(null);
|
$rocket->setPayload(null);
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Plugin\Wechat\Risk\Complaints;
|
namespace Yansongda\Pay\Plugin\Wechat\Risk\Complaints;
|
||||||
|
|
||||||
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
|
||||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ class DownloadMediaPlugin extends GeneralPlugin
|
|||||||
|
|
||||||
protected function doSomething(Rocket $rocket): void
|
protected function doSomething(Rocket $rocket): void
|
||||||
{
|
{
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
|
|
||||||
$rocket->setPayload(null);
|
$rocket->setPayload(null);
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Plugin\Wechat\Risk\Complaints;
|
namespace Yansongda\Pay\Plugin\Wechat\Risk\Complaints;
|
||||||
|
|
||||||
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
|
||||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class ResponseComplaintPlugin extends GeneralPlugin
|
|||||||
*/
|
*/
|
||||||
protected function doSomething(Rocket $rocket): void
|
protected function doSomething(Rocket $rocket): void
|
||||||
{
|
{
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
|
|
||||||
$config = get_wechat_config($rocket->getParams());
|
$config = get_wechat_config($rocket->getParams());
|
||||||
$payload = $rocket->getPayload();
|
$payload = $rocket->getPayload();
|
||||||
|
@ -12,6 +12,7 @@ use Yansongda\Pay\Contract\HttpClientInterface;
|
|||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
use Yansongda\Pay\Contract\ProviderInterface;
|
use Yansongda\Pay\Contract\ProviderInterface;
|
||||||
use Yansongda\Pay\Contract\ShortcutInterface;
|
use Yansongda\Pay\Contract\ShortcutInterface;
|
||||||
|
use Yansongda\Pay\Direction\ArrayDirection;
|
||||||
use Yansongda\Pay\Event;
|
use Yansongda\Pay\Event;
|
||||||
use Yansongda\Pay\Exception\ContainerException;
|
use Yansongda\Pay\Exception\ContainerException;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
@ -20,7 +21,6 @@ use Yansongda\Pay\Exception\InvalidParamsException;
|
|||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
use Yansongda\Pay\Exception\ServiceNotFoundException;
|
||||||
use Yansongda\Pay\Logger;
|
use Yansongda\Pay\Logger;
|
||||||
use Yansongda\Pay\Parser\ArrayParser;
|
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Supports\Collection;
|
use Yansongda\Supports\Collection;
|
||||||
@ -81,7 +81,7 @@ abstract class AbstractProvider implements ProviderInterface
|
|||||||
|
|
||||||
$destination = $rocket->getDestination();
|
$destination = $rocket->getDestination();
|
||||||
|
|
||||||
if (ArrayParser::class === $rocket->getDirection() && $destination instanceof Collection) {
|
if (ArrayDirection::class === $rocket->getDirection() && $destination instanceof Collection) {
|
||||||
return $destination->toArray();
|
return $destination->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Parser;
|
namespace Yansongda\Pay\Tests\Direction;
|
||||||
|
|
||||||
use GuzzleHttp\Psr7\Response;
|
use GuzzleHttp\Psr7\Response;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
use Yansongda\Pay\Packer\JsonPacker;
|
use Yansongda\Pay\Packer\JsonPacker;
|
||||||
use Yansongda\Pay\Packer\QueryPacker;
|
use Yansongda\Pay\Packer\QueryPacker;
|
||||||
use Yansongda\Pay\Parser\ArrayParser;
|
use Yansongda\Pay\Direction\ArrayDirection;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
|
|
||||||
class ArrayParserTest extends TestCase
|
class ArrayDirectionTest extends TestCase
|
||||||
{
|
{
|
||||||
protected ArrayParser $parser;
|
protected ArrayDirection $parser;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->parser = new ArrayParser();
|
$this->parser = new ArrayDirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testResponseNull()
|
public function testResponseNull()
|
@ -1,22 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Parser;
|
namespace Yansongda\Pay\Tests\Direction;
|
||||||
|
|
||||||
use GuzzleHttp\Psr7\Response;
|
use GuzzleHttp\Psr7\Response;
|
||||||
use Yansongda\Pay\Packer\JsonPacker;
|
use Yansongda\Pay\Packer\JsonPacker;
|
||||||
use Yansongda\Pay\Parser\CollectionParser;
|
use Yansongda\Pay\Direction\CollectionDirection;
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
|
|
||||||
class CollectionParserTest extends TestCase
|
class CollectionDirectionTest extends TestCase
|
||||||
{
|
{
|
||||||
protected CollectionParser $parser;
|
protected CollectionDirection $parser;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->parser = new CollectionParser();
|
$this->parser = new CollectionDirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormal()
|
public function testNormal()
|
@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Parser;
|
namespace Yansongda\Pay\Tests\Direction;
|
||||||
|
|
||||||
use GuzzleHttp\Psr7\Response;
|
use GuzzleHttp\Psr7\Response;
|
||||||
use Yansongda\Pay\Packer\JsonPacker;
|
use Yansongda\Pay\Packer\JsonPacker;
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
|
|
||||||
class NoHttpRequestParserTest extends TestCase
|
class NoHttpRequestDirectionTest extends TestCase
|
||||||
{
|
{
|
||||||
protected NoHttpRequestParser $parser;
|
protected NoHttpRequestDirection $parser;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->parser = new NoHttpRequestParser();
|
$this->parser = new NoHttpRequestDirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormal()
|
public function testNormal()
|
@ -1,22 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Parser;
|
namespace Yansongda\Pay\Tests\Direction;
|
||||||
|
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
use Yansongda\Pay\Packer\JsonPacker;
|
use Yansongda\Pay\Packer\JsonPacker;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
|
|
||||||
class OriginResponseParserTest extends TestCase
|
class OriginResponseDirectionTest extends TestCase
|
||||||
{
|
{
|
||||||
protected OriginResponseParser $parser;
|
protected OriginResponseDirection $parser;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->parser = new OriginResponseParser();
|
$this->parser = new OriginResponseDirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testResponseNull()
|
public function testResponseNull()
|
7
tests/Direction/ResponseDirectionTest.php
Normal file
7
tests/Direction/ResponseDirectionTest.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Yansongda\Pay\Tests\Direction;
|
||||||
|
|
||||||
|
class ResponseDirectionTest extends NoHttpRequestDirectionTest
|
||||||
|
{
|
||||||
|
}
|
@ -11,9 +11,9 @@ use Yansongda\Pay\Contract\HttpClientInterface;
|
|||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidConfigException;
|
use Yansongda\Pay\Exception\InvalidConfigException;
|
||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
use Yansongda\Pay\Parser\CollectionParser;
|
use Yansongda\Pay\Direction\CollectionDirection;
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Pay\Provider\Wechat;
|
use Yansongda\Pay\Provider\Wechat;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
@ -56,13 +56,13 @@ class FunctionTest extends TestCase
|
|||||||
|
|
||||||
self::assertTrue(should_do_http_request($rocket->getDirection()));
|
self::assertTrue(should_do_http_request($rocket->getDirection()));
|
||||||
|
|
||||||
$rocket->setDirection(CollectionParser::class);
|
$rocket->setDirection(CollectionDirection::class);
|
||||||
self::assertTrue(should_do_http_request($rocket->getDirection()));
|
self::assertTrue(should_do_http_request($rocket->getDirection()));
|
||||||
|
|
||||||
$rocket->setDirection(ResponseParser::class);
|
$rocket->setDirection(ResponseDirection::class);
|
||||||
self::assertFalse(should_do_http_request($rocket->getDirection()));
|
self::assertFalse(should_do_http_request($rocket->getDirection()));
|
||||||
|
|
||||||
$rocket->setDirection(NoHttpRequestParser::class);
|
$rocket->setDirection(NoHttpRequestDirection::class);
|
||||||
self::assertFalse(should_do_http_request($rocket->getDirection()));
|
self::assertFalse(should_do_http_request($rocket->getDirection()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Parser;
|
|
||||||
|
|
||||||
class ResponseParserTest extends NoHttpRequestParserTest
|
|
||||||
{
|
|
||||||
}
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Fund;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\Fund;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\Fund\AccountQueryPlugin;
|
use Yansongda\Pay\Plugin\Alipay\Fund\AccountQueryPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -25,7 +25,7 @@ class AccountQueryPluginTest extends TestCase
|
|||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
self::assertNotEquals(ResponseParser::class, $result->getDirection());
|
self::assertNotEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertStringContainsString('alipay.fund.account.query', $result->getPayload()->toJson());
|
self::assertStringContainsString('alipay.fund.account.query', $result->getPayload()->toJson());
|
||||||
self::assertStringContainsString('TRANS_ACCOUNT_NO_PWD', $result->getPayload()->toJson());
|
self::assertStringContainsString('TRANS_ACCOUNT_NO_PWD', $result->getPayload()->toJson());
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Fund;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\Fund;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\Fund\AuthOrderFreezePlugin;
|
use Yansongda\Pay\Plugin\Alipay\Fund\AuthOrderFreezePlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -25,7 +25,7 @@ class AuthOrderFreezePluginTest extends TestCase
|
|||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
self::assertNotEquals(ResponseParser::class, $result->getDirection());
|
self::assertNotEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertStringContainsString('alipay.fund.auth.order.freeze', $result->getPayload()->toJson());
|
self::assertStringContainsString('alipay.fund.auth.order.freeze', $result->getPayload()->toJson());
|
||||||
self::assertStringContainsString('PRE_AUTH', $result->getPayload()->toJson());
|
self::assertStringContainsString('PRE_AUTH', $result->getPayload()->toJson());
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Fund;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\Fund;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\Fund\TransCommonQueryPlugin;
|
use Yansongda\Pay\Plugin\Alipay\Fund\TransCommonQueryPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -26,7 +26,7 @@ class TransCommonQueryPluginTest extends TestCase
|
|||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
$payloadString = $result->getPayload()->toJson();
|
$payloadString = $result->getPayload()->toJson();
|
||||||
|
|
||||||
self::assertNotEquals(ResponseParser::class, $result->getDirection());
|
self::assertNotEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertStringContainsString('alipay.fund.trans.common.query', $payloadString);
|
self::assertStringContainsString('alipay.fund.trans.common.query', $payloadString);
|
||||||
self::assertStringContainsString('TRANS_ACCOUNT_NO_PWD', $payloadString);
|
self::assertStringContainsString('TRANS_ACCOUNT_NO_PWD', $payloadString);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Fund;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\Fund;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\Fund\TransPagePayPlugin;
|
use Yansongda\Pay\Plugin\Alipay\Fund\TransPagePayPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -25,7 +25,7 @@ class TransPagePayPluginTest extends TestCase
|
|||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
self::assertEquals(ResponseParser::class, $result->getDirection());
|
self::assertEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertStringContainsString('alipay.fund.trans.page.pay', $result->getPayload()->toJson());
|
self::assertStringContainsString('alipay.fund.trans.page.pay', $result->getPayload()->toJson());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Fund;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\Fund;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\Fund\TransUniTransferPlugin;
|
use Yansongda\Pay\Plugin\Alipay\Fund\TransUniTransferPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -25,7 +25,7 @@ class TransUniTransferPluginTest extends TestCase
|
|||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
self::assertNotEquals(ResponseParser::class, $result->getDirection());
|
self::assertNotEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertStringContainsString('alipay.fund.trans.uni.transfer', $result->getPayload()->toJson());
|
self::assertStringContainsString('alipay.fund.trans.uni.transfer', $result->getPayload()->toJson());
|
||||||
self::assertStringContainsString('DIRECT_TRANSFER', $result->getPayload()->toJson());
|
self::assertStringContainsString('DIRECT_TRANSFER', $result->getPayload()->toJson());
|
||||||
self::assertStringContainsString('TRANS_ACCOUNT_NO_PWD', $result->getPayload()->toJson());
|
self::assertStringContainsString('TRANS_ACCOUNT_NO_PWD', $result->getPayload()->toJson());
|
||||||
|
@ -4,7 +4,7 @@ namespace Yansongda\Pay\Tests\Plugin\Alipay;
|
|||||||
|
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\LaunchPlugin;
|
use Yansongda\Pay\Plugin\Alipay\LaunchPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -24,7 +24,7 @@ class LaunchPluginTest extends TestCase
|
|||||||
public function testNoHttpRequest()
|
public function testNoHttpRequest()
|
||||||
{
|
{
|
||||||
$rocket = new Rocket();
|
$rocket = new Rocket();
|
||||||
$rocket->setDirection(NoHttpRequestParser::class);
|
$rocket->setDirection(NoHttpRequestDirection::class);
|
||||||
|
|
||||||
self::assertSame($rocket, $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }));
|
self::assertSame($rocket, $this->plugin->assembly($rocket, function ($rocket) { return $rocket; }));
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Tools;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\Tools;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\Tools\SystemOauthTokenPlugin;
|
use Yansongda\Pay\Plugin\Alipay\Tools\SystemOauthTokenPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\Trade\AppPayPlugin;
|
use Yansongda\Pay\Plugin\Alipay\Trade\AppPayPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -25,7 +25,7 @@ class AppPayPluginTest extends TestCase
|
|||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
self::assertEquals(ResponseParser::class, $result->getDirection());
|
self::assertEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertStringContainsString('alipay.trade.app.pay', $result->getPayload()->toJson());
|
self::assertStringContainsString('alipay.trade.app.pay', $result->getPayload()->toJson());
|
||||||
self::assertStringContainsString('QUICK_MSECURITY_PAY', $result->getPayload()->toJson());
|
self::assertStringContainsString('QUICK_MSECURITY_PAY', $result->getPayload()->toJson());
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\Trade\PagePayPlugin;
|
use Yansongda\Pay\Plugin\Alipay\Trade\PagePayPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -25,7 +25,7 @@ class PagePayPluginTest extends TestCase
|
|||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
self::assertEquals(ResponseParser::class, $result->getDirection());
|
self::assertEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertStringContainsString('alipay.trade.page.pay', $result->getPayload()->toJson());
|
self::assertStringContainsString('alipay.trade.page.pay', $result->getPayload()->toJson());
|
||||||
self::assertStringContainsString('FAST_INSTANT_TRADE_PAY', $result->getPayload()->toJson());
|
self::assertStringContainsString('FAST_INSTANT_TRADE_PAY', $result->getPayload()->toJson());
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\Trade\PageRefundPlugin;
|
use Yansongda\Pay\Plugin\Alipay\Trade\PageRefundPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -25,7 +25,7 @@ class PageRefundPluginTest extends TestCase
|
|||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
self::assertEquals(ResponseParser::class, $result->getDirection());
|
self::assertEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertStringContainsString('alipay.trade.page.refund', $result->getPayload()->toJson());
|
self::assertStringContainsString('alipay.trade.page.refund', $result->getPayload()->toJson());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\Trade\PayPlugin;
|
use Yansongda\Pay\Plugin\Alipay\Trade\PayPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -25,7 +25,7 @@ class PayPluginTest extends TestCase
|
|||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
self::assertNotEquals(ResponseParser::class, $result->getDirection());
|
self::assertNotEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertStringContainsString('alipay.trade.pay', $result->getPayload()->toJson());
|
self::assertStringContainsString('alipay.trade.pay', $result->getPayload()->toJson());
|
||||||
self::assertStringContainsString('FACE_TO_FACE_PAYMENT', $result->getPayload()->toJson());
|
self::assertStringContainsString('FACE_TO_FACE_PAYMENT', $result->getPayload()->toJson());
|
||||||
self::assertStringContainsString('bar_code', $result->getPayload()->toJson());
|
self::assertStringContainsString('bar_code', $result->getPayload()->toJson());
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\Trade\WapPayPlugin;
|
use Yansongda\Pay\Plugin\Alipay\Trade\WapPayPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -25,7 +25,7 @@ class WapPluginTest extends TestCase
|
|||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
self::assertEquals(ResponseParser::class, $result->getDirection());
|
self::assertEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertStringContainsString('alipay.trade.wap.pay', $result->getPayload()->toJson());
|
self::assertStringContainsString('alipay.trade.wap.pay', $result->getPayload()->toJson());
|
||||||
self::assertStringContainsString('QUICK_WAP_PAY', $result->getPayload()->toJson());
|
self::assertStringContainsString('QUICK_WAP_PAY', $result->getPayload()->toJson());
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Alipay\User;
|
namespace Yansongda\Pay\Tests\Plugin\Alipay\User;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Alipay\User\AgreementPageSignPlugin;
|
use Yansongda\Pay\Plugin\Alipay\User\AgreementPageSignPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -25,7 +25,7 @@ class AgreementPageSignPluginTest extends TestCase
|
|||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
self::assertEquals(ResponseParser::class, $result->getDirection());
|
self::assertEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertStringContainsString('alipay.user.agreement.page.sign', $result->getPayload()->toJson());
|
self::assertStringContainsString('alipay.user.agreement.page.sign', $result->getPayload()->toJson());
|
||||||
self::assertStringContainsString('CYCLE_PAY_AUTH', $result->getPayload()->toJson());
|
self::assertStringContainsString('CYCLE_PAY_AUTH', $result->getPayload()->toJson());
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace Yansongda\Pay\Tests\Plugin;
|
|||||||
|
|
||||||
use Yansongda\Pay\Contract\ParserInterface;
|
use Yansongda\Pay\Contract\ParserInterface;
|
||||||
use Yansongda\Pay\Exception\InvalidConfigException;
|
use Yansongda\Pay\Exception\InvalidConfigException;
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Pay\Plugin\ParserPlugin;
|
use Yansongda\Pay\Plugin\ParserPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
@ -47,7 +47,7 @@ class ParserPluginTest extends TestCase
|
|||||||
|
|
||||||
public function testDefaultParser()
|
public function testDefaultParser()
|
||||||
{
|
{
|
||||||
Pay::set(ParserInterface::class, NoHttpRequestParser::class);
|
Pay::set(ParserInterface::class, NoHttpRequestDirection::class);
|
||||||
|
|
||||||
$rocket = new Rocket();
|
$rocket = new Rocket();
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ class ParserPluginTest extends TestCase
|
|||||||
|
|
||||||
public function testObjectParser()
|
public function testObjectParser()
|
||||||
{
|
{
|
||||||
Pay::set(ParserInterface::class, new NoHttpRequestParser());
|
Pay::set(ParserInterface::class, new NoHttpRequestDirection());
|
||||||
|
|
||||||
$rocket = new Rocket();
|
$rocket = new Rocket();
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Yansongda\Pay\Tests\Plugin\Unipay;
|
namespace Yansongda\Pay\Tests\Plugin\Unipay;
|
||||||
|
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Plugin\Unipay\LaunchPlugin;
|
use Yansongda\Pay\Plugin\Unipay\LaunchPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -25,7 +25,7 @@ class LaunchPluginTest extends TestCase
|
|||||||
public function testShouldNotDoRequest()
|
public function testShouldNotDoRequest()
|
||||||
{
|
{
|
||||||
$rocket = new Rocket();
|
$rocket = new Rocket();
|
||||||
$rocket->setDirection(NoHttpRequestParser::class);
|
$rocket->setDirection(NoHttpRequestDirection::class);
|
||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ namespace Yansongda\Pay\Tests\Plugin\Unipay\OnlineGateway;
|
|||||||
|
|
||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
use Psr\Http\Message\RequestInterface;
|
use Psr\Http\Message\RequestInterface;
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Pay\Plugin\Unipay\OnlineGateway\PagePayPlugin;
|
use Yansongda\Pay\Plugin\Unipay\OnlineGateway\PagePayPlugin;
|
||||||
use Yansongda\Pay\Provider\Unipay;
|
use Yansongda\Pay\Provider\Unipay;
|
||||||
@ -38,7 +38,7 @@ class PagePayPluginTest extends TestCase
|
|||||||
self::assertInstanceOf(RequestInterface::class, $radar);
|
self::assertInstanceOf(RequestInterface::class, $radar);
|
||||||
self::assertEquals('POST', $radar->getMethod());
|
self::assertEquals('POST', $radar->getMethod());
|
||||||
self::assertEquals(new Uri(Unipay::URL[Pay::MODE_NORMAL].'gateway/api/frontTransReq.do'), $radar->getUri());
|
self::assertEquals(new Uri(Unipay::URL[Pay::MODE_NORMAL].'gateway/api/frontTransReq.do'), $radar->getUri());
|
||||||
self::assertEquals(ResponseParser::class, $result->getDirection());
|
self::assertEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertEquals('000201', $payload['bizType']);
|
self::assertEquals('000201', $payload['bizType']);
|
||||||
self::assertEquals('01', $payload['txnType']);
|
self::assertEquals('01', $payload['txnType']);
|
||||||
self::assertEquals('01', $payload['txnSubType']);
|
self::assertEquals('01', $payload['txnSubType']);
|
||||||
|
@ -4,7 +4,7 @@ namespace Yansongda\Pay\Tests\Plugin\Unipay\OnlineGateway;
|
|||||||
|
|
||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
use Psr\Http\Message\RequestInterface;
|
use Psr\Http\Message\RequestInterface;
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Pay\Plugin\Unipay\OnlineGateway\WapPayPlugin;
|
use Yansongda\Pay\Plugin\Unipay\OnlineGateway\WapPayPlugin;
|
||||||
use Yansongda\Pay\Provider\Unipay;
|
use Yansongda\Pay\Provider\Unipay;
|
||||||
@ -38,7 +38,7 @@ class WapPayPluginTest extends TestCase
|
|||||||
self::assertInstanceOf(RequestInterface::class, $radar);
|
self::assertInstanceOf(RequestInterface::class, $radar);
|
||||||
self::assertEquals('POST', $radar->getMethod());
|
self::assertEquals('POST', $radar->getMethod());
|
||||||
self::assertEquals(new Uri(Unipay::URL[Pay::MODE_NORMAL].'gateway/api/frontTransReq.do'), $radar->getUri());
|
self::assertEquals(new Uri(Unipay::URL[Pay::MODE_NORMAL].'gateway/api/frontTransReq.do'), $radar->getUri());
|
||||||
self::assertEquals(ResponseParser::class, $result->getDirection());
|
self::assertEquals(ResponseDirection::class, $result->getDirection());
|
||||||
self::assertEquals('000201', $payload['bizType']);
|
self::assertEquals('000201', $payload['bizType']);
|
||||||
self::assertEquals('01', $payload['txnType']);
|
self::assertEquals('01', $payload['txnType']);
|
||||||
self::assertEquals('01', $payload['txnSubType']);
|
self::assertEquals('01', $payload['txnSubType']);
|
||||||
|
@ -5,7 +5,7 @@ namespace Yansongda\Pay\Tests\Plugin\Wechat\Fund\Profitsharing;
|
|||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Wechat\Fund\Profitsharing\DownloadBillPlugin;
|
use Yansongda\Pay\Plugin\Wechat\Fund\Profitsharing\DownloadBillPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -34,7 +34,7 @@ class DownloadBillPluginTest extends TestCase
|
|||||||
|
|
||||||
$radar = $result->getRadar();
|
$radar = $result->getRadar();
|
||||||
|
|
||||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
|
||||||
self::assertEquals('GET', $radar->getMethod());
|
self::assertEquals('GET', $radar->getMethod());
|
||||||
self::assertEquals(new Uri('https://yansongda.cn'), $radar->getUri());
|
self::assertEquals(new Uri('https://yansongda.cn'), $radar->getUri());
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ namespace Yansongda\Pay\Tests\Plugin\Wechat\Fund\Transfer;
|
|||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Wechat\Fund\Transfer\DownloadReceiptPlugin;
|
use Yansongda\Pay\Plugin\Wechat\Fund\Transfer\DownloadReceiptPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -34,7 +34,7 @@ class DownloadReceiptPluginTest extends TestCase
|
|||||||
|
|
||||||
$radar = $result->getRadar();
|
$radar = $result->getRadar();
|
||||||
|
|
||||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
|
||||||
self::assertEquals('GET', $radar->getMethod());
|
self::assertEquals('GET', $radar->getMethod());
|
||||||
self::assertEquals(new Uri('https://yansongda.cn'), $radar->getUri());
|
self::assertEquals(new Uri('https://yansongda.cn'), $radar->getUri());
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ use GuzzleHttp\Psr7\Response;
|
|||||||
use GuzzleHttp\Psr7\ServerRequest;
|
use GuzzleHttp\Psr7\ServerRequest;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidResponseException;
|
use Yansongda\Pay\Exception\InvalidResponseException;
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Wechat\LaunchPlugin;
|
use Yansongda\Pay\Plugin\Wechat\LaunchPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -30,7 +30,7 @@ class LaunchPluginTest extends TestCase
|
|||||||
public function testShouldNotDoRequest()
|
public function testShouldNotDoRequest()
|
||||||
{
|
{
|
||||||
$rocket = new Rocket();
|
$rocket = new Rocket();
|
||||||
$rocket->setDirection(NoHttpRequestParser::class);
|
$rocket->setDirection(NoHttpRequestDirection::class);
|
||||||
|
|
||||||
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class LaunchPluginTest extends TestCase
|
|||||||
$destination = new Response();
|
$destination = new Response();
|
||||||
|
|
||||||
$rocket = new Rocket();
|
$rocket = new Rocket();
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
$rocket->setDestination($destination);
|
$rocket->setDestination($destination);
|
||||||
$rocket->setDestinationOrigin(new ServerRequest('POST', 'http://localhost'));
|
$rocket->setDestinationOrigin(new ServerRequest('POST', 'http://localhost'));
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class LaunchPluginTest extends TestCase
|
|||||||
$destination = new Response(500);
|
$destination = new Response(500);
|
||||||
|
|
||||||
$rocket = new Rocket();
|
$rocket = new Rocket();
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
$rocket->setDestination($destination);
|
$rocket->setDestination($destination);
|
||||||
$rocket->setDestinationOrigin(new ServerRequest('POST', 'http://localhost'));
|
$rocket->setDestinationOrigin(new ServerRequest('POST', 'http://localhost'));
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class LaunchPluginTest extends TestCase
|
|||||||
$destination = [];
|
$destination = [];
|
||||||
|
|
||||||
$rocket = new Rocket();
|
$rocket = new Rocket();
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
$rocket->setDestination($destination);
|
$rocket->setDestination($destination);
|
||||||
$rocket->setDestinationOrigin(new ServerRequest('POST', 'http://localhost'));
|
$rocket->setDestinationOrigin(new ServerRequest('POST', 'http://localhost'));
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ class LaunchPluginTest extends TestCase
|
|||||||
$destination = new Collection();
|
$destination = new Collection();
|
||||||
|
|
||||||
$rocket = new Rocket();
|
$rocket = new Rocket();
|
||||||
$rocket->setDirection(OriginResponseParser::class);
|
$rocket->setDirection(OriginResponseDirection::class);
|
||||||
$rocket->setDestination($destination);
|
$rocket->setDestination($destination);
|
||||||
$rocket->setDestinationOrigin(new ServerRequest('POST', 'http://localhost'));
|
$rocket->setDestinationOrigin(new ServerRequest('POST', 'http://localhost'));
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ namespace Yansongda\Pay\Tests\Plugin\Wechat\Pay\Common;
|
|||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Wechat\Pay\Common\DownloadBillPlugin;
|
use Yansongda\Pay\Plugin\Wechat\Pay\Common\DownloadBillPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -34,7 +34,7 @@ class DownloadBillPluginTest extends TestCase
|
|||||||
|
|
||||||
$radar = $result->getRadar();
|
$radar = $result->getRadar();
|
||||||
|
|
||||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
|
||||||
self::assertEquals('GET', $radar->getMethod());
|
self::assertEquals('GET', $radar->getMethod());
|
||||||
self::assertEquals(new Uri('https://yansongda.cn'), $radar->getUri());
|
self::assertEquals(new Uri('https://yansongda.cn'), $radar->getUri());
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ namespace Yansongda\Pay\Tests\Plugin\Wechat\Risk\Complaints;
|
|||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Pay\Plugin\Wechat\Risk\Complaints\CompleteComplaintPlugin;
|
use Yansongda\Pay\Plugin\Wechat\Risk\Complaints\CompleteComplaintPlugin;
|
||||||
use Yansongda\Pay\Provider\Wechat;
|
use Yansongda\Pay\Provider\Wechat;
|
||||||
@ -39,7 +39,7 @@ class CompleteComplaintPluginTest extends TestCase
|
|||||||
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/123/complete'), $radar->getUri());
|
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/123/complete'), $radar->getUri());
|
||||||
self::assertEquals(['complainted_mchid' => '1600314069'], $rocket->getPayload()->toArray());
|
self::assertEquals(['complainted_mchid' => '1600314069'], $rocket->getPayload()->toArray());
|
||||||
self::assertEquals('POST', $radar->getMethod());
|
self::assertEquals('POST', $radar->getMethod());
|
||||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDirectMchId()
|
public function testDirectMchId()
|
||||||
@ -53,7 +53,7 @@ class CompleteComplaintPluginTest extends TestCase
|
|||||||
|
|
||||||
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/456/complete'), $radar->getUri());
|
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/456/complete'), $radar->getUri());
|
||||||
self::assertEquals(['complainted_mchid' => 'bar'], $rocket->getPayload()->toArray());
|
self::assertEquals(['complainted_mchid' => 'bar'], $rocket->getPayload()->toArray());
|
||||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMissingId()
|
public function testMissingId()
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace Yansongda\Pay\Tests\Plugin\Wechat\Risk\Complaints;
|
namespace Yansongda\Pay\Tests\Plugin\Wechat\Risk\Complaints;
|
||||||
|
|
||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Pay\Plugin\Wechat\Risk\Complaints\DeleteCallbackPlugin;
|
use Yansongda\Pay\Plugin\Wechat\Risk\Complaints\DeleteCallbackPlugin;
|
||||||
use Yansongda\Pay\Provider\Wechat;
|
use Yansongda\Pay\Provider\Wechat;
|
||||||
@ -37,6 +37,6 @@ class DeleteCallbackPluginTest extends TestCase
|
|||||||
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaint-notifications'), $radar->getUri());
|
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaint-notifications'), $radar->getUri());
|
||||||
self::assertNull($rocket->getPayload());
|
self::assertNull($rocket->getPayload());
|
||||||
self::assertEquals('DELETE', $radar->getMethod());
|
self::assertEquals('DELETE', $radar->getMethod());
|
||||||
self::assertEquals(OriginResponseParser::class, $rocket->getDirection());
|
self::assertEquals(OriginResponseDirection::class, $rocket->getDirection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ namespace Yansongda\Pay\Tests\Plugin\Wechat\Risk\Complaints;
|
|||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Plugin\Wechat\Risk\Complaints\DownloadMediaPlugin;
|
use Yansongda\Pay\Plugin\Wechat\Risk\Complaints\DownloadMediaPlugin;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
use Yansongda\Pay\Tests\TestCase;
|
use Yansongda\Pay\Tests\TestCase;
|
||||||
@ -34,7 +34,7 @@ class DownloadMediaPluginTest extends TestCase
|
|||||||
|
|
||||||
$radar = $result->getRadar();
|
$radar = $result->getRadar();
|
||||||
|
|
||||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
|
||||||
self::assertEquals('GET', $radar->getMethod());
|
self::assertEquals('GET', $radar->getMethod());
|
||||||
self::assertEquals(new Uri('https://yansongda.cn'), $radar->getUri());
|
self::assertEquals(new Uri('https://yansongda.cn'), $radar->getUri());
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ namespace Yansongda\Pay\Tests\Plugin\Wechat\Risk\Complaints;
|
|||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
use Yansongda\Pay\Direction\OriginResponseDirection;
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Pay\Plugin\Wechat\Risk\Complaints\ResponseComplaintPlugin;
|
use Yansongda\Pay\Plugin\Wechat\Risk\Complaints\ResponseComplaintPlugin;
|
||||||
use Yansongda\Pay\Provider\Wechat;
|
use Yansongda\Pay\Provider\Wechat;
|
||||||
@ -36,7 +36,7 @@ class ResponseComplaintPluginTest extends TestCase
|
|||||||
|
|
||||||
$radar = $result->getRadar();
|
$radar = $result->getRadar();
|
||||||
|
|
||||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
|
||||||
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/123/response'), $radar->getUri());
|
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/123/response'), $radar->getUri());
|
||||||
self::assertEquals('POST', $radar->getMethod());
|
self::assertEquals('POST', $radar->getMethod());
|
||||||
self::assertEquals(['foo' => 'bar', 'complainted_mchid' => '1600314069'], $rocket->getPayload()->toArray());
|
self::assertEquals(['foo' => 'bar', 'complainted_mchid' => '1600314069'], $rocket->getPayload()->toArray());
|
||||||
@ -51,7 +51,7 @@ class ResponseComplaintPluginTest extends TestCase
|
|||||||
|
|
||||||
$radar = $result->getRadar();
|
$radar = $result->getRadar();
|
||||||
|
|
||||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
self::assertEquals(OriginResponseDirection::class, $result->getDirection());
|
||||||
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/456/response'), $radar->getUri());
|
self::assertEquals(new Uri(Wechat::URL[Pay::MODE_NORMAL].'v3/merchant-service/complaints-v2/456/response'), $radar->getUri());
|
||||||
self::assertEquals(['complainted_mchid' => 'bar', 'u' => 'a'], $rocket->getPayload()->toArray());
|
self::assertEquals(['complainted_mchid' => 'bar', 'u' => 'a'], $rocket->getPayload()->toArray());
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ use Yansongda\Pay\Contract\HttpClientInterface;
|
|||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
use Yansongda\Pay\Exception\Exception;
|
use Yansongda\Pay\Exception\Exception;
|
||||||
use Yansongda\Pay\Exception\InvalidConfigException;
|
use Yansongda\Pay\Exception\InvalidConfigException;
|
||||||
use Yansongda\Pay\Parser\ArrayParser;
|
use Yansongda\Pay\Direction\ArrayDirection;
|
||||||
use Yansongda\Pay\Parser\NoHttpRequestParser;
|
use Yansongda\Pay\Direction\NoHttpRequestDirection;
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use Yansongda\Pay\Provider\AbstractProvider;
|
use Yansongda\Pay\Provider\AbstractProvider;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
@ -35,7 +35,7 @@ class AbstractProviderTest extends TestCase
|
|||||||
public function testVerifyCallablePlugin()
|
public function testVerifyCallablePlugin()
|
||||||
{
|
{
|
||||||
$plugin = [function ($rocket, $next) {
|
$plugin = [function ($rocket, $next) {
|
||||||
$rocket->setDirection(NoHttpRequestParser::class)
|
$rocket->setDirection(NoHttpRequestDirection::class)
|
||||||
->setDestination(new Response());
|
->setDestination(new Response());
|
||||||
|
|
||||||
return $next($rocket);
|
return $next($rocket);
|
||||||
@ -171,7 +171,7 @@ class FooPlugin implements PluginInterface
|
|||||||
{
|
{
|
||||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||||
{
|
{
|
||||||
$rocket->setDirection(NoHttpRequestParser::class)
|
$rocket->setDirection(NoHttpRequestDirection::class)
|
||||||
->setDestination(new Response());
|
->setDestination(new Response());
|
||||||
|
|
||||||
return $next($rocket);
|
return $next($rocket);
|
||||||
@ -182,7 +182,7 @@ class BarPlugin implements PluginInterface
|
|||||||
{
|
{
|
||||||
public function assembly(Rocket $rocket, Closure $next): Rocket
|
public function assembly(Rocket $rocket, Closure $next): Rocket
|
||||||
{
|
{
|
||||||
$rocket->setDirection(ArrayParser::class)
|
$rocket->setDirection(ArrayDirection::class)
|
||||||
->setRadar(new Request('get', ''));
|
->setRadar(new Request('get', ''));
|
||||||
|
|
||||||
$rocket = $next($rocket);
|
$rocket = $next($rocket);
|
||||||
|
@ -44,7 +44,7 @@ namespace Yansongda\Pay\Plugin\Alipay\Trade;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Yansongda\Pay\Contract\PluginInterface;
|
use Yansongda\Pay\Contract\PluginInterface;
|
||||||
use Yansongda\Pay\Logger;
|
use Yansongda\Pay\Logger;
|
||||||
use Yansongda\Pay\Parser\ResponseParser;
|
use Yansongda\Pay\Direction\ResponseDirection;
|
||||||
use Yansongda\Pay\Rocket;
|
use Yansongda\Pay\Rocket;
|
||||||
|
|
||||||
class PagePayPlugin implements PluginInterface
|
class PagePayPlugin implements PluginInterface
|
||||||
@ -53,7 +53,7 @@ class PagePayPlugin implements PluginInterface
|
|||||||
{
|
{
|
||||||
Logger::info('[alipay][PagePayPlugin] 插件开始装载', ['rocket' => $rocket]);
|
Logger::info('[alipay][PagePayPlugin] 插件开始装载', ['rocket' => $rocket]);
|
||||||
|
|
||||||
$rocket->setDirection(ResponseParser::class)
|
$rocket->setDirection(ResponseDirection::class)
|
||||||
->mergePayload([
|
->mergePayload([
|
||||||
'method' => 'alipay.trade.page.pay',
|
'method' => 'alipay.trade.page.pay',
|
||||||
'biz_content' => array_merge(
|
'biz_content' => array_merge(
|
||||||
@ -70,7 +70,7 @@ class PagePayPlugin implements PluginInterface
|
|||||||
```
|
```
|
||||||
|
|
||||||
这个 Plugin 的目的就是为了组装一系列支付宝所需要的参数,同时,由于电脑支付是不需要后端 http 调用支付宝接口的,
|
这个 Plugin 的目的就是为了组装一系列支付宝所需要的参数,同时,由于电脑支付是不需要后端 http 调用支付宝接口的,
|
||||||
只需要一个浏览器的响应,所以,我们把 🚀 的 `Direction` 设置成了 `ResponseParser::class`。
|
只需要一个浏览器的响应,所以,我们把 🚀 的 `Direction` 设置成了 `ResponseDirection::class`。
|
||||||
|
|
||||||
- 跳转响应 Plugin
|
- 跳转响应 Plugin
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ Pay 项目中,将所有以 _下划线_ 开始的参数都定义为 `特殊参
|
|||||||
实际的作用为:把控最终请求需要解包的类型
|
实际的作用为:把控最终请求需要解包的类型
|
||||||
|
|
||||||
例如,支付宝电脑支付中,其最终返回的是一个 `Response` 对象,不需要直接后端 http 请求支付宝接口的,
|
例如,支付宝电脑支付中,其最终返回的是一个 `Response` 对象,不需要直接后端 http 请求支付宝接口的,
|
||||||
所以当使用支付宝电脑支付时,其 Direction 为 `Yansongda\Pay\Parser\ResponseParser::class`。
|
所以当使用支付宝电脑支付时,其 Direction 为 `Yansongda\Pay\Parser\ResponseDirection::class`。
|
||||||
|
|
||||||
绝大多数情况下,均默认为:`Yansongda\Pay\Parser\CollectionParser::class`
|
绝大多数情况下,均默认为:`Yansongda\Pay\Parser\CollectionParser::class`
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ Pay 项目中,将所有以 _下划线_ 开始的参数都定义为 `特殊参
|
|||||||
|
|
||||||
Destination 最终返回的是 Collection 对象
|
Destination 最终返回的是 Collection 对象
|
||||||
|
|
||||||
- 当 Direction 为 ResponseParser 时
|
- 当 Direction 为 ResponseDirection 时
|
||||||
|
|
||||||
Destination 最终返回的是 Response 对象
|
Destination 最终返回的是 Response 对象
|
||||||
|
|
||||||
@ -75,11 +75,11 @@ Pay 项目中,将所有以 _下划线_ 开始的参数都定义为 `特殊参
|
|||||||
|
|
||||||
Destination 最终返回的是 string
|
Destination 最终返回的是 string
|
||||||
|
|
||||||
- 当 Direction 为 NoHttpRequestParser 时
|
- 当 Direction 为 NoHttpRequestDirection 时
|
||||||
|
|
||||||
Destination 最终返回的是 原样的 Radar
|
Destination 最终返回的是 原样的 Radar
|
||||||
|
|
||||||
- 当 Direction 为 OriginResponseParser 时
|
- 当 Direction 为 OriginResponseDirection 时
|
||||||
|
|
||||||
Destination 最终返回的是 Rocket 中的 DestinationOrigin
|
Destination 最终返回的是 Rocket 中的 DestinationOrigin
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ API 调用场景下的返回类型,`array` 和 `Collection` 是可以自定义
|
|||||||
|
|
||||||
```php
|
```php
|
||||||
use Yansongda\Pay\Contract\ParserInterface;
|
use Yansongda\Pay\Contract\ParserInterface;
|
||||||
use Yansongda\Pay\Parser\ArrayParser;
|
use Yansongda\Pay\Direction\ArrayDirection;
|
||||||
|
|
||||||
Pay::set(ParserInterface::class, ArrayParser::class);
|
Pay::set(ParserInterface::class, ArrayDirection::class);
|
||||||
```
|
```
|
||||||
|
|
||||||
是不是很简单方便?
|
是不是很简单方便?
|
||||||
|
Loading…
Reference in New Issue
Block a user