output:
Chunk ID: df4553
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 1982
Output:

## Suite 4: Admin Order Management

**File:** `tests/Browser/Admin/OrderManagementTest.php`

**Purpose:** Verify order listing, status filtering, order detail with timeline, fulfillment creation, and refund processing.

### Order State Transitions (via admin actions)

```mermaid
stateDiagram-v2
    state financial {
        pending_f --> paid: payment captured
        paid --> partially_refunded: partial refund
        paid --> refunded: full refund
    }
    state fulfillment {
        unfulfilled --> partial: partial fulfillment
        unfulfilled --> fulfilled: full fulfillment
        partial --> fulfilled: remaining items fulfilled
    }
```

---

### Test 4.1: Shows the order list with seeded orders

**Preconditions:** Logged in as admin, seeded orders

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Orders" in the sidebar

**Expected Results:**
- Page displays "#1001"
- No JavaScript errors

---

### Test 4.2: Can filter orders by status

**Preconditions:** Logged in as admin, seeded orders

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Orders" in the sidebar
4. Click the "Paid" status filter/tab
5. Verify "#1001" is visible
6. Click the "Fulfilled" status filter/tab
7. Click the "All" tab to reset the filter

**Expected Results:**
- After step 4: "#1001" is visible, no JavaScript errors
- After step 6: filtered results shown, no JavaScript errors
- After step 7: full list shown, no JavaScript errors

---

### Test 4.3: Shows order detail with line items and totals

**Preconditions:** Logged in as admin, Order #1001 exists

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Orders" in the sidebar
4. Click "#1001" to open the order detail

**Expected Results:**
- Page displays "#1001"
- Page displays "Paid" (financial status)
- Page displays "Unfulfilled" (fulfillment status)
- Page displays "Classic Cotton T-Shirt" (line item)
- Page displays "Subtotal", "Shipping", "Tax", and "Total" sections
- No JavaScript errors

---

### Test 4.4: Shows order timeline events

**Preconditions:** Logged in as admin, Order #1001 exists

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Orders" in the sidebar
4. Click "#1001" to open the order detail

**Expected Results:**
- Page displays "Timeline" section
- Timeline shows at least the order creation event
- No JavaScript errors

---

### Test 4.5: Can create a fulfillment

**Preconditions:** Logged in as admin, Order #1001 is unfulfilled

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Orders" in the sidebar
4. Click "#1001" to open the order detail
5. Click "Create fulfillment"
6. Enter tracking company: `DHL`
7. Enter tracking number: `DHL123456789`
8. Click "Fulfill items"

**Expected Results:**
- Page displays "Fulfillment created"
- Page displays "DHL" and "DHL123456789" in the fulfillment section
- No JavaScript errors

---

### Test 4.6: Can process a refund

**Preconditions:** Logged in as admin, Order #1001 is paid

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Orders" in the sidebar
4. Click "#1001" to open the order detail
5. Click "Refund"
6. Enter amount: `10.00`
7. Enter reason: `Customer requested partial refund`
8. Click "Process refund"

**Expected Results:**
- Page displays "Refund processed"
- Page displays "Partially refunded" (updated financial status)
- No JavaScript errors

---

### Test 4.7: Shows customer information in order detail

**Preconditions:** Logged in as admin, Order #1001 exists with customer

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Orders" in the sidebar
4. Click "#1001" to open the order detail

**Expected Results:**
- Page displays "customer@acme.test" in the customer info section
- No JavaScript errors

---

### Test 4.8: Can confirm bank transfer payment

**Preconditions:** Logged in as admin, Order #1005 exists with payment_method=bank_transfer and financial_status=pending

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Orders" in the sidebar
4. Click "#1005" to open the order detail
5. Verify "Pending" financial status badge is displayed
6. Verify "Confirm payment" button is visible
7. Click "Confirm payment"

**Expected Results:**
- Page displays "Payment confirmed"
- Financial status badge changes to "Paid"
- "Confirm payment" button is no longer visible
- No JavaScript errors

---

### Test 4.9: Shows fulfillment guard for unpaid order

**Preconditions:** Logged in as admin, Order #1005 exists with financial_status=pending (before payment confirmation)

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Orders" in the sidebar
4. Click "#1005" to open the order detail

**Expected Results:**
- Page displays a warning message about payment required before fulfillment
- "Create fulfillment" button is disabled or hidden
- No JavaScript errors

---

### Test 4.10: Can mark fulfillment as shipped

**Preconditions:** Logged in as admin, Order #1001 is paid and has been fulfilled (fulfillment created in test 4.5)

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Orders" in the sidebar
4. Click "#1001" to open the order detail
5. Create a fulfillment first (if not already done via test 4.5)
6. Click "Mark as shipped" on the fulfillment card

**Expected Results:**
- Fulfillment status badge changes to "Shipped"
- No JavaScript errors

---

### Test 4.11: Can mark fulfillment as delivered

**Preconditions:** Logged in as admin, Order #1001 has a shipped fulfillment

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Orders" in the sidebar
4. Click "#1001" to open the order detail
5. Click "Mark as delivered" on the shipped fulfillment card

**Expected Results:**
- Fulfillment status badge changes to "Delivered"
- Order fulfillment status updates to "Fulfilled"
- No JavaScript errors

**Total: 11 tests**

---

## Suite 5: Admin Discount Management

**File:** `tests/Browser/Admin/DiscountManagementTest.php`

**Purpose:** Verify discount code listing, creation (all three value types), editing, and status display.

### Discount Types

| Value Type | Description | Fields Required |
|------------|-------------|-----------------|
| `percent` | Percentage off the order subtotal | code, value (whole number, e.g., 25 for 25%), starts_at, optional ends_at |
| `fixed` | Fixed currency amount off | code, value (e.g., 10.00), starts_at, optional ends_at |
| `free_shipping` | Waive shipping costs entirely | code, starts_at, optional ends_at |

---

### Test 5.1: Shows seeded discount codes

**Preconditions:** Logged in as admin, seeded discounts

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Discounts" in the sidebar

**Expected Results:**
- Page displays "WELCOME10"
- Page displays "FLAT5"
- Page displays "FREESHIP"
- No JavaScript errors

---

### Test 5.2: Can create a new percentage discount code

**Preconditions:** Logged in as admin

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Discounts" in the sidebar
4. Click "Create discount"
5. Enter code: `E2ETEST25`
6. Click "Percentage" to select the value type
7. Enter value: `25`
8. Enter starts_at: `2026-01-01`
9. Enter ends_at: `2026-12-31`
10. Click "Save"
11. Click "Discounts" to return to the list

**Expected Results:**
- After step 10: page displays "Discount saved", no JavaScript errors
- After step 11: page displays "E2ETEST25" in the list

---

### Test 5.3: Can create a fixed amount discount code

**Preconditions:** Logged in as admin

**Steps:**
1. Navigate to `/admin/login`
2. Log in as admin
3. Click "Discounts" then "Create discount"
4. Enter code: `E2EFLAT10`
5. Click "Fixed amount" to select the value type
6. Enter value: `10.00`
7. Enter starts_at: `2026-01-01`
8. Click "Save"

**Expected Results:**
- Page displays "Discount saved"
- No JavaScript errors

---


output:
Chunk ID: 5ab610
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 63
Output:
tests/Browser/Admin:
AuthenticationTest.php
ProductManagementTest.php

tests/Browser/Storefront:
AccessibilityTest.php
BrowsingTest.php
CartTest.php
CheckoutTest.php
CustomerAccountTest.php
InventoryTest.php
ResponsiveTest.php
TenantIsolationTest.php


step: Inspect Suite 4 order-management requirements and current admin order fixtures/UI

step: Add Suite 4 browser coverage with deterministic order setup

status: pending

step: Fix admin order UI/test gaps if exposed

step: Run focused/full verification

step: Update progress and commit Suite 4

explanation: Continuing with the next missing Spec 08 suite: Admin Order Management.


output: Plan updated


message: The next missing suite is Suite 4, admin order management. I’m going to inspect the existing order factories, feature tests, and Livewire order pages first because the progress log still says order seed fixtures are absent, so this browser suite probably needs deterministic per-test setup rather than relying on seed data.

phase: commentary


type: message

role: assistant

text: The next missing suite is Suite 4, admin order management. I’m going to inspect the existing order factories, feature tests, and Livewire order pages first because the progress log still says order seed fixtures are absent, so this browser suite probably needs deterministic per-test setup rather than relying on seed data.


cmd: rg -n "OrderManagement|#1001|#1005|financial|fulfill|Refund|Payment confirmed|Fulfillment created|tracking" app resources tests database specs/07-SEEDERS-AND-TEST-DATA.md specs/03-ADMIN-UI.md


cmd: ls app/Livewire/Admin/Orders resources/views/livewire/admin/orders tests/Feature/Admin tests/Feature/Orders database/factories


cmd: sed -n '1,320p' tests/Feature/Admin/OrderManagementTest.php


command: ls app/Livewire/Admin/Orders resources/views/livewire/admin/orders tests/Feature/Admin tests/Feature/Orders database/factories

path: Orders

aggregated_output:
app/Livewire/Admin/Orders:
Index.php
Show.php

database/factories:
AnalyticsDailyFactory.php
AnalyticsEventFactory.php
AppFactory.php
AppInstallationFactory.php
CartFactory.php
CartLineFactory.php
CheckoutFactory.php
CollectionFactory.php
CustomerAddressFactory.php
CustomerFactory.php
DataExportFactory.php
DiscountFactory.php
FulfillmentFactory.php
FulfillmentLineFactory.php
InventoryItemFactory.php
NavigationItemFactory.php
NavigationMenuFactory.php
OauthClientFactory.php
OauthTokenFactory.php
OrderFactory.php
OrderLineFactory.php
OrganizationFactory.php
PageFactory.php
PaymentFactory.php
ProductFactory.php
ProductMediaFactory.php
ProductOptionFactory.php
ProductOptionValueFactory.php
ProductVariantFactory.php
RefundFactory.php
SearchQueryFactory.php
SearchSettingsFactory.php
ShippingRateFactory.php
ShippingZoneFactory.php
StoreDomainFactory.php
StoreFactory.php
StoreSettingsFactory.php
TaxSettingsFactory.php
ThemeFactory.php
ThemeFileFactory.php
ThemeSettingsFactory.php
UserFactory.php
WebhookDeliveryFactory.php
WebhookSubscriptionFactory.php

resources/views/livewire/admin/orders:
index.blade.php
show.blade.php

tests/Feature/Admin:
AnalyticsDashboardTest.php
AppsDevelopersTest.php
ContentManagementTest.php
CustomerManagementTest.php
DashboardTest.php
DiscountManagementTest.php
OrderManagementTest.php
ProductMediaManagementTest.php
SearchSettingsTest.php
SettingsManagementTest.php

tests/Feature/Orders:
BankTransferOrderTest.php
FulfillmentServiceTest.php
OrderServiceTest.php
RefundServiceTest.php

status: completed


command: sed -n '1,320p' tests/Feature/Admin/OrderManagementTest.php

OrderManagementTest.php

type: read

aggregated_output:
<?php

use App\Enums\FinancialStatus;
use App\Enums\FulfillmentShipmentStatus;
use App\Enums\FulfillmentStatus;
use App\Enums\OrderStatus;
use App\Enums\PaymentMethod;
use App\Enums\PaymentStatus;
use App\Livewire\Admin\Orders\Index as AdminOrdersIndex;
use App\Livewire\Admin\Orders\Show as AdminOrderShow;
use App\Models\Fulfillment;
use App\Models\InventoryItem;
use App\Models\Order;
use App\Models\OrderLine;
use App\Models\Payment;
use App\Models\Product;
use App\Models\ProductVariant;
use App\Models\Store;
use App\Models\User;
use Database\Seeders\DatabaseSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;

uses(RefreshDatabase::class);

beforeEach(function () {
    $this->withoutVite();
    $this->seed(DatabaseSeeder::class);
});

