Skip to content

Commit

Permalink
fix: 微信查询插件退款查询问题 (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
yansongda authored Jan 21, 2024
1 parent 439d1b1 commit 39227bf
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- change: 手机网站支付快捷方式由 wap 改为 h5(#911, #915, #916)
- change: `Pay` 类对外方法由所改变,如果您有自行扩展相关插件,请检查(#926)
- change(internal): 按场景对 支付宝/微信/银联 插件进行分类 && 插件代码优化(#894, #909, #913, #922)
- change(internal): 将 支付/微信/银联 shortcut 从 plugin 文件夹独立出来(#895, #904, #905)
- change(internal): 将 支付/微信/银联 shortcut 从 plugin 文件夹独立出来(#895, #904, #905, #933)
- change(internal): shortcut 完整标明各个插件,不使用 commonPlugin(#886)
- change(internal): DirectionInterface 方法由 `parse` 改为 `guide`(#896)
- change(internal): 错误代码 const 命名规则统一(#902, #903, #906, #909, #926)
Expand Down
24 changes: 12 additions & 12 deletions src/Shortcut/Wechat/QueryShortcut.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
use Yansongda\Pay\Plugin\Wechat\V3\AddPayloadSignaturePlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Transfer\QueryDetailPlugin as TransferQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\App\QueryPlugin as AppQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\App\RefundPlugin as AppRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\App\QueryRefundPlugin as AppQueryRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Combine\QueryPlugin as CombineQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Combine\RefundPlugin as CombineRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Combine\QueryRefundPlugin as CombineQueryRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\H5\QueryPlugin as H5QueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\H5\RefundPlugin as H5RefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\H5\QueryRefundPlugin as H5QueryRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi\QueryPlugin as JsapiQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi\RefundPlugin as JsapiRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi\QueryRefundPlugin as JsapiQueryRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini\QueryPlugin as MiniQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini\RefundPlugin as MiniRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini\QueryRefundPlugin as MiniQueryRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Native\QueryPlugin as NativeQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Native\RefundPlugin as NativeRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Native\QueryRefundPlugin as NativeQueryRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\VerifySignaturePlugin;
use Yansongda\Supports\Str;

Expand Down Expand Up @@ -147,7 +147,7 @@ protected function refundAppPlugins(): array
{
return [
StartPlugin::class,
AppRefundPlugin::class,
AppQueryRefundPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
Expand All @@ -161,7 +161,7 @@ protected function refundCombinePlugins(): array
{
return [
StartPlugin::class,
CombineRefundPlugin::class,
CombineQueryRefundPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
Expand All @@ -175,7 +175,7 @@ protected function refundH5Plugins(): array
{
return [
StartPlugin::class,
H5RefundPlugin::class,
H5QueryRefundPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
Expand All @@ -189,7 +189,7 @@ protected function refundJsapiPlugins(): array
{
return [
StartPlugin::class,
JsapiRefundPlugin::class,
JsapiQueryRefundPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
Expand All @@ -203,7 +203,7 @@ protected function refundMiniPlugins(): array
{
return [
StartPlugin::class,
MiniRefundPlugin::class,
MiniQueryRefundPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
Expand All @@ -217,7 +217,7 @@ protected function refundNativePlugins(): array
{
return [
StartPlugin::class,
NativeRefundPlugin::class,
NativeQueryRefundPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
Expand Down
84 changes: 79 additions & 5 deletions tests/Shortcut/Wechat/QueryShortcutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
use Yansongda\Pay\Plugin\Wechat\StartPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\AddPayloadSignaturePlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Marketing\Transfer\QueryDetailPlugin as TransferQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\App\QueryPlugin as AppQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Combine\QueryPlugin as CombineQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\H5\QueryPlugin as H5QueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi\QueryPlugin as JsapiQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi\RefundPlugin as JsapiRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Jsapi\QueryRefundPlugin as JsapiQueryRefundPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini\QueryPlugin as MiniQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\Pay\Native\QueryPlugin as NativeQueryPlugin;
use Yansongda\Pay\Plugin\Wechat\V3\VerifySignaturePlugin;
use Yansongda\Pay\Shortcut\Wechat\QueryShortcut;
use Yansongda\Pay\Tests\TestCase;
Expand Down Expand Up @@ -45,18 +49,18 @@ public function testDefault()
], $this->plugin->getPlugins([]));
}

public function testRefund()
public function testApp()
{
self::assertEquals([
StartPlugin::class,
JsapiRefundPlugin::class,
AppQueryPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
ResponsePlugin::class,
VerifySignaturePlugin::class,
ParserPlugin::class,
], $this->plugin->getPlugins(['_action' => 'refund']));
], $this->plugin->getPlugins(['_action' => 'app']));
}

public function testCombine()
Expand Down Expand Up @@ -87,6 +91,76 @@ public function testCombineParams()
], $this->plugin->getPlugins(['combine_out_trade_no' => '123abc']));
}

public function testH5()
{
self::assertEquals([
StartPlugin::class,
H5QueryPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
ResponsePlugin::class,
VerifySignaturePlugin::class,
ParserPlugin::class,
], $this->plugin->getPlugins(['_action' => 'h5']));
}

public function testJsapi()
{
self::assertEquals([
StartPlugin::class,
JsapiQueryPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
ResponsePlugin::class,
VerifySignaturePlugin::class,
ParserPlugin::class,
], $this->plugin->getPlugins(['_action' => 'jsapi']));
}

public function testMini()
{
self::assertEquals([
StartPlugin::class,
MiniQueryPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
ResponsePlugin::class,
VerifySignaturePlugin::class,
ParserPlugin::class,
], $this->plugin->getPlugins(['_action' => 'mini']));
}

public function testNative()
{
self::assertEquals([
StartPlugin::class,
NativeQueryPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
ResponsePlugin::class,
VerifySignaturePlugin::class,
ParserPlugin::class,
], $this->plugin->getPlugins(['_action' => 'native']));
}

public function testRefund()
{
self::assertEquals([
StartPlugin::class,
JsapiQueryRefundPlugin::class,
AddPayloadBodyPlugin::class,
AddPayloadSignaturePlugin::class,
AddRadarPlugin::class,
ResponsePlugin::class,
VerifySignaturePlugin::class,
ParserPlugin::class,
], $this->plugin->getPlugins(['_action' => 'refund']));
}

public function testTransfer()
{
self::assertEquals([
Expand All @@ -109,4 +183,4 @@ public function testFoo()

$this->plugin->getPlugins(['_action' => 'foo']);
}
}
}

0 comments on commit 39227bf

Please sign in to comment.