feat: 增加支付宝 分账关系维护/分账查询 插件 (#874)

This commit is contained in:
yansongda 2023-11-28 20:52:54 +08:00 committed by GitHub
parent 0ca35cfb97
commit 6db99832ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 219 additions and 6 deletions

View File

@ -1,4 +1,8 @@
## v3.5.3-TBD
## v3.5.3
### feat
- feat: 增加支付宝 分账关系维护/分账查询 插件(#874)
### optimized

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02pj6l?ref=api
*/
class OrderSettleQueryPlugin extends GeneralPlugin
{
protected function getMethod(): string
{
return 'alipay.trade.order.settle.query';
}
}

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02c7hs?ref=api
*/
class RoyaltyRelationBatchQueryPlugin extends GeneralPlugin
{
protected function getMethod(): string
{
return 'alipay.trade.royalty.relation.batchquery';
}
}

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02c7hq?ref=api
*/
class RoyaltyRelationBindPlugin extends GeneralPlugin
{
public function getMethod(): string
{
return 'alipay.trade.royalty.relation.bind';
}
}

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\GeneralPlugin;
/**
* @see https://opendocs.alipay.com/open/02c7hr?ref=api
*/
class RoyaltyRelationUnbindPlugin extends GeneralPlugin
{
public function getMethod(): string
{
return 'alipay.trade.royalty.relation.unbind';
}
}

View File

@ -9,7 +9,7 @@ use Yansongda\Pay\Tests\TestCase;
class AppPayPluginTest extends TestCase
{
protected $plugin;
protected AppPayPlugin $plugin;
protected function setUp(): void
{

View File

@ -0,0 +1,31 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
use Yansongda\Pay\Direction\ResponseDirection;
use Yansongda\Pay\Plugin\Alipay\Trade\AppPayPlugin;
use Yansongda\Pay\Plugin\Alipay\Trade\OrderSettleQueryPlugin;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Tests\TestCase;
class OrderSettleQueryPluginTest extends TestCase
{
protected OrderSettleQueryPlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new OrderSettleQueryPlugin();
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setParams([]);
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertStringContainsString('alipay.trade.order.settle.query', $result->getPayload()->toJson());
}
}

View File

@ -9,7 +9,7 @@ use Yansongda\Pay\Tests\TestCase;
class PagePayPluginTest extends TestCase
{
protected $plugin;
protected PagePayPlugin $plugin;
protected function setUp(): void
{

View File

@ -9,7 +9,7 @@ use Yansongda\Pay\Tests\TestCase;
class PageRefundPluginTest extends TestCase
{
protected $plugin;
protected PageRefundPlugin $plugin;
protected function setUp(): void
{

View File

@ -9,7 +9,7 @@ use Yansongda\Pay\Tests\TestCase;
class PayPluginTest extends TestCase
{
protected $plugin;
protected PayPlugin $plugin;
protected function setUp(): void
{

View File

@ -0,0 +1,29 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\Trade\RoyaltyRelationBatchQueryPlugin;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Tests\TestCase;
class RoyaltyRelationBatchQueryPluginTest extends TestCase
{
protected RoyaltyRelationBatchQueryPlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new RoyaltyRelationBatchQueryPlugin();
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setParams([]);
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertStringContainsString('alipay.trade.royalty.relation.batchquery', $result->getPayload()->toJson());
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\Trade\RoyaltyRelationBindPlugin;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Tests\TestCase;
class RoyaltyRelationBindPluginTest extends TestCase
{
protected RoyaltyRelationBindPlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new RoyaltyRelationBindPlugin();
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setParams([]);
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertStringContainsString('alipay.trade.royalty.relation.bind', $result->getPayload()->toJson());
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Yansongda\Pay\Tests\Plugin\Alipay\Trade;
use Yansongda\Pay\Plugin\Alipay\Trade\RoyaltyRelationBatchQueryPlugin;
use Yansongda\Pay\Plugin\Alipay\Trade\RoyaltyRelationUnbindPlugin;
use Yansongda\Pay\Rocket;
use Yansongda\Pay\Tests\TestCase;
class RoyaltyRelationUnbindPluginTest extends TestCase
{
protected RoyaltyRelationUnbindPlugin $plugin;
protected function setUp(): void
{
parent::setUp();
$this->plugin = new RoyaltyRelationUnbindPlugin();
}
public function testNormal()
{
$rocket = new Rocket();
$rocket->setParams([]);
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertStringContainsString('alipay.trade.royalty.relation.unbind', $result->getPayload()->toJson());
}
}

View File

@ -9,7 +9,7 @@ use Yansongda\Pay\Tests\TestCase;
class WapPluginTest extends TestCase
{
protected $plugin;
protected WapPayPlugin $plugin;
protected function setUp(): void
{

View File

@ -135,3 +135,21 @@ $result = Pay::alipay()->pay($allPlugins, $params);
### 协议由普通通用代扣协议产品转移到周期扣协议产品
- `Yansongda\Pay\Plugin\Alipay\User\AgreementTransferPlugin`
## 交易
### 交易分账查询接口
- `Yansongda\Pay\Plugin\Alipay\Trade\OrderSettleQueryPlugin`
### 分账关系查询
- `Yansongda\Pay\Plugin\Alipay\Trade\RoyaltyRelationBatchQueryPlugin`
### 分账关系绑定
- `Yansongda\Pay\Plugin\Alipay\Trade\RoyaltyRelationBindPlugin`
### 分账关系解绑
- `Yansongda\Pay\Plugin\Alipay\Trade\RoyaltyRelationUnbindPlugin`