feat: one price per product; the grade is shown but no longer prices
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 3m58s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m11s
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 3m58s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m11s
Dropstar asked on 2026-10-23 to drop the five-band ladder by grade: textile R$ 19,90 a ready sheet and R$ 21,90 loose art, UV R$ 79,90 and R$ 89,90. - the server charges PRICES (app/core/pricing.py) whatever the grade; the grade is still validated and kept with the item, and discount_cents is gone - a file opened by hand pays the product's price plus MANUAL_FILE_EXTRA_CENTS - the Site's PRECO replaces FAIXAS, TABELA and MONTAGEM; the top chip, the home example, the product cards, the selector and the price table read it (data-preco), so no page still says "a partir de R$ 14,90" - no "Desconto pela nota", ladder, "cai até" or "sai mais barato" anywhere; the buy box shows "Nota da arte" on its own line, the 96 DPI refusal and the resolution warning stay - the review reason "Nota informada sem análise da arte" is removed: it only stopped a discount. The server still checks the grade against the files, so the grade shown on the Kanban and in Tiny stays honest - the Tiny probe's test order uses the single price - docs/CONTEXT.md: Commercial rules and Still to do Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,23 +1,19 @@
|
||||
"""Exact approved Site DTF price ladders; integer BRL cents at the boundary.
|
||||
"""Dropstar's single price per metre for each product; integer BRL cents at the boundary.
|
||||
|
||||
Quantity/grade must be supplied by an authenticated commercial reviewer.
|
||||
This module does not inspect artwork or perform pre-flight.
|
||||
One price per product (Dropstar, 2026-10-23). The grade is still recorded with
|
||||
each item, for the customer and the print room, but it no longer changes the
|
||||
price. This module does not inspect artwork or perform pre-flight.
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
from decimal import Decimal, ROUND_CEILING
|
||||
|
||||
TIERS = {
|
||||
'file': [(90,1490),(75,1620),(60,1750),(40,1870),(0,1990)],
|
||||
'avulsa': [(90,2490),(75,2620),(60,2750),(40,2870),(0,2990)],
|
||||
'uvfile': [(90,6990),(75,7390),(60,7790),(40,8190),(0,8590)],
|
||||
'uv': [(90,8390),(75,8790),(60,9190),(40,9590),(0,9990)],
|
||||
}
|
||||
PRICES = {'file': 1990, 'avulsa': 2190, 'uvfile': 7990, 'uv': 8990}
|
||||
|
||||
# A finished sheet the Site cannot open (CDR, AI, PSD, TIFF) is opened by a
|
||||
# person before printing. It is priced at the top of the ladder, plus this per
|
||||
# metre when the business sets it, to make the formats the robot reads the
|
||||
# cheaper path. Zero (the default) adds nothing.
|
||||
# person before printing. It pays this per metre on top of the product's price
|
||||
# when the business sets it, to make the formats the robot reads the cheaper
|
||||
# path. Zero adds nothing.
|
||||
MANUAL_FORMATS = re.compile(r'\.(cdr|ai|psd|psb|tiff?)$', re.I)
|
||||
|
||||
|
||||
@@ -37,21 +33,20 @@ def is_manual(item, names) -> bool:
|
||||
|
||||
|
||||
def price(mode: str, metres: str, grade: int, extra_cents: int = 0) -> dict:
|
||||
"""The item's charge. The grade is validated and kept with the item; the
|
||||
price does not depend on it."""
|
||||
length = Decimal(str(metres))
|
||||
if mode not in TIERS or not length.is_finite() or not 0 < length <= 12000:
|
||||
if mode not in PRICES or not length.is_finite() or not 0 < length <= 12000:
|
||||
raise ValueError('Invalid product or length')
|
||||
if isinstance(grade, bool) or not isinstance(grade, int) or not 0 <= grade <= 100:
|
||||
raise ValueError('Grade must be an integer between 0 and 100')
|
||||
billed = max(Decimal('1'), (length * 10).to_integral_value(rounding=ROUND_CEILING) / 10)
|
||||
if isinstance(extra_cents, bool) or not isinstance(extra_cents, int) or extra_cents < 0:
|
||||
raise ValueError('Invalid extra charge')
|
||||
tier = next(cents for minimum, cents in TIERS[mode] if grade >= minimum)
|
||||
unit = tier + extra_cents
|
||||
unit = PRICES[mode] + extra_cents
|
||||
priced = {'mode': mode, 'metres': str(length), 'grade': grade,
|
||||
'billed_metres': str(billed), 'unit_cents': unit,
|
||||
'total_cents': int(billed * unit),
|
||||
'discount_cents': int(billed * (TIERS[mode][-1][1] - tier))}
|
||||
'total_cents': int(billed * unit)}
|
||||
if extra_cents:
|
||||
priced['manual_extra_cents'] = extra_cents
|
||||
return priced
|
||||
|
||||
|
||||
Reference in New Issue
Block a user