Add unit test for reconcile mismatch when no receipt evidence
This commit is contained in:
@@ -55,6 +55,46 @@ class PlatformOrderReconcileMismatchTest extends TestCase
|
|||||||
$this->assertTrue($order->isReconcileMismatch());
|
$this->assertTrue($order->isReconcileMismatch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_is_reconcile_mismatch_returns_false_when_no_receipt_evidence(): void
|
||||||
|
{
|
||||||
|
$merchant = Merchant::query()->create([
|
||||||
|
'name' => '单测站点_reconcile_none',
|
||||||
|
'slug' => 'unit-test-merchant-reconcile-none',
|
||||||
|
'status' => 'active',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$plan = Plan::query()->create([
|
||||||
|
'code' => 'unit_test_plan_reconcile_none',
|
||||||
|
'name' => '单测套餐_reconcile_none',
|
||||||
|
'billing_cycle' => 'monthly',
|
||||||
|
'price' => 10,
|
||||||
|
'list_price' => 10,
|
||||||
|
'status' => 'active',
|
||||||
|
'sort' => 10,
|
||||||
|
'published_at' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 无 payment_summary/payment_receipts:不应判定为对账不一致
|
||||||
|
$order = PlatformOrder::query()->create([
|
||||||
|
'merchant_id' => $merchant->id,
|
||||||
|
'plan_id' => $plan->id,
|
||||||
|
'order_no' => 'PO_UNIT_RECONCILE_NONE_0001',
|
||||||
|
'order_type' => 'subscription',
|
||||||
|
'status' => 'activated',
|
||||||
|
'payment_status' => 'paid',
|
||||||
|
'plan_name' => 'Unit Test Plan',
|
||||||
|
'billing_cycle' => 'monthly',
|
||||||
|
'period_months' => 1,
|
||||||
|
'quantity' => 1,
|
||||||
|
'payable_amount' => 10,
|
||||||
|
'paid_amount' => 10,
|
||||||
|
'placed_at' => now(),
|
||||||
|
'meta' => [],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertFalse($order->isReconcileMismatch());
|
||||||
|
}
|
||||||
|
|
||||||
public function test_is_reconcile_mismatch_returns_false_when_receipt_total_equals_paid_amount(): void
|
public function test_is_reconcile_mismatch_returns_false_when_receipt_total_equals_paid_amount(): void
|
||||||
{
|
{
|
||||||
$merchant = Merchant::query()->create([
|
$merchant = Merchant::query()->create([
|
||||||
|
|||||||
Reference in New Issue
Block a user