Commit Graph

41 Commits

Author SHA1 Message Date
Fabian @ Blax Software 8eb1802ef8 feat: promote IsLoanableProduct to MayBeLoanableProduct on Product
Renames the host-attached IsLoanableProduct trait to MayBeLoanableProduct
and mixes it directly into Product, matching the existing MayBePoolProduct
shape. Hosts opt in with a single DEFAULT_TYPE constant — no more manual
`use ...Trait` ceremony to forget:

    class Book extends Product
    {
        public const DEFAULT_TYPE = ProductType::LOANABLE;
    }

The boot hook reads DEFAULT_TYPE on the concrete class and only applies
the LOANABLE creating-defaults (type, status, is_visible, manage_stock)
when it matches; type-specific helpers (checkOutTo, total_quantity,
available_quantity) early-out via isLoanable() so they're harmless on
non-loanable products. checkOutTo now throws NotLoanableProductException
when called on the wrong type, mirroring NotPoolProductException.

Also fixes total_quantity for the loan lifecycle: previously summed every
INCREASE entry in product_stocks, which inflated the displayed total
after each loan cycle because returns fire increaseStock(). Now reports
physical inventory as availableStock + activeLoans.

README gains a Testing section that surfaces the current phpunit summary
line, plus passing and assertion-count badges linking to it.
2026-05-16 12:17:38 +02:00
Fabian @ Blax Software afdcd8bc75 feat: Enhance traits with strict types and improve method signatures
- Added strict types declaration to multiple traits for better type safety.
- Updated method signatures in traits to use nullable types where applicable.
- Improved documentation for traits, including host-model contracts and method descriptions.
- Added new tests to ensure correct behavior of loan checkout and stock management.
- Fixed regression in order number generation to ensure proper string formatting.
- Ensured that currency codes sent to Stripe are consistently lowercased.
2026-05-15 20:26:24 +02:00
Fabian @ Blax Software fe41475c84 I loanable product type, tiered pricing, lifecycle events, host helpers 2026-05-15 10:27:59 +02:00
Fabian @ Blax Software 7aeffd27a9 RI optimizations 2025-12-29 11:11:27 +01:00
Fabian @ Blax Software 6e9c9043ae I order, A handy methods 2025-12-29 10:26:51 +01:00
a6a2f5842 70adf0b0c6 BFI cart availability 2025-12-26 08:42:59 +01:00
Fabian @ Blax Software 20e6538626 BFI pool cart 2025-12-20 11:22:04 +01:00
Fabian @ Blax Software 145c629786 BFI cart stock, A exceptions 2025-12-19 14:26:57 +01:00
Fabian @ Blax Software dbc297122e BF pool cart 2025-12-19 12:25:59 +01:00
Fabian @ Blax Software f20637770f I pool cart support, tests 2025-12-19 10:57:26 +01:00
Fabian @ Blax Software c5b78071e7 IA booking checking & simplifications, A test/trait 2025-12-18 16:54:33 +01:00
Fabian @ Blax Software a12738db1c BF race condition 2025-12-18 09:57:33 +01:00
Fabian @ Blax Software 3d7a273946 BFI cart & tests 2025-12-17 16:43:22 +01:00
Fabian @ Blax Software 2f0d0757ee BF cart item pool calculation 2025-12-17 10:41:52 +01:00
Fabian @ Blax Software 7478f69bcf I cart facade 2025-12-17 09:24:42 +01:00
Fabian @ Blax Software edbf116c48 AIBFR pool/booking/cart 2025-12-16 13:58:03 +01:00
Fabian @ Blax Software 3045f72304 BFI cart, A stripe logic, checkout & tests, A tests, RA pool product 2025-12-15 14:10:59 +01:00
Fabian @ Blax Software d2cf70ce44 ABFI cart, cartitems, pool/bookings, tests 2025-12-15 12:28:15 +01:00
Fabian @ Blax Software 67917e6a31 A booking/pool procedures & tests, IA tests, exceptions 2025-12-15 11:32:31 +01:00
Fabian @ Blax Software beebee6b82 BF self to static, which allows extendable models 2025-12-09 09:09:23 +01:00
Fabian @ Blax Software 4a303c0f3f I category methods, IRA product relations & tests 2025-12-05 09:21:07 +01:00
Fabian @ Blax Software fe0fa63919 IA product category scopes & methods, I adjust stock method, R stocks 2025-12-04 12:35:39 +01:00
Fabian @ Blax Software c711afb570 R reserve to claim 2025-12-04 11:06:09 +01:00
a6a2f5842 c5004158eb A types, enums & statuses, U product models, I shopping trait, A booking support, R tests 2025-12-03 13:59:01 +01:00
a6a2f5842 2008a16a53 I price factory, RA product traits 2025-12-03 13:21:23 +01:00
a6a2f5842 5dcbf73be3 BF product fillables 2025-12-02 10:58:43 +01:00
a6a2f5842 a4fedcdb58 A tests, I product action 2025-11-29 20:09:19 +01:00
a6a2f5842 bc8158ba7b BF test 2025-11-29 08:32:58 +01:00
a6a2f5842 ffc8716c22 A stripe & BFI cart 2025-11-28 10:24:07 +01:00
a6a2f5842 82ee18b0f1 I tests & documentation 2025-11-25 17:25:20 +01:00
a6a2f5842 3593a462a1 I basic tests 2025-11-25 17:14:00 +01:00
a6a2f5842 5fb31d0c4f D basic tests 2025-11-25 17:02:39 +01:00
a6a2f5842 01c21506b6 BFI tests 2025-11-25 12:33:42 +01:00
a6a2f5842 7c6b61da45 BFI tests 2025-11-24 14:32:11 +01:00
a6a2f5842 c1f531e659 BFI tests 2025-11-24 07:00:07 +01:00
a6a2f5842 ab1e2468ca BFI tests fixing, prices, purchases, cart 2025-11-23 15:07:12 +01:00
a6a2f5842 fda536deea BFIM bugfixed failed tests 2025-11-22 18:09:45 +01:00
a6a2f5842 2c31b6ea98 IM product purchase process 2025-11-22 15:13:30 +01:00
a6a2f5842 afe7359ea4 R product columns 2025-11-22 09:55:58 +01:00
a6a2f5842 b76ae2f867 MI product name, short and description 2025-11-21 15:55:15 +01:00
a6a2f5842 d610cc5717 init 2025-11-21 11:49:41 +01:00