@12-apps/marketplace 1.14.0 → 1.15.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 +115 -0
- package/dist/99food/index.d.ts +2 -2
- package/dist/99food/index.js +2 -2
- package/dist/{adapter-szxo9ohc.d.ts → adapter-CjVdMhZ2.d.ts} +96 -3
- package/dist/{chunk-MDXSVE7Q.js → chunk-B4DYPQFE.js} +6 -6
- package/dist/chunk-B4DYPQFE.js.map +1 -0
- package/dist/{chunk-BD7DS3XM.js → chunk-E4XJXHUK.js} +20 -1
- package/dist/chunk-E4XJXHUK.js.map +1 -0
- package/dist/{chunk-R3BUW5PX.js → chunk-FQI56NGC.js} +2 -2
- package/dist/chunk-H2VQRD3B.js +16 -0
- package/dist/chunk-H2VQRD3B.js.map +1 -0
- package/dist/{chunk-BNWRIR5J.js → chunk-TRUK5ZBE.js} +11 -3
- package/dist/chunk-TRUK5ZBE.js.map +1 -0
- package/dist/{client-CaZiG7Lw.d.ts → client-DgzCkl8u.d.ts} +1 -1
- package/dist/{engine-CgKBbk9J.d.ts → engine-BSLdhAGC.d.ts} +8 -1
- package/dist/hono/index.d.ts +2 -2
- package/dist/hono/index.js +3 -2
- package/dist/hono/index.js.map +1 -1
- package/dist/ifood/index.d.ts +1 -1
- package/dist/ifood/index.js +105 -6
- package/dist/ifood/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -2
- 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/server.d.ts +2 -2
- package/dist/manifest/server.js +3 -2
- package/dist/manifest/server.js.map +1 -1
- package/dist/rappi/index.d.ts +1 -1
- package/dist/rappi/index.js +1 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +3 -2
- package/package.json +1 -1
- package/src/core/ingest.ts +1 -0
- package/src/core/order-types.ts +8 -0
- package/src/core/payload-read.ts +24 -0
- package/src/core/types.ts +111 -2
- package/src/ifood/normalize.ts +22 -5
- package/src/ifood/order-details.ts +120 -0
- package/src/index.ts +6 -0
- package/src/open-delivery/normalize.ts +9 -0
- package/dist/chunk-BD7DS3XM.js.map +0 -1
- package/dist/chunk-BNWRIR5J.js.map +0 -1
- package/dist/chunk-MDXSVE7Q.js.map +0 -1
- /package/dist/{chunk-R3BUW5PX.js.map → chunk-FQI56NGC.js.map} +0 -0
package/ADOPTING.md
CHANGED
|
@@ -627,3 +627,118 @@ Events `webhook-overview`, `webhook-best-practices`, `presence`,
|
|
|
627
627
|
go with it; and until the refusal dialog reads the order's own reasons
|
|
628
628
|
(step 5), a static code iFood did not list for that order is refused
|
|
629
629
|
`INVALID_REASON` instead of being sent.
|
|
630
|
+
|
|
631
|
+
## 13. Options, payment, fees and the buyer's document (FUT-5803)
|
|
632
|
+
|
|
633
|
+
An iFood order used to land without its complementos, its payment, its fees
|
|
634
|
+
besides delivery, the buyer's CPF/CNPJ and its eat-in types, and its lines
|
|
635
|
+
could sum to less than the receipt (a line was priced `unitPrice` only). Every
|
|
636
|
+
case below is a test in `src/ifood/__tests__/order-details.test.ts`, replayed
|
|
637
|
+
with the order shape of iFood's order-details guide
|
|
638
|
+
("Detalhes do pedido" on iFood's developer portal; the page answered 404 and 403
|
|
639
|
+
from this environment on 2026-12-02, so the shape was not checked against it), that failed
|
|
640
|
+
on `main` (`3e8ce550`: 14 failed; the 3 "absent when unstated" cases passed and
|
|
641
|
+
stay pinned).
|
|
642
|
+
|
|
643
|
+
### 13.1 The shape (additive, provider-neutral)
|
|
644
|
+
|
|
645
|
+
| field | meaning | iFood source | other adapters |
|
|
646
|
+
|---|---|---|---|
|
|
647
|
+
| `NormalizedOrderLine.options?: NormalizedLineOption[]` | each option the buyer chose: `externalCode`, `name`, `groupName`, `quantity` (for the WHOLE line), `unitPriceCents`, `totalCents` (always `unitPriceCents × quantity`). An option whose stated price does not divide by its count arrives as two rows of the same name (the floor, then one unit carrying the remainder), so the counts still sum to the stated count. Present only when there is at least one; then `unitPriceCents` is the item ALONE | `items[].options[]` (`name`, `externalCode`, `groupName`, `quantity`, `unitPrice`, `price`) | absent: Open Delivery (99Food, Keeta) and Rappi keep folding option prices into `unitPriceCents` and option names into `note`, as on `main` |
|
|
648
|
+
| `normalizedLineTotalCents(line)` | what a line costs: `unitPriceCents × quantity + Σ options[].totalCents`. Σ over the lines is the items' subtotal | iFood's `totalPrice` (`price + optionsPrice`) | equals `unitPriceCents × quantity` (no options) |
|
|
649
|
+
| `ResolvedOrderLine.options?` | the same options, handed to `order.create` with the resolved lines | — | absent |
|
|
650
|
+
| `NormalizedBuyer.document?` | the CPF or CNPJ for the invoice, digits only | `customer.documentNumber`, else `customer.document` | Open Delivery's `customer.documentNumber` |
|
|
651
|
+
| `NormalizedBuyer.phoneLocalizer?` | the extension that reaches the buyer through the marketplace's masked number | `customer.phone.localizer` | absent |
|
|
652
|
+
| `MarketplaceOrderType` gains `DINE_IN` and `INDOOR` | eaten at the store; ordered from inside it (a table) | `orderType` | unchanged (Open Delivery's `INDOOR` still reads null) |
|
|
653
|
+
| `NormalizedMarketplaceOrder.payments?: NormalizedPayments` | `prepaidCents`, `pendingCents`, `methods[]`: `method` (`CREDIT`, `DEBIT`, `MEAL_VOUCHER`, `FOOD_VOUCHER`, `PIX`, `CASH`, `DIGITAL_WALLET`, else `OTHER`), `statedMethod` (verbatim), `prepaid` (true online, false at the door, null unstated), `valueCents`, `cardBrand`, `changeForCents` (cash: the note the buyer pays with) | `payments.prepaid`, `payments.pending`, `payments.methods[]` (`method`, `type` ONLINE/OFFLINE, else `prepaid`, `value`, `card.brand`, `cash.changeFor`) | absent |
|
|
654
|
+
| `NormalizedMarketplaceOrder.additionalFees?: NormalizedOrderFee[]` | fees besides delivery, inside `totalCents`: `kind` (verbatim), `cents`, `name?` | top-level `additionalFees[]` (`type`, `value`, `description`) | absent |
|
|
655
|
+
|
|
656
|
+
Every new field is optional, and an unstated one is ABSENT (not null): a
|
|
657
|
+
payload that states none of these parts normalizes deep-equal to what `main`
|
|
658
|
+
produced. A payload that states them does not, and a host that deep-compares
|
|
659
|
+
normalized orders sees each of these:
|
|
660
|
+
|
|
661
|
+
- an iFood line with `options[]` gains `options`;
|
|
662
|
+
- an iFood order gains `payments` when it states `payments` (every real order
|
|
663
|
+
does), and `additionalFees` when it states `additionalFees[]`;
|
|
664
|
+
- an iFood buyer gains `document` (`customer.documentNumber` or `document`)
|
|
665
|
+
and `phoneLocalizer` (`customer.phone.localizer`);
|
|
666
|
+
- an iFood `orderType` of `DINE_IN` or `INDOOR` reads as that value, where
|
|
667
|
+
`main` read null;
|
|
668
|
+
- an Open Delivery buyer (99Food, Keeta) gains `document` when the order
|
|
669
|
+
states `customer.documentNumber`.
|
|
670
|
+
|
|
671
|
+
### 13.2 The cases
|
|
672
|
+
|
|
673
|
+
| id | order | `main` | this release |
|
|
674
|
+
|---|---|---|---|
|
|
675
|
+
| O1 | a pizza with "Borda recheada" R$ 8, "Bacon extra" 2 × R$ 2, "Sem cebola" R$ 0 | options dropped | each option on the line, a free one included (the kitchen reads it) |
|
|
676
|
+
| O2 | the same order | lines sum R$ 57 against a subtotal of R$ 69 | Σ `normalizedLineTotalCents` = `subtotalCents`, and subtotal + delivery fee = total |
|
|
677
|
+
| O3 | no `total` stated | total = Σ unit × quantity, options lost | total = Σ line totals, options included |
|
|
678
|
+
| O4 | an option whose `price` is not `unitPrice × quantity` (3 × Borda at R$ 10.00) | — | the stated `price` is the total, split over the stated count: 2 × 3.33 + 1 × 3.34, still 3 × Borda; one row at `price / quantity` when it divides (O4b) |
|
|
679
|
+
| O6 | 2 × Pizza, each with a Borda (option `quantity: 2`, `price: 16`) | options dropped, line R$ 90 against a `totalPrice` of R$ 106 | line R$ 90 + 2 × Borda R$ 16 = R$ 106; the lines add up to the subtotal |
|
|
680
|
+
| O5 | the order ingested | — | `order.create` receives the options on the resolved lines; a line with none carries no key |
|
|
681
|
+
| P1 | online credit card | dropped | `CREDIT`, prepaid, brand, value |
|
|
682
|
+
| P2 | cash at the door with change for R$ 100 | dropped | `CASH`, not prepaid, `changeForCents: 10000`, `pendingCents` the whole total |
|
|
683
|
+
| P3 | debit at the door, a gift card online | dropped | `DEBIT` not prepaid with its brand; `OTHER` with `statedMethod: "GIFT_CARD"` |
|
|
684
|
+
| P4 | any stated payment | — | Σ `methods[].valueCents` = `totalCents` = prepaid + pending, as iFood states them |
|
|
685
|
+
| F1 | a small-order fee R$ 2.99 | dropped (inside the total, nowhere else) | `additionalFees: [{ kind: "SMALL_ORDER_FEE", cents: 299, name }]`; lines + delivery fee + fees = total |
|
|
686
|
+
| B1/B2 | a CPF as `documentNumber`, a CNPJ as `document` | dropped | `buyer.document`, digits only; the phone's localizer in `buyer.phoneLocalizer` |
|
|
687
|
+
| T1/T2 | `INDOOR`, `DINE_IN` | `orderType: null` | `orderType: "INDOOR"` / `"DINE_IN"`, no deliverer, no address |
|
|
688
|
+
|
|
689
|
+
### 13.3 What is still ESTIMATED
|
|
690
|
+
|
|
691
|
+
- iFood's option `quantity`: read as the count for the whole line. The money
|
|
692
|
+
is right either way (the option's stated `price` is used), but if iFood's
|
|
693
|
+
count is per unit of the item, a line of 2 shows "1 × Borda" where the
|
|
694
|
+
kitchen makes two. Test O6 pins the whole-line reading. Confirming it on a
|
|
695
|
+
real order with an item quantity above 1 is a gate of the HOST bump (its
|
|
696
|
+
step 1 puts the count on the kitchen ticket), not of this release.
|
|
697
|
+
- An option's nested `customizations[]` (a sub-choice inside an option) are
|
|
698
|
+
not read: their price is assumed inside the option's `price`.
|
|
699
|
+
- An item stating `optionsPrice` with no `options[]` listed keeps only its
|
|
700
|
+
`unitPrice × quantity`; the stated order total is unaffected.
|
|
701
|
+
- `additionalFees[].liabilities` (who keeps the fee) is not read.
|
|
702
|
+
- A tax id stated as a NUMBER lost its leading zeros on the wire; it is padded
|
|
703
|
+
back to 11 digits (CPF), or 14 (CNPJ) when longer (test B4). A CNPJ sent as
|
|
704
|
+
a number with three or more leading zeros has 11 digits or fewer and reads
|
|
705
|
+
as a CPF; a bare number cannot tell the two apart. Both providers document
|
|
706
|
+
the field as a string.
|
|
707
|
+
|
|
708
|
+
### 13.4 What the host binds on the bump
|
|
709
|
+
|
|
710
|
+
The engine adds no table and no migration: everything travels on the order and
|
|
711
|
+
lines `order.create` already receives. Where a host keeps it is the host's
|
|
712
|
+
call; for a host with a line-extras model and a door-payment model (the origin
|
|
713
|
+
host), the mapping is:
|
|
714
|
+
|
|
715
|
+
1. **Options → the line's extras.** For each `options[]` entry write one extra
|
|
716
|
+
row (an option split in two rows, O4, is two extras of the same name) (name snapshot = `name`, unit price = `unitPriceCents`,
|
|
717
|
+
quantity = `quantity`, no catalogue id): every reader that already shows a
|
|
718
|
+
storefront line's extras (the order board card, the kitchen ticket, the
|
|
719
|
+
fiscal and till sums: `unit × quantity + Σ extra unit × extra quantity`)
|
|
720
|
+
then shows and sums them unchanged. Keep the line's own unit price as
|
|
721
|
+
`unitPriceCents` (the item alone). A host that ignores `options` keeps
|
|
722
|
+
`main`'s behaviour, lines short by the options' price.
|
|
723
|
+
2. **The buyer's document** goes where the host keeps a buyer tax id for the
|
|
724
|
+
invoice (encrypted at rest like any CPF), never in a log.
|
|
725
|
+
3. **Payment.** `payments.pendingCents > 0` is money the store's courier or
|
|
726
|
+
counter still collects: draw the pedido's payment line from the pending
|
|
727
|
+
method (`CASH` with `changeForCents` reads as cash with change for that
|
|
728
|
+
amount, the vocabulary a door payment already has; `CREDIT`, `DEBIT`,
|
|
729
|
+
`PIX`, `MEAL_VOUCHER`, `FOOD_VOUCHER` map one to one; `DIGITAL_WALLET` and
|
|
730
|
+
`OTHER` read as the marketplace's own word). Whether such a pedido is
|
|
731
|
+
still born PAID is the host's decision; a prepaid order (`pendingCents`
|
|
732
|
+
0) reads "Pago no <marketplace>" with the method and brand.
|
|
733
|
+
4. **Additional fees** are inside `totalCents` already. A host whose order-fee
|
|
734
|
+
table has a closed kind list widens it (an additive CHECK change, a host
|
|
735
|
+
migration) or shows them from the order's own record; summing them again
|
|
736
|
+
would charge them twice.
|
|
737
|
+
5. **Order type.** `DINE_IN` / `INDOOR` are not deliveries: route them like a
|
|
738
|
+
counter or table order (no delivery run, no address), never by the
|
|
739
|
+
`deliveredBy` fallback that treats an unknown type as a delivery.
|
|
740
|
+
6. **TypeScript-visible additions** (a minor): the optional fields above;
|
|
741
|
+
`MarketplaceOrderType` widens (an exhaustive switch adds two cases); new
|
|
742
|
+
exports `normalizedLineTotalCents`, `NormalizedLineOption`,
|
|
743
|
+
`NormalizedPayments`, `NormalizedPaymentMethod`, `MarketplacePaymentMethod`,
|
|
744
|
+
`NormalizedOrderFee`.
|
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-CjVdMhZ2.js';
|
|
2
|
+
import { O as OpenDeliveryApiBaseUrls } from '../client-DgzCkl8u.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,9 +12,9 @@ import {
|
|
|
12
12
|
openDeliveryStatus,
|
|
13
13
|
openDeliverySwitchAvailability,
|
|
14
14
|
verifyOpenDeliverySignature
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-TRUK5ZBE.js";
|
|
16
16
|
import "../chunk-M2V4RFMA.js";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-E4XJXHUK.js";
|
|
18
18
|
import "../chunk-BTKVZAJI.js";
|
|
19
19
|
import {
|
|
20
20
|
__name
|
|
@@ -199,13 +199,53 @@ interface NormalizedOrderLine {
|
|
|
199
199
|
unitPriceCents: number;
|
|
200
200
|
/** The buyer's note on this line, when they left one. */
|
|
201
201
|
note: string | null;
|
|
202
|
+
/**
|
|
203
|
+
* OPTIONAL (FUT-5803). The options the buyer chose on this line (a
|
|
204
|
+
* complemento: "borda recheada", "sem cebola"), each priced on its own. When
|
|
205
|
+
* present, `unitPriceCents` is the item ALONE and the line costs
|
|
206
|
+
* `unitPriceCents × quantity + Σ options[].totalCents`
|
|
207
|
+
* ({@link normalizedLineTotalCents}). Absent: none is itemized. Open
|
|
208
|
+
* Delivery and Rappi then fold the options' price into `unitPriceCents`;
|
|
209
|
+
* iFood does not, so an iFood item that states `optionsPrice` but lists no
|
|
210
|
+
* `options[]` is priced as the item alone. Never an empty array.
|
|
211
|
+
*/
|
|
212
|
+
options?: NormalizedLineOption[];
|
|
202
213
|
}
|
|
214
|
+
/** One option on an order line, as the marketplace priced it (FUT-5803). */
|
|
215
|
+
interface NormalizedLineOption {
|
|
216
|
+
/** The marketplace's own code for the option, when it gives one. */
|
|
217
|
+
externalCode: string | null;
|
|
218
|
+
name: string;
|
|
219
|
+
/** The group the marketplace shows it under ("Borda", "Adicionais"), when it says. */
|
|
220
|
+
groupName: string | null;
|
|
221
|
+
/** How many, for the WHOLE line (never per unit of it). */
|
|
222
|
+
quantity: number;
|
|
223
|
+
unitPriceCents: number;
|
|
224
|
+
/**
|
|
225
|
+
* Always exactly `unitPriceCents × quantity`. A stated price that does not
|
|
226
|
+
* divide by its count arrives as two rows of the same option (the floor,
|
|
227
|
+
* then one unit carrying the remainder), whose counts sum to the stated one.
|
|
228
|
+
*/
|
|
229
|
+
totalCents: number;
|
|
230
|
+
}
|
|
231
|
+
/** What a line costs: the item times its quantity, plus each of its options. */
|
|
232
|
+
declare function normalizedLineTotalCents(line: Pick<NormalizedOrderLine, "unitPriceCents" | "quantity" | "options">): number;
|
|
203
233
|
/** The buyer, as much of them as the marketplace discloses. */
|
|
204
234
|
interface NormalizedBuyer {
|
|
205
235
|
/** The marketplace's own stable id for this customer, when it gives one. */
|
|
206
236
|
externalId: string | null;
|
|
207
237
|
name: string | null;
|
|
208
238
|
phone: string | null;
|
|
239
|
+
/**
|
|
240
|
+
* OPTIONAL (FUT-5803). The buyer's tax id for the invoice (a CPF or a CNPJ),
|
|
241
|
+
* digits only. Absent: the marketplace states none.
|
|
242
|
+
*/
|
|
243
|
+
document?: string | null;
|
|
244
|
+
/**
|
|
245
|
+
* OPTIONAL (FUT-5803). The extension that reaches the buyer through the
|
|
246
|
+
* marketplace's masked number in `phone` (iFood's `phone.localizer`). Absent: none.
|
|
247
|
+
*/
|
|
248
|
+
phoneLocalizer?: string | null;
|
|
209
249
|
}
|
|
210
250
|
/** Where a delivery goes, as much of it as the marketplace states. */
|
|
211
251
|
interface NormalizedAddress {
|
|
@@ -219,8 +259,12 @@ interface NormalizedAddress {
|
|
|
219
259
|
city: string | null;
|
|
220
260
|
state: string | null;
|
|
221
261
|
}
|
|
222
|
-
/**
|
|
223
|
-
|
|
262
|
+
/**
|
|
263
|
+
* How the order reaches the buyer: brought to the door (`DELIVERY`), collected
|
|
264
|
+
* (`TAKEOUT`), eaten at the store (`DINE_IN`), or ordered from inside it, at a
|
|
265
|
+
* table or a spot the buyer names (`INDOOR`, FUT-5803).
|
|
266
|
+
*/
|
|
267
|
+
type MarketplaceOrderType = "DELIVERY" | "TAKEOUT" | "DINE_IN" | "INDOOR";
|
|
224
268
|
/** WHO carries a delivery: the merchant's own courier, or the marketplace's fleet. */
|
|
225
269
|
type MarketplaceDeliveredBy = "MERCHANT" | "MARKETPLACE";
|
|
226
270
|
/** WHO pays for a discount: the store, the marketplace's own campaign, or someone else (a card issuer, a voucher). */
|
|
@@ -233,6 +277,44 @@ interface NormalizedOrderDiscount {
|
|
|
233
277
|
/** What the marketplace called the campaign, when it says. */
|
|
234
278
|
name?: string;
|
|
235
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* How a buyer paid, as a closed set a host has words for. `OTHER`: stated,
|
|
282
|
+
* and none of these (the marketplace's own word is in `statedMethod`).
|
|
283
|
+
*/
|
|
284
|
+
type MarketplacePaymentMethod = "CREDIT" | "DEBIT" | "MEAL_VOUCHER" | "FOOD_VOUCHER" | "PIX" | "CASH" | "DIGITAL_WALLET" | "OTHER";
|
|
285
|
+
/** One way the buyer pays an order (FUT-5803). */
|
|
286
|
+
interface NormalizedPaymentMethod {
|
|
287
|
+
method: MarketplacePaymentMethod;
|
|
288
|
+
/** The marketplace's own word for the method, verbatim; null when it states none. */
|
|
289
|
+
statedMethod: string | null;
|
|
290
|
+
/**
|
|
291
|
+
* True: already paid on the marketplace. False: to collect from the buyer at
|
|
292
|
+
* the door or the counter. Null: unstated.
|
|
293
|
+
*/
|
|
294
|
+
prepaid: boolean | null;
|
|
295
|
+
/** What this method pays, in the smallest currency unit. */
|
|
296
|
+
valueCents: number;
|
|
297
|
+
/** The card's brand as the marketplace names it ("VISA"), when it does. */
|
|
298
|
+
cardBrand: string | null;
|
|
299
|
+
/** On cash: the note the buyer pays with, so the courier brings the change. Null: no change asked, or unstated. */
|
|
300
|
+
changeForCents: number | null;
|
|
301
|
+
}
|
|
302
|
+
/** The order's payment, as the marketplace states it (FUT-5803). */
|
|
303
|
+
interface NormalizedPayments {
|
|
304
|
+
/** What the marketplace already collected. Null: unstated. */
|
|
305
|
+
prepaidCents: number | null;
|
|
306
|
+
/** What is still to collect from the buyer. Null: unstated. */
|
|
307
|
+
pendingCents: number | null;
|
|
308
|
+
methods: NormalizedPaymentMethod[];
|
|
309
|
+
}
|
|
310
|
+
/** A fee the marketplace charged the buyer besides delivery (FUT-5803), such as a small-order fee. */
|
|
311
|
+
interface NormalizedOrderFee {
|
|
312
|
+
/** The marketplace's own kind, verbatim (`SMALL_ORDER_FEE`). */
|
|
313
|
+
kind: string;
|
|
314
|
+
cents: number;
|
|
315
|
+
/** What the marketplace called it, when it says. */
|
|
316
|
+
name?: string;
|
|
317
|
+
}
|
|
236
318
|
/** An incoming marketplace order, normalized. */
|
|
237
319
|
interface NormalizedMarketplaceOrder {
|
|
238
320
|
provider: MarketplaceProvider;
|
|
@@ -287,6 +369,17 @@ interface NormalizedMarketplaceOrder {
|
|
|
287
369
|
* the bag itself).
|
|
288
370
|
*/
|
|
289
371
|
pickupCode?: string | null;
|
|
372
|
+
/**
|
|
373
|
+
* OPTIONAL (FUT-5803). How the buyer pays: each method, what is prepaid and
|
|
374
|
+
* what is still to collect, and the change a cash buyer asks for. Absent:
|
|
375
|
+
* the marketplace states none.
|
|
376
|
+
*/
|
|
377
|
+
payments?: NormalizedPayments;
|
|
378
|
+
/**
|
|
379
|
+
* OPTIONAL (FUT-5803). The fees besides delivery, inside `totalCents`.
|
|
380
|
+
* Absent is "did not say"; an empty array is "none".
|
|
381
|
+
*/
|
|
382
|
+
additionalFees?: NormalizedOrderFee[];
|
|
290
383
|
}
|
|
291
384
|
/**
|
|
292
385
|
* What an event says about the STORE's own cancellation request: `CONFIRMED`
|
|
@@ -1193,4 +1286,4 @@ declare function tokenGrantResultOf(response: MarketplaceHttpResponse): Outbound
|
|
|
1193
1286
|
/** A call that never got an answer is a retry, with the reason a log can read. */
|
|
1194
1287
|
declare function answered(call: () => Promise<OutboundResult>): Promise<OutboundResult>;
|
|
1195
1288
|
|
|
1196
|
-
export { type MarketplaceCapabilities as $, type AdapterCallContext as A, type CatalogueReadResult as B, type CatalogueMenuEntry as C, type CatalogueReadWarning as D, type CatalogueReadWarningCode as E, type FetchOrderResult as F, type CatalogueSnapshot as G, type CatalogueSnapshotCategory as H, type CatalogueSnapshotItem as I, type CatalogueSnapshotOption as J, type CatalogueSnapshotOptionGroup as K, type CatalogueStoredImage as L, type MarketplaceAvailability as M, type NormalizedEvent as N, type OutboundResult as O, type PullCatalogue as P, type CatalogueWarningCode as Q, type CourierTrackingCallResult as R, type StorePauseRequest as S, type CourierTrackingResult as T, type LinkCallContext as U, type LinkCode as V, type LinkGrant as W, type LinkResult as X, type LinkedMerchant as Y, type MarketplaceAcknowledgement as Z, type MarketplaceAppCredentialsPort as _, type NormalizedMarketplaceOrder as a, type MarketplaceCatalogue as a0, type MarketplaceCourier as a1, type MarketplaceCourierAnswer as a2, type MarketplaceCourierEngine as a3, type MarketplaceCourierFacts as a4, type MarketplaceCourierStep as a5, type MarketplaceCourierTracking as a6, type MarketplaceCourierVehicle as a7, type MarketplaceCredentials as a8, type MarketplaceDeliveredBy as a9, type MarketplaceDiscountSponsor as aa, type MarketplaceHttp as ab, type MarketplaceHttpRequest as ac, type MarketplaceHttpResponse as ad, type MarketplaceLifecycle as ae, type MarketplaceLinkAttemptDelegate as af, type MarketplaceOrderType as ag, type
|
|
1289
|
+
export { type MarketplaceCapabilities as $, type AdapterCallContext as A, type CatalogueReadResult as B, type CatalogueMenuEntry as C, type CatalogueReadWarning as D, type CatalogueReadWarningCode as E, type FetchOrderResult as F, type CatalogueSnapshot as G, type CatalogueSnapshotCategory as H, type CatalogueSnapshotItem as I, type CatalogueSnapshotOption as J, type CatalogueSnapshotOptionGroup as K, type CatalogueStoredImage as L, type MarketplaceAvailability as M, type NormalizedEvent as N, type OutboundResult as O, type PullCatalogue as P, type CatalogueWarningCode as Q, type CourierTrackingCallResult as R, type StorePauseRequest as S, type CourierTrackingResult as T, type LinkCallContext as U, type LinkCode as V, type LinkGrant as W, type LinkResult as X, type LinkedMerchant as Y, type MarketplaceAcknowledgement as Z, type MarketplaceAppCredentialsPort as _, type NormalizedMarketplaceOrder as a, type MarketplaceCatalogue as a0, type MarketplaceCourier as a1, type MarketplaceCourierAnswer as a2, type MarketplaceCourierEngine as a3, type MarketplaceCourierFacts as a4, type MarketplaceCourierStep as a5, type MarketplaceCourierTracking as a6, type MarketplaceCourierVehicle as a7, type MarketplaceCredentials as a8, type MarketplaceDeliveredBy as a9, answered as aA, centsFromMajor as aB, normalizedLineTotalCents as aC, outboundResultOf as aD, tokenGrantResultOf as aE, type MarketplaceDiscountSponsor as aa, type MarketplaceHttp as ab, type MarketplaceHttpRequest as ac, type MarketplaceHttpResponse as ad, type MarketplaceLifecycle as ae, type MarketplaceLinkAttemptDelegate as af, type MarketplaceOrderType as ag, type MarketplacePaymentMethod as ah, type NormalizedAddress as ai, type NormalizedBuyer as aj, type NormalizedLineOption as ak, type NormalizedOrderDiscount as al, type NormalizedOrderFee as am, type NormalizedOrderLine as an, type NormalizedPaymentMethod as ao, type NormalizedPayments as ap, type OrderCancellationReason as aq, type OrderCancellationReasonsResult as ar, type OutboundOrderRef as as, PROVIDER_ID_PATTERN as at, type PickupCodeCallResult as au, type PickupCodeValidation as av, type PresenceProbe as aw, type StatusFacts as ax, type StatusStep as ay, type ValidatePickupCodeInput as az, type CatalogueMenuOptions as b, type MarketplaceAdapter as c, type PushCatalogue as d, type CatalogueItemOut as e, type CatalogueReader as f, type MarketplaceLinking as g, type MarketplaceCourierApi as h, type NormalizedCourierEvent as i, type StorePauseResult as j, type StorePauseRef as k, type MarketplaceProvider as l, type CancellationReason as m, type AdapterGrant as n, type AdapterTokenCache as o, type CancellationOutcome as p, type CancellationRequestInput as q, type CatalogueCallContext as r, type CatalogueFailure as s, type CatalogueImage as t, type CatalogueItem as u, type CatalogueItemRef as v, type CataloguePublishResult as w, type CatalogueReadContext as x, type CatalogueReadNotice as y, type CatalogueReadRefusalCode as z };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PROVIDER_ID_PATTERN
|
|
3
|
+
} from "./chunk-H2VQRD3B.js";
|
|
1
4
|
import {
|
|
2
5
|
__name
|
|
3
6
|
} from "./chunk-7QVYU63E.js";
|
|
4
7
|
|
|
5
|
-
// src/core/types.ts
|
|
6
|
-
var PROVIDER_ID_PATTERN = /^[A-Z][A-Z0-9_]*$/u;
|
|
7
|
-
|
|
8
8
|
// src/core/registry.ts
|
|
9
9
|
var MarketplaceAdapterRegistrationError = class extends Error {
|
|
10
10
|
static {
|
|
@@ -1466,7 +1466,8 @@ async function composeLines(db, clientId, order, seenAt) {
|
|
|
1466
1466
|
unitPriceCents: line.unitPriceCents,
|
|
1467
1467
|
note: line.note,
|
|
1468
1468
|
subjectRef: mapping.get(line.externalSku)?.menuItemId ?? null,
|
|
1469
|
-
variationRef: mapping.get(line.externalSku)?.variationId ?? null
|
|
1469
|
+
variationRef: mapping.get(line.externalSku)?.variationId ?? null,
|
|
1470
|
+
...line.options ? { options: line.options } : {}
|
|
1470
1471
|
}));
|
|
1471
1472
|
}
|
|
1472
1473
|
__name(composeLines, "composeLines");
|
|
@@ -2838,7 +2839,6 @@ __name(runAvailability, "runAvailability");
|
|
|
2838
2839
|
export {
|
|
2839
2840
|
requestsFirst,
|
|
2840
2841
|
tellCancellationFailed,
|
|
2841
|
-
PROVIDER_ID_PATTERN,
|
|
2842
2842
|
MarketplaceAdapterRegistrationError,
|
|
2843
2843
|
createAdapterRegistry,
|
|
2844
2844
|
storedReasons,
|
|
@@ -2932,4 +2932,4 @@ export {
|
|
|
2932
2932
|
AvailabilityRetryError,
|
|
2933
2933
|
runAvailability
|
|
2934
2934
|
};
|
|
2935
|
-
//# sourceMappingURL=chunk-
|
|
2935
|
+
//# sourceMappingURL=chunk-B4DYPQFE.js.map
|