@12-apps/marketplace 1.16.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADOPTING.md +185 -0
- package/dist/99food/index.d.ts +2 -2
- package/dist/99food/index.js +2 -2
- package/dist/{adapter-CjVdMhZ2.d.ts → adapter-ZpAWKoCk.d.ts} +300 -3
- package/dist/{chunk-TRUK5ZBE.js → chunk-3B5EULS6.js} +2 -2
- package/dist/{chunk-DJIMUEHT.js → chunk-BLHZ3MRB.js} +79 -7
- package/dist/chunk-BLHZ3MRB.js.map +1 -0
- package/dist/{chunk-SGOTN5PX.js → chunk-LO7OKO6V.js} +45 -4
- package/dist/chunk-LO7OKO6V.js.map +1 -0
- package/dist/{chunk-TICWLBSA.js → chunk-MDEIRGNL.js} +1372 -823
- package/dist/chunk-MDEIRGNL.js.map +1 -0
- package/dist/{chunk-H2VQRD3B.js → chunk-Q5RMVNU5.js} +1 -1
- package/dist/chunk-Q5RMVNU5.js.map +1 -0
- package/dist/{chunk-BTKVZAJI.js → chunk-ZT6TZTLD.js} +1 -1
- package/dist/chunk-ZT6TZTLD.js.map +1 -0
- package/dist/{client-DgzCkl8u.d.ts → client-DpEq0yXb.d.ts} +1 -1
- package/dist/{engine-DSRj7qnC.d.ts → engine-DRRhAjZK.d.ts} +566 -293
- package/dist/hono/index.d.ts +2 -2
- package/dist/hono/index.js +4 -4
- package/dist/ifood/index.d.ts +14 -2
- package/dist/ifood/index.js +406 -120
- package/dist/ifood/index.js.map +1 -1
- package/dist/index.d.ts +21 -4
- package/dist/index.js +453 -43
- package/dist/index.js.map +1 -1
- package/dist/keeta/index.d.ts +2 -2
- package/dist/keeta/index.js +2 -2
- package/dist/manifest/index.d.ts +78 -0
- package/dist/manifest/index.js +1 -1
- package/dist/manifest/server.d.ts +6 -2
- package/dist/manifest/server.js +4 -4
- package/dist/rappi/index.d.ts +1 -1
- package/dist/rappi/index.js +1 -1
- package/dist/server/index.d.ts +93 -7
- package/dist/server/index.js +4 -4
- package/package.json +1 -1
- package/prisma/marketplace.prisma +70 -2
- package/prisma/migrations/20261203180000_marketplace_app_link_check/migration.sql +14 -0
- package/prisma/migrations/20261203190000_marketplace_disputes/migration.sql +96 -0
- package/prisma/migrations/20261203200000_marketplace_status_logistics_steps/migration.sql +12 -0
- package/src/core/adapter.ts +14 -2
- package/src/core/app-linking.ts +396 -0
- package/src/core/delivery-code.ts +119 -0
- package/src/core/dispute-engine.ts +32 -0
- package/src/core/dispute-job.ts +142 -0
- package/src/core/dispute-port.ts +133 -0
- package/src/core/dispute-store.ts +203 -0
- package/src/core/disputes.ts +263 -0
- package/src/core/engine.ts +12 -55
- package/src/core/integration.ts +3 -1
- package/src/core/link-engine.ts +176 -0
- package/src/core/link-store.ts +15 -0
- package/src/core/linking-port.ts +35 -1
- package/src/core/linking.ts +8 -0
- package/src/core/logistics.ts +388 -0
- package/src/core/outbound-queue.ts +6 -1
- package/src/core/outbound-sweep.ts +19 -6
- package/src/core/outbound.ts +4 -5
- package/src/core/pipeline.ts +14 -4
- package/src/core/ports.ts +20 -2
- package/src/core/status-job.ts +3 -0
- package/src/core/status-store.ts +2 -1
- package/src/core/types.ts +10 -0
- package/src/ifood/app-linking.ts +119 -0
- package/src/ifood/disputes.ts +209 -0
- package/src/ifood/index.ts +15 -1
- package/src/ifood/logistics.ts +38 -0
- package/src/ifood/normalize.ts +14 -1
- package/src/index.ts +44 -0
- package/src/server/jobs.ts +51 -3
- package/src/server/link-routes.ts +56 -4
- package/src/server/mcp-link.ts +44 -2
- package/src/server/mcp.ts +2 -1
- package/dist/chunk-BTKVZAJI.js.map +0 -1
- package/dist/chunk-DJIMUEHT.js.map +0 -1
- package/dist/chunk-H2VQRD3B.js.map +0 -1
- package/dist/chunk-SGOTN5PX.js.map +0 -1
- package/dist/chunk-TICWLBSA.js.map +0 -1
- /package/dist/{chunk-TRUK5ZBE.js.map → chunk-3B5EULS6.js.map} +0 -0
package/ADOPTING.md
CHANGED
|
@@ -359,6 +359,46 @@ software's own app"). What the host binds and decides:
|
|
|
359
359
|
- **A view** gains `authMode`; a host that switches on it treats an absent
|
|
360
360
|
value as `CREDENTIALS`.
|
|
361
361
|
|
|
362
|
+
### 9.1 iFood links through the CENTRALIZED app (FUT-5798)
|
|
363
|
+
|
|
364
|
+
iFood offers its webhook only to centralized apps, so the iFood adapter now
|
|
365
|
+
declares `appLinking` beside `linking`, and `appLinking` wins at every entry
|
|
366
|
+
point: every new link is centralized. `linking` (`IFOOD_LINKING`) stays
|
|
367
|
+
declared so a store linked through the code flow keeps refreshing its own
|
|
368
|
+
token until it links again. Nothing
|
|
369
|
+
is typed or pasted: the store authorizes the software's app on the Portal do
|
|
370
|
+
Parceiro, the app's own `client_credentials` token lists every store that
|
|
371
|
+
authorized it, and the store picks its own. Additive for a host:
|
|
372
|
+
|
|
373
|
+
- **Routes.** `POST …/link/start` opens an attempt (30 minutes, renewed by
|
|
374
|
+
each read) and asks iFood nothing; its `pending` has `mode: "app"`, an empty
|
|
375
|
+
`userCode`, the portal as `verificationUrl`, and `seenAt` / `checkedAt`.
|
|
376
|
+
`POST …/link/check` asks the list now (`merchants`, each with `taken` and
|
|
377
|
+
`address`; `pending.seenAt` is when a store to pick first appeared).
|
|
378
|
+
`GET …/link/merchants` is the same list. `PUT …/link/merchant` writes the
|
|
379
|
+
LINKED connection (refused `UNKNOWN_MERCHANT`, `MERCHANT_TAKEN`).
|
|
380
|
+
`POST …/link/cancel` is Cancelar. `POST …/link/finish` answers 409
|
|
381
|
+
`UNAVAILABLE` for a centralized adapter.
|
|
382
|
+
- **No ownership proof beyond the portal.** iFood exposes no CNPJ in the list
|
|
383
|
+
or the detail; the authorization is the proof. Only a store another
|
|
384
|
+
account's live connection holds is refused (the claim guard).
|
|
385
|
+
- **The job.** `marketplace.link-check` ticks each minute and queues one
|
|
386
|
+
half-minute pass while a store waits (`enqueue` with `delayMs`), so a
|
|
387
|
+
waiting attempt is asked every 30 seconds without a sub-minute scheduler.
|
|
388
|
+
`GET …/link` also asks once when its last check is 30 s old (on every
|
|
389
|
+
driver: at most one list call per 30 s per attempt), which is what a host
|
|
390
|
+
with no worker relies on. Every read of a live attempt renews it.
|
|
391
|
+
- **The hint.** Bind the optional port `publishLinkSeen(clientId, provider)`
|
|
392
|
+
to tell that store's open screen to read again; payload-free. The screen
|
|
393
|
+
should not poll.
|
|
394
|
+
- **Outbound.** A centralized link's blob holds no token (`{ app: true }`):
|
|
395
|
+
its calls use the app's client-credentials token, from the same cache key
|
|
396
|
+
as every other call of that app. A LINKED row from the distributed flow
|
|
397
|
+
keeps its refresh-token path.
|
|
398
|
+
- **Migration** `20261203180000_marketplace_app_link_check` adds
|
|
399
|
+
`marketplace_link_attempts.seen_at`, `.checked_at` and an index on
|
|
400
|
+
`expires_at`: additive.
|
|
401
|
+
|
|
362
402
|
## 10. The marketplace's own courier and the pickup code (FUT-5665)
|
|
363
403
|
|
|
364
404
|
When the marketplace's fleet carries a bag (`deliveredBy: "MARKETPLACE"`;
|
|
@@ -776,3 +816,148 @@ that sends it, are the host's.
|
|
|
776
816
|
position or route (read 2026-12-01).
|
|
777
817
|
- Every result is an `OutboundResult` shape: 429, 408 and 5xx are retries, a
|
|
778
818
|
401 renews the token once inside the call.
|
|
819
|
+
|
|
820
|
+
## 15. Buyer disputes: iFood's Negotiation Platform (FUT-6099)
|
|
821
|
+
|
|
822
|
+
A buyer asks the marketplace, after ordering, for a refund or a change (iFood's
|
|
823
|
+
"Plataforma de Negociação", handshake disputes), and the store answers:
|
|
824
|
+
accept, reject with one of the marketplace's reasons, or offer one of the
|
|
825
|
+
alternatives the marketplace sent for THAT dispute. The engine keeps each
|
|
826
|
+
dispute per order, sends the answer from a job and closes the dispute on the
|
|
827
|
+
marketplace's settlement. Everything is additive and optional: a host that
|
|
828
|
+
composes no table keeps its orders as before: a dispute event fails its inbox
|
|
829
|
+
row (FAILED), is retried by the reconcile pass, then retired by the attempt
|
|
830
|
+
bound.
|
|
831
|
+
|
|
832
|
+
### 15.1 The cases
|
|
833
|
+
|
|
834
|
+
Every case is a test in `src/__tests__/disputes.test.ts` (and the PGlite case
|
|
835
|
+
in `migration.test.ts`); on `main` (`7dc036c3`) the file did not import: no
|
|
836
|
+
dispute module existed.
|
|
837
|
+
|
|
838
|
+
| id | event / call | this release |
|
|
839
|
+
|---|---|---|
|
|
840
|
+
| D1 | iFood `HANDSHAKE_DISPUTE` (HSD) on an order the engine holds | one `marketplace_disputes` row, OPEN, with what iFood sent: `action`, `handshakeType`, `reason`, `message`, the https photos (`evidences`, other schemes dropped), the disputed lines (`garnishItems`), the asked amount, `expiresAt`, `timeoutAction`, `alternatives` (REFUND / BENEFIT with `maxAmount`, ADDITIONAL_TIME with its allowed minutes), the rejection reasons (`negotiationReasons`) and the accept reasons (`acceptCancellationReasons`); inbox PROCESSED; `publishChanged` and `order.onDispute(…, { kind: "opened" })` after the commit; the acceptance row and the order untouched; no call to iFood; outcome `{ kind: "dispute", change: "opened" }` |
|
|
841
|
+
| D2 | the same HSD redelivered / another event id for the same dispute | `duplicate` / `change: "unchanged"`, still one row (unique `(provider, dispute_id)`) |
|
|
842
|
+
| D3 | HSD before its order | deferred PENDING (`dispute before its order`); the reconcile pass applies it once the order is ingested |
|
|
843
|
+
| D4 | `HANDSHAKE_SETTLEMENT` (HSS) | SETTLED with `settlement` ACCEPTED / REJECTED / EXPIRED / ALTERNATIVE_REPLIED (OTHER for an unknown word), `settledAt`, the amount; `onDispute(…, { kind: "settled" })` |
|
|
844
|
+
| D5 | HSS before its HSD | deferred PENDING (`settlement before its dispute`) |
|
|
845
|
+
| D15 | HSD whatever the acceptance's status (delivered, cancelled, in preparation) | kept: a dispute never reads or moves the acceptance |
|
|
846
|
+
| D6 | `answerDispute` ACCEPT | judged, claimed OPEN → SENDING (`updateMany … status: "OPEN"`, so two tablets never both answer), `marketplace.dispute-answer` `{ clientId, disputeId }` queued (key `…:<disputeId>:<answered at ms>`), no call; the job `POST /order/v1.0/disputes/{id}/accept` with no body → ANSWERED |
|
|
847
|
+
| D6b | ACCEPT when iFood listed accept reasons | the FIRST listed is sent (`{ reason }`); a person gives none (owner, 2026-12-03: no PIN, no reason) |
|
|
848
|
+
| D7 | REJECT | only a code iFood sent for THIS dispute (`INVALID_REASON` otherwise); `POST …/reject` `{ reason }` |
|
|
849
|
+
| D8 | ALTERNATIVE refund / benefit (an alternative whose stated `maxAmount` is not whole cents is not offered at all) | a positive whole number of cents, at most the alternative's `maxAmount` (`INVALID_AMOUNT`); an id iFood did not send is `INVALID_ALTERNATIVE`; `POST …/alternatives/{alternativeId}` `{ type, metadata: { amount: { value: "<cents>", currency: "BRL" } } }` |
|
|
850
|
+
| D9 | ALTERNATIVE more time | positive minutes, one of those iFood allows when it lists some (`INVALID_MINUTES`); `{ type: "ADDITIONAL_TIME", metadata: { additionalTimeInMinutes } }` |
|
|
851
|
+
| D10 | an unknown dispute (or one of another order than the `orderId` given) / past `expiresAt` / already answered | `NOT_FOUND` / `EXPIRED` / `ALREADY_ANSWERED`, refused locally, nothing claimed, nothing queued |
|
|
852
|
+
| D11 | the job's answer | 2xx → ANSWERED; `422 DISPUTE_ALREADY_ANSWERED` → ANSWERED with `failure: ALREADY_ANSWERED` (another device or iFood's portal answered first); `404`, `400 INVALID_REASON` / `INVALID_AMOUNT`, any other final 4xx → back to OPEN with that code and the answer cleared, so a person answers again; 408/429/5xx/timeout retried (3 attempts from 10 s), the last → OPEN, UNREACHABLE; a row no longer SENDING → skipped, no call |
|
|
853
|
+
| D12 | `disputes({ clientId, settledSince })` | one statement: every dispute OPEN, SENDING or ANSWERED, plus those settled since then (the board's shift); `disputes({ clientId, orderIds })` the orders' own ; a host that folds the read into one of its own statements maps each `marketplace_disputes` row with the exported `disputeView(row: DisputeRow)` |
|
|
854
|
+
| D13 | a marketplace without disputes (99Food, Keeta, Rappi) | `capabilities.disputes` and `adapter.disputes` absent; an answer on its row is `UNSUPPORTED` |
|
|
855
|
+
| D14 | an answer still SENDING | the `marketplace.outbound-sweep` re-queues it after 10 minutes (counted in `requeued`), and gives it back OPEN, UNREACHABLE after a day (counted in `givenUp`) |
|
|
856
|
+
|
|
857
|
+
### 15.2 Invariants
|
|
858
|
+
|
|
859
|
+
- **No call to the marketplace in a request.** The webhook records and applies
|
|
860
|
+
the event; `answerDispute` claims and queues. Only the
|
|
861
|
+
`marketplace.dispute-answer` job calls iFood, through the host's `http` port.
|
|
862
|
+
- **One answer per dispute.** The claim is predicated on OPEN; the job sends
|
|
863
|
+
only from SENDING; a failure gives the dispute back OPEN with its code.
|
|
864
|
+
- **Only what the marketplace offers.** Reasons, alternatives, amounts and
|
|
865
|
+
minutes are judged against the dispute's own row, never a static list.
|
|
866
|
+
- **A dispute moves no order.** No admit, no claim, no `onRefused`, no stock.
|
|
867
|
+
- **The engine writes no sentence.** `MarketplaceDisputeView` carries codes,
|
|
868
|
+
numbers and the marketplace's own words; every sentence is the host's.
|
|
869
|
+
|
|
870
|
+
### 15.3 What is still ESTIMATED
|
|
871
|
+
|
|
872
|
+
iFood's developer portal answered 403 (Cloudflare) to curl and WebFetch on
|
|
873
|
+
2026-12-02, so `src/ifood/disputes.ts` follows four independent public
|
|
874
|
+
write-ups of iFood's handshake guide, not iFood's page. Not verified live:
|
|
875
|
+
|
|
876
|
+
- U1, the proposal endpoint: `POST …/disputes/{id}/alternatives/{alternativeId}`
|
|
877
|
+
with `{ type, metadata }`; the other reading is `POST …/disputes/{id}/alternative`
|
|
878
|
+
with the type in the body;
|
|
879
|
+
- U2, whether accept takes a reason: sent only when iFood lists accept reasons;
|
|
880
|
+
- the field names inside `metadata` (`garnishItems`, `negotiationReasons`,
|
|
881
|
+
`allowedsAdditionalTimeInMinutes`, `selectedDisputeAlternative`), money as
|
|
882
|
+
cents in `{ value }`, and the success code (201 or 202: any 2xx is taken).
|
|
883
|
+
|
|
884
|
+
### 15.4 What the host binds
|
|
885
|
+
|
|
886
|
+
| | |
|
|
887
|
+
|---|---|
|
|
888
|
+
| **Database** | Compose the partial (`MarketplaceDispute`) and run `20261203190000_marketplace_disputes` (one new table, additive) with the bump: sync the partial, `prisma generate`, migrate. `MarketplaceDb.marketplaceDispute` is OPTIONAL in the type: without it `disputes` answers `[]`, `answerDispute` `NOT_FOUND`, and a dispute event fails its inbox row (retried by the reconcile pass, then retired). A host that wants it adds `marketplace_disputes.order_id → <orders>(id) ON DELETE CASCADE`. |
|
|
889
|
+
| **Job** | `marketplace.dispute-answer` arrives with `MARKETPLACE_JOBS` (bind `{ engine }`); allow it through any job allow-list in front of the queue. |
|
|
890
|
+
| **Hook** | OPTIONAL `order.onDispute(clientId, orderId, { kind: "opened" \| "settled", disputeId })`, after the commit: refresh the board, tell a person. A throw is logged. `publishChanged` is called either way. |
|
|
891
|
+
| **Read** | `engine.disputes({ clientId, settledSince })` for the board (the host's own shift start), `{ orderIds }` for an order. Draw `status` OPEN (with `expiresAt`'s countdown; past it, the host's "deadline gone" line and no answer), SENDING / ANSWERED (what was sent, `answer`, and "waiting on the marketplace"; `failure: ALREADY_ANSWERED` means another answer stood), SETTLED (`settlement.outcome`). A `failure` on an OPEN dispute is the last answer's refusal: say so beside the answer controls. |
|
|
892
|
+
| **Answer** | `engine.answerDispute({ clientId, disputeId, orderId, answer })` (pass the order the person acted on: a dispute of another order is NOT_FOUND before anything is claimed) with `{ kind: "ACCEPT" }`, `{ kind: "REJECT", reasonCode }` or `{ kind: "ALTERNATIVE", alternativeId, amountCents? , minutes? }`. Answers `queued` with the view, or `refused` with `NOT_FOUND`, `ALREADY_ANSWERED`, `EXPIRED`, `UNSUPPORTED`, `INVALID_REASON`, `INVALID_ALTERNATIVE`, `INVALID_AMOUNT` or `INVALID_MINUTES`. Gate it with `marketplace:decide`. |
|
|
893
|
+
| **Capability** | `engine.adapter(provider)?.capabilities.disputes` (iFood only). Offer Recusar only when `rejectReasons` is not empty, and Propor only when `alternatives` is not empty. |
|
|
894
|
+
|
|
895
|
+
## 16. iFood Logistics: the job that reports the store's courier (FUT-6166)
|
|
896
|
+
|
|
897
|
+
§14's wire client, driven by the engine. The host binds two ports and calls one method:
|
|
898
|
+
|
|
899
|
+
- **`logisticsCredentials(provider, environment)`** (engine port, OPTIONAL): the
|
|
900
|
+
software's Logistics app, or null. It is a separate app from
|
|
901
|
+
`appCredentials`. Absent or null: no Logistics step is ever sent (logged at info).
|
|
902
|
+
- **`order.logisticsDriver(clientId, orderId)`** (order port, OPTIONAL): the
|
|
903
|
+
store's courier on the order, `{ name, phone, vehicle }`, or null. It is read
|
|
904
|
+
before the run claims anything, only while ASSIGNED is still owed, and is never
|
|
905
|
+
carried in the job's payload. Null or absent: the run is skipped, logged at
|
|
906
|
+
info, and lets go of any claim it held (through the status table's
|
|
907
|
+
`deleteMany`, which a Prisma delegate has; without it the claim waits for the
|
|
908
|
+
sweep's give-up). Answer null once the host's undo of a
|
|
909
|
+
dispatch took the courier off: that is the whole undo contract, since the
|
|
910
|
+
engine asks the host nothing else before it sends a Logistics step.
|
|
911
|
+
- **`engine.informLogistics({ clientId, orderId, step, at })`**: one enqueue of
|
|
912
|
+
`marketplace.outbound`, action `logistics`. It never throws. Steps:
|
|
913
|
+
`ASSIGNED`, `GOING_TO_ORIGIN`, `ARRIVED_AT_ORIGIN`, `DISPATCHED`,
|
|
914
|
+
`ARRIVED_AT_DESTINATION`.
|
|
915
|
+
|
|
916
|
+
The job runs only for an ACCEPTED order that the store carries
|
|
917
|
+
(`deliveredBy: MERCHANT`) with no standing cancellation request, and only on
|
|
918
|
+
an adapter with a `logistics` half (iFood). It sends every step not yet SENT,
|
|
919
|
+
in order, up to the one named. Each step has its own claim row,
|
|
920
|
+
`LOGISTICS_<STEP>`, in the status table. The table's `step` CHECK admits
|
|
921
|
+
those five values from migration `20261203200000_marketplace_status_logistics_steps`,
|
|
922
|
+
which the host takes in with `prisma:sync-partials` before it binds the job.
|
|
923
|
+
So a step is never sent twice, and a run waits while another run holds a
|
|
924
|
+
step's claim. A claim left SENDING is re-queued by the outbound sweep as a
|
|
925
|
+
`logistics` job up to its own step.
|
|
926
|
+
|
|
927
|
+
- While ASSIGNED is owed, the job reads the courier before it claims anything.
|
|
928
|
+
No courier now is a skip, not a failure: pass the board's undo window as
|
|
929
|
+
`delayMs`, and a dispatch undone inside it sends nothing, while a later
|
|
930
|
+
dispatch (a new `at`) still does. Once ASSIGNED went, the later steps are sent
|
|
931
|
+
without asking, so a host may clear the courier on a later move.
|
|
932
|
+
- A final refusal, an invalid driver or the last attempt marks the step FAILED and
|
|
933
|
+
stops the chain: the marketplace would refuse a later step out of order.
|
|
934
|
+
- A 429, 5xx or timeout is retried.
|
|
935
|
+
- Nothing here touches the order.
|
|
936
|
+
|
|
937
|
+
## 17. iFood Logistics: the customer's delivery code (FUT-6167)
|
|
938
|
+
|
|
939
|
+
When the store's own courier carries an iFood order, iFood can ask the courier
|
|
940
|
+
for the code the customer reads in the iFood app before the order counts as
|
|
941
|
+
delivered (`DELIVERY_DROP_CODE_REQUESTED`, code `DDCR`). The engine has two
|
|
942
|
+
halves for it; a host binds neither and nothing changes.
|
|
943
|
+
|
|
944
|
+
- **`order.onDeliveryCodeRequested(clientId, orderId)`**, optional. The event
|
|
945
|
+
normalizes as `deliveryCodeRequested: true`. For an ACCEPTED order the
|
|
946
|
+
engine calls the hook, settles the event PROCESSED and publishes; the
|
|
947
|
+
outcome is `{ kind: "deliveryCodeRequested", orderId }`. The hook must be
|
|
948
|
+
idempotent (a redelivery calls it again). Before its order exists the event
|
|
949
|
+
is deferred like any other; for an order in another state it is IGNORED.
|
|
950
|
+
Store the request on the order, so the courier's close asks for the code.
|
|
951
|
+
- **`engine.verifyDeliveryCode({ clientId, orderId, code })`**, called in the
|
|
952
|
+
courier's close request (the courier waits for it at the door, so it is
|
|
953
|
+
never a job). It runs on the Logistics app's credentials (§16) and never
|
|
954
|
+
throws. Its answer:
|
|
955
|
+
- `VERIFIED`: close.
|
|
956
|
+
- `WRONG_CODE`: iFood's 422 (or a code that is no code at all). Say so and
|
|
957
|
+
let the courier type it again.
|
|
958
|
+
- `NOT_REQUESTED`: iFood's 412, no code was asked for this order. Close.
|
|
959
|
+
- `UNAVAILABLE` with a reason: no such order, the store does not carry it, no
|
|
960
|
+
Logistics app, or iFood did not answer. **Close anyway and tell the
|
|
961
|
+
store**: a close is never refused because the marketplace is away.
|
|
962
|
+
|
|
963
|
+
The code itself is never logged, stored or put in an error.
|
package/dist/99food/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NormalizedEvent, a as NormalizedMarketplaceOrder, C as CatalogueMenuEntry, b as CatalogueMenuOptions, P as PullCatalogue, M as MarketplaceAvailability, A as AdapterCallContext, O as OutboundResult, c as MarketplaceAdapter } from '../adapter-
|
|
2
|
-
import { O as OpenDeliveryApiBaseUrls } from '../client-
|
|
1
|
+
import { N as NormalizedEvent, a as NormalizedMarketplaceOrder, C as CatalogueMenuEntry, b as CatalogueMenuOptions, P as PullCatalogue, M as MarketplaceAvailability, A as AdapterCallContext, O as OutboundResult, c as MarketplaceAdapter } from '../adapter-ZpAWKoCk.js';
|
|
2
|
+
import { O as OpenDeliveryApiBaseUrls } from '../client-DpEq0yXb.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The words the 99Food adapter needs from its host, and nothing else.
|
package/dist/99food/index.js
CHANGED
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
openDeliveryStatus,
|
|
13
13
|
openDeliverySwitchAvailability,
|
|
14
14
|
verifyOpenDeliverySignature
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-3B5EULS6.js";
|
|
16
16
|
import "../chunk-M2V4RFMA.js";
|
|
17
17
|
import "../chunk-E4XJXHUK.js";
|
|
18
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-ZT6TZTLD.js";
|
|
19
19
|
import {
|
|
20
20
|
__name
|
|
21
21
|
} from "../chunk-7QVYU63E.js";
|
|
@@ -160,6 +160,136 @@ interface PullCatalogue {
|
|
|
160
160
|
/** The catalogue capability an adapter states, or leaves out. */
|
|
161
161
|
type MarketplaceCatalogue = PushCatalogue | PullCatalogue;
|
|
162
162
|
|
|
163
|
+
/**
|
|
164
|
+
* A marketplace's disputes (FUT-6099): the buyer asks the marketplace for a
|
|
165
|
+
* refund or a change AFTER the order was placed (iFood's Negotiation Platform,
|
|
166
|
+
* "Plataforma de Negociação"), and the store answers: accept, reject with one
|
|
167
|
+
* of the marketplace's reasons, or offer one of the alternatives the
|
|
168
|
+
* marketplace sent. Provider-neutral: what a dispute carries is read by the
|
|
169
|
+
* adapter, kept by the engine, drawn and worded by the host.
|
|
170
|
+
*/
|
|
171
|
+
/** The kinds of alternative a store may offer instead of what the buyer asked. */
|
|
172
|
+
type DisputeAlternativeType = "REFUND" | "BENEFIT" | "ADDITIONAL_TIME";
|
|
173
|
+
/** One alternative the marketplace allows for THIS dispute. */
|
|
174
|
+
interface DisputeAlternative {
|
|
175
|
+
/** The marketplace's id for it; sent back with the proposal. */
|
|
176
|
+
id: string;
|
|
177
|
+
type: DisputeAlternativeType;
|
|
178
|
+
/** A refund or a benefit: the most the store may offer, in cents; null when the marketplace states none. */
|
|
179
|
+
maxAmountCents: number | null;
|
|
180
|
+
/** More time: the minutes the marketplace allows, when it lists them; empty when it states none. */
|
|
181
|
+
allowedMinutes: number[];
|
|
182
|
+
}
|
|
183
|
+
/** One reason the marketplace accepts with an answer: its code and its own words. */
|
|
184
|
+
interface DisputeReason {
|
|
185
|
+
code: string;
|
|
186
|
+
description: string;
|
|
187
|
+
}
|
|
188
|
+
/** One line the buyer disputes, as the marketplace lists it. */
|
|
189
|
+
interface DisputeItem {
|
|
190
|
+
name: string;
|
|
191
|
+
quantity: number;
|
|
192
|
+
/** What the line cost, in cents; null when unstated. */
|
|
193
|
+
amountCents: number | null;
|
|
194
|
+
}
|
|
195
|
+
/** A dispute the marketplace opened, normalized. */
|
|
196
|
+
interface NormalizedDisputeOpened {
|
|
197
|
+
/** The marketplace's id for the dispute: the key of every answer. */
|
|
198
|
+
disputeId: string;
|
|
199
|
+
/** What the buyer asks, the marketplace's own code (iFood: CANCELLATION, PARTIAL_CANCELLATION, …). */
|
|
200
|
+
action: string;
|
|
201
|
+
/** When in the order's life it was opened (iFood: AFTER_DELIVERY, PREPARATION_TIME, DELAY, …); null unstated. */
|
|
202
|
+
handshakeType: string | null;
|
|
203
|
+
/** Why, in the marketplace's words ("Faltou item"); null unstated. */
|
|
204
|
+
reason: string | null;
|
|
205
|
+
/** The buyer's own words; null unstated. */
|
|
206
|
+
message: string | null;
|
|
207
|
+
/** The buyer's photos: https URLs only. */
|
|
208
|
+
evidenceUrls: string[];
|
|
209
|
+
items: DisputeItem[];
|
|
210
|
+
/** What the buyer asks back, in cents; null unstated. */
|
|
211
|
+
requestedAmountCents: number | null;
|
|
212
|
+
/** The store's deadline; null unstated. */
|
|
213
|
+
expiresAt: Date | null;
|
|
214
|
+
/** When the buyer opened it; null unstated (the engine then keeps its clock). */
|
|
215
|
+
openedAt: Date | null;
|
|
216
|
+
/** What the marketplace does when the store does not answer (iFood: ACCEPT_CANCELLATION, …); null unstated. */
|
|
217
|
+
timeoutAction: string | null;
|
|
218
|
+
alternatives: DisputeAlternative[];
|
|
219
|
+
/** The reasons a rejection may carry, as the marketplace sent them for this dispute. */
|
|
220
|
+
rejectReasons: DisputeReason[];
|
|
221
|
+
/** The reasons an acceptance may carry; sent only when the marketplace lists some. */
|
|
222
|
+
acceptReasons: DisputeReason[];
|
|
223
|
+
}
|
|
224
|
+
/** How the marketplace closed a dispute. `OTHER`: closed, with a word the engine does not know. */
|
|
225
|
+
type DisputeOutcome = "ACCEPTED" | "REJECTED" | "EXPIRED" | "ALTERNATIVE_REPLIED" | "OTHER";
|
|
226
|
+
/** A dispute the marketplace closed, normalized. */
|
|
227
|
+
interface NormalizedDisputeSettled {
|
|
228
|
+
disputeId: string;
|
|
229
|
+
outcome: DisputeOutcome;
|
|
230
|
+
/** When it closed; null unstated. */
|
|
231
|
+
at: Date | null;
|
|
232
|
+
/** What was refunded or granted, in cents; null unstated. */
|
|
233
|
+
amountCents: number | null;
|
|
234
|
+
}
|
|
235
|
+
/** What a delivery says about a dispute, when it says one. */
|
|
236
|
+
type NormalizedDisputeEvent = {
|
|
237
|
+
kind: "opened";
|
|
238
|
+
dispute: NormalizedDisputeOpened;
|
|
239
|
+
} | {
|
|
240
|
+
kind: "settled";
|
|
241
|
+
settlement: NormalizedDisputeSettled;
|
|
242
|
+
};
|
|
243
|
+
/** The store's answer, as it is sent. */
|
|
244
|
+
type DisputeAnswer = {
|
|
245
|
+
kind: "ACCEPT";
|
|
246
|
+
reasonCode: string | null;
|
|
247
|
+
} | {
|
|
248
|
+
kind: "REJECT";
|
|
249
|
+
reasonCode: string;
|
|
250
|
+
} | {
|
|
251
|
+
kind: "ALTERNATIVE";
|
|
252
|
+
alternative: DisputeAlternative;
|
|
253
|
+
amountCents: number | null;
|
|
254
|
+
minutes: number | null;
|
|
255
|
+
};
|
|
256
|
+
/** Why an answer did not land. */
|
|
257
|
+
type DisputeFailureCode = "ALREADY_ANSWERED" | "NOT_FOUND" | "INVALID_REASON" | "INVALID_AMOUNT" | "REFUSED" | "UNREACHABLE" | "NOT_CONNECTED" | "UNSUPPORTED";
|
|
258
|
+
/** One answer call's result: the outbound shapes, a refusal carrying the engine's code. */
|
|
259
|
+
type DisputeAnswerResult = {
|
|
260
|
+
kind: "accepted";
|
|
261
|
+
} | {
|
|
262
|
+
kind: "refused";
|
|
263
|
+
status: number;
|
|
264
|
+
message: string;
|
|
265
|
+
code: DisputeFailureCode;
|
|
266
|
+
} | {
|
|
267
|
+
kind: "retry";
|
|
268
|
+
reason: string;
|
|
269
|
+
};
|
|
270
|
+
/** The adapter's disputes API. Present only on a marketplace with disputes (`capabilities.disputes`). */
|
|
271
|
+
interface MarketplaceDisputeApi {
|
|
272
|
+
/** Send the store's answer to one dispute. Called only from the `marketplace.dispute-answer` job. */
|
|
273
|
+
answer(ctx: AdapterCallContext, target: {
|
|
274
|
+
externalOrderId: string;
|
|
275
|
+
disputeId: string;
|
|
276
|
+
}, answer: DisputeAnswer): Promise<DisputeAnswerResult>;
|
|
277
|
+
}
|
|
278
|
+
/** What the host hears after a dispute's commit (`order.onDispute`). */
|
|
279
|
+
interface MarketplaceDisputeChange {
|
|
280
|
+
kind: "opened" | "settled";
|
|
281
|
+
disputeId: string;
|
|
282
|
+
}
|
|
283
|
+
/** The dispute table's delegate. OPTIONAL in `MarketplaceDb`: a host that has not composed it gets no disputes. */
|
|
284
|
+
interface MarketplaceDisputeDelegate {
|
|
285
|
+
findFirst(args: unknown): Promise<unknown>;
|
|
286
|
+
findMany(args: unknown): Promise<unknown[]>;
|
|
287
|
+
create(args: unknown): Promise<unknown>;
|
|
288
|
+
updateMany(args: unknown): Promise<{
|
|
289
|
+
count: number;
|
|
290
|
+
}>;
|
|
291
|
+
}
|
|
292
|
+
|
|
163
293
|
/**
|
|
164
294
|
* The canonical shape every marketplace adapter normalizes INTO.
|
|
165
295
|
*
|
|
@@ -471,6 +601,14 @@ interface NormalizedEvent {
|
|
|
471
601
|
* host's admit, with no confirm sent back. Carries no order body.
|
|
472
602
|
*/
|
|
473
603
|
marketplaceConfirmed?: boolean;
|
|
604
|
+
/** The marketplace asked the customer's delivery code for the order (FUT-6167). */
|
|
605
|
+
deliveryCodeRequested?: boolean;
|
|
606
|
+
/**
|
|
607
|
+
* OPTIONAL (FUT-6099). A dispute the marketplace opened or closed on this
|
|
608
|
+
* order (iFood's HSD / HSS). Carries no order body, and never moves the
|
|
609
|
+
* order or its acceptance.
|
|
610
|
+
*/
|
|
611
|
+
dispute?: NormalizedDisputeEvent | null;
|
|
474
612
|
}
|
|
475
613
|
|
|
476
614
|
/**
|
|
@@ -775,11 +913,15 @@ interface LinkGrant {
|
|
|
775
913
|
*/
|
|
776
914
|
refreshToken: string | null;
|
|
777
915
|
}
|
|
778
|
-
/** One marketplace store the grant covers. */
|
|
916
|
+
/** One marketplace store the grant (or, centralized, the app's authorization) covers. */
|
|
779
917
|
interface LinkedMerchant {
|
|
780
918
|
id: string;
|
|
781
919
|
name: string | null;
|
|
782
920
|
corporateName: string | null;
|
|
921
|
+
/** One line of the store's address, read off its detail (centralized linking, FUT-5798); absent when not asked. */
|
|
922
|
+
address?: string | null;
|
|
923
|
+
/** Another store's live connection already holds it (centralized linking, FUT-5798); absent when not judged. */
|
|
924
|
+
taken?: boolean;
|
|
783
925
|
}
|
|
784
926
|
/**
|
|
785
927
|
* A linking call's answer: the value, or why there is none. `refused` is
|
|
@@ -814,6 +956,33 @@ interface MarketplaceLinking {
|
|
|
814
956
|
* working unchanged either way.
|
|
815
957
|
*/
|
|
816
958
|
type MarketplaceAppCredentialsPort = (provider: string, environment: "SANDBOX" | "PRODUCTION") => MarketplaceCredentials | null | Promise<MarketplaceCredentials | null>;
|
|
959
|
+
/**
|
|
960
|
+
* LINKING through the software's CENTRALIZED app (FUT-5798): the store
|
|
961
|
+
* authorizes the app on the marketplace's portal, and that is all. No code is
|
|
962
|
+
* typed, nothing is pasted, no token is the store's: the app's own
|
|
963
|
+
* client-credentials token sees every store that authorized it, and the store
|
|
964
|
+
* picks its own from that list. A linked connection then talks to the
|
|
965
|
+
* marketplace with the app's token, and the app's webhook brings its orders.
|
|
966
|
+
*
|
|
967
|
+
* The adapter's half is the wire format of the list and nothing else; the
|
|
968
|
+
* attempt, the claim and the rows are the engine's (`./app-linking.ts`).
|
|
969
|
+
*/
|
|
970
|
+
interface MarketplaceAppLinking {
|
|
971
|
+
/** The portal page where the store authorizes the app. Always https. */
|
|
972
|
+
readonly portalUrl: string;
|
|
973
|
+
/** Every store the app is authorized for, through the app's own token. */
|
|
974
|
+
merchants(ctx: AppLinkCallContext): Promise<LinkResult<LinkedMerchant[]>>;
|
|
975
|
+
/** One line of a store's address, for the person to recognise it; null when the detail carries none. */
|
|
976
|
+
address(ctx: AppLinkCallContext, merchantId: string): Promise<LinkResult<string | null>>;
|
|
977
|
+
}
|
|
978
|
+
/** What a centralized linking call is handed: the APP's credentials and the engine's token cache. */
|
|
979
|
+
interface AppLinkCallContext extends LinkCallContext {
|
|
980
|
+
/** The engine's per-process token cache: the app's token is shared with its outbound calls, never bought early. */
|
|
981
|
+
tokens: Map<string, {
|
|
982
|
+
token: string;
|
|
983
|
+
expiresAt: number;
|
|
984
|
+
}>;
|
|
985
|
+
}
|
|
817
986
|
/** The link-attempt delegate the engine reads and writes (the `MarketplaceLinkAttempt` model). */
|
|
818
987
|
interface MarketplaceLinkAttemptDelegate {
|
|
819
988
|
findUnique(args: unknown): Promise<unknown>;
|
|
@@ -821,6 +990,124 @@ interface MarketplaceLinkAttemptDelegate {
|
|
|
821
990
|
deleteMany(args: unknown): Promise<{
|
|
822
991
|
count: number;
|
|
823
992
|
}>;
|
|
993
|
+
/** The live attempts the periodic check walks (FUT-5798). Absent: the check finds none. */
|
|
994
|
+
findMany?(args: unknown): Promise<unknown[]>;
|
|
995
|
+
/** Stamp a check on an attempt (FUT-5798). */
|
|
996
|
+
updateMany?(args: unknown): Promise<{
|
|
997
|
+
count: number;
|
|
998
|
+
}>;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* The store's OWN courier carrying a marketplace order, reported to the
|
|
1003
|
+
* marketplace (FUT-5988, FUT-6166): iFood's Logistics module, so the buyer
|
|
1004
|
+
* follows the delivery in the marketplace's app.
|
|
1005
|
+
*
|
|
1006
|
+
* The host says the courier reached a step (`informLogistics`, one enqueue);
|
|
1007
|
+
* the `marketplace.outbound` job, action `logistics`, sends every step still
|
|
1008
|
+
* owed up to it, in the marketplace's one order, each under its own claim row
|
|
1009
|
+
* in the status table (`LOGISTICS_<STEP>`, unique per order and step, so a
|
|
1010
|
+
* step is never sent twice). Only for an ACCEPTED order the store carries
|
|
1011
|
+
* itself (`deliveredBy: MERCHANT`), only when the adapter has a Logistics
|
|
1012
|
+
* half and the host configured the Logistics app's credentials
|
|
1013
|
+
* (`logisticsCredentials`, the software's own app, never the store's PDV
|
|
1014
|
+
* credentials). The courier's name and phone are read from the host at send
|
|
1015
|
+
* time (`order.logisticsDriver`), never carried in the job's payload.
|
|
1016
|
+
*
|
|
1017
|
+
* A step that fails (a final refusal, or the last attempt) is FAILED and the
|
|
1018
|
+
* chain stops there: the marketplace refuses a later step out of order. A
|
|
1019
|
+
* failure never touches the order.
|
|
1020
|
+
*/
|
|
1021
|
+
/** The steps, in the one order a marketplace takes them. */
|
|
1022
|
+
declare const LOGISTICS_STEPS: readonly ["ASSIGNED", "GOING_TO_ORIGIN", "ARRIVED_AT_ORIGIN", "DISPATCHED", "ARRIVED_AT_DESTINATION"];
|
|
1023
|
+
type LogisticsStep = (typeof LOGISTICS_STEPS)[number];
|
|
1024
|
+
/** How the courier travels, as the marketplace is told. */
|
|
1025
|
+
type LogisticsVehicle = "MOTORCYCLE" | "CAR" | "BICYCLE" | "ON_FOOT" | "SCOOTER";
|
|
1026
|
+
/** Who carries the order, read from the host when ASSIGNED is sent. */
|
|
1027
|
+
interface LogisticsDriver {
|
|
1028
|
+
name: string;
|
|
1029
|
+
phone: string;
|
|
1030
|
+
vehicle: LogisticsVehicle;
|
|
1031
|
+
}
|
|
1032
|
+
/** An adapter's Logistics half: the wire calls, nothing else. */
|
|
1033
|
+
interface MarketplaceLogistics {
|
|
1034
|
+
assignDriver(ctx: AdapterCallContext, order: OutboundOrderRef, driver: LogisticsDriver): Promise<OutboundResult | {
|
|
1035
|
+
kind: "invalid";
|
|
1036
|
+
reason: string;
|
|
1037
|
+
}>;
|
|
1038
|
+
step(ctx: AdapterCallContext, order: OutboundOrderRef, step: Exclude<LogisticsStep, "ASSIGNED">): Promise<OutboundResult>;
|
|
1039
|
+
/** OPTIONAL (FUT-6167). The customer's delivery code, typed by the courier at the door. */
|
|
1040
|
+
verifyDeliveryCode?(ctx: AdapterCallContext, order: OutboundOrderRef, code: string): Promise<DeliveryCodeAnswer>;
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* What the marketplace said of the customer's delivery code (FUT-6167).
|
|
1044
|
+
* UNAVAILABLE is never a refusal of the close: the host closes and records it.
|
|
1045
|
+
*/
|
|
1046
|
+
type DeliveryCodeAnswer = {
|
|
1047
|
+
kind: "VERIFIED";
|
|
1048
|
+
}
|
|
1049
|
+
/** Wrong, or not a code at all: the courier may type it again. */
|
|
1050
|
+
| {
|
|
1051
|
+
kind: "WRONG_CODE";
|
|
1052
|
+
}
|
|
1053
|
+
/** The marketplace never asked this order for a code. */
|
|
1054
|
+
| {
|
|
1055
|
+
kind: "NOT_REQUESTED";
|
|
1056
|
+
} | {
|
|
1057
|
+
kind: "UNAVAILABLE";
|
|
1058
|
+
reason: string;
|
|
1059
|
+
};
|
|
1060
|
+
/** The adapter's Logistics half (`MarketplaceAdapter` extends it). */
|
|
1061
|
+
interface LogisticsAdapter {
|
|
1062
|
+
/** OPTIONAL (FUT-6166). The store's own courier reported to the marketplace. */
|
|
1063
|
+
readonly logistics?: MarketplaceLogistics;
|
|
1064
|
+
}
|
|
1065
|
+
/** The order port's Logistics half (`MarketplaceOrderPort` extends it). */
|
|
1066
|
+
interface LogisticsOrderPort {
|
|
1067
|
+
/**
|
|
1068
|
+
* OPTIONAL (FUT-6166). The store's courier carrying the order, read before a
|
|
1069
|
+
* Logistics run claims anything while ASSIGNED is still owed, or null when none
|
|
1070
|
+
* is. Null or absent: the run is skipped and claims nothing. Answer null after
|
|
1071
|
+
* the host's undo of a dispatch (ADOPTING §16).
|
|
1072
|
+
*/
|
|
1073
|
+
logisticsDriver?(clientId: string, orderId: string): Promise<LogisticsDriver | null>;
|
|
1074
|
+
/**
|
|
1075
|
+
* OPTIONAL (FUT-6167). The marketplace asked the customer's delivery code for
|
|
1076
|
+
* an ACCEPTED order: store it, so the courier's close asks for the code.
|
|
1077
|
+
* Idempotent: a redelivery calls it again. Absent: the event is ignored.
|
|
1078
|
+
*/
|
|
1079
|
+
onDeliveryCodeRequested?(clientId: string, orderId: string): Promise<void>;
|
|
1080
|
+
}
|
|
1081
|
+
/** The host's Logistics ports (`MarketplacePorts` extends it). */
|
|
1082
|
+
interface LogisticsPorts {
|
|
1083
|
+
/**
|
|
1084
|
+
* OPTIONAL (FUT-6166). The software's Logistics app on this marketplace (a
|
|
1085
|
+
* separate app from the one that links stores), or null. Absent or null: no
|
|
1086
|
+
* Logistics step is ever sent.
|
|
1087
|
+
*/
|
|
1088
|
+
logisticsCredentials?: MarketplaceAppCredentialsPort;
|
|
1089
|
+
}
|
|
1090
|
+
/** What the host says when its courier reaches a step. */
|
|
1091
|
+
interface InformLogisticsInput {
|
|
1092
|
+
clientId: string;
|
|
1093
|
+
orderId: string;
|
|
1094
|
+
step: LogisticsStep;
|
|
1095
|
+
/** The move's instant: it keys the job and owns the claims it makes. */
|
|
1096
|
+
at: Date;
|
|
1097
|
+
/**
|
|
1098
|
+
* Hold the job this long (the host's undo window): a move undone inside it
|
|
1099
|
+
* leaves the order with no courier, and the job then sends nothing.
|
|
1100
|
+
*/
|
|
1101
|
+
delayMs?: number;
|
|
1102
|
+
}
|
|
1103
|
+
/** The engine's Logistics half (`MarketplaceEngine` extends it). */
|
|
1104
|
+
interface MarketplaceLogisticsEngine {
|
|
1105
|
+
/**
|
|
1106
|
+
* The store's own courier reached a step (FUT-6166): ONE enqueue of the
|
|
1107
|
+
* `marketplace.outbound` job, action `logistics`, which sends every step
|
|
1108
|
+
* still owed up to it. Never throws. True when the queue took it.
|
|
1109
|
+
*/
|
|
1110
|
+
informLogistics(input: InformLogisticsInput): Promise<boolean>;
|
|
824
1111
|
}
|
|
825
1112
|
|
|
826
1113
|
/**
|
|
@@ -1034,6 +1321,8 @@ interface MarketplaceCapabilities {
|
|
|
1034
1321
|
* it has not confirmed). Absent: steps never wait on the confirm.
|
|
1035
1322
|
*/
|
|
1036
1323
|
statusAfterConfirm?: boolean;
|
|
1324
|
+
/** OPTIONAL (FUT-6099). The buyer's disputes arrive as events and are answered through `disputes`. */
|
|
1325
|
+
disputes?: boolean;
|
|
1037
1326
|
}
|
|
1038
1327
|
/**
|
|
1039
1328
|
* A marketplace's presence heartbeat (FUT-5984: iFood's `KEEPALIVE`), read off
|
|
@@ -1167,7 +1456,7 @@ interface CancellationRequestInput {
|
|
|
1167
1456
|
offendingSkus: readonly string[];
|
|
1168
1457
|
}
|
|
1169
1458
|
/** One marketplace, in and out. */
|
|
1170
|
-
interface MarketplaceAdapter {
|
|
1459
|
+
interface MarketplaceAdapter extends LogisticsAdapter {
|
|
1171
1460
|
readonly provider: MarketplaceProvider;
|
|
1172
1461
|
readonly capabilities: MarketplaceCapabilities;
|
|
1173
1462
|
/** Inbound: one delivery into the canonical shape, or null when it carries no order id. */
|
|
@@ -1262,11 +1551,19 @@ interface MarketplaceAdapter {
|
|
|
1262
1551
|
* marketplace (FUT-5613). Absent: a store connects with its own credentials only.
|
|
1263
1552
|
*/
|
|
1264
1553
|
readonly linking?: MarketplaceLinking;
|
|
1554
|
+
/**
|
|
1555
|
+
* OPTIONAL. Linking a store through the software's CENTRALIZED app (FUT-5798):
|
|
1556
|
+
* the store authorizes the app on the portal and picks its store from the
|
|
1557
|
+
* app's list; no code, no token of its own. Wins over `linking` when both are set.
|
|
1558
|
+
*/
|
|
1559
|
+
readonly appLinking?: MarketplaceAppLinking;
|
|
1265
1560
|
/**
|
|
1266
1561
|
* OPTIONAL. The marketplace's own courier (FUT-5665): the pickup-code check
|
|
1267
1562
|
* and the tracking read. Absent: neither is offered, and the host says so.
|
|
1268
1563
|
*/
|
|
1269
1564
|
readonly courier?: MarketplaceCourierApi;
|
|
1565
|
+
/** OPTIONAL (FUT-6099). Answering the buyer's disputes; present with `capabilities.disputes`. */
|
|
1566
|
+
readonly disputes?: MarketplaceDisputeApi;
|
|
1270
1567
|
/** Where "open it on the marketplace" goes: the order when `perOrderAppLink`, else the portal. Always https. */
|
|
1271
1568
|
appLink(order: Pick<OutboundOrderRef, "externalOrderId" | "externalDisplayId">): string;
|
|
1272
1569
|
}
|
|
@@ -1286,4 +1583,4 @@ declare function tokenGrantResultOf(response: MarketplaceHttpResponse): Outbound
|
|
|
1286
1583
|
/** A call that never got an answer is a retry, with the reason a log can read. */
|
|
1287
1584
|
declare function answered(call: () => Promise<OutboundResult>): Promise<OutboundResult>;
|
|
1288
1585
|
|
|
1289
|
-
export { type
|
|
1586
|
+
export { type DisputeAnswerResult as $, type AdapterCallContext as A, type CatalogueReadContext as B, type CatalogueMenuEntry as C, type CatalogueReadNotice as D, type CatalogueReadRefusalCode as E, type FetchOrderResult as F, type CatalogueReadResult as G, type CatalogueReadWarning as H, type CatalogueReadWarningCode as I, type CatalogueSnapshot as J, type CatalogueSnapshotCategory as K, type CatalogueSnapshotItem as L, type MarketplaceAvailability as M, type NormalizedEvent as N, type OutboundResult as O, type PullCatalogue as P, type CatalogueSnapshotOption as Q, type CatalogueSnapshotOptionGroup as R, type StorePauseRequest as S, type CatalogueStoredImage as T, type CatalogueWarningCode as U, type CourierTrackingCallResult as V, type CourierTrackingResult as W, type DeliveryCodeAnswer as X, type DisputeAlternative as Y, type DisputeAlternativeType as Z, type DisputeAnswer as _, type NormalizedMarketplaceOrder as a, tokenGrantResultOf as a$, type DisputeFailureCode as a0, type DisputeItem as a1, type DisputeOutcome as a2, type DisputeReason as a3, type InformLogisticsInput as a4, LOGISTICS_STEPS as a5, type LinkCallContext as a6, type LinkCode as a7, type LinkGrant as a8, type LinkResult as a9, type MarketplaceOrderType as aA, type MarketplacePaymentMethod as aB, type NormalizedAddress as aC, type NormalizedBuyer as aD, type NormalizedDisputeEvent as aE, type NormalizedDisputeOpened as aF, type NormalizedDisputeSettled as aG, type NormalizedLineOption as aH, type NormalizedOrderDiscount as aI, type NormalizedOrderFee as aJ, type NormalizedOrderLine as aK, type NormalizedPaymentMethod as aL, type NormalizedPayments as aM, type OrderCancellationReason as aN, type OrderCancellationReasonsResult as aO, type OutboundOrderRef as aP, PROVIDER_ID_PATTERN as aQ, type PickupCodeCallResult as aR, type PickupCodeValidation as aS, type PresenceProbe as aT, type StatusFacts as aU, type StatusStep as aV, type ValidatePickupCodeInput as aW, answered as aX, centsFromMajor as aY, normalizedLineTotalCents as aZ, outboundResultOf as a_, type LinkedMerchant as aa, type LogisticsDriver as ab, type LogisticsStep as ac, type LogisticsVehicle as ad, type MarketplaceAcknowledgement as ae, type MarketplaceAppCredentialsPort as af, type MarketplaceCapabilities as ag, type MarketplaceCatalogue as ah, type MarketplaceCourier as ai, type MarketplaceCourierAnswer as aj, type MarketplaceCourierEngine as ak, type MarketplaceCourierFacts as al, type MarketplaceCourierStep as am, type MarketplaceCourierTracking as an, type MarketplaceCourierVehicle as ao, type MarketplaceCredentials as ap, type MarketplaceDeliveredBy as aq, type MarketplaceDiscountSponsor as ar, type MarketplaceDisputeApi as as, type MarketplaceDisputeChange as at, type MarketplaceDisputeDelegate as au, type MarketplaceHttp as av, type MarketplaceHttpRequest as aw, type MarketplaceHttpResponse as ax, type MarketplaceLifecycle as ay, type MarketplaceLinkAttemptDelegate as az, type CatalogueMenuOptions as b, type LogisticsPorts as b0, type LogisticsOrderPort as b1, type MarketplaceLogisticsEngine as b2, type MarketplaceAdapter as c, type PushCatalogue as d, type CatalogueItemOut as e, type CatalogueReader as f, type MarketplaceLinking as g, type MarketplaceAppLinking as h, type MarketplaceCourierApi as i, type NormalizedCourierEvent as j, type StorePauseResult as k, type StorePauseRef as l, type MarketplaceLogistics as m, type MarketplaceProvider as n, type CancellationReason as o, type AdapterGrant as p, type AdapterTokenCache as q, type AppLinkCallContext as r, type CancellationOutcome as s, type CancellationRequestInput as t, type CatalogueCallContext as u, type CatalogueFailure as v, type CatalogueImage as w, type CatalogueItem as x, type CatalogueItemRef as y, type CataloguePublishResult as z };
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
answered,
|
|
16
16
|
outboundResultOf,
|
|
17
17
|
tokenGrantResultOf
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ZT6TZTLD.js";
|
|
19
19
|
import {
|
|
20
20
|
__name
|
|
21
21
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -483,4 +483,4 @@ export {
|
|
|
483
483
|
normalizeOpenDeliveryEventAs,
|
|
484
484
|
normalizeOpenDeliveryOrderAs
|
|
485
485
|
};
|
|
486
|
-
//# sourceMappingURL=chunk-
|
|
486
|
+
//# sourceMappingURL=chunk-3B5EULS6.js.map
|