refactor: remove the WhatsApp integration
All checks were successful
Build and deploy / Validate source (push) Successful in 15s
Build and deploy / Integration suite on a real stack (push) Successful in 4m24s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m11s
All checks were successful
Build and deploy / Validate source (push) Successful in 15s
Build and deploy / Integration suite on a real stack (push) Successful in 4m24s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m11s
The system will not send WhatsApp messages: the client's n8n already does, from Tiny's status changes. Paid orders and stage changes now queue only the Tiny delivery; the fake WhatsApp adapter, its setting and secret, the Integrações row and the send log's Destino column are gone, and the old WhatsApp log rows are removed. The customer's WhatsApp number, the "Avisar no WhatsApp" link for corrections and the contact links stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -134,9 +134,8 @@ def run():
|
||||
events = board.call('/operator/events?order=' + str(order['number']), operator=True)['events']
|
||||
paid = [e for e in events if e['payload'].get('order_id') == order['id']
|
||||
and e['payload'].get('event') == 'payment_approved']
|
||||
assert len(paid) == 2, f'expected one tiny and one whatsapp event, got {len(paid)}'
|
||||
assert {e['provider'] for e in paid} == {'tiny', 'whatsapp'}, paid
|
||||
print('PASS: exactly one notification per provider for the order')
|
||||
assert [e['provider'] for e in paid] == ['tiny'], paid
|
||||
print('PASS: exactly one Tiny notification for the order')
|
||||
|
||||
# A payment that was never reviewed, and one for something that is not a quote.
|
||||
deliver({'event_id': 'nonsense-' + uuid4().hex, 'reference': 'not-a-uuid',
|
||||
@@ -160,7 +159,7 @@ def run():
|
||||
queued = c.execute("SELECT count(*) AS n FROM dtf_local.outbox WHERE event_key LIKE %s", (order['id'] + ':%',)).fetchone()['n']
|
||||
jobs = c.execute('SELECT count(*) AS n FROM dtf_local.print_files WHERE order_id=%s', (order['id'],)).fetchone()['n']
|
||||
assert queued == 0 and jobs == 1, (queued, jobs)
|
||||
print('PASS: an operator test order reaches the board and the print queue, never Tiny or WhatsApp')
|
||||
print('PASS: an operator test order reaches the board and the print queue, never Tiny')
|
||||
|
||||
# Files are uploaded before payment. An unpaid cart keeps them briefly; a
|
||||
# paid order keeps them for its 30 days; a payment never starts for files
|
||||
|
||||
@@ -240,7 +240,7 @@ def run():
|
||||
assert len(client.call('/operator/orders/'+oid+'/history',operator=True))==6
|
||||
# A mistaken move can be undone one stage at a time, with an internal
|
||||
# reason. The customer is not told again: going back and forward once more
|
||||
# adds no messages (the outbox count below stays 8).
|
||||
# adds no messages (the outbox count below stays 4).
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'imp','version':version},operator=True,expected=422)
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'tra','version':version},operator=True,expected=409)
|
||||
back=client.call('/operator/orders/'+oid+'/move',{'state':'imp','version':version,'reason':'Movido por engano'},operator=True)
|
||||
@@ -258,16 +258,15 @@ def run():
|
||||
deadline=time.monotonic()+30
|
||||
while time.monotonic()<deadline:
|
||||
events=[e for e in client.call('/operator/events?order='+str(order['number']),operator=True)['events'] if e['payload']['order_id']==oid]
|
||||
if len(events)==8 and all(e['delivered_at'] and e['receipt'] for e in events):break
|
||||
if len(events)==4 and all(e['delivered_at'] and e['receipt'] for e in events):break
|
||||
time.sleep(1)
|
||||
else:raise AssertionError('Mock outbox did not drain')
|
||||
assert len({e['event_key'] for e in events})==8
|
||||
assert len({e['event_key'] for e in events})==4 and {e['provider'] for e in events}=={'tiny'}
|
||||
# Tiny sets the pickup situação from the order it is sent; the fake sale
|
||||
# has no Tiny id, so the real adapter would search for it.
|
||||
ready={e['provider']:e['payload'] for e in events if e['payload']['event']=='ready'}
|
||||
assert ready['tiny']['order']['freight']==order['snapshot']['freight'] and 'tiny_id' in ready['tiny']
|
||||
assert 'order' not in ready['whatsapp']
|
||||
print(f"PASS: 8 durable fake receipts. Local test order #{order['number']} retained in Finalizado.")
|
||||
print(f"PASS: 4 durable fake receipts. Local test order #{order['number']} retained in Finalizado.")
|
||||
return oid
|
||||
|
||||
if __name__=='__main__':run()
|
||||
|
||||
Reference in New Issue
Block a user