function adminOrderManagementStore(): Store
{
    $store = Store::query()->where('handle', 'acme-fashion')->firstOrFail();
    app()->instance('current_store', $store);

    return $store;
}

function adminOrderManagementUser(): User
{
    return User::query()->where('email', 'admin@acme.test')->firstOrFail();
}

/**
 * @return array{0: Order, 1: OrderLine, 2: ProductVariant}
 */
function adminOrderManagementOrder(Store $store, array $orderAttributes = [], int $quantity = 2, int $unitPrice = 2500): array
{
    $product = Product::factory()
        ->withDefaultVariant($unitPrice)
        ->create(['store_id' => $store->getKey()]);
    $variant = ProductVariant::withoutGlobalScopes()
        ->where('product_id', $product->getKey())
        ->firstOrFail();

    InventoryItem::withoutGlobalScopes()
        ->where('variant_id', $variant->getKey())
        ->update([
            'quantity_on_hand' => 10,
            'quantity_reserved' => 0,
        ]);

    $total = $quantity * $unitPrice;
    $order = Order::factory()->paid()->create(array_merge([
        'store_id' => $store->getKey(),
        'subtotal_amount' => $total,
        'shipping_amount' => 0,
        'tax_amount' => 0,
        'total_amount' => $total,
        'email' => 'buyer@example.test',
    ], $orderAttributes));
    $line = OrderLine::factory()->create([
        'order_id' => $order->getKey(),
        'product_id' => $product->getKey(),
        'variant_id' => $variant->getKey(),
        'title_snapshot' => 'Admin Test Product',
        'sku_snapshot' => 'ADMIN-TEST-001',
        'quantity' => $quantity,
        'unit_price_amount' => $unitPrice,
        'total_amount' => $total,
    ]);

    Payment::factory()->create([
        'order_id' => $order->getKey(),
        'method' => $order->payment_method,
        'status' => $order->financial_status === FinancialStatus::Pending ? PaymentStatus::Pending : PaymentStatus::Captured,
        'amount' => $total,
        'currency' => $order->currency,
    ]);

    return [$order, $line, $variant];
}

test('admin order routes require authentication and render scoped orders', function () {
    $store = adminOrderManagementStore();
    [$order] = adminOrderManagementOrder($store, [
        'order_number' => '#7001',
        'email' => 'alpha@example.test',
    ]);

    $otherStore = Store::factory()->create();
    adminOrderManagementOrder($otherStore, [
        'order_number' => '#9001',
        'email' => 'other@example.test',
    ]);

    $this->get('/admin/orders')->assertRedirect('/admin/login');

    $user = adminOrderManagementUser();

    $this->actingAs($user)
        ->get('/admin/orders')
        ->assertSuccessful()
        ->assertSee('#7001')
        ->assertDontSee('#9001');

    $this->actingAs($user)
        ->get('/admin/orders/'.$order->getKey())
        ->assertSuccessful()
        ->assertSee('#7001')
        ->assertSee('Admin Test Product');
});

test('admin order index filters by search and status dimensions', function () {
    $store = adminOrderManagementStore();
    $user = adminOrderManagementUser();
    adminOrderManagementOrder($store, [
        'order_number' => '#7001',
        'email' => 'alpha@example.test',
    ]);
    adminOrderManagementOrder($store, [
        'order_number' => '#7002',
        'email' => 'bravo@example.test',
        'status' => OrderStatus::Pending,
        'financial_status' => FinancialStatus::Pending,
        'payment_method' => PaymentMethod::BankTransfer,
    ]);

    Livewire::actingAs($user)
        ->test(AdminOrdersIndex::class)
        ->assertSee('#7001')
        ->assertSee('#7002')
        ->set('search', 'alpha')
        ->assertSee('#7001')
        ->assertDontSee('#7002')
        ->set('search', '')
        ->set('financialStatusFilter', 'pending')
        ->assertSee('#7002')
        ->assertDontSee('#7001');
});

test('admin order detail confirms bank transfer payments', function () {
    $store = adminOrderManagementStore();
    $user = adminOrderManagementUser();
    [$order, $line, $variant] = adminOrderManagementOrder($store, [
        'payment_method' => PaymentMethod::BankTransfer,
        'status' => OrderStatus::Pending,
        'financial_status' => FinancialStatus::Pending,
    ]);

    InventoryItem::withoutGlobalScopes()
        ->where('variant_id', $variant->getKey())
        ->update(['quantity_reserved' => $line->quantity]);

    Livewire::actingAs($user)
        ->test(AdminOrderShow::class, ['order' => $order])
        ->call('confirmBankTransferPayment')
        ->assertHasNoErrors();

    $inventory = InventoryItem::withoutGlobalScopes()->where('variant_id', $variant->getKey())->firstOrFail();

    expect($order->refresh()->status)->toBe(OrderStatus::Paid)
        ->and($order->financial_status)->toBe(FinancialStatus::Paid)
        ->and($order->payments()->first()?->status)->toBe(PaymentStatus::Captured)
        ->and($inventory->quantity_on_hand)->toBe(8)
        ->and($inventory->quantity_reserved)->toBe(0);
});

test('admin order detail processes refunds and fulfillment transitions', function () {
    $store = adminOrderManagementStore();
    $user = adminOrderManagementUser();
    [$order, $line] = adminOrderManagementOrder($store, quantity: 2, unitPrice: 2500);

    Livewire::actingAs($user)
        ->test(AdminOrderShow::class, ['order' => $order])
        ->set('refundAmount', '10.00')
        ->set('refundReason', 'Customer return')
        ->call('processRefund')
        ->assertHasNoErrors();

    expect($order->refresh()->financial_status)->toBe(FinancialStatus::PartiallyRefunded)
        ->and($order->refunds()->first()?->amount)->toBe(1000);

    Livewire::actingAs($user)
        ->test(AdminOrderShow::class, ['order' => $order->refresh()])
        ->set("fulfillmentLineQuantities.{$line->getKey()}", 1)
        ->set('trackingCompany', 'DHL')
        ->set('trackingNumber', 'DHL123')
        ->call('createFulfillment')
        ->assertHasNoErrors();

    $fulfillment = Fulfillment::query()->where('order_id', $order->getKey())->firstOrFail();

    expect($order->refresh()->fulfillment_status)->toBe(FulfillmentStatus::Partial)
        ->and($fulfillment->lines()->first()?->quantity)->toBe(1);

    Livewire::actingAs($user)
        ->test(AdminOrderShow::class, ['order' => $order->refresh()])
        ->call('markFulfillmentShipped', $fulfillment->getKey())
        ->call('markFulfillmentDelivered', $fulfillment->getKey())
        ->assertHasNoErrors();

    expect($fulfillment->refresh()->status)->toBe(FulfillmentShipmentStatus::Delivered)
        ->and($fulfillment->delivered_at)->not->toBeNull();
});

test('admin order detail rejects orders from another store', function () {
    $store = adminOrderManagementStore();
    $otherStore = Store::factory()->create();
    $user = adminOrderManagementUser();
    [$otherOrder] = adminOrderManagementOrder($otherStore, [
        'order_number' => '#9001',
    ]);

    app()->instance('current_store', $store);

    Livewire::actingAs($user)
        ->test(AdminOrderShow::class, ['order' => $otherOrder])
        ->assertStatus(404);
});


command: rg -n "OrderManagement|#1001|#1005|financial|fulfill|Refund|Payment confirmed|Fulfillment created|tracking" app resources tests database specs/07-SEEDERS-AND-TEST-DATA.md specs/03-ADMIN-UI.md

type: search

cmd: rg -n 'OrderManagement|#1001|#1005|financial|fulfill|Refund|Payment confirmed|Fulfillment created|tracking' app resources tests database specs/07-SEEDERS-AND-TEST-DATA.md specs/03-ADMIN-UI.md

query: OrderManagement|#1001|#1005|financial|fulfill|Refund|Payment confirmed|Fulfillment created|tracking

path: app

aggregated_output:
app/ValueObjects/RefundResult.php:5:use App\Enums\RefundStatus;
app/ValueObjects/RefundResult.php:7:final readonly class RefundResult
app/ValueObjects/RefundResult.php:11:        public RefundStatus $status,
database/factories/FulfillmentLineFactory.php:22:            'fulfillment_id' => Fulfillment::factory(),
resources/views/layouts/storefront.blade.php:33:
specs/07-SEEDERS-AND-TEST-DATA.md:27:| 13 | OrderSeeder | Stores, Customers, Products, Variants, Discounts | Creates orders with lines, payments, fulfillments, refunds |
specs/07-SEEDERS-AND-TEST-DATA.md:365:| financial_status | "paid" |
specs/07-SEEDERS-AND-TEST-DATA.md:366:| fulfillment_status | "unfulfilled" |
specs/07-SEEDERS-AND-TEST-DATA.md:382:| `pending` | status = "pending", financial_status = "pending" |
specs/07-SEEDERS-AND-TEST-DATA.md:383:| `pendingBankTransfer` | status = "pending", financial_status = "pending", payment_method = "bank_transfer" |
specs/07-SEEDERS-AND-TEST-DATA.md:384:| `fulfilled` | status = "fulfilled", fulfillment_status = "fulfilled" |
specs/07-SEEDERS-AND-TEST-DATA.md:385:| `cancelled` | status = "cancelled", financial_status = "refunded" |
specs/07-SEEDERS-AND-TEST-DATA.md:386:| `refunded` | status = "refunded", financial_status = "refunded" |
specs/07-SEEDERS-AND-TEST-DATA.md:387:| `partiallyFulfilled` | fulfillment_status = "partial" |
specs/07-SEEDERS-AND-TEST-DATA.md:447:### 2.15 RefundFactory
specs/07-SEEDERS-AND-TEST-DATA.md:449:**Model:** Refund
specs/07-SEEDERS-AND-TEST-DATA.md:481:| tracking_company | Random from: DHL, UPS, FedEx, DPD |
specs/07-SEEDERS-AND-TEST-DATA.md:482:| tracking_number | Faker pattern "??########" (2 letters + 8 digits) |
specs/07-SEEDERS-AND-TEST-DATA.md:483:| tracking_url | "https://tracking.example.com/" + tracking_number |
specs/07-SEEDERS-AND-TEST-DATA.md:490:| `pending` | status = "pending", tracking_number = null, tracking_url = null, shipped_at = null |
specs/07-SEEDERS-AND-TEST-DATA.md:503:| fulfillment_id | FK | Parent fulfillment |
specs/07-SEEDERS-AND-TEST-DATA.md:504:| order_line_id | FK | The order line being fulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:505:| quantity | integer, 1..max | Quantity fulfilled for this line (must not exceed order line quantity) |
specs/07-SEEDERS-AND-TEST-DATA.md:1503:All orders use the customer's default shipping address (unless noted). Order numbers follow the "#NNNN" format starting from #1001.
specs/07-SEEDERS-AND-TEST-DATA.md:1507:**Order #1001 - Awaiting fulfillment (Credit Card)**
specs/07-SEEDERS-AND-TEST-DATA.md:1513:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1536:| status / financial / fulfillment | fulfilled / paid / fulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1550:Fulfillment: status "delivered", tracking company "DHL", tracking number "DHL1234567890", shipped 8 days ago. Fulfillment lines cover all order lines at full quantity.
specs/07-SEEDERS-AND-TEST-DATA.md:1554:**Order #1003 - Partially fulfilled (Credit Card)**
specs/07-SEEDERS-AND-TEST-DATA.md:1560:| status / financial / fulfillment | paid / paid / partial |
specs/07-SEEDERS-AND-TEST-DATA.md:1584:| status / financial / fulfillment | cancelled / refunded / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1597:Refund: amount 2998, reason "Customer requested cancellation", status "processed", provider_refund_id "mock_re_test_order1004"
specs/07-SEEDERS-AND-TEST-DATA.md:1601:**Order #1005 - Bank transfer awaiting payment**
specs/07-SEEDERS-AND-TEST-DATA.md:1607:| status / financial / fulfillment | pending / pending / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1620:**Test purpose:** Tests the bank transfer flow - admin "Confirm Payment" button, fulfillment guard (cannot fulfill until payment confirmed), and auto-cancel job scenario.
specs/07-SEEDERS-AND-TEST-DATA.md:1630:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1651:| status / financial / fulfillment | fulfilled / paid / fulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1665:Fulfillment: delivered, DHL, "DHL1112223334", shipped 18 days ago. All lines fulfilled.
specs/07-SEEDERS-AND-TEST-DATA.md:1675:| status / financial / fulfillment | paid / partially_refunded / fulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1691:Refund (partial - for Graphic Print Tee only): amount 2999, reason "Item returned", status "processed", provider_refund_id "mock_re_test_order1008"
specs/07-SEEDERS-AND-TEST-DATA.md:1701:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1723:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1744:| status / financial / fulfillment | paid / paid / fulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1767:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1788:| stat…65454 chars truncated…:64:                                    {{ Str::headline($fulfillment->status->value) }}
resources/views/livewire/storefront/account/orders/show.blade.php:65:                                    @if ($fulfillment->tracking_number)
resources/views/livewire/storefront/account/orders/show.blade.php:66:                                        {{ $fulfillment->tracking_number }}
resources/views/livewire/storefront/account/orders/show.blade.php:79:                <flux:badge>{{ Str::headline($order->financial_status->value) }}</flux:badge>
resources/views/livewire/storefront/account/orders/show.blade.php:80:                <flux:badge>{{ Str::headline($order->fulfillment_status->value) }}</flux:badge>
app/Enums/WebhookEventType.php:11:    case OrderFulfilled = 'order.fulfilled';
app/Enums/WebhookEventType.php:12:    case OrderRefunded = 'order.refunded';
app/Enums/WebhookEventType.php:18:    case FulfillmentCreated = 'fulfillment.created';
app/Enums/WebhookEventType.php:19:    case RefundCreated = 'refund.created';
app/Enums/WebhookEventType.php:28:            self::OrderFulfilled => 'Order fulfilled',
app/Enums/WebhookEventType.php:29:            self::OrderRefunded => 'Order refunded',
app/Enums/WebhookEventType.php:35:            self::FulfillmentCreated => 'Fulfillment created',
app/Enums/WebhookEventType.php:36:            self::RefundCreated => 'Refund created',
app/Enums/WebhookEventType.php:55:            self::RefundCreated,
resources/views/livewire/storefront/account/orders/index.blade.php:10:
Welcome back, {{ Str::before($customer->name ?: $customer->email, ' ') }}!

