feat: the cart offers Correios PAC and SEDEX next to Jadlog
All checks were successful
Build and deploy / Validate source (push) Successful in 1m48s
Build and deploy / Integration suite on a real stack (push) Successful in 4m25s
Build and deploy / Secret scan and release gate (push) Successful in 15s
Build and deploy / Publish images (push) Successful in 1m54s
All checks were successful
Build and deploy / Validate source (push) Successful in 1m48s
Build and deploy / Integration suite on a real stack (push) Successful in 4m25s
Build and deploy / Secret scan and release gate (push) Successful in 15s
Build and deploy / Publish images (push) Successful in 1m54s
Dropstar sent its Correios contract. The cart now asks every carrier at once for the CEP and lists each option with its delivery time, cheapest first and chosen by default: Jadlog .PACKAGE, Correios PAC and Correios SEDEX, plus pickup. A carrier that does not answer is left out instead of blocking the others, and the server quotes the customer's choice again at approval. The order summary, the Kanban and Minha conta name the carrier chosen. app/correios.py follows the CWS manuals: a token from the posting card (kept until shortly before it expires, renewed once if refused), the contract's own prices by its DR, and the delivery time. Each box is one object priced by its sides; Correios work out the cubic weight. All carriers price the same package, now in app/package.py. Only CORREIOS_CODIGO_ACESSO goes in the stack; the user, card and contract are its defaults. python -m app.correios_probe checks the contract and its service codes on the account. Tested: tests/test_correios (token, contract parameters, prices in Brazilian format, boxes, a code override, a failing carrier), the full suite in a CI-style stack, and the cart in Brave on desktop and phone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -68,15 +68,12 @@ def operator_logout(request: Request, response: Response):
|
||||
|
||||
def freight_status():
|
||||
"""What delivery the Site offers, and the package rule it prices with."""
|
||||
if freight.name != 'jadlog':
|
||||
return {'provider': freight.name}
|
||||
cubed = freight.cubed_kg()
|
||||
return {'provider': 'jadlog', 'base_kg': str(freight.base_kg), 'per_metre_kg': str(freight.per_metre_kg),
|
||||
'production_days': freight.production_days,
|
||||
'box_cm': [str(side) for side in freight.box_cm] if freight.box_cm else None,
|
||||
'cubage_kg_m3': str(freight.cubage_kg_m3) if freight.cubage_kg_m3 else None,
|
||||
'cubed_kg': str(cubed) if cubed is not None else None,
|
||||
'metres_per_box': str(freight.metres_per_box) if freight.metres_per_box else None}
|
||||
real = [carrier for carrier in freight.carriers if carrier.name != 'fake']
|
||||
status = {'carriers': [carrier.name for carrier in real], 'services': freight.services if real else {}}
|
||||
if real:
|
||||
# One package for every carrier (app/package.py).
|
||||
status.update(real[0].status())
|
||||
return status
|
||||
|
||||
|
||||
def backup_status(c):
|
||||
|
||||
Reference in New Issue
Block a user