diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ae06fb82..dc294030c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/Shortcut/Wechat/QueryShortcut.php b/src/Shortcut/Wechat/QueryShortcut.php index ba0e2456f..954b0187b 100644 --- a/src/Shortcut/Wechat/QueryShortcut.php +++ b/src/Shortcut/Wechat/QueryShortcut.php @@ -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; @@ -147,7 +147,7 @@ protected function refundAppPlugins(): array { return [ StartPlugin::class, - AppRefundPlugin::class, + AppQueryRefundPlugin::class, AddPayloadBodyPlugin::class, AddPayloadSignaturePlugin::class, AddRadarPlugin::class, @@ -161,7 +161,7 @@ protected function refundCombinePlugins(): array { return [ StartPlugin::class, - CombineRefundPlugin::class, + CombineQueryRefundPlugin::class, AddPayloadBodyPlugin::class, AddPayloadSignaturePlugin::class, AddRadarPlugin::class, @@ -175,7 +175,7 @@ protected function refundH5Plugins(): array { return [ StartPlugin::class, - H5RefundPlugin::class, + H5QueryRefundPlugin::class, AddPayloadBodyPlugin::class, AddPayloadSignaturePlugin::class, AddRadarPlugin::class, @@ -189,7 +189,7 @@ protected function refundJsapiPlugins(): array { return [ StartPlugin::class, - JsapiRefundPlugin::class, + JsapiQueryRefundPlugin::class, AddPayloadBodyPlugin::class, AddPayloadSignaturePlugin::class, AddRadarPlugin::class, @@ -203,7 +203,7 @@ protected function refundMiniPlugins(): array { return [ StartPlugin::class, - MiniRefundPlugin::class, + MiniQueryRefundPlugin::class, AddPayloadBodyPlugin::class, AddPayloadSignaturePlugin::class, AddRadarPlugin::class, @@ -217,7 +217,7 @@ protected function refundNativePlugins(): array { return [ StartPlugin::class, - NativeRefundPlugin::class, + NativeQueryRefundPlugin::class, AddPayloadBodyPlugin::class, AddPayloadSignaturePlugin::class, AddRadarPlugin::class, diff --git a/tests/Shortcut/Wechat/QueryShortcutTest.php b/tests/Shortcut/Wechat/QueryShortcutTest.php index c6f3469d0..6c1d1b706 100644 --- a/tests/Shortcut/Wechat/QueryShortcutTest.php +++ b/tests/Shortcut/Wechat/QueryShortcutTest.php @@ -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; @@ -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() @@ -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([ @@ -109,4 +183,4 @@ public function testFoo() $this->plugin->getPlugins(['_action' => 'foo']); } -} +} \ No newline at end of file