resources/views/livewire/storefront/account/orders/index.blade.php:38:
Order History

resources/views/livewire/storefront/account/orders/index.blade.php:55:                        <flux:badge>{{ Str::headline($order->financial_status->value) }}</flux:badge>
resources/views/livewire/storefront/account/orders/index.blade.php:56:                        <flux:badge>{{ Str::headline($order->fulfillment_status->value) }}</flux:badge>
app/Enums/OrderStatus.php:9:    case Fulfilled = 'fulfilled';
app/Enums/OrderStatus.php:11:    case Refunded = 'refunded';
resources/views/livewire/storefront/search/index.blade.php:5:

resources/views/livewire/storefront/account/addresses/index.blade.php:10:
Addresses

app/Http/Resources/Storefront/V1/OrderResource.php:25:            'financial_status' => $this->financial_status?->value,
app/Http/Resources/Storefront/V1/OrderResource.php:26:            'fulfillment_status' => $this->fulfillment_status?->value,
app/Http/Resources/Storefront/V1/OrderResource.php:52:            'fulfillments' => $this->whenLoaded('fulfillments', fn () => $this->fulfillments->map(fn ($fulfillment): array => [
app/Http/Resources/Storefront/V1/OrderResource.php:53:                'id' => $fulfillment->id,
app/Http/Resources/Storefront/V1/OrderResource.php:54:                'status' => $fulfillment->status?->value,
app/Http/Resources/Storefront/V1/OrderResource.php:55:                'tracking_company' => $fulfillment->tracking_company,
app/Http/Resources/Storefront/V1/OrderResource.php:56:                'tracking_number' => $fulfillment->tracking_number,
app/Http/Resources/Storefront/V1/OrderResource.php:57:                'tracking_url' => $fulfillment->tracking_url,
app/Http/Resources/Storefront/V1/OrderResource.php:58:                'shipped_at' => $fulfillment->shipped_at?->toIso8601String(),
app/Http/Resources/Storefront/V1/OrderResource.php:59:                'delivered_at' => $fulfillment->delivered_at?->toIso8601String(),
app/Providers/AppServiceProvider.php:13:use App\Events\OrderRefunded;
app/Providers/AppServiceProvider.php:164:            OrderRefunded::class,
app/Enums/RefundStatus.php:5:enum RefundStatus: string
resources/views/livewire/storefront/checkout/show.blade.php:10:
Checkout

resources/views/livewire/storefront/cart/show.blade.php:8:
Your Cart

resources/views/livewire/storefront/products/show.blade.php:25:
{{ $product->title }}

resources/views/livewire/storefront/checkout/confirmation.blade.php:20:


output:
Chunk ID: 63ab42
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 18864
Output:
Total output lines: 640

app/ValueObjects/RefundResult.php:5:use App\Enums\RefundStatus;
app/ValueObjects/RefundResult.php:7:final readonly class RefundResult
app/ValueObjects/RefundResult.php:11:        public RefundStatus $status,
database/factories/FulfillmentLineFactory.php:22:            'fulfillment_id' => Fulfillment::factory(),
resources/views/layouts/storefront.blade.php:33:                <a href="{{ route('home') }}" class="text-lg font-semibold tracking-normal" wire:navigate>
specs/07-SEEDERS-AND-TEST-DATA.md:27:| 13 | OrderSeeder | Stores, Customers, Products, Variants, Discounts | Creates orders with lines, payments, fulfillments, refunds |
specs/07-SEEDERS-AND-TEST-DATA.md:365:| financial_status | "paid" |
specs/07-SEEDERS-AND-TEST-DATA.md:366:| fulfillment_status | "unfulfilled" |
specs/07-SEEDERS-AND-TEST-DATA.md:382:| `pending` | status = "pending", financial_status = "pending" |
specs/07-SEEDERS-AND-TEST-DATA.md:383:| `pendingBankTransfer` | status = "pending", financial_status = "pending", payment_method = "bank_transfer" |
specs/07-SEEDERS-AND-TEST-DATA.md:384:| `fulfilled` | status = "fulfilled", fulfillment_status = "fulfilled" |
specs/07-SEEDERS-AND-TEST-DATA.md:385:| `cancelled` | status = "cancelled", financial_status = "refunded" |
specs/07-SEEDERS-AND-TEST-DATA.md:386:| `refunded` | status = "refunded", financial_status = "refunded" |
specs/07-SEEDERS-AND-TEST-DATA.md:387:| `partiallyFulfilled` | fulfillment_status = "partial" |
specs/07-SEEDERS-AND-TEST-DATA.md:447:### 2.15 RefundFactory
specs/07-SEEDERS-AND-TEST-DATA.md:449:**Model:** Refund
specs/07-SEEDERS-AND-TEST-DATA.md:481:| tracking_company | Random from: DHL, UPS, FedEx, DPD |
specs/07-SEEDERS-AND-TEST-DATA.md:482:| tracking_number | Faker pattern "??########" (2 letters + 8 digits) |
specs/07-SEEDERS-AND-TEST-DATA.md:483:| tracking_url | "https://tracking.example.com/" + tracking_number |
specs/07-SEEDERS-AND-TEST-DATA.md:490:| `pending` | status = "pending", tracking_number = null, tracking_url = null, shipped_at = null |
specs/07-SEEDERS-AND-TEST-DATA.md:503:| fulfillment_id | FK | Parent fulfillment |
specs/07-SEEDERS-AND-TEST-DATA.md:504:| order_line_id | FK | The order line being fulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:505:| quantity | integer, 1..max | Quantity fulfilled for this line (must not exceed order line quantity) |
specs/07-SEEDERS-AND-TEST-DATA.md:1503:All orders use the customer's default shipping address (unless noted). Order numbers follow the "#NNNN" format starting from #1001.
specs/07-SEEDERS-AND-TEST-DATA.md:1507:**Order #1001 - Awaiting fulfillment (Credit Card)**
specs/07-SEEDERS-AND-TEST-DATA.md:1513:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1536:| status / financial / fulfillment | fulfilled / paid / fulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1550:Fulfillment: status "delivered", tracking company "DHL", tracking number "DHL1234567890", shipped 8 days ago. Fulfillment lines cover all order lines at full quantity.
specs/07-SEEDERS-AND-TEST-DATA.md:1554:**Order #1003 - Partially fulfilled (Credit Card)**
specs/07-SEEDERS-AND-TEST-DATA.md:1560:| status / financial / fulfillment | paid / paid / partial |
specs/07-SEEDERS-AND-TEST-DATA.md:1584:| status / financial / fulfillment | cancelled / refunded / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1597:Refund: amount 2998, reason "Customer requested cancellation", status "processed", provider_refund_id "mock_re_test_order1004"
specs/07-SEEDERS-AND-TEST-DATA.md:1601:**Order #1005 - Bank transfer awaiting payment**
specs/07-SEEDERS-AND-TEST-DATA.md:1607:| status / financial / fulfillment | pending / pending / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1620:**Test purpose:** Tests the bank transfer flow - admin "Confirm Payment" button, fulfillment guard (cannot fulfill until payment confirmed), and auto-cancel job scenario.
specs/07-SEEDERS-AND-TEST-DATA.md:1630:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1651:| status / financial / fulfillment | fulfilled / paid / fulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1665:Fulfillment: delivered, DHL, "DHL1112223334", shipped 18 days ago. All lines fulfilled.
specs/07-SEEDERS-AND-TEST-DATA.md:1675:| status / financial / fulfillment | paid / partially_refunded / fulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1691:Refund (partial - for Graphic Print Tee only): amount 2999, reason "Item returned", status "processed", provider_refund_id "mock_re_test_order1008"
specs/07-SEEDERS-AND-TEST-DATA.md:1701:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1723:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1744:| status / financial / fulfillment | paid / paid / fulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1767:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1788:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1810:| status / financial / fulfillment | paid / paid / fulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1823:Fulfillment: delivered (auto-fulfilled digital product), no tracking company, no tracking number, shipped_at = placed_at, delivered_at = placed_at
specs/07-SEEDERS-AND-TEST-DATA.md:1833:| status / financial / fulfillment | paid / paid / unfulfilled |
specs/07-SEEDERS-AND-TEST-DATA.md:1849:**Test purpose:** Tests a bank transfer order that has been confirmed by the admin (payment status = captured). Contrasts with #1005 which is still pending.
specs/07-SEEDERS-AND-TEST-DATA.md:1857:| #1001 | John Doe | credit_card | paid | paid | unfulfilled | 5497 | Awaiting fulfillment |
specs/07-SEEDERS-AND-TEST-DATA.md:1858:| #1002 | John Doe | credit_card | fulfilled | paid | fulfilled | 8997 | Delivered order |
specs/07-SEEDERS-AND-TEST-DATA.md:1859:| #1003 | Jane Smith | credit_card | paid | paid | partial | 11997 | Partial fulfillment |
specs/07-SEEDERS-AND-TEST-DATA.md:1860:| #1004 | John Doe | credit_card | cancelled | refunded | unfulfilled | 2998 | Full cancellation + refund |
specs/07-SEEDERS-AND-TEST-DATA.md:1861:| #1005 | Jane Smith | bank_transfer | pending | pending | unfulfilled | 3998 | Bank transfer awaiting payment |
specs/07-SEEDERS-AND-TEST-DATA.md:1862:| #1006 | Michael Brown | credit_card | paid | paid | unfulfilled | 12498 | Standard paid order |
specs/07-SEEDERS-AND-TEST-DATA.md:1863:| #1007 | Sarah Wilson | paypal | fulfilled | paid | fulfilled | 10496 | Multi-item delivered (PayPal) |
specs/07-SEEDERS-AND-TEST-DATA.md:1864:| #1008 | David Lee | credit_card | paid | partially_refunded | fulfilled | 8997 | Partial refund |
specs/07-SEEDERS-AND-TEST-DATA.md:1865:| #1009 | Emma Garcia | credit_card | paid | paid | unfulfilled | 4997 | Accessories order |
specs/07-SEEDERS-AND-TEST-DATA.md:1866:| #1010 | John Doe | paypal | paid | paid | unfulfilled | 50498 | High-value order (PayPal) |
specs/07-SEEDERS-AND-TEST-DATA.md:1867:| #1011 | James Taylor | credit_card | paid | paid | fulfilled | 3298 | Single item delivered |
specs/07-SEEDERS-AND-TEST-DATA.md:1868:| #1012 | Lisa Anderson | credit_card | paid | paid | unfulfilled | 8497 | Multi-quantity order |
specs/07-SEEDERS-AND-TEST-DATA.md:1869:| #1013 | Robert Martinez | credit_card | paid | paid | unfulfilled | 8497 | Multi-item order |
specs/07-SEEDERS-AND-TEST-DATA.md:1870:| #1014 | Anna Thomas | credit_card | paid | paid | fulfilled | 5000 | Digital product (auto-fulfilled) |
specs/07-SEEDERS-AND-TEST-DATA.md:1871:| #1015 | John Doe | bank_transfer | paid | paid | unfulfilled | 5447 | Order with discount (bank transfer, confirmed) |
specs/07-SEEDERS-AND-TEST-DATA.md:1879:| #5001 | techfan@example.com | credit_card | paid | paid | fulfilled | 121298 | Pro Laptop 512GB (119999) + USB-C Cable (1299), shipping 0 |
specs/07-SEEDERS-AND-TEST-DATA.md:1880:| #5002 | gadgetlover@example.com | credit_card | paid | paid | unfulfilled | 14999 | Wireless Headphones Black (14999), shipping 0 |
specs/07-SEEDERS-AND-TEST-DATA.md:1881:| #5003 | techfan@example.com | bank_transfer | pending | pending | unfulfilled | 4999 | Monitor Stand (4999), shipping 0, bank transfer pending |
specs/07-SEEDERS-AND-TEST-DATA.md:1955:  4. Order tracking (email with tracking number after shipment)
specs/03-ADMIN-UI.md:875:| `statusFilter` | `string` | `all`, `pending`, `paid`, `fulfilled`, `cancelled`, `refunded` |
specs/03-ADMIN-UI.md:897:| [All] [Pending] [Paid] [Fulfilled] [Cancelled] [Refunded]       |
specs/03-ADMIN-UI.md:901:| #1001    | Jan 15, 2:30 PM| John Doe  | Paid      | Unful.  | $131.36|
specs/03-ADMIN-UI.md:910:A horizontal row of tab-style buttons (plain Tailwind, not Flux component). Options: All, Pending, Paid, Fulfilled, Cancelled, Refunded. The active tab gets a bottom border and bold text. Inactive tabs use muted text color.
specs/03-ADMIN-UI.md:916:| Order number | Link to order detail (e.g., "#1001"), uses Livewire navigate |
specs/03-ADMIN-UI.md:920:| Fulfillment status | Flux badge: unfulfilled=zinc, partial=yellow, fulfilled=green |
specs/03-ADMIN-UI.md:948:| `order` | `Order` | The order model (eager loaded with lines, payments, fulfillments, customer) |
specs/03-ADMIN-UI.md:949:| `fulfillmentLines` | `array` | Lines/quantities selected for fulfillment |
specs/03-ADMIN-UI.md:950:| `trackingCompany` | `string` | Tracking company for fulfillment |
specs/03-ADMIN-UI.md:951:| `trackingNumber` | `string` | Tracking number |
specs/03-ADMIN-UI.md:952:| `trackingUrl` | `string` | Tracking URL |
specs/03-ADMIN-UI.md:954:| `refundReason` | `string` | Refund reason text |
specs/03-ADMIN-UI.md:960:| `confirmPayment()` | Confirms bank transfer payment received (transitions financial_status to `paid`, commits inventory, dispatches `OrderPaid`) |
specs/03-ADMIN-UI.md:961:| `createFulfillment()` | Creates a fulfillment record for selected lines (enforces fulfillment guard) |
specs/03-ADMIN-UI.md:962:| `markAsShipped(int $fulfillmentId)` | Transitions fulfillment to `shipped`, sets `shipped_at` |
specs/03-ADMIN-UI.md:963:| `markAsDelivered(int $fulfillmentId)` | Transitions fulfillment to `delivered`, sets `delivered_at` |
specs/03-ADMIN-UI.md:964:| `createRefund()` | Creates a refund for selected lines or custom amount |
specs/03-ADMIN-UI.md:965:| `openFulfillmentModal()` | Opens the fulfillment modal |
specs/03-ADMIN-UI.md:966:| `openRefundModal()` | Opens the refund modal |
specs/03-ADMIN-UI.md:974:| #1001  [Paid]  [Unfulfilled]                 | CUSTOMER           |
specs/03-ADMIN-UI.md:977:| [Create fulfillment]  [Refund]               | > View customer    |
specs/03-ADMIN-UI.md:1012:- Fulfillment status badge (color mapped: fulfilled=green, default=zinc)
specs/03-ADMIN-UI.md:1017:- "Confirm payment" button (primary, shown only when `payment_method = bank_transfer` AND `financial_status = pending`). On click, calls `confirmPayment()` which transitions the order to `paid`, commits inventory, and dispatches `OrderPaid`.
specs/03-ADMIN-UI.md:1018:- "Create fulfillment" button (shown when order is not fully fulfilled AND fulfillment guard passes - see below)
specs/03-ADMIN-UI.md:1019:- "Refund" button (ghost variant, shown when order is paid or partially_refunded)
specs/03-ADMIN-UI.md:1023:A Flux `callout` (variant: warning) is displayed when the order's `financial_status` is NOT `paid` and NOT `partially_refunded`:
specs/03-ADMIN-UI.md:1025:> **Cannot create fulfillment.** Payment must be confirmed before items can be fulfilled. Current financial status: *{financial_status}*.
specs/03-ADMIN-UI.md:1027:When the guard condition is active, the "Create fulfillment" button is disabled (or hidden). This prevents shipping items before payment is secured.
specs/03-ADMIN-UI.md:1032:- Events include: Order placed, Payment received, Fulfillment created, Shipped, Delivered, Refunded (as applicable)
specs/03-ADMIN-UI.md:1055:- **"Confirm payment" button** (primary variant): Shown only when `payment_method = bank_transfer` AND `financial_status = pending`. Clicking calls `confirmPayment()`.
specs/03-ADMIN-UI.md:1059:Each existing fulfillment is rendered as a card below the timeline. Each card shows:
specs/03-ADMIN-UI.md:1062:- Line items included in the fulfillment
specs/03-ADMIN-UI.md:1063:- **Action buttons on each fulfillment card:**
specs/03-ADMIN-UI.md:1064:  - "Mark as shipped" button (shown when fulfillment status is `pending`). On click, calls `markAsShipped(fulfillmentId)`. Sets `shipped_at` timestamp.
specs/03-ADMIN-UI.md:1065:  - "Mark as delivered" button (shown when fulfillment status is `shipped`). On click, calls `markAsDelivered(fulfillmentId)`. Sets `delivered_at` timestamp. When all fulfillments are delivered, the order's `fulfillment_status` transitions to `fulfilled`.
specs/03-ADMIN-UI.md:1088:| Modal name | `create-fulfillment` |
specs/03-ADMIN-UI.md:1090:| Heading | "Create fulfillment" |
specs/03-ADMIN-UI.md:1093:- For each unfulfilled order line: a row with checkbox, line title + unfulfilled quantity text, and a number input for quantity to fulfill (min 1, max unfulfilled quantity)
specs/03-ADMIN-UI.md:1098:- Cancel button (ghost) and "Create fulfillment" button (primary)
specs/03-ADMIN-UI.md:1100:### Refund Modal
specs/03-ADMIN-UI.md:1106:| Heading | "Refund order" |
specs/03-ADMIN-UI.md:1200:| #1005   | Jan 20    | Paid   | $89.00        | Chicago, IL        |
specs/03-ADMIN-UI.md:1201:| #1001   | Jan 15    | Paid   | $131.36       | [Edit] [Delete]    |
specs/03-ADMIN-UI.md:2116:- Event type select with options: order.created, order.updated, order.cancelled, product.created, product.updated, product.deleted, customer.created, checkout.completed, fulfillment.created, refund.created
specs/03-ADMIN-UI.md:2385:| Order fulfilled | "Fulfillment created" | success |
specs/03-ADMIN-UI.md:2386:| Refund issued | "Refund issued" | success |
database/factories/FulfillmentFactory.php:24:            'tracking_company' => null,
database/factories/FulfillmentFactory.php:25:            'tracking_number' => null,
database/factories/FulfillmentFactory.php:26:            'tracking_url' => null,
database/factories/FulfillmentFactory.php:35:            'tracking_company' => fake()->randomElement(['DHL', 'UPS', 'DPD']),
database/factories/FulfillmentFactory.php:36:            'tracking_number' => fake()->bothify('??##########'),
database/factories/FulfillmentFactory.php:37:            'tracking_url' => fake()->url(),
database/factories/RefundFactory.php:5:use App\Enums\RefundStatus;
database/factories/RefundFactory.php:11: * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Refund>
database/factories/RefundFactory.php:13:class RefundFactory extends Factory
database/factories/RefundFactory.php:27:            'status' => RefundStatus::Pending,
database/factories/RefundFactory.php:35:            'status' => RefundStatus::Processed,
database/factories/RefundFactory.php:43:            'status' => RefundStatus::Failed,
tests/Feature/Orders/OrderServiceTest.php:161:    expect($order->order_number)->toBe('#1001')
tests/Feature/Orders/OrderServiceTest.php:163:        ->and($order->financial_status)->toBe(FinancialStatus::Paid)
tests/Feature/Orders/OrderServiceTest.php:277:        ->and($order->financial_status)->toBe(FinancialStatus::Pending)
tests/Feature/Orders/BankTransferOrderTest.php:57:        'financial_status' => FinancialStatus::Pending,
tests/Feature/Orders/BankTransferOrderTest.php:89:        ->and($paidOrder->financial_status)->toBe(FinancialStatus::Paid)
tests/Feature/Orders/BankTransferOrderTest.php:97:test('confirming digital bank transfer payment auto-fulfills the order', function () {
tests/Feature/Orders/BankTransferOrderTest.php:103:        ->and($paidOrder->fulfillment_status)->toBe(FulfillmentStatus::Fulfilled)
tests/Feature/Orders/BankTransferOrderTest.php:104:        ->and($paidOrder->fulfillments)->toHaveCount(1)
tests/Feature/Orders/BankTransferOrderTest.php:105:        ->and($paidOrder->fulfillments->first()->status)->toBe(FulfillmentShipmentStatus::Delivered);
tests/Feature/Orders/BankTransferOrderTest.php:120:        ->and($oldOrder->financial_status)->toBe(FinancialStatus::Voided)
database/factories/PaymentFactory.php:59:            'status' => PaymentStatus::Refunded,
tests/Feature/Orders/RefundServiceTest.php:6:use App\Enums\RefundStatus;
tests/Feature/Orders/RefundServiceTest.php:7:use App\Events\OrderRefunded;
tests/Feature/Orders/RefundServiceTest.php:8:use App\Exceptions\InvalidRefundOperationException;
tests/Feature/Orders/RefundServiceTest.php:16:use App\Services\RefundService;
tests/Feature/Orders/RefundServiceTest.php:75:    $refund = app(RefundService::class)->process($order, [
tests/Feature/Orders/RefundServiceTest.php:82:        ->and($refund->status)->toBe(RefundStatus::Processed)
tests/Feature/Orders/RefundServiceTest.php:85:        ->and($order->financial_status)->toBe(FinancialStatus::PartiallyRefunded)
tests/Feature/Orders/RefundServiceTest.php:89:    Event::assertDispatched(OrderRefunded::class, fn (OrderRefunded $event): bool => $event->refund->is($refund));
tests/Feature/Orders/RefundServiceTest.php:95:    $refund = app(RefundService::class)->process($order);
tests/Feature/Orders/RefundServiceTest.php:98:        ->and($order->refresh()->status)->toBe(OrderStatus::Refunded)
tests/Feature/Orders/RefundServiceTest.php:99:        ->and($order->financial_status)->toBe(FinancialStatus::Refunded)
tests/Feature/Orders/RefundServiceTest.php:100:        ->and($order->payments()->first()?->status)->toBe(PaymentStatus::Refunded);
tests/Feature/Orders/RefundServiceTest.php:106:    expect(fn () => app(RefundService::class)->process($order, ['amount' => 10001]))
tests/Feature/Orders/RefundServiceTest.php:107:        ->toThrow(InvalidRefundOperationException::class);
tests/Feature/Orders/RefundServiceTest.php:111:    expect(fn () => app(RefundService::class)->process($order, ['amount' => 500]))
tests/Feature/Orders/RefundServiceTest.php:112:        ->toThrow(InvalidRefundOperationException::class);
database/factories/OrderFactory.php:37:            'financial_status' => FinancialStatus::Paid,
database/factories/OrderFactory.php:38:            'fulfillment_status' => FulfillmentStatus::Unfulfilled,
database/factories/OrderFactory.php:70:            'financial_status' => FinancialStatus::Paid,
database/factories/OrderFactory.php:78:            'financial_status' => FinancialStatus::Pending,
database/factories/OrderFactory.php:101:            'financial_status' => FinancialStatus::Pending,
database/factories/OrderFactory.php:109:            'financial_status' => FinancialStatus::Voided,
database/factories/OrderFactory.php:116:            'fulfillment_status' => FulfillmentStatus::Partial,
database/factories/OrderFactory.php:120:    public function fulfilled(): static
database/factories/OrderFactory.php:124:            'financial_status' => FinancialStatus::Paid,
database/factories/OrderFactory.php:125:            'fulfillment_status' => FulfillmentStatus::Fulfilled,
database/factories/OrderFactory.php:132:            'status' => OrderStatus::Refunded,
database/factories/OrderFactory.php:133:            'financial_status' => FinancialStatus::Refunded,
tests/Feature/Orders/FulfillmentServiceTest.php:25:function fulfillmentServiceOrder(FinancialStatus $financialStatus = FinancialStatus::Paid): array
tests/Feature/Orders/FulfillmentServiceTest.php:37:        'financial_status' => $financialStatus,
tests/Feature/Orders/FulfillmentServiceTest.php:38:        'status' => $financialStatus === FinancialStatus::Pending ? OrderStatus::Pending : OrderStatus::Paid,
tests/Feature/Orders/FulfillmentServiceTest.php:60:test('fulfillment service blocks fulfillment until payment is confirmed', function () {
tests/Feature/Orders/FulfillmentServiceTest.php:61:    [$order, $line] = fulfillmentServiceOrder(FinancialStatus::Pending);
tests/Feature/Orders/FulfillmentServiceT…8864 tokens truncated…> ['nullable', Rule::in(['pending', 'paid', 'fulfilled', 'cancelled', 'refunded'])],
app/Http/Controllers/Api/Admin/V1/OrderController.php:22:            'financial_status' => ['nullable', Rule::in(['pending', 'authorized', 'paid', 'partially_refunded', 'refunded', 'voided'])],
app/Http/Controllers/Api/Admin/V1/OrderController.php:23:            'fulfillment_status' => ['nullable', Rule::in(['unfulfilled', 'partial', 'fulfilled'])],
app/Http/Controllers/Api/Admin/V1/OrderController.php:33:            ->when(data_get($validated, 'financial_status'), fn (Builder $query, string $status) => $query->where('financial_status', $status))
app/Http/Controllers/Api/Admin/V1/OrderController.php:34:            ->when(data_get($validated, 'fulfillment_status'), fn (Builder $query, string $status) => $query->where('fulfillment_status', $status))
app/Http/Controllers/Api/Admin/V1/OrderController.php:81:            'fulfillments.lines',
app/Models/Fulfillment.php:22:        'tracking_company',
app/Models/Fulfillment.php:23:        'tracking_number',
app/Models/Fulfillment.php:24:        'tracking_url',
app/Http/Controllers/Api/Admin/V1/OrderExportController.php:23:            'filters.status' => ['nullable', Rule::in(['pending', 'paid', 'fulfilled', 'cancelled', 'refunded'])],
app/Http/Controllers/Api/Admin/V1/OrderExportController.php:24:            'filters.financial_status' => ['nullable', Rule::in(['pending', 'authorized', 'paid', 'partially_refunded', 'refunded', 'voided'])],
app/Http/Controllers/Api/Admin/V1/OrderExportController.php:25:            'filters.fulfillment_status' => ['nullable', Rule::in(['unfulfilled', 'partial', 'fulfilled'])],
database/migrations/2026_05_04_000413_create_fulfillments_table.php:14:        Schema::create('fulfillments', function (Blueprint $table) {
database/migrations/2026_05_04_000413_create_fulfillments_table.php:18:            $table->string('tracking_company')->nullable();
database/migrations/2026_05_04_000413_create_fulfillments_table.php:19:            $table->string('tracking_number')->nullable();
database/migrations/2026_05_04_000413_create_fulfillments_table.php:20:            $table->string('tracking_url')->nullable();
database/migrations/2026_05_04_000413_create_fulfillments_table.php:27:            $table->index(['tracking_company', 'tracking_number']);
database/migrations/2026_05_04_000413_create_fulfillments_table.php:36:        Schema::dropIfExists('fulfillments');
app/Models/OrderLine.php:60:    public function fulfillmentLines(): HasMany
app/Http/Controllers/Api/Admin/V1/AnalyticsSummaryController.php:137:            ->whereIn('orders.financial_status', [
app/Http/Controllers/Api/Admin/V1/AnalyticsSummaryController.php:139:                FinancialStatus::PartiallyRefunded->value,
app/Http/Requests/Api/Admin/V1/CreateOrderFulfillmentRequest.php:23:            'tracking_company' => ['nullable', 'string', 'max:255'],
app/Http/Requests/Api/Admin/V1/CreateOrderFulfillmentRequest.php:24:            'tracking_number' => ['nullable', 'string', 'max:255'],
app/Http/Requests/Api/Admin/V1/CreateOrderFulfillmentRequest.php:25:            'tracking_url' => ['nullable', 'url', 'max:2048'],
app/Http/Requests/Api/Admin/V1/CreateOrderRefundRequest.php:7:class CreateOrderRefundRequest extends FormRequest
app/Enums/PaymentStatus.php:10:    case Refunded = 'refunded';
resources/views/livewire/admin/settings/notifications.blade.php:47:                    <flux:switch wire:model="refundConfirmationEnabled" label="Refund confirmation" align="left" />
app/Http/Controllers/Api/Storefront/V1/OrderController.php:21:            ->with(['lines', 'payments', 'fulfillments.lines'])
app/Enums/FulfillmentStatus.php:7:    case Unfulfilled = 'unfulfilled';
app/Enums/FulfillmentStatus.php:9:    case Fulfilled = 'fulfilled';
resources/views/livewire/admin/customers/show.blade.php:60:                                    $statusColor = match ($order->financial_status->value) {
resources/views/livewire/admin/customers/show.blade.php:76:                                        <flux:badge :color="$statusColor">{{ Str::headline($order->financial_status->value) }}</flux:badge>
app/Http/Controllers/Api/Storefront/V1/CheckoutController.php:161:        return $order->load(['lines', 'payments', 'fulfillments.lines']);
database/migrations/2026_05_04_000414_create_fulfillment_lines_table.php:14:        Schema::create('fulfillment_lines', function (Blueprint $table) {
database/migrations/2026_05_04_000414_create_fulfillment_lines_table.php:16:            $table->foreignId('fulfillment_id')->constrained()->cascadeOnDelete();
database/migrations/2026_05_04_000414_create_fulfillment_lines_table.php:20:            $table->index('fulfillment_id');
database/migrations/2026_05_04_000414_create_fulfillment_lines_table.php:21:            $table->unique(['fulfillment_id', 'order_line_id']);
database/migrations/2026_05_04_000414_create_fulfillment_lines_table.php:30:        Schema::dropIfExists('fulfillment_lines');
app/Livewire/Storefront/Account/Orders/Show.php:52:            ->with(['lines', 'payments', 'refunds', 'fulfillments.lines'])
app/Livewire/Admin/Analytics/Index.php:189:            ->whereIn('orders.financial_status', [
app/Livewire/Admin/Analytics/Index.php:191:                FinancialStatus::PartiallyRefunded->value,
resources/views/livewire/storefront/home.blade.php:8:                    <p class="text-sm font-medium uppercase tracking-normal text-blue-700 dark:text-blue-300">{{ data_get($hero, 'eyebrow') }}</p>
resources/views/livewire/storefront/home.blade.php:9:                    <h1 class="max-w-3xl text-4xl font-semibold tracking-normal text-zinc-950 dark:text-white md:text-5xl">{{ data_get($hero, 'heading', $store->name) }}</h1>
resources/views/livewire/storefront/home.blade.php:34:                <h2 class="text-2xl font-semibold tracking-normal text-zinc-950 dark:text-white">Featured collections</h2>
resources/views/livewire/storefront/home.blade.php:56:                <h2 class="text-2xl font-semibold tracking-normal text-zinc-950 dark:text-white">Featured products</h2>
app/Enums/FinancialStatus.php:10:    case PartiallyRefunded = 'partially_refunded';
app/Enums/FinancialStatus.php:11:    case Refunded = 'refunded';
resources/views/livewire/storefront/pages/show.blade.php:5:        <h1 class="text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white">{{ $title }}</h1>
app/Livewire/Storefront/Checkout/Confirmation.php:61:            ->with(['lines', 'payments', 'fulfillments.lines'])
app/Http/Resources/Admin/V1/CustomerResource.php:35:                'financial_status' => $order->financial_status?->value,
app/Http/Resources/Admin/V1/CustomerResource.php:36:                'fulfillment_status' => $order->fulfillment_status?->value,
app/Livewire/Admin/Dashboard.php:161:            ->whereIn('orders.financial_status', $this->revenueStatuses())
app/Livewire/Admin/Dashboard.php:274:            ->whereIn('financial_status', $this->revenueStatuses());
app/Livewire/Admin/Dashboard.php:284:            FinancialStatus::PartiallyRefunded->value,
app/Http/Resources/Admin/V1/RefundResource.php:8:class RefundResource extends JsonResource
resources/views/livewire/storefront/collections/show.blade.php:8:        <h1 class="text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white">{{ $collection->title }}</h1>
app/Livewire/Admin/Orders/Show.php:5:use App\Enums\RefundStatus;
app/Livewire/Admin/Orders/Show.php:8:use App\Exceptions\InvalidRefundOperationException;
app/Livewire/Admin/Orders/Show.php:12:use App\Models\Refund;
app/Livewire/Admin/Orders/Show.php:16:use App\Services\RefundService;
app/Livewire/Admin/Orders/Show.php:37:    public array $fulfillmentLineQuantities = [];
app/Livewire/Admin/Orders/Show.php:39:    public string $trackingCompany = '';
app/Livewire/Admin/Orders/Show.php:41:    public string $trackingNumber = '';
app/Livewire/Admin/Orders/Show.php:43:    public string $trackingUrl = '';
app/Livewire/Admin/Orders/Show.php:68:            $this->dispatch('toast', type: 'success', message: __('Payment confirmed'));
app/Livewire/Admin/Orders/Show.php:76:    public function processRefund(RefundService $refunds): void
app/Livewire/Admin/Orders/Show.php:96:            $this->dispatch('toast', type: 'success', message: __('Refund processed'));
app/Livewire/Admin/Orders/Show.php:97:        } catch (InvalidRefundOperationException $exception) {
app/Livewire/Admin/Orders/Show.php:104:    public function createFulfillment(FulfillmentService $fulfillments): void
app/Livewire/Admin/Orders/Show.php:107:            'fulfillmentLineQuantities' => ['array'],
app/Livewire/Admin/Orders/Show.php:108:            'trackingCompany' => ['nullable', 'string', 'max:255'],
app/Livewire/Admin/Orders/Show.php:109:            'trackingNumber' => ['nullable', 'string', 'max:255'],
app/Livewire/Admin/Orders/Show.php:110:            'trackingUrl' => ['nullable', 'url', 'max:2048'],
app/Livewire/Admin/Orders/Show.php:113:        $lines = collect($this->fulfillmentLineQuantities)
app/Livewire/Admin/Orders/Show.php:120:                'fulfillment' => __('At least one fulfillment line is required.'),
app/Livewire/Admin/Orders/Show.php:125:            $fulfillments->create($this->order(), $lines, [
app/Livewire/Admin/Orders/Show.php:126:                'tracking_company' => $this->trackingCompany !== '' ? $this->trackingCompany : null,
app/Livewire/Admin/Orders/Show.php:127:                'tracking_number' => $this->trackingNumber !== '' ? $this->trackingNumber : null,
app/Livewire/Admin/Orders/Show.php:128:                'tracking_url' => $this->trackingUrl !== '' ? $this->trackingUrl : null,
app/Livewire/Admin/Orders/Show.php:131:            $this->trackingCompany = '';
app/Livewire/Admin/Orders/Show.php:132:            $this->trackingNumber = '';
app/Livewire/Admin/Orders/Show.php:133:            $this->trackingUrl = '';
app/Livewire/Admin/Orders/Show.php:135:            $this->modal('fulfillment-order')->close();
app/Livewire/Admin/Orders/Show.php:136:            $this->dispatch('toast', type: 'success', message: __('Fulfillment created'));
app/Livewire/Admin/Orders/Show.php:139:                'fulfillment' => $exception->getMessage(),
app/Livewire/Admin/Orders/Show.php:144:    public function markFulfillmentShipped(int $fulfillmentId, FulfillmentService $fulfillments): void
app/Livewire/Admin/Orders/Show.php:147:            $fulfillments->markShipped($this->fulfillment($fulfillmentId));
app/Livewire/Admin/Orders/Show.php:151:                'fulfillment' => $exception->getMessage(),
app/Livewire/Admin/Orders/Show.php:156:    public function markFulfillmentDelivered(int $fulfillmentId, FulfillmentService $fulfillments): void
app/Livewire/Admin/Orders/Show.php:159:            $fulfillments->markDelivered($this->fulfillment($fulfillmentId));
app/Livewire/Admin/Orders/Show.php:163:                'fulfillment' => $exception->getMessage(),
app/Livewire/Admin/Orders/Show.php:186:                'lines.fulfillmentLines',
app/Livewire/Admin/Orders/Show.php:189:                'fulfillments.lines.orderLine',
app/Livewire/Admin/Orders/Show.php:196:    private function fulfillment(int $fulfillmentId): Fulfillment
app/Livewire/Admin/Orders/Show.php:198:        $fulfillment = $this->order()
app/Livewire/Admin/Orders/Show.php:199:            ->fulfillments
app/Livewire/Admin/Orders/Show.php:200:            ->firstWhere('id', $fulfillmentId);
app/Livewire/Admin/Orders/Show.php:202:        abort_unless($fulfillment instanceof Fulfillment, 404);
app/Livewire/Admin/Orders/Show.php:204:        return $fulfillment;
app/Livewire/Admin/Orders/Show.php:214:                $fulfilled = $line->fulfillmentLines->sum('quantity');
app/Livewire/Admin/Orders/Show.php:216:                return [$line->getKey() => max(0, $line->quantity - $fulfilled)];
app/Livewire/Admin/Orders/Show.php:223:        $this->fulfillmentLineQuantities = $this->remainingFulfillmentQuantities($order);
app/Livewire/Admin/Orders/Show.php:229:            ->reject(fn (Refund $refund): bool => $refund->status === RefundStatus::Failed)
resources/views/livewire/storefront/collections/index.blade.php:5:        <h1 class="text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white">Collections</h1>
app/Http/Resources/Admin/V1/OrderResource.php:28:            'financial_status' => $this->financial_status?->value,
app/Http/Resources/Admin/V1/OrderResource.php:29:            'fulfillment_status' => $this->fulfillment_status?->value,
app/Http/Resources/Admin/V1/OrderResource.php:57:            'refunds' => RefundResource::collection($this->whenLoaded('refunds')),
app/Http/Resources/Admin/V1/OrderResource.php:58:            'fulfillments' => FulfillmentResource::collection($this->whenLoaded('fulfillments')),
app/Livewire/Admin/Orders/Index.php:29:    public string $financialStatusFilter = 'all';
app/Livewire/Admin/Orders/Index.php:31:    public string $fulfillmentStatusFilter = 'all';
app/Livewire/Admin/Orders/Index.php:96:            ->when($this->financialStatusFilter !== 'all', fn (Builder $query) => $query->where('financial_status', $this->financialStatusFilter))
app/Livewire/Admin/Orders/Index.php:97:            ->when($this->fulfillmentStatusFilter !== 'all', fn (Builder $query) => $query->where('fulfillment_status', $this->fulfillmentStatusFilter))
app/Livewire/Admin/Orders/Index.php:110:            'financialStatuses' => FinancialStatus::cases(),
app/Livewire/Admin/Orders/Index.php:111:            'fulfillmentStatuses' => FulfillmentStatus::cases(),
app/Http/Resources/Admin/V1/FulfillmentResource.php:21:            'tracking_company' => $this->tracking_company,
app/Http/Resources/Admin/V1/FulfillmentResource.php:22:            'tracking_number' => $this->tracking_number,
app/Http/Resources/Admin/V1/FulfillmentResource.php:23:            'tracking_url' => $this->tracking_url,
resources/views/livewire/storefront/account/orders/show.blade.php:11:                <h2 class="text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white">Order {{ $order->order_number }}</h2>
resources/views/livewire/storefront/account/orders/show.blade.php:50:                            <flux:badge>{{ Str::headline($order->financial_status->value) }}</flux:badge>
resources/views/livewire/storefront/account/orders/show.blade.php:51:                            <flux:badge>{{ Str::headline($order->fulfillment_status->value) }}</flux:badge>
resources/views/livewire/storefront/account/orders/show.blade.php:57:            @if ($order->fulfillments->isNotEmpty())
resources/views/livewire/storefront/account/orders/show.blade.php:61:                        @foreach ($order->fulfillments as $fulfillment)
resources/views/livewire/storefront/account/orders/show.blade.php:62:                            <div class="rounded-md border border-zinc-200 p-4 dark:border-zinc-800" wire:key="account-fulfillment-{{ $fulfillment->getKey() }}">
resources/views/livewire/storefront/account/orders/show.blade.php:64:                                    <span class="font-medium text-zinc-950 dark:text-white">{{ Str::headline($fulfillment->status->value) }}</span>
resources/views/livewire/storefront/account/orders/show.blade.php:65:                                    @if ($fulfillment->tracking_number)
resources/views/livewire/storefront/account/orders/show.blade.php:66:                                        <span class="text-sm text-zinc-500 dark:text-zinc-400">{{ $fulfillment->tracking_number }}</span>
resources/views/livewire/storefront/account/orders/show.blade.php:79:                <flux:badge>{{ Str::headline($order->financial_status->value) }}</flux:badge>
resources/views/livewire/storefront/account/orders/show.blade.php:80:                <flux:badge>{{ Str::headline($order->fulfillment_status->value) }}</flux:badge>
app/Enums/WebhookEventType.php:11:    case OrderFulfilled = 'order.fulfilled';
app/Enums/WebhookEventType.php:12:    case OrderRefunded = 'order.refunded';
app/Enums/WebhookEventType.php:18:    case FulfillmentCreated = 'fulfillment.created';
app/Enums/WebhookEventType.php:19:    case RefundCreated = 'refund.created';
app/Enums/WebhookEventType.php:28:            self::OrderFulfilled => 'Order fulfilled',
app/Enums/WebhookEventType.php:29:            self::OrderRefunded => 'Order refunded',
app/Enums/WebhookEventType.php:35:            self::FulfillmentCreated => 'Fulfillment created',
app/Enums/WebhookEventType.php:36:            self::RefundCreated => 'Refund created',
app/Enums/WebhookEventType.php:55:            self::RefundCreated,
resources/views/livewire/storefront/account/orders/index.blade.php:10:                <h2 class="text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white">Welcome back, {{ Str::before($customer->name ?: $customer->email, ' ') }}!</h2>
resources/views/livewire/storefront/account/orders/index.blade.php:38:                <h2 class="text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white">Order History</h2>
resources/views/livewire/storefront/account/orders/index.blade.php:55:                        <flux:badge>{{ Str::headline($order->financial_status->value) }}</flux:badge>
resources/views/livewire/storefront/account/orders/index.blade.php:56:                        <flux:badge>{{ Str::headline($order->fulfillment_status->value) }}</flux:badge>
app/Enums/OrderStatus.php:9:    case Fulfilled = 'fulfilled';
app/Enums/OrderStatus.php:11:    case Refunded = 'refunded';
resources/views/livewire/storefront/search/index.blade.php:5:        <h1 class="text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white">
resources/views/livewire/storefront/account/addresses/index.blade.php:10:                <h2 class="text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white">Addresses</h2>
app/Http/Resources/Storefront/V1/OrderResource.php:25:            'financial_status' => $this->financial_status?->value,
app/Http/Resources/Storefront/V1/OrderResource.php:26:            'fulfillment_status' => $this->fulfillment_status?->value,
app/Http/Resources/Storefront/V1/OrderResource.php:52:            'fulfillments' => $this->whenLoaded('fulfillments', fn () => $this->fulfillments->map(fn ($fulfillment): array => [
app/Http/Resources/Storefront/V1/OrderResource.php:53:                'id' => $fulfillment->id,
app/Http/Resources/Storefront/V1/OrderResource.php:54:                'status' => $fulfillment->status?->value,
app/Http/Resources/Storefront/V1/OrderResource.php:55:                'tracking_company' => $fulfillment->tracking_company,
app/Http/Resources/Storefront/V1/OrderResource.php:56:                'tracking_number' => $fulfillment->tracking_number,
app/Http/Resources/Storefront/V1/OrderResource.php:57:                'tracking_url' => $fulfillment->tracking_url,
app/Http/Resources/Storefront/V1/OrderResource.php:58:                'shipped_at' => $fulfillment->shipped_at?->toIso8601String(),
app/Http/Resources/Storefront/V1/OrderResource.php:59:                'delivered_at' => $fulfillment->delivered_at?->toIso8601String(),
app/Providers/AppServiceProvider.php:13:use App\Events\OrderRefunded;
app/Providers/AppServiceProvider.php:164:            OrderRefunded::class,
app/Enums/RefundStatus.php:5:enum RefundStatus: string
resources/views/livewire/storefront/checkout/show.blade.php:10:                <h1 class="text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white">Checkout</h1>
resources/views/livewire/storefront/cart/show.blade.php:8:                    <h1 class="text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white">Your Cart</h1>
resources/views/livewire/storefront/products/show.blade.php:25:                <h1 class="text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white md:text-4xl">{{ $product->title }}</h1>
resources/views/livewire/storefront/checkout/confirmation.blade.php:20:                <h1 class="mt-4 text-3xl font-semibold tracking-normal text-zinc-950 dark:text-white">


output:
Chunk ID: c856d8
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 382
Output:
app/Livewire/Admin/Orders:
Index.php
Show.php

database/factories:
AnalyticsDailyFactory.php
AnalyticsEventFactory.php
AppFactory.php
AppInstallationFactory.php
CartFactory.php
CartLineFactory.php
CheckoutFactory.php
CollectionFactory.php
CustomerAddressFactory.php
CustomerFactory.php
DataExportFactory.php
DiscountFactory.php
FulfillmentFactory.php
FulfillmentLineFactory.php
InventoryItemFactory.php
NavigationItemFactory.php
NavigationMenuFactory.php
OauthClientFactory.php
OauthTokenFactory.php
OrderFactory.php
OrderLineFactory.php
OrganizationFactory.php
PageFactory.php
PaymentFactory.php
ProductFactory.php
ProductMediaFactory.php
ProductOptionFactory.php
ProductOptionValueFactory.php
ProductVariantFactory.php
RefundFactory.php
SearchQueryFactory.php
SearchSettingsFactory.php
ShippingRateFactory.php
ShippingZoneFactory.php
StoreDomainFactory.php
StoreFactory.php
StoreSettingsFactory.php
TaxSettingsFactory.php
ThemeFactory.php
ThemeFileFactory.php
ThemeSettingsFactory.php
UserFactory.php
WebhookDeliveryFactory.php
WebhookSubscriptionFactory.php

resources/views/livewire/admin/orders:
index.blade.php
show.blade.php

tests/Feature/Admin:
AnalyticsDashboardTest.php
AppsDevelopersTest.php
ContentManagementTest.php
CustomerManagementTest.php
DashboardTest.php
DiscountManagementTest.php
OrderManagementTest.php
ProductMediaManagementTest.php
SearchSettingsTest.php
SettingsManagementTest.php

tests/Feature/Orders:
BankTransferOrderTest.php
FulfillmentServiceTest.php
OrderServiceTest.php
RefundServiceTest.php


output:
Chunk ID: f9a8c2
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 1975
Output:
<?php

use App\Enums\FinancialStatus;
use App\Enums\FulfillmentShipmentStatus;
use App\Enums\FulfillmentStatus;
use App\Enums\OrderStatus;
use App\Enums\PaymentMethod;
use App\Enums\PaymentStatus;
use App\Livewire\Admin\Orders\Index as AdminOrdersIndex;
use App\Livewire\Admin\Orders\Show as AdminOrderShow;
use App\Models\Fulfillment;
use App\Models\InventoryItem;
use App\Models\Order;
use App\Models\OrderLine;
use App\Models\Payment;
use App\Models\Product;
use App\Models\ProductVariant;
use App\Models\Store;
use App\Models\User;
use Database\Seeders\DatabaseSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;

uses(RefreshDatabase::class);

beforeEach(function () {
    $this->withoutVite();
    $this->seed(DatabaseSeeder::class);
});

function adminOrderManagementStore(): Store
{
    $store = Store::query()->where('handle', 'acme-fashion')->firstOrFail();
    app()->instance('current_store', $store);

    return $store;
}

function adminOrderManagementUser(): User
{
    return User::query()->where('email', 'admin@acme.test')->firstOrFail();
}

/**
 * @return array{0: Order, 1: OrderLine, 2: ProductVariant}
 */
function adminOrderManagementOrder(Store $store, array $orderAttributes = [], int $quantity = 2, int $unitPrice = 2500): array
{
    $product = Product::factory()
        ->withDefaultVariant($unitPrice)
        ->create(['store_id' => $store->getKey()]);
    $variant = ProductVariant::withoutGlobalScopes()
        ->where('product_id', $product->getKey())
        ->firstOrFail();

    InventoryItem::withoutGlobalScopes()
        ->where('variant_id', $variant->getKey())
        ->update([
            'quantity_on_hand' => 10,
            'quantity_reserved' => 0,
        ]);

    $total = $quantity * $unitPrice;
    $order = Order::factory()->paid()->create(array_merge([
        'store_id' => $store->getKey(),
        'subtotal_amount' => $total,
        'shipping_amount' => 0,
        'tax_amount' => 0,
        'total_amount' => $total,
        'email' => 'buyer@example.test',
    ], $orderAttributes));
    $line = OrderLine::factory()->create([
        'order_id' => $order->getKey(),
        'product_id' => $product->getKey(),
        'variant_id' => $variant->getKey(),
        'title_snapshot' => 'Admin Test Product',
        'sku_snapshot' => 'ADMIN-TEST-001',
        'quantity' => $quantity,
        'unit_price_amount' => $unitPrice,
        'total_amount' => $total,
    ]);

    Payment::factory()->create([
        'order_id' => $order->getKey(),
        'method' => $order->payment_method,
        'status' => $order->financial_status === FinancialStatus::Pending ? PaymentStatus::Pending : PaymentStatus::Captured,
        'amount' => $total,
        'currency' => $order->currency,
    ]);

    return [$order, $line, $variant];
}

test('admin order routes require authentication and render scoped orders', function () {
    $store = adminOrderManagementStore();
    [$order] = adminOrderManagementOrder($store, [
        'order_number' => '#7001',
        'email' => 'alpha@example.test',
    ]);

    $otherStore = Store::factory()->create();
    adminOrderManagementOrder($otherStore, [
        'order_number' => '#9001',
        'email' => 'other@example.test',
    ]);

    $this->get('/admin/orders')->assertRedirect('/admin/login');

    $user = adminOrderManagementUser();

    $this->actingAs($user)
        ->get('/admin/orders')
        ->assertSuccessful()
        ->assertSee('#7001')
        ->assertDontSee('#9001');

    $this->actingAs($user)
        ->get('/admin/orders/'.$order->getKey())
        ->assertSuccessful()
        ->assertSee('#7001')
        ->assertSee('Admin Test Product');
});

test('admin order index filters by search and status dimensions', function () {
    $store = adminOrderManagementStore();
    $user = adminOrderManagementUser();
    adminOrderManagementOrder($store, [
        'order_number' => '#7001',
        'email' => 'alpha@example.test',
    ]);
    adminOrderManagementOrder($store, [
        'order_number' => '#7002',
        'email' => 'bravo@example.test',
        'status' => OrderStatus::Pending,
        'financial_status' => FinancialStatus::Pending,
        'payment_method' => PaymentMethod::BankTransfer,
    ]);

    Livewire::actingAs($user)
        ->test(AdminOrdersIndex::class)
        ->assertSee('#7001')
        ->assertSee('#7002')
        ->set('search', 'alpha')
        ->assertSee('#7001')
        ->assertDontSee('#7002')
        ->set('search', '')
        ->set('financialStatusFilter', 'pending')
        ->assertSee('#7002')
        ->assertDontSee('#7001');
});

test('admin order detail confirms bank transfer payments', function () {
    $store = adminOrderManagementStore();
    $user = adminOrderManagementUser();
    [$order, $line, $variant] = adminOrderManagementOrder($store, [
        'payment_method' => PaymentMethod::BankTransfer,
        'status' => OrderStatus::Pending,
        'financial_status' => FinancialStatus::Pending,
    ]);

    InventoryItem::withoutGlobalScopes()
        ->where('variant_id', $variant->getKey())
        ->update(['quantity_reserved' => $line->quantity]);

    Livewire::actingAs($user)
        ->test(AdminOrderShow::class, ['order' => $order])
        ->call('confirmBankTransferPayment')
        ->assertHasNoErrors();

    $inventory = InventoryItem::withoutGlobalScopes()->where('variant_id', $variant->getKey())->firstOrFail();

    expect($order->refresh()->status)->toBe(OrderStatus::Paid)
        ->and($order->financial_status)->toBe(FinancialStatus::Paid)
        ->and($order->payments()->first()?->status)->toBe(PaymentStatus::Captured)
        ->and($inventory->quantity_on_hand)->toBe(8)
        ->and($inventory->quantity_reserved)->toBe(0);
});

test('admin order detail processes refunds and fulfillment transitions', function () {
    $store = adminOrderManagementStore();
    $user = adminOrderManagementUser();
    [$order, $line] = adminOrderManagementOrder($store, quantity: 2, unitPrice: 2500);

    Livewire::actingAs($user)
        ->test(AdminOrderShow::class, ['order' => $order])
        ->set('refundAmount', '10.00')
        ->set('refundReason', 'Customer return')
        ->call('processRefund')
        ->assertHasNoErrors();

    expect($order->refresh()->financial_status)->toBe(FinancialStatus::PartiallyRefunded)
        ->and($order->refunds()->first()?->amount)->toBe(1000);

    Livewire::actingAs($user)
        ->test(AdminOrderShow::class, ['order' => $order->refresh()])
        ->set("fulfillmentLineQuantities.{$line->getKey()}", 1)
        ->set('trackingCompany', 'DHL')
        ->set('trackingNumber', 'DHL123')
        ->call('createFulfillment')
        ->assertHasNoErrors();

    $fulfillment = Fulfillment::query()->where('order_id', $order->getKey())->firstOrFail();

    expect($order->refresh()->fulfillment_status)->toBe(FulfillmentStatus::Partial)
        ->and($fulfillment->lines()->first()?->quantity)->toBe(1);

    Livewire::actingAs($user)
        ->test(AdminOrderShow::class, ['order' => $order->refresh()])
        ->call('markFulfillmentShipped', $fulfillment->getKey())
        ->call('markFulfillmentDelivered', $fulfillment->getKey())
        ->assertHasNoErrors();

    expect($fulfillment->refresh()->status)->toBe(FulfillmentShipmentStatus::Delivered)
        ->and($fulfillment->delivered_at)->not->toBeNull();
});

test('admin order detail rejects orders from another store', function () {
    $store = adminOrderManagementStore();
    $otherStore = Store::factory()->create();
    $user = adminOrderManagementUser();
    [$otherOrder] = adminOrderManagementOrder($otherStore, [
        'order_number' => '#9001',
    ]);

    app()->instance('current_store', $store);

    Livewire::actingAs($user)
        ->test(AdminOrderShow::class, ['order' => $otherOrder])
        ->assertStatus(404);
});


cmd: sed -n '1,260p' app/Livewire/Admin/Orders/Index.php


cmd: sed -n '1,320p' app/Livewire/Admin/Orders/Show.php


cmd: sed -n '1,260p' resources/views/livewire/admin/orders/index.blade.php


cmd: sed -n '1,360p' resources/views/livewire/admin/orders/show.blade.php


command: sed -n '1,260p' app/Livewire/Admin/Orders/Index.php

aggregated_output:
<?php

namespace App\Livewire\Admin\Orders;

use App\Enums\FinancialStatus;
use App\Enums\FulfillmentStatus;
use App\Enums\OrderStatus;
use App\Models\Order;
use App\Models\Store;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Livewire\Attributes\Locked;
use Livewire\Component;
use Livewire\WithPagination;
use Throwable;

class Index extends Component
{
    use WithPagination;

    #[Locked]
    public int $storeId;

    public string $search = '';

    public string $statusFilter = 'all';

    public string $financialStatusFilter = 'all';

    public string $fulfillmentStatusFilter = 'all';

    public string $dateFrom = '';

    public string $dateTo = '';

    public function mount(): void
    {
        $store = app('current_store');

        abort_unless($store instanceof Store, 404);

        $this->storeId = $store->getKey();
    }

    public function updatedSearch(): void
    {
        $this->resetPage();
    }

    public function updatedStatusFilter(): void
    {
        $this->resetPage();
    }

    public function updatedFinancialStatusFilter(): void
    {
        $this->resetPage();
    }

    public function updatedFulfillmentStatusFilter(): void
    {
        $this->resetPage();
    }

    public function updatedDateFrom(): void
    {
        $this->resetPage();
    }

    public function updatedDateTo(): void
    {
        $this->resetPage();
    }

    public function orders(): LengthAwarePaginator
    {
        $dateFrom = $this->parsedDate($this->dateFrom);
        $dateTo = $this->parsedDate($this->dateTo, endOfDay: true);

        return Order::withoutGlobalScopes()
            ->with('customer')
            ->withCount('lines')
            ->where('store_id', $this->storeId)
            ->when($this->search !== '', function (Builder $query): void {
                $search = '%'.$this->search.'%';

                $query->where(function (Builder $query) use ($search): void {
                    $query
                        ->where('order_number', 'like', $search)
                        ->orWhere('email', 'like', $search)
                        ->orWhereHas('customer', fn (Builder $query) => $query->where('name', 'like', $search));
                });
            })
            ->when($this->statusFilter !== 'all', fn (Builder $query) => $query->where('status', $this->statusFilter))
            ->when($this->financialStatusFilter !== 'all', fn (Builder $query) => $query->where('financial_status', $this->financialStatusFilter))
            ->when($this->fulfillmentStatusFilter !== 'all', fn (Builder $query) => $query->where('fulfillment_status', $this->fulfillmentStatusFilter))
            ->when($dateFrom instanceof Carbon, fn (Builder $query) => $query->where('placed_at', '>=', $dateFrom))
            ->when($dateTo instanceof Carbon, fn (Builder $query) => $query->where('placed_at', '<=', $dateTo))
            ->latest('placed_at')
            ->latest('id')
            ->paginate(20);
    }

    public function render(): mixed
    {
        return view('livewire.admin.orders.index', [
            'orders' => $this->orders(),
            'statuses' => OrderStatus::cases(),
            'financialStatuses' => FinancialStatus::cases(),
            'fulfillmentStatuses' => FulfillmentStatus::cases(),
        ])->layout('layouts.app', [
            'title' => __('Orders'),
        ]);
    }

    private function parsedDate(string $value, bool $endOfDay = false): ?Carbon
    {
        if ($value === '') {
            return null;
        }

        try {
            $date = Carbon::parse($value);

            return $endOfDay ? $date->endOfDay() : $date->startOfDay();
        } catch (Throwable) {
            return null;
        }
    }
}


command: sed -n '1,320p' app/Livewire/Admin/Orders/Show.php

aggregated_output:
<?php

namespace App\Livewire\Admin\Orders;

use App\Enums\RefundStatus;
use App\Exceptions\InvalidFulfillmentOperationException;
use App\Exceptions\InvalidOrderOperationException;
use App\Exceptions\InvalidRefundOperationException;
use App\Models\Fulfillment;
use App\Models\Order;
use App\Models\OrderLine;
use App\Models\Refund;
use App\Models\Store;
use App\Services\FulfillmentService;
use App\Services\OrderService;
use App\Services\RefundService;
use App\Support\Money;
use Illuminate\Validation\ValidationException;
use Livewire\Attributes\Locked;
use Livewire\Component;

class Show extends Component
{
    #[Locked]
    public int $storeId;

    #[Locked]
    public int $orderId;

    public string $refundAmount = '';

    public string $refundReason = '';

    /**
     * @var array<int, int>
     */
    public array $fulfillmentLineQuantities = [];

    public string $trackingCompany = '';

    public string $trackingNumber = '';

    public string $trackingUrl = '';

    public function mount(Order $order): void
    {
        $store = app('current_store');

        abort_unless($store instanceof Store, 404);

        $order = Order::withoutGlobalScopes()
            ->where('store_id', $store->getKey())
            ->whereKey($order->getKey())
            ->first();

        abort_unless($order instanceof Order, 404);

        $this->storeId = $store->getKey();
        $this->orderId = $order->getKey();
        $this->resetFulfillmentLineQuantities($this->order());
    }

    public function confirmBankTransferPayment(OrderService $orders): void
    {
        try {
            $orders->confirmBankTransferPayment($this->order());
            $this->resetFulfillmentLineQuantities($this->order());
            $this->dispatch('toast', type: 'success', message: __('Payment confirmed'));
        } catch (InvalidOrderOperationException $exception) {
            throw ValidationException::withMessages([
                'orderAction' => $exception->getMessage(),
            ]);
        }
    }

    public function processRefund(RefundService $refunds): void
    {
        $this->validate([
            'refundAmount' => ['nullable', 'numeric', 'min:0.01'],
            'refundReason' => ['nullable', 'string', 'max:500'],
        ]);

        $request = [
            'reason' => $this->refundReason !== '' ? $this->refundReason : null,
        ];

        if ($this->refundAmount !== '') {
            $request['amount'] = Money::fromDecimalString($this->refundAmount);
        }

        try {
            $refunds->process($this->order(), $request);
            $this->refundAmount = '';
            $this->refundReason = '';
            $this->modal('refund-order')->close();
            $this->dispatch('toast', type: 'success', message: __('Refund processed'));
        } catch (InvalidRefundOperationException $exception) {
            throw ValidationException::withMessages([
                'refundAmount' => $exception->getMessage(),
            ]);
        }
    }

    public function createFulfillment(FulfillmentService $fulfillments): void
    {
        $this->validate([
            'fulfillmentLineQuantities' => ['array'],
            'trackingCompany' => ['nullable', 'string', 'max:255'],
            'trackingNumber' => ['nullable', 'string', 'max:255'],
            'trackingUrl' => ['nullable', 'url', 'max:2048'],
        ]);

        $lines = collect($this->fulfillmentLineQuantities)
            ->mapWithKeys(fn (mixed $quantity, int|string $lineId): array => [(int) $lineId => (int) $quantity])
            ->filter(fn (int $quantity): bool => $quantity > 0)
            ->all();

        if ($lines === []) {
            throw ValidationException::withMessages([
                'fulfillment' => __('At least one fulfillment line is required.'),
            ]);
        }

        try {
            $fulfillments->create($this->order(), $lines, [
                'tracking_company' => $this->trackingCompany !== '' ? $this->trackingCompany : null,
                'tracking_number' => $this->trackingNumber !== '' ? $this->trackingNumber : null,
                'tracking_url' => $this->trackingUrl !== '' ? $this->trackingUrl : null,
            ]);

            $this->trackingCompany = '';
            $this->trackingNumber = '';
            $this->trackingUrl = '';
            $this->resetFulfillmentLineQuantities($this->order());
            $this->modal('fulfillment-order')->close();
            $this->dispatch('toast', type: 'success', message: __('Fulfillment created'));
        } catch (InvalidFulfillmentOperationException $exception) {
            throw ValidationException::withMessages([
                'fulfillment' => $exception->getMessage(),
            ]);
        }
    }

    public function markFulfillmentShipped(int $fulfillmentId, FulfillmentService $fulfillments): void
    {
        try {
            $fulfillments->markShipped($this->fulfillment($fulfillmentId));
            $this->dispatch('toast', type: 'success', message: __('Fulfillment marked as shipped'));
        } catch (InvalidFulfillmentOperationException $exception) {
            throw ValidationException::withMessages([
                'fulfillment' => $exception->getMessage(),
            ]);
        }
    }

    public function markFulfillmentDelivered(int $fulfillmentId, FulfillmentService $fulfillments): void
    {
        try {
            $fulfillments->markDelivered($this->fulfillment($fulfillmentId));
            $this->dispatch('toast', type: 'success', message: __('Fulfillment marked as delivered'));
        } catch (InvalidFulfillmentOperationException $exception) {
            throw ValidationException::withMessages([
                'fulfillment' => $exception->getMessage(),
            ]);
        }
    }

    public function render(): mixed
    {
        $order = $this->order();

        return view('livewire.admin.orders.show', [
            'order' => $order,
            'remainingFulfillmentQuantities' => $this->remainingFulfillmentQuantities($order),
            'refundableAmount' => $this->refundableAmount($order),
        ])->layout('layouts.app', [
            'title' => $order->order_number,
        ]);
    }

    private function order(): Order
    {
        return Order::withoutGlobalScopes()
            ->with([
                'customer',
                'lines.fulfillmentLines',
                'payments',
                'refunds',
                'fulfillments.lines.orderLine',
            ])
            ->where('store_id', $this->storeId)
            ->whereKey($this->orderId)
            ->firstOrFail();
    }

    private function fulfillment(int $fulfillmentId): Fulfillment
    {
        $fulfillment = $this->order()
            ->fulfillments
            ->firstWhere('id', $fulfillmentId);

        abort_unless($fulfillment instanceof Fulfillment, 404);

        return $fulfillment;
    }

    /**
     * @return array<int, int>
     */
    private function remainingFulfillmentQuantities(Order $order): array
    {
        return $order->lines
            ->mapWithKeys(function (OrderLine $line): array {
                $fulfilled = $line->fulfillmentLines->sum('quantity');

                return [$line->getKey() => max(0, $line->quantity - $fulfilled)];
            })
            ->all();
    }

    private function resetFulfillmentLineQuantities(Order $order): void
    {
        $this->fulfillmentLineQuantities = $this->remainingFulfillmentQuantities($order);
    }

    private function refundableAmount(Order $order): int
    {
        $refunded = $order->refunds
            ->reject(fn (Refund $refund): bool => $refund->status === RefundStatus::Failed)
            ->sum('amount');

        return max(0, $order->total_amount - $refunded);
    }
}


command: sed -n '1,260p' resources/views/livewire/admin/orders/index.blade.php

aggregated_output:
        <flux:heading size="xl">Orders</flux:heading>
        <flux:text class="mt-1">Review orders, payment status, and fulfillment progress.</flux:text>

        <flux:input wire:model.live.debounce.300ms="search" icon="magnifying-glass" placeholder="Search orders or customers..." aria-label="Search orders" />

        <flux:select wire:model.live="statusFilter" aria-label="Order status filter">
            <flux:select.option value="all">All orders</flux:select.option>
            @foreach ($statuses as $status)
                <flux:select.option value="{{ $status->value }}">{{ Str::title($status->value) }}</flux:select.option>
            @endforeach
        </flux:select>

        <flux:select wire:model.live="financialStatusFilter" aria-label="Financial status filter">
            <flux:select.option value="all">All financial</flux:select.option>
            @foreach ($financialStatuses as $status)
                <flux:select.option value="{{ $status->value }}">{{ Str::headline($status->value) }}</flux:select.option>
            @endforeach
        </flux:select>

        <flux:select wire:model.live="fulfillmentStatusFilter" aria-label="Fulfillment status filter">
            <flux:select.option value="all">All fulfillment</flux:select.option>
            @foreach ($fulfillmentStatuses as $status)
                <flux:select.option value="{{ $status->value }}">{{ Str::headline($status->value) }}</flux:select.option>
            @endforeach
        </flux:select>

        <flux:input type="date" wire:model.live="dateFrom" aria-label="Placed from" />
        <flux:input type="date" wire:model.live="dateTo" aria-label="Placed to" />

                        Order
                        Customer
                        Status
                        Fulfillment
                        Items
                        Total
                        Placed

                    @forelse ($orders as $order)
                        @php
                            $financialColor = match ($order->financial_status->value) {
                                'paid' => 'green',
                                'partially_refunded' => 'amber',
                                'refunded', 'voided' => 'red',
                                default => 'zinc',
                            };
                            $fulfillmentColor = match ($order->fulfillment_status->value) {
                                'fulfilled' => 'green',
                                'partial' => 'amber',
                                default => 'zinc',
                            };
                        @endphp

getKey() }}">

                                    {{ $order->order_number }}

{{ Str::headline($order->status->value) }}

{{ $order->customer?->name ?: 'Guest' }}

{{ $order->email }}

                                <flux:badge :color="$financialColor">{{ Str::headline($order->financial_status->value) }}</flux:badge>

                                <flux:badge :color="$fulfillmentColor">{{ Str::headline($order->fulfillment_status->value) }}</flux:badge>

                            {{ $order->lines_count }}

                                <x-storefront.price :amount="$order->total_amount" :currency="$order->currency" class="justify-end" />

                            {{ $order->placed_at?->format('M j, Y H:i') }}

                    @empty

                                        <flux:icon name="shopping-bag" class="size-6" />

                                    <flux:heading size="lg">No orders found</flux:heading>
                                    <flux:text>Orders will appear here after checkout completion.</flux:text>

                    @endforelse

    {{ $orders->links() }}