feat: an approved order nobody paid expires in 24 h (front 9)
All checks were successful
Build and deploy / Validate source (push) Successful in 1m15s
Build and deploy / Integration suite on a real stack (push) Successful in 5m10s
Build and deploy / Secret scan and release gate (push) Successful in 11s
Build and deploy / Publish images (push) Successful in 1m29s
All checks were successful
Build and deploy / Validate source (push) Successful in 1m15s
Build and deploy / Integration suite on a real stack (push) Successful in 5m10s
Build and deploy / Secret scan and release gate (push) Successful in 11s
Build and deploy / Publish images (push) Successful in 1m29s
An approved quote with no payment expires on its own after 24 h, never while a Pix or card attempt is still live: the worker marks quotes.expired_at, frees its files and e-mails the customer that the order expired and can be sent again on the Site. The backlog from before this front expires silently. Kanban: Cotações › Aguardando pagamento shows when each one expires and the review gets an "Abrir conversa" WhatsApp button; Números gets "Pedidos sem pagamento" (made, paid, expired, waiting, abandonment rate). release_files moves to app/payments.py so the worker can use it; an expired quote no longer counts as open there. New tests/unpaid_test.py in the integration job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
23
app/mail.py
23
app/mail.py
@@ -92,6 +92,29 @@ PRODUCTS = {'file': 'DTF Têxtil · folha montada', 'avulsa': 'DTF Têxtil · ar
|
||||
'uvfile': 'DTF UV · folha montada', 'uv': 'DTF UV · artes avulsas'}
|
||||
|
||||
|
||||
def quote_expired(c, quote, origin):
|
||||
"""The customer's notice that an approved, unpaid order expired after 24 h
|
||||
(Fase 2, front 9): its files were deleted and they can send it again on
|
||||
the Site. Returns whether it was queued (False without an e-mail)."""
|
||||
customer = (quote.get('draft') or {}).get('customer') or {}
|
||||
if not customer.get('mail'):
|
||||
return False
|
||||
from . import mail_html
|
||||
link = f'{origin}/'
|
||||
text = '\n'.join([mail_html.greeting(customer.get('name')), '',
|
||||
'Seu pedido não foi pago em 24 horas e expirou. Os arquivos que você enviou foram apagados.', '',
|
||||
f'Quando quiser, é só montar de novo no site: {link}'])
|
||||
html = mail_html.layout('Seu pedido não foi pago em 24 horas e expirou.', 'Seu pedido', [
|
||||
mail_html.pill('Pedido expirado', 'info'),
|
||||
mail_html.title('Seu pedido expirou'),
|
||||
mail_html.para(f'{mail_html.greeting(customer.get("name"))} Seu pedido não foi pago em 24 horas e '
|
||||
'expirou. Os arquivos que você enviou foram apagados.'),
|
||||
mail_html.button('Montar de novo', link),
|
||||
mail_html.small(f'Quando quiser, é só montar de novo no site: {link}'),
|
||||
])
|
||||
return queue(c, 'notice', customer['mail'], 'Seu pedido expirou · DTF Dropstar', text, html)
|
||||
|
||||
|
||||
def money(cents):
|
||||
whole, cents = divmod(int(cents), 100)
|
||||
return 'R$ ' + f'{whole:,}'.replace(',', '.') + f',{cents:02d}'
|
||||
|
||||
Reference in New Issue
Block a user