Governance: block batch BMPA when renewal missing subscription filter present
This commit is contained in:
@@ -1641,6 +1641,11 @@ class PlatformOrderController extends Controller
|
||||
'refund_inconsistent' => (string) $request->input('refund_inconsistent', ''),
|
||||
];
|
||||
|
||||
// 防误操作(治理优先):续费单未绑定订阅属于高风险治理集合,不允许执行 BMPA(会产生大量失败标记,掩盖问题)。
|
||||
if ($scope === 'filtered' && ((string) ($filters['renewal_missing_subscription'] ?? '') === '1')) {
|
||||
return redirect()->back()->with('warning', '当前筛选为「续费单未绑定订阅」治理集合。为避免带病推进,请先完成订阅绑定/修复关联后再执行 BMPA。');
|
||||
}
|
||||
|
||||
// 防误操作:批量“标记支付并生效”默认要求当前筛选口径为「待处理(pending) + 未支付(unpaid)」
|
||||
if ($scope === 'filtered') {
|
||||
if (($filters['status'] ?? '') !== 'pending' || ($filters['payment_status'] ?? '') !== 'unpaid') {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderBatchMarkPaidAndActivateShouldBlockWhenRenewalMissingSubscriptionTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function loginAsPlatformAdmin(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
$this->post('/admin/login', [
|
||||
'email' => 'platform.admin@demo.local',
|
||||
'password' => 'Platform@123456',
|
||||
])->assertRedirect('/admin');
|
||||
}
|
||||
|
||||
public function test_batch_mark_paid_and_activate_should_block_when_renewal_missing_subscription_filter_present(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->post('/admin/platform-orders/batch-mark-paid-and-activate', [
|
||||
'scope' => 'filtered',
|
||||
'renewal_missing_subscription' => '1',
|
||||
// 即便其它条件满足 BMPA 口径,也应被治理集合优先阻断
|
||||
'status' => 'pending',
|
||||
'payment_status' => 'unpaid',
|
||||
'limit' => 50,
|
||||
]);
|
||||
|
||||
$res->assertRedirect();
|
||||
$res->assertSessionHas('warning');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user