feat(platform_orders): add enter-failed-set links in reason top5 cards
This commit is contained in:
@@ -438,6 +438,8 @@
|
||||
<span class="muted">({{ $count }})</span>
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! $safeFullUrlWithQuery(['sync_error_keyword' => $reason, 'sync_status' => null, 'syncable_only' => '1', 'page' => null]) !!}">切到可同步重试</a>
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! $safeFullUrlWithQuery(['sync_error_keyword' => $reason, 'sync_status' => 'failed', 'page' => null]) !!}">进入失败集合</a>
|
||||
@endif
|
||||
@else
|
||||
<span class="muted">(空原因)</span>
|
||||
@@ -480,6 +482,8 @@
|
||||
<span class="muted">({{ $count }})</span>
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! $safeFullUrlWithQuery(['bmpa_error_keyword' => $reason, 'status' => 'pending', 'payment_status' => 'unpaid', 'page' => null]) !!}">切到可处理集合重试</a>
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! $safeFullUrlWithQuery(['bmpa_failed_only' => '1', 'bmpa_error_keyword' => $reason, 'page' => null]) !!}">进入失败集合</a>
|
||||
@endif
|
||||
@else
|
||||
<span class="muted">(空原因)</span>
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Merchant;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlatformOrder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Arr;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderFailedReasonStatsHaveEnterFailedSetLinksTest 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_failed_reason_stats_should_render_enter_failed_set_links(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'po_failed_reason_enter_failed_set',
|
||||
'name' => '失败原因统计进入失败集合链接测试套餐',
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => 10,
|
||||
'list_price' => 10,
|
||||
'status' => 'active',
|
||||
'sort' => 10,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
$syncReason = '订单未生效';
|
||||
$bmpaReason = '回执缺失';
|
||||
|
||||
PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'order_no' => 'PO_FAILED_REASON_SYNC_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' => [
|
||||
'subscription_activation_error' => [
|
||||
'message' => $syncReason,
|
||||
'at' => now()->format('Y-m-d H:i:s'),
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'order_no' => 'PO_FAILED_REASON_BMPA_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' => [
|
||||
'batch_mark_paid_and_activate_error' => [
|
||||
'message' => $bmpaReason,
|
||||
'at' => now()->format('Y-m-d H:i:s'),
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$res = $this->get('/admin/platform-orders');
|
||||
$res->assertOk();
|
||||
|
||||
$expectedSyncEnterFailedUrl = '/admin/platform-orders?' . Arr::query([
|
||||
'sync_error_keyword' => $syncReason,
|
||||
'sync_status' => 'failed',
|
||||
]);
|
||||
|
||||
$expectedBmpaEnterFailedUrl = '/admin/platform-orders?' . Arr::query([
|
||||
'bmpa_failed_only' => '1',
|
||||
'bmpa_error_keyword' => $bmpaReason,
|
||||
]);
|
||||
|
||||
$res->assertSee('进入失败集合', false);
|
||||
$res->assertSee($expectedSyncEnterFailedUrl, false);
|
||||
$res->assertSee($expectedBmpaEnterFailedUrl, false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user