From 45ac72eb2159ab4a2082ba12f626f1b0b62a7f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sat, 14 Mar 2026 00:11:27 +0000 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=AE=A2=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=EF=BC=9ABMPA=E7=A6=81=E7=94=A8=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B0=B1=E5=9C=B0=E5=BC=95=E5=AF=BC=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=EF=BC=88=E8=A1=A5=E5=9B=9E=E6=89=A7/=E6=A0=B8?= =?UTF-8?q?=E5=AF=B9=E9=80=80=E6=AC=BE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_orders/show.blade.php | 12 +- ...owMarkPaidAndActivateGuidanceLinksTest.php | 135 ++++++++++++++++++ 2 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 tests/Feature/AdminPlatformOrderShowMarkPaidAndActivateGuidanceLinksTest.php diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index a1f8cbf..e01d72b 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -185,9 +185,17 @@ @if($markPaidBlockedByRefund) -
提示:当前订单已存在退款记录/退款汇总,建议先核对退款轨迹与状态后再进行「标记支付并生效」。
+
+ 提示:当前订单已存在退款记录/退款汇总,建议先核对退款轨迹与状态后再进行「标记支付并生效」。 + + 去核对退款 +
@elseif($markPaidBlockedByReceiptMismatch) -
提示:当前订单已存在支付回执,但回执总额与订单金额不一致,建议先补齐/修正回执后再进行「标记支付并生效」。
+
+ 提示:当前订单已存在支付回执,但回执总额与订单金额不一致,建议先补齐/修正回执后再进行「标记支付并生效」。 + + 去补回执 +
@endif
diff --git a/tests/Feature/AdminPlatformOrderShowMarkPaidAndActivateGuidanceLinksTest.php b/tests/Feature/AdminPlatformOrderShowMarkPaidAndActivateGuidanceLinksTest.php new file mode 100644 index 0000000..a24f61e --- /dev/null +++ b/tests/Feature/AdminPlatformOrderShowMarkPaidAndActivateGuidanceLinksTest.php @@ -0,0 +1,135 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_when_bmpa_blocked_by_refund_should_show_refund_guidance_link(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'po_show_bmpa_guidance_refund_plan', + 'name' => 'BMPA引导-退款场景测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_SHOW_BMPA_GUIDANCE_REFUND_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'unpaid', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 10, + 'paid_amount' => 0, + 'placed_at' => now(), + 'meta' => [ + 'refund_receipts' => [ + [ + 'type' => 'refund', + 'channel' => 'offline', + 'amount' => 1, + 'refunded_at' => now()->toDateTimeString(), + 'note' => 'test-refund', + 'created_at' => now()->toDateTimeString(), + 'admin_id' => 1, + ], + ], + ], + ]); + + $res = $this->get('/admin/platform-orders/' . $order->id); + $res->assertOk(); + + $res->assertSee('去核对退款', false); + $res->assertSee('href="#refund-receipts"', false); + } + + public function test_when_bmpa_blocked_by_receipt_mismatch_should_show_receipt_guidance_link(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'po_show_bmpa_guidance_receipt_plan', + 'name' => 'BMPA引导-回执差额场景测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_SHOW_BMPA_GUIDANCE_RCPT_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'unpaid', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 10, + 'paid_amount' => 0, + 'placed_at' => now(), + 'meta' => [ + 'payment_receipts' => [ + [ + 'type' => 'bank_transfer', + 'channel' => 'offline', + 'amount' => 9, + 'paid_at' => now()->toDateTimeString(), + 'note' => 'test-pay', + 'created_at' => now()->toDateTimeString(), + 'admin_id' => 1, + ], + ], + 'payment_summary' => [ + 'count' => 1, + 'total_amount' => 9, + 'last_at' => now()->toDateTimeString(), + 'last_amount' => 9, + 'last_channel' => 'offline', + ], + ], + ]); + + $res = $this->get('/admin/platform-orders/' . $order->id); + $res->assertOk(); + + $res->assertSee('去补回执', false); + $res->assertSee('href="#add-payment-receipt"', false); + } +}