mirror of
https://gitee.com/yansongda/pay.git
synced 2024-12-02 04:08:21 +08:00
fixed: 下载对账单时响应解析
This commit is contained in:
parent
7916fdd74b
commit
df27f9538d
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,3 +1,15 @@
|
||||
## v3.0.15
|
||||
|
||||
### fixed
|
||||
|
||||
- fixed: 下载对账单时响应解析 (#511)
|
||||
|
||||
## v3.0.14
|
||||
|
||||
### fixed
|
||||
|
||||
- fixed: app 支付调起签名中参数大小写问题 (#7916fdd)
|
||||
|
||||
## v3.0.13
|
||||
|
||||
### fixed
|
||||
|
@ -6,6 +6,7 @@ namespace Yansongda\Pay\Plugin\Wechat\Fund\Transfer;
|
||||
|
||||
use Yansongda\Pay\Exception\Exception;
|
||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
@ -32,6 +33,8 @@ class DownloadReceiptPlugin extends GeneralPlugin
|
||||
|
||||
protected function doSomething(Rocket $rocket): void
|
||||
{
|
||||
$rocket->setDirection(OriginResponseParser::class);
|
||||
|
||||
$rocket->setPayload(null);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\Common;
|
||||
|
||||
use Yansongda\Pay\Exception\Exception;
|
||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
||||
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
|
||||
@ -32,6 +33,8 @@ class DownloadBillPlugin extends GeneralPlugin
|
||||
|
||||
protected function doSomething(Rocket $rocket): void
|
||||
{
|
||||
$rocket->setDirection(OriginResponseParser::class);
|
||||
|
||||
$rocket->setPayload(null);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ namespace Yansongda\Pay\Tests\Plugin\Wechat\Fund\Transfer;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use Yansongda\Pay\Exception\Exception;
|
||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
||||
use Yansongda\Pay\Plugin\Wechat\Fund\Transfer\DownloadReceiptPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Pay\Tests\TestCase;
|
||||
@ -23,6 +24,7 @@ class DownloadReceiptPluginTest extends TestCase
|
||||
|
||||
$radar = $result->getRadar();
|
||||
|
||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
||||
self::assertEquals('GET', $radar->getMethod());
|
||||
self::assertEquals(new Uri('https://yansongda.cn'), $radar->getUri());
|
||||
}
|
||||
|
44
tests/Plugin/Wechat/Pay/Common/DownloadBillPluginTest.php
Normal file
44
tests/Plugin/Wechat/Pay/Common/DownloadBillPluginTest.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Tests\Plugin\Wechat\Pay\Common;
|
||||
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use Yansongda\Pay\Exception\Exception;
|
||||
use Yansongda\Pay\Exception\InvalidParamsException;
|
||||
use Yansongda\Pay\Parser\OriginResponseParser;
|
||||
use Yansongda\Pay\Plugin\Wechat\Pay\Common\DownloadBillPlugin;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Pay\Tests\TestCase;
|
||||
use Yansongda\Supports\Collection;
|
||||
|
||||
class DownloadBillPluginTest extends TestCase
|
||||
{
|
||||
public function testNormal()
|
||||
{
|
||||
$rocket = new Rocket();
|
||||
$rocket->setParams([])->setPayload(new Collection(['download_url' => 'https://yansongda.cn']));
|
||||
|
||||
$plugin = new DownloadBillPlugin();
|
||||
|
||||
$result = $plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||
|
||||
$radar = $result->getRadar();
|
||||
|
||||
self::assertEquals(OriginResponseParser::class, $result->getDirection());
|
||||
self::assertEquals('GET', $radar->getMethod());
|
||||
self::assertEquals(new Uri('https://yansongda.cn'), $radar->getUri());
|
||||
}
|
||||
|
||||
public function testNormalNoDownloadUrl()
|
||||
{
|
||||
$rocket = new Rocket();
|
||||
$rocket->setParams([])->setPayload(new Collection());
|
||||
|
||||
$plugin = new DownloadBillPlugin();
|
||||
|
||||
self::expectException(InvalidParamsException::class);
|
||||
self::expectExceptionCode(Exception::MISSING_NECESSARY_PARAMS);
|
||||
|
||||
$plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user