Skip to content

Commit

Permalink
feat: 增加支付宝 分账关系维护/分账查询 插件 (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
yansongda authored Nov 28, 2023
1 parent 0ca35cf commit 6db9983
Show file tree
Hide file tree
Showing 15 changed files with 219 additions and 6 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## v3.5.3-TBD
## v3.5.3

### feat

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

### optimized

Expand Down
18 changes: 18 additions & 0 deletions src/Plugin/Alipay/Trade/OrderSettleQueryPlugin.php
Original file line number Diff line number Diff line change
@@ -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';
}
}
18 changes: 18 additions & 0 deletions src/Plugin/Alipay/Trade/RoyaltyRelationBatchQueryPlugin.php
Original file line number Diff line number Diff line change
@@ -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';
}
}
18 changes: 18 additions & 0 deletions src/Plugin/Alipay/Trade/RoyaltyRelationBindPlugin.php
Original file line number Diff line number Diff line change
@@ -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';
}
}
18 changes: 18 additions & 0 deletions src/Plugin/Alipay/Trade/RoyaltyRelationUnbindPlugin.php
Original file line number Diff line number Diff line change
@@ -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';
}
}
2 changes: 1 addition & 1 deletion tests/Plugin/Alipay/Trade/AppPayPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class AppPayPluginTest extends TestCase
{
protected $plugin;
protected AppPayPlugin $plugin;

protected function setUp(): void
{
Expand Down
31 changes: 31 additions & 0 deletions tests/Plugin/Alipay/Trade/OrderSettleQueryPluginTest.php
Original file line number Diff line number Diff line change
@@ -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());
}
}
2 changes: 1 addition & 1 deletion tests/Plugin/Alipay/Trade/PagePayPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class PagePayPluginTest extends TestCase
{
protected $plugin;
protected PagePayPlugin $plugin;

protected function setUp(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Plugin/Alipay/Trade/PageRefundPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class PageRefundPluginTest extends TestCase
{
protected $plugin;
protected PageRefundPlugin $plugin;

protected function setUp(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Plugin/Alipay/Trade/PayPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class PayPluginTest extends TestCase
{
protected $plugin;
protected PayPlugin $plugin;

protected function setUp(): void
{
Expand Down
29 changes: 29 additions & 0 deletions tests/Plugin/Alipay/Trade/RoyaltyRelationBatchQueryPluginTest.php
Original file line number Diff line number Diff line change
@@ -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());
}
}
29 changes: 29 additions & 0 deletions tests/Plugin/Alipay/Trade/RoyaltyRelationBindPluginTest.php
Original file line number Diff line number Diff line change
@@ -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());
}
}
30 changes: 30 additions & 0 deletions tests/Plugin/Alipay/Trade/RoyaltyRelationUnbindPluginTest.php
Original file line number Diff line number Diff line change
@@ -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());
}
}
2 changes: 1 addition & 1 deletion tests/Plugin/Alipay/Trade/WapPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class WapPluginTest extends TestCase
{
protected $plugin;
protected WapPayPlugin $plugin;

protected function setUp(): void
{
Expand Down
18 changes: 18 additions & 0 deletions web/docs/v3/alipay/more.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

0 comments on commit 6db9983

Please sign in to comment.