factory/shape-catalog (0.3.0)
Published 2026-08-06 01:35:50 +00:00 by bmiadmin
Installation
{
"repositories": [{
"type": "composer",
"url": " "
}
]
}composer require factory/shape-catalog:0.3.0About this package
Shape E: catalog commerce. Products, variants, carts, checkout and shop orders (PetWorld shop, AppsGate).
factory/shape-catalog — v0.1.0
Shape E — catalog commerce: products → cart → checkout → shop order
(PetWorld shop, AppsGate storefront). JSON field names follow the same
snake_case + *_minor conventions as factory_core (models.dart wins).
Endpoints (all under /api, product resolved via X-Product-Slug or default)
| Method | Path | Body / notes | Response |
|---|---|---|---|
| GET | /catalog | ?q=&category=&per_page= |
{ok, data:[CatalogProduct + variants], meta} |
| GET | /catalog/{id} | flat product | |
| GET | /cart | the user's single open cart (auto-created) | flat cart {id, status, subtotal_minor, items} |
| POST | /cart/items | catalog_product_id (+opt variant_id, qty) — merges duplicate lines |
flat cart, 201 |
| PATCH | /cart/items/{itemId} | qty (0 removes the line) |
flat cart |
| POST | /cart/checkout | address (+opt payment_label, fee_minor, tax_minor) |
flat ShopOrder, 201 |
| GET | /shop/orders | per X-User-Ref (default demo) |
{ok, data:[ShopOrder], meta} |
| GET | /shop/orders/{id} | flat ShopOrder | |
| PATCH | /shop/orders/{id} | status — forward-only FSM transition |
flat ShopOrder |
Behaviour
- Delivery fee defaults from product knobs:
delivery_fee_minor, waived atfree_delivery_over_minor(PetWorld: GHS 25 flat, free over GHS 400); tax fromtax_bps(basis points, int —Money::taxMinor). - Shop orders run the
shop_statusesknob lifecycle if set (PetWorld: Placed → Packed → Out for delivery → Delivered), else the product's primary FSM. Transitions are forward-only, timestamped, audited in-transaction (audit failure rolls the change back). - Checkout is audited in the same transaction as the order write — no
audit ⇒ no order — and flips the cart to
checked_out. - Tables:
catalog_products,catalog_variants,carts,cart_items,shop_orders,shop_order_items— catalog/cart/order rows product-scoped (product_slug).
Dependencies
Dependencies
| ID | Version |
|---|---|
| factory/auth | ^0.3 |
| factory/infra | ^0.1 || ^0.2 |
| factory/kernel | ^0.4 || ^0.5 || ^0.6 || ^0.7 || ^0.8 || ^0.9 |
| illuminate/database | ^10.0 || ^11.0 || ^12.0 || ^13.0 |
| illuminate/routing | ^10.0 || ^11.0 || ^12.0 || ^13.0 |
| illuminate/support | ^10.0 || ^11.0 || ^12.0 || ^13.0 |
| php | ^8.2 |
Development dependencies
| ID | Version |
|---|---|
| orchestra/testbench | ^8.0 || ^9.0 || ^10.0 || ^11.0 |
| phpunit/phpunit | ^10.1 || ^11.0 || ^12.0 |
Details
2026-08-06 01:35:50 +00:00
Assets (1)
Versions (3)
View all
Composer
54
proprietary
24 KiB