REPOSITORY CODING · HARD
Validate quote histories without conflating supplier identities
Conflicting revisions escape validation when a newer quote was seen first, and slash-delimited keys merge different supplier/quote pairs. Use an unambiguous composite identity and validate every normalized revision before latest-selection. Identical redelivery remains harmless, including tier arrays supplied in a different order.
Repository ImplementationSupplier quotation comparison desk
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
PHP · 75 minute session
- Compare quotes for a requested SKU and positive quantity. Buy whole packs, rounding the pack count up. The quote must have enough stock packs and leadDays no greater than maxLeadDays.
- Prices use integer cents in one already-agreed currency. Each quote has quantity tiers in packs, including minPacks=1. Use the greatest threshold reached by the purchased pack count. Thresholds may be supplied in any order.
- For tax-exclusive prices, add basis-point tax rounded half-up once on the entire goods line. Do not add tax again for tax-inclusive quotes. ShippingCents is an already-taxed final amount added once.
- Quote identity is supplier plus id. Resolve the highest revision before eligibility filtering. A quote expires at now >= expires. Do not resurrect an older revision when a newer one is expired or ineligible.
- Return eligible options ordered by totalCents, leadDays, supplier and quote ID; the first is recommended or null. Return excluded latest quotes ordered by supplier and ID, with reason precedence different-sku, expired, late, insufficient-stock.
- Reject contradictory same revisions, duplicate tier thresholds and invalid numeric values. Exact duplicate deliveries are ignored. This service compares proposals only; it does not place orders or make payments.