订阅详情补充已付无回执治理入口
This commit is contained in:
@@ -150,6 +150,7 @@
|
||||
<div class="mt-6 actions gap-10">
|
||||
{{-- 去重降噪:下方摘要卡/表格头部已提供“全部订单/可同步”等跳转入口,这里仅保留治理相关入口与下单入口 --}}
|
||||
<a class="btn btn-secondary btn-sm" href="{!! $makePlatformOrderUrl(['merchant_id' => $subscription->merchant_id, 'plan_id' => $subscription->plan_id, 'renewal_missing_subscription' => '1']) !!}">查看续费缺订阅订单(同站点/同套餐)</a>
|
||||
<a class="btn btn-secondary btn-sm" href="{!! $makePlatformOrderUrl(['merchant_id' => $subscription->merchant_id, 'plan_id' => $subscription->plan_id, 'payment_status' => 'paid', 'receipt_status' => 'none']) !!}">查看已付无回执订单(同站点/同套餐)</a>
|
||||
@php
|
||||
$createRenewalOrderUrl = '/admin/platform-orders/create?' . \Illuminate\Support\Arr::query([
|
||||
'merchant_id' => $subscription->merchant_id,
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Merchant;
|
||||
use App\Models\Plan;
|
||||
use App\Models\SiteSubscription;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminSiteSubscriptionShowPaidNoReceiptGovernanceLinkTest 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_show_should_render_paid_no_receipt_governance_link(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'sub_show_paid_no_receipt_link_plan',
|
||||
'name' => '订阅详情已付无回执治理入口测试套餐',
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => 199,
|
||||
'list_price' => 199,
|
||||
'status' => 'active',
|
||||
'sort' => 10,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
$subscription = SiteSubscription::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'status' => 'active',
|
||||
'source' => 'manual',
|
||||
'subscription_no' => 'SS_SHOW_PNR_LINK_0001',
|
||||
'plan_name' => $plan->name,
|
||||
'billing_cycle' => $plan->billing_cycle,
|
||||
'period_months' => 1,
|
||||
'amount' => 199,
|
||||
'starts_at' => now()->subDay(),
|
||||
'ends_at' => now()->addMonth(),
|
||||
]);
|
||||
|
||||
$res = $this->get('/admin/site-subscriptions/' . $subscription->id);
|
||||
$res->assertOk();
|
||||
|
||||
$html = (string) $res->getContent();
|
||||
$this->assertStringContainsString('查看已付无回执订单(同站点/同套餐)', $html);
|
||||
|
||||
$matched = preg_match('/<a[^>]+href="([^"]+)"[^>]*>\s*查看已付无回执订单(同站点\/同套餐)\s*<\/a>/u', $html, $m);
|
||||
$this->assertSame(1, $matched, '未找到订阅详情页“查看已付无回执订单(同站点/同套餐)”入口');
|
||||
|
||||
$url = html_entity_decode($m[1] ?? '');
|
||||
$parts = parse_url($url);
|
||||
parse_str($parts['query'] ?? '', $q);
|
||||
|
||||
$this->assertSame((string) $merchant->id, (string) ($q['merchant_id'] ?? ''));
|
||||
$this->assertSame((string) $plan->id, (string) ($q['plan_id'] ?? ''));
|
||||
$this->assertSame('paid', (string) ($q['payment_status'] ?? ''));
|
||||
$this->assertSame('none', (string) ($q['receipt_status'] ?? ''));
|
||||
$this->assertSame('/admin/site-subscriptions/' . $subscription->id, (string) ($q['back'] ?? ''));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user