fix(uber createDelivery): send the 4 required pickup/dropoff contact fields (no more invalid_params)#495
Merged
Conversation
test(uber createDelivery): assert the 4 required Create fields + dropoff_name fallback Create Delivery requires pickup_address, pickup_phone_number, dropoff_name, dropoff_phone_number even alongside a valid quote_id. Update the createDelivery unit test to assert all four on the request body (pickup_* from the tenant, dropoff_* from the customer/order), add a dropoff_name="Client" fallback test, and extend the course orchestrator test to thread + assert the four fields. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> @
… fields Uber Direct Create Delivery returns HTTP 400 invalid_params for pickup_address, pickup_phone_number, dropoff_name and dropoff_phone_number even when a valid quote_id is present, so every delivery course aborted (refused_post_payment + auto-refund) and never reached `nouvelle`. The old comment wrongly assumed the quote_id covered the pickup. createDelivery now accepts + sends the four fields. The orchestrator (createCourseOnPaymentConfirmed) sources them from existing data: pickup_address + pickup_phone_number from the tenant, built EXACTLY as the quote endpoint does (uberPickupFromComponents JSON shape, falling back to the raw address string for legacy tenants); dropoff_phone_number from the order denormalised customerPhone; dropoff_name from the customer firstName (read via the sanctioned readCustomerFicheById MOAT seam by order.customerId), falling back to "Client" when absent (cosmetic, never blocks the course). Also log the Uber status + body on a non-2xx Create so future refusals are diagnosable (tonight the error was swallowed). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Le bug (prouvé ce soir avec la vraie réponse Uber)
createDeliveryenvoyait une requête Uber Direct Create Delivery incomplète. Avec unquote_idVALIDE, Uber renvoyait quand même HTTP 400 :{ "code": "invalid_params", "metadata": { "pickup_address": "This field is required.", "pickup_phone_number": "This field is required.", "dropoff_name": "This field is required.", "dropoff_phone_number": "This field is required." } }Résultat : chaque commande livraison avortait (
refused_post_payment+ remboursement auto) et n'atteignait jamaisnouvelle. Le commentaire supposait à tort que lequote_idcouvrait le pickup — il ne le fait pas : Create exige les champs contact pickup + dropoff complets, même avec un quote.Le fix
Ajout des 4 champs requis au body
POST /customers/{id}/deliveries, sourcés depuis de la donnée existante :uberPickupFromComponents→ shape JSON-encodée, fallback sur la string brute pour les tenants legacy ; phone =tenant.phone).order.customerPhone(déjà dénormalisé sur la commande au checkout).firstNamedu client, lu via le seam sanctionnéreadCustomerFicheById(tablecustomers= MOAT global, ADR 0010) parorder.customerId. Fallback"Client"si absent (cosmétique, ne bloque jamais la course).Observabilité : on
console.errorle status + body Uber sur un Create non-2xx (ce soir l'erreur était avalée, impossible à diagnostiquer).interpretCreateDeliveryResponse,quote_id,manifest_items,manifest_reference, etclick_and_collect(aucun appel Uber) restent inchangés.Plan de test E2E
address+addressComponents(4-tuple) +phoneconfigurés ; client avecphone(et idéalementfirstName) ; credentials Uber Direct du tenant en place ; modedelivery./t/<tenantId>→ menu → cart →/checkout→ Payer.payment_intent.succeededdéclenchecreateCourseOnPaymentConfirmed→createDelivery.pickup_address,pickup_phone_number,dropoff_name,dropoff_phone_number— plus de 400invalid_params. Sur acceptation Uber, la commande passeen attente de paiement → nouvelle(le resto la voit + beep). SifirstNameabsent →dropoff_name: "Client".[[Cmd avortée]](un Create refusé resterefused_post_payment+ remboursement auto, jamaisnouvelle).Checks
pnpm typecheck✅ ·pnpm lint✅ ·pnpm test✅ (1668 tests)🤖 Generated with Claude Code