fix: Tiny's pickup is "Retirar pessoalmente", even with "Retirar na loja" there
All checks were successful
Build and deploy / Validate source (push) Successful in 14s
Build and deploy / Integration suite on a real stack (push) Successful in 4m9s
Build and deploy / Secret scan and release gate (push) Successful in 12s
Build and deploy / Publish images (push) Successful in 1m42s
All checks were successful
Build and deploy / Validate source (push) Successful in 14s
Build and deploy / Integration suite on a real stack (push) Successful in 4m9s
Build and deploy / Secret scan and release gate (push) Successful in 12s
Build and deploy / Publish images (push) Successful in 1m42s
Dropstar's Tiny has two formas de envio named like "retirar": "Retirar pessoalmente", the one its team uses, and an unused "Retirar na loja", so the lookup by name asked for a setting. The exact name now decides; two other "retirar" methods still ask. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -84,6 +84,7 @@ STATUS_UPDATES_SETTING = 'TINY_STATUS_UPDATES'
|
||||
# only overrides that.
|
||||
PICKUP_SETTING = 'TINY_FORMA_ENVIO_RETIRADA'
|
||||
PICKUP_NAME = 'retir'
|
||||
PICKUP_EXACT = 'retirar pessoalmente'
|
||||
STATE_MINUTES = 10
|
||||
# Renewal runs about every four hours against a one-day refresh token, so
|
||||
# less than this left means renewals have been failing for hours.
|
||||
@@ -454,9 +455,14 @@ def configured_skus(orders, mode):
|
||||
|
||||
|
||||
def find_pickup(orders):
|
||||
"""The one forma de envio named like "retirar", or why there is not one."""
|
||||
"""The forma de envio named "Retirar pessoalmente" (Dropstar's), else the one
|
||||
named like "retirar", or why there is not one."""
|
||||
found = orders.request('GET', '/formas-envio', params={'nome': PICKUP_NAME, 'limit': 100}).get('itens') or []
|
||||
named = [f for f in found if PICKUP_NAME in str(f.get('nome', '')).lower()]
|
||||
# The account also has "Retirar na loja", unused: the exact name decides.
|
||||
exact = [f for f in named if ' '.join(str(f.get('nome', '')).lower().split()) == PICKUP_EXACT]
|
||||
if len(exact) == 1:
|
||||
return exact[0], 'ok'
|
||||
if len(named) == 1:
|
||||
return named[0], 'ok'
|
||||
if not named:
|
||||
|
||||
Reference in New Issue
Block a user