@12-apps/marketplace 1.13.0 → 1.14.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 +143 -3
- package/README.md +27 -2
- package/dist/99food/index.d.ts +2 -2
- package/dist/99food/index.js +2 -2
- package/dist/{adapter-CQ4QiZPi.d.ts → adapter-szxo9ohc.d.ts} +82 -2
- package/dist/{chunk-NFJQQWG4.js → chunk-BNWRIR5J.js} +2 -2
- package/dist/{chunk-4J2KJ3ZW.js → chunk-BTKVZAJI.js} +1 -1
- package/dist/chunk-BTKVZAJI.js.map +1 -0
- package/dist/{chunk-CEWTV2TC.js → chunk-MDXSVE7Q.js} +652 -246
- package/dist/chunk-MDXSVE7Q.js.map +1 -0
- package/dist/{chunk-W57TITU4.js → chunk-R3BUW5PX.js} +53 -6
- package/dist/chunk-R3BUW5PX.js.map +1 -0
- package/dist/{client-CCSnylou.d.ts → client-CaZiG7Lw.d.ts} +1 -1
- package/dist/{engine-1KlJ_8jK.d.ts → engine-CgKBbk9J.d.ts} +127 -3
- package/dist/hono/index.d.ts +2 -2
- package/dist/hono/index.js +2 -2
- package/dist/ifood/index.d.ts +13 -3
- package/dist/ifood/index.js +114 -23
- package/dist/ifood/index.js.map +1 -1
- package/dist/index.d.ts +29 -5
- package/dist/index.js +54 -6
- 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 +4 -2
- package/dist/manifest/server.js +2 -2
- package/dist/rappi/index.d.ts +1 -1
- package/dist/rappi/index.js +1 -1
- package/dist/server/index.d.ts +14 -5
- package/dist/server/index.js +2 -2
- package/package.json +1 -1
- package/prisma/marketplace.prisma +17 -3
- package/prisma/migrations/20261202120000_marketplace_ifood_conformity/migration.sql +25 -0
- package/src/core/acceptance.ts +12 -6
- package/src/core/acknowledge.ts +189 -0
- package/src/core/adapter.ts +74 -1
- package/src/core/cancellation.ts +10 -6
- package/src/core/conformity.ts +63 -0
- package/src/core/engine.ts +3 -2
- package/src/core/ingest.ts +6 -0
- package/src/core/link-store.ts +2 -4
- package/src/core/marketplace-confirmed.ts +229 -0
- package/src/core/order-reasons.ts +119 -0
- package/src/core/outbound.ts +5 -1
- package/src/core/pipeline.ts +27 -1
- package/src/core/ports.ts +2 -0
- package/src/core/registry.ts +28 -2
- package/src/core/state.ts +10 -0
- package/src/core/status-job.ts +86 -3
- package/src/core/types.ts +6 -0
- package/src/ifood/index.ts +27 -4
- package/src/ifood/normalize.ts +16 -0
- package/src/ifood/outbound.ts +131 -27
- package/src/index.ts +18 -0
- package/src/server/jobs.ts +57 -4
- package/src/server/webhook.ts +27 -4
- package/dist/chunk-4J2KJ3ZW.js.map +0 -1
- package/dist/chunk-CEWTV2TC.js.map +0 -1
- package/dist/chunk-W57TITU4.js.map +0 -1
- /package/dist/{chunk-NFJQQWG4.js.map → chunk-BNWRIR5J.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as AcceptanceDecision, a as AcceptanceStatus, b as
|
|
2
|
-
import { c as MarketplaceAdapter, l as MarketplaceProvider, m as CancellationReason } from './adapter-
|
|
3
|
-
export { A as AdapterCallContext, n as AdapterGrant, o as AdapterTokenCache, p as CancellationOutcome, q as CancellationRequestInput, r as CatalogueCallContext, s as CatalogueFailure, t as CatalogueImage, u as CatalogueItem, e as CatalogueItemOut, v as CatalogueItemRef, C as CatalogueMenuEntry, b as CatalogueMenuOptions, w as CataloguePublishResult, x as CatalogueReadContext, y as CatalogueReadNotice, z as CatalogueReadRefusalCode, B as CatalogueReadResult, D as CatalogueReadWarning, E as CatalogueReadWarningCode, f as CatalogueReader, G as CatalogueSnapshot, H as CatalogueSnapshotCategory, I as CatalogueSnapshotItem, J as CatalogueSnapshotOption, K as CatalogueSnapshotOptionGroup, L as CatalogueStoredImage, Q as CatalogueWarningCode, R as CourierTrackingCallResult, T as CourierTrackingResult, F as FetchOrderResult, U as LinkCallContext, V as LinkCode, W as LinkGrant, X as LinkResult, Y as LinkedMerchant, Z as MarketplaceAppCredentialsPort, M as MarketplaceAvailability,
|
|
1
|
+
export { A as AcceptanceDecision, a as AcceptanceStatus, b as AcknowledgeJobPayload, c as AcknowledgeOutcome, d as AcknowledgeRetryError, e as AvailabilityJobPayload, f as AvailabilityOutcome, g as AvailabilityRetryError, h as AvailabilitySweepResult, B as BulkProblem, i as BulkProblemCode, j as BulkResult, C as CancellationFailureReason, k as CancellationReasonsJobPayload, l as CancellationReasonsOutcome, m as CancellationReasonsRetryError, n as CancellationStatus, o as CatalogueAction, p as CatalogueActionResult, q as CatalogueDocumentResult, r as CatalogueFailedAction, s as CatalogueFailureCode, t as CatalogueJobPayload, u as CatalogueOutcome, v as CataloguePublicationView, w as CataloguePublishInput, x as CatalogueRefusalCode, y as CatalogueRetryError, z as CatalogueStatus, D as CatalogueTarget, E as DecideManyResult, F as DecidedRow, G as DecisionInput, H as DecisionProblem, I as DecisionProblemCode, J as DecisionResult, K as DeliveryOutcome, L as ExpirySweepResult, M as FetchOrderJobPayload, N as FetchOrderOutcome, O as FetchOrderRetryError, P as InformStatusInput, Q as IngestResult, R as IngestSettings, S as IngestionTarget, T as IntegrationRowInput, U as LinkFailure, V as LinkFinished, W as LinkPendingView, X as LinkRefusalCode, Y as MARKETPLACE_ACKNOWLEDGE_JOB, Z as MARKETPLACE_AVAILABILITY_JOB, _ as MARKETPLACE_CANCELLATION_REASONS_JOB, $ as MARKETPLACE_CATALOGUE_JOB, a0 as MARKETPLACE_FETCH_ORDER_JOB, a1 as MARKETPLACE_OUTBOUND_JOB, a2 as MarketplaceAdmission, a3 as MarketplaceAdmissionRequest, a4 as MarketplaceAdmissionResult, a5 as MarketplaceAuditEntry, a6 as MarketplaceAuditPort, a7 as MarketplaceAuthMode, a8 as MarketplaceCataloguePort, a9 as MarketplaceClockPort, aa as MarketplaceConformityEngine, ab as MarketplaceDb, ac as MarketplaceEngine, ad as MarketplaceEngineConfig, ae as MarketplaceEnqueuePort, af as MarketplaceIntegrationView, ag as MarketplaceLifecycleAnswer, ah as MarketplaceLifecycleFacts, ai as MarketplaceLogger, aj as MarketplaceMenuLinkView, ak as MarketplaceOrderPort, al as MarketplaceOrderState, am as MarketplaceOrderSummary, an as MarketplacePorts, ao as MarketplaceRefusal, ap as MarketplaceSecretsPort, aq as MenuLinkRowInput, ar as OUTBOUND_GIVE_UP_MS, as as OUTBOUND_STALE_MS, at as OutboundAction, au as OutboundAttempt, av as OutboundJobPayload, aw as OutboundOutcome, ax as OutboundRetryError, ay as OutboundSweepResult, az as PauseOutcome, aA as PauseStoreInput, aB as PauseStoreResult, aC as PendingAcceptance, aD as PendingInboxEvent, aE as ResolvedOrderLine, aF as ResumeOutcome, aG as STORE_PAUSE_LEASE_MS, aH as SaveMarketplaceIntegrationInput, aI as StoreAvailabilityView, aJ as StorePauseFailureCode, aK as StorePauseState, aL as StorePauseWanted, aM as availabilityDedupeKey, aN as catalogueDedupeKey, aO as createMarketplaceEngine, aP as outboundDedupeKey } from './engine-CgKBbk9J.js';
|
|
2
|
+
import { c as MarketplaceAdapter, l as MarketplaceProvider, m as CancellationReason } from './adapter-szxo9ohc.js';
|
|
3
|
+
export { A as AdapterCallContext, n as AdapterGrant, o as AdapterTokenCache, p as CancellationOutcome, q as CancellationRequestInput, r as CatalogueCallContext, s as CatalogueFailure, t as CatalogueImage, u as CatalogueItem, e as CatalogueItemOut, v as CatalogueItemRef, C as CatalogueMenuEntry, b as CatalogueMenuOptions, w as CataloguePublishResult, x as CatalogueReadContext, y as CatalogueReadNotice, z as CatalogueReadRefusalCode, B as CatalogueReadResult, D as CatalogueReadWarning, E as CatalogueReadWarningCode, f as CatalogueReader, G as CatalogueSnapshot, H as CatalogueSnapshotCategory, I as CatalogueSnapshotItem, J as CatalogueSnapshotOption, K as CatalogueSnapshotOptionGroup, L as CatalogueStoredImage, Q as CatalogueWarningCode, R as CourierTrackingCallResult, T as CourierTrackingResult, F as FetchOrderResult, U as LinkCallContext, V as LinkCode, W as LinkGrant, X as LinkResult, Y as LinkedMerchant, Z as MarketplaceAcknowledgement, _ as MarketplaceAppCredentialsPort, M as MarketplaceAvailability, $ as MarketplaceCapabilities, a0 as MarketplaceCatalogue, a1 as MarketplaceCourier, a2 as MarketplaceCourierAnswer, h as MarketplaceCourierApi, a3 as MarketplaceCourierEngine, a4 as MarketplaceCourierFacts, a5 as MarketplaceCourierStep, a6 as MarketplaceCourierTracking, a7 as MarketplaceCourierVehicle, a8 as MarketplaceCredentials, a9 as MarketplaceDeliveredBy, aa as MarketplaceDiscountSponsor, ab as MarketplaceHttp, ac as MarketplaceHttpRequest, ad as MarketplaceHttpResponse, ae as MarketplaceLifecycle, af as MarketplaceLinkAttemptDelegate, g as MarketplaceLinking, ag as MarketplaceOrderType, ah as NormalizedAddress, ai as NormalizedBuyer, i as NormalizedCourierEvent, N as NormalizedEvent, a as NormalizedMarketplaceOrder, aj as NormalizedOrderDiscount, ak as NormalizedOrderLine, al as OrderCancellationReason, am as OrderCancellationReasonsResult, an as OutboundOrderRef, O as OutboundResult, ao as PROVIDER_ID_PATTERN, ap as PickupCodeCallResult, aq as PickupCodeValidation, ar as PresenceProbe, P as PullCatalogue, d as PushCatalogue, as as StatusFacts, at as StatusStep, k as StorePauseRef, S as StorePauseRequest, j as StorePauseResult, au as ValidatePickupCodeInput, av as answered, aw as centsFromMajor, ax as outboundResultOf, ay as tokenGrantResultOf } from './adapter-szxo9ohc.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The adapter registry: the ONE place a provider id becomes a marketplace.
|
|
@@ -32,7 +32,9 @@ declare function createAdapterRegistry(adapters: readonly MarketplaceAdapter[]):
|
|
|
32
32
|
* named none — the adapter's first. `null` when the code is not one of the
|
|
33
33
|
* adapter's, which a caller answers as a refusal of the whole request.
|
|
34
34
|
*/
|
|
35
|
-
declare function resolveReason(adapter: MarketplaceAdapter, code: string | null | undefined
|
|
35
|
+
declare function resolveReason(adapter: MarketplaceAdapter, code: string | null | undefined,
|
|
36
|
+
/** The order's own list (`cancellation_reasons`, FUT-5984); absent or unread: the static one. */
|
|
37
|
+
stored?: unknown): CancellationReason | null;
|
|
36
38
|
/**
|
|
37
39
|
* The reason a host should preselect: the adapter's "item unavailable" reason
|
|
38
40
|
* when the order cannot be covered, else its first. The SHORTAGE is the
|
|
@@ -73,6 +75,28 @@ declare class MarketplaceMerchantTakenError extends Error {
|
|
|
73
75
|
constructor(provider: string, merchantId: string);
|
|
74
76
|
}
|
|
75
77
|
|
|
78
|
+
/**
|
|
79
|
+
* The store accepted an order in the marketplace's own app (FUT-5653: iFood's
|
|
80
|
+
* CFM from its tablet or Gestor de Pedidos). The owner's decision (2026-12-02):
|
|
81
|
+
* the order is accepted here too, through the SAME admit as an aceite on the
|
|
82
|
+
* Quadro (`order.admit`: the stock ask), with no confirm sent back (the
|
|
83
|
+
* marketplace has it), and is never expired by our clock afterwards.
|
|
84
|
+
*
|
|
85
|
+
* In order:
|
|
86
|
+
* 1. no acceptance yet (the PLACED's fetch still running): DEFERRED, and
|
|
87
|
+
* applied right after that order's ingest, or by the expiry sweep before it
|
|
88
|
+
* would expire it;
|
|
89
|
+
* 2. not AWAITING (an ACCEPTED one is our own confirm's echo): IGNORED;
|
|
90
|
+
* 3. `confirmed_at` stamped on the AWAITING row: the marketplace has the
|
|
91
|
+
* acceptance, so the clock never expires it and no confirm is ever sent;
|
|
92
|
+
* 4. with no cancellation request standing, the host admits it and the row is
|
|
93
|
+
* claimed AWAITING → ACCEPTED in one transaction, then `onAccepted`. A
|
|
94
|
+
* refused admit leaves it AWAITING for a person, whose aceite then goes
|
|
95
|
+
* through `decide` as ever.
|
|
96
|
+
*/
|
|
97
|
+
/** The reason a confirmation that outran its order waits under. */
|
|
98
|
+
declare const CONFIRMED_BEFORE_ORDER = "confirmed before its order";
|
|
99
|
+
|
|
76
100
|
/**
|
|
77
101
|
* The outbound sweep's catalogue half (FUT-4768): nothing the store switched
|
|
78
102
|
* on or off is lost, and nothing waits forever on "sending".
|
|
@@ -87,4 +111,4 @@ declare const CATALOGUE_STALE_MS: number;
|
|
|
87
111
|
/** Past this, the marketplace is not going to answer this ask. */
|
|
88
112
|
declare const CATALOGUE_GIVE_UP_MS: number;
|
|
89
113
|
|
|
90
|
-
export { type AdapterRegistry, CATALOGUE_GIVE_UP_MS, CATALOGUE_STALE_MS, CancellationReason, MarketplaceAdapter, MarketplaceAdapterRegistrationError, MarketplaceMerchantTakenError, MarketplaceProvider, createAdapterRegistry, resolveReason, stableUuid, suggestReason };
|
|
114
|
+
export { type AdapterRegistry, CATALOGUE_GIVE_UP_MS, CATALOGUE_STALE_MS, CONFIRMED_BEFORE_ORDER, CancellationReason, MarketplaceAdapter, MarketplaceAdapterRegistrationError, MarketplaceMerchantTakenError, MarketplaceProvider, createAdapterRegistry, resolveReason, stableUuid, suggestReason };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AcknowledgeRetryError,
|
|
2
3
|
AvailabilityRetryError,
|
|
3
4
|
CANCELLED_BEFORE_INGEST_REASON,
|
|
4
5
|
CATALOGUE_GIVE_UP_MS,
|
|
5
6
|
CATALOGUE_ROW_SELECT,
|
|
6
7
|
CATALOGUE_STALE_MS,
|
|
7
8
|
CLAIM_SELECT,
|
|
9
|
+
CONFIRMED_BEFORE_ORDER,
|
|
10
|
+
CancellationReasonsRetryError,
|
|
8
11
|
CatalogueRetryError,
|
|
9
12
|
FetchOrderRetryError,
|
|
13
|
+
MARKETPLACE_ACKNOWLEDGE_JOB,
|
|
10
14
|
MARKETPLACE_AVAILABILITY_JOB,
|
|
15
|
+
MARKETPLACE_CANCELLATION_REASONS_JOB,
|
|
11
16
|
MARKETPLACE_CATALOGUE_JOB,
|
|
12
17
|
MARKETPLACE_FETCH_ORDER_JOB,
|
|
13
18
|
MARKETPLACE_OUTBOUND_JOB,
|
|
@@ -21,6 +26,7 @@ import {
|
|
|
21
26
|
PROVIDER_ID_PATTERN,
|
|
22
27
|
STORE_PAUSE_LEASE_MS,
|
|
23
28
|
appCredentialsOf,
|
|
29
|
+
applyMarketplaceConfirmation,
|
|
24
30
|
availabilityDedupeKey,
|
|
25
31
|
awaitOrderBody,
|
|
26
32
|
cacheLinkToken,
|
|
@@ -32,6 +38,7 @@ import {
|
|
|
32
38
|
connectionMerchantId,
|
|
33
39
|
createAdapterRegistry,
|
|
34
40
|
deferInboxEvent,
|
|
41
|
+
enqueueAcknowledge,
|
|
35
42
|
enqueueAvailability,
|
|
36
43
|
enqueueCatalogue,
|
|
37
44
|
enqueueOutbound,
|
|
@@ -55,9 +62,11 @@ import {
|
|
|
55
62
|
outboundDedupeKey,
|
|
56
63
|
pauseTable,
|
|
57
64
|
planCancellation,
|
|
65
|
+
readOrderReasons,
|
|
58
66
|
readOutboundConnection,
|
|
59
67
|
readPause,
|
|
60
68
|
readStatusRows,
|
|
69
|
+
reasonsForOrder,
|
|
61
70
|
recordInboxEvent,
|
|
62
71
|
refusalData,
|
|
63
72
|
requestData,
|
|
@@ -66,7 +75,9 @@ import {
|
|
|
66
75
|
resolveIngestionTarget,
|
|
67
76
|
resolveReason,
|
|
68
77
|
resolveTenantByMerchant,
|
|
78
|
+
runAcknowledge,
|
|
69
79
|
runAvailability,
|
|
80
|
+
runCancellationReasons,
|
|
70
81
|
runCatalogue,
|
|
71
82
|
runFetchOrder,
|
|
72
83
|
runOutbound,
|
|
@@ -75,13 +86,15 @@ import {
|
|
|
75
86
|
settleInboxEvent,
|
|
76
87
|
statusDedupeKey,
|
|
77
88
|
statusTable,
|
|
89
|
+
storedReasons,
|
|
78
90
|
suggestReason,
|
|
91
|
+
sweepAcknowledgements,
|
|
79
92
|
sweepOutbound,
|
|
80
93
|
tellCancellationFailed,
|
|
81
94
|
upsertLink,
|
|
82
95
|
validatePickupCode,
|
|
83
96
|
viewOf
|
|
84
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-MDXSVE7Q.js";
|
|
85
98
|
import {
|
|
86
99
|
centsFromMajor
|
|
87
100
|
} from "./chunk-WN2EK4KX.js";
|
|
@@ -92,7 +105,7 @@ import {
|
|
|
92
105
|
answered,
|
|
93
106
|
outboundResultOf,
|
|
94
107
|
tokenGrantResultOf
|
|
95
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-BTKVZAJI.js";
|
|
96
109
|
import {
|
|
97
110
|
__name
|
|
98
111
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -753,6 +766,28 @@ function courierEngine(ctx) {
|
|
|
753
766
|
}
|
|
754
767
|
__name(courierEngine, "courierEngine");
|
|
755
768
|
|
|
769
|
+
// src/core/conformity.ts
|
|
770
|
+
function conformityEngine(ctx) {
|
|
771
|
+
return {
|
|
772
|
+
answerStatus: /* @__PURE__ */ __name((provider) => ctx.registry.get(provider)?.capabilities.webhookAnswerStatus ?? 200, "answerStatus"),
|
|
773
|
+
presence: /* @__PURE__ */ __name((provider, payload) => ctx.registry.get(provider)?.presence?.(payload) ?? null, "presence"),
|
|
774
|
+
signedByApp: /* @__PURE__ */ __name(async (provider, rawBody, signature) => {
|
|
775
|
+
const adapter = ctx.registry.has(provider) ? ctx.registry.get(provider) : null;
|
|
776
|
+
if (!adapter || signature === null) return false;
|
|
777
|
+
for (const environment of ["PRODUCTION", "SANDBOX"]) {
|
|
778
|
+
const app = await appCredentialsOf(ctx, provider, environment);
|
|
779
|
+
if (app && adapter.verifySignature(rawBody, signature, app.webhookSecret || app.clientSecret)) return true;
|
|
780
|
+
}
|
|
781
|
+
return false;
|
|
782
|
+
}, "signedByApp"),
|
|
783
|
+
orderReasons: /* @__PURE__ */ __name((clientId, orderId) => readOrderReasons(ctx, clientId, orderId), "orderReasons"),
|
|
784
|
+
runAcknowledge: /* @__PURE__ */ __name((payload, attempt) => runAcknowledge(ctx, payload, attempt), "runAcknowledge"),
|
|
785
|
+
sweepAcknowledgements: /* @__PURE__ */ __name(() => sweepAcknowledgements(ctx), "sweepAcknowledgements"),
|
|
786
|
+
runCancellationReasons: /* @__PURE__ */ __name((payload, attempt) => runCancellationReasons(ctx, payload, attempt), "runCancellationReasons")
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
__name(conformityEngine, "conformityEngine");
|
|
790
|
+
|
|
756
791
|
// src/core/linking.ts
|
|
757
792
|
var refused2 = /* @__PURE__ */ __name((code, status = null, message = null) => ({
|
|
758
793
|
kind: "refused",
|
|
@@ -1268,6 +1303,7 @@ async function processDelivery(ctx, input) {
|
|
|
1268
1303
|
const { clientId, event, settings } = input;
|
|
1269
1304
|
const record = await recordInboxEvent(ctx, { clientId, event, payload: input.payload });
|
|
1270
1305
|
if (!record.fresh) return { kind: "duplicate" };
|
|
1306
|
+
await enqueueAcknowledge(ctx, { clientId, provider: event.provider, inboxId: record.id });
|
|
1271
1307
|
if (!clientId || !settings) {
|
|
1272
1308
|
const reason = clientId ? "integration is not enabled" : "no tenant claims this merchant";
|
|
1273
1309
|
if (clientId) await deferInboxEvent(ctx, record.id, reason);
|
|
@@ -1313,11 +1349,16 @@ async function applyEvent(ctx, inboxId, clientId, event, settings, now) {
|
|
|
1313
1349
|
await awaitOrderBody(ctx, clientId, inboxId);
|
|
1314
1350
|
return { kind: "awaitingOrder" };
|
|
1315
1351
|
}
|
|
1316
|
-
const followed = await
|
|
1352
|
+
const followed = await followMarketplace(ctx, inboxId, clientId, event, settings);
|
|
1317
1353
|
if (followed) return followed;
|
|
1318
1354
|
return ingestOrIgnore(ctx, inboxId, clientId, event, settings, now);
|
|
1319
1355
|
}
|
|
1320
1356
|
__name(applyEvent, "applyEvent");
|
|
1357
|
+
async function followMarketplace(ctx, inboxId, clientId, event, settings) {
|
|
1358
|
+
const confirmed = await applyMarketplaceConfirmation(ctx, inboxId, clientId, event);
|
|
1359
|
+
return confirmed ?? followCourierAndLifecycle(ctx, inboxId, clientId, event, settings);
|
|
1360
|
+
}
|
|
1361
|
+
__name(followMarketplace, "followMarketplace");
|
|
1321
1362
|
async function ingestOrIgnore(ctx, inboxId, clientId, event, settings, now) {
|
|
1322
1363
|
if (!event.order) {
|
|
1323
1364
|
const reason = `no order body on ${event.eventType}`;
|
|
@@ -1392,7 +1433,8 @@ async function readOrderStates(ctx, clientId, orderIds) {
|
|
|
1392
1433
|
confirmFailedAt: true,
|
|
1393
1434
|
cancellationStatus: true,
|
|
1394
1435
|
cancellationReasonCode: true,
|
|
1395
|
-
cancellationFailureReason: true
|
|
1436
|
+
cancellationFailureReason: true,
|
|
1437
|
+
cancellationReasons: true
|
|
1396
1438
|
}
|
|
1397
1439
|
});
|
|
1398
1440
|
return new Map(
|
|
@@ -1409,7 +1451,8 @@ async function readOrderStates(ctx, clientId, orderIds) {
|
|
|
1409
1451
|
cancellation: row.cancellationStatus,
|
|
1410
1452
|
cancellationReasonCode: row.cancellationReasonCode,
|
|
1411
1453
|
cancellationFailure: row.cancellationFailureReason,
|
|
1412
|
-
appUrl: adapter ? adapter.appLink(row) : null
|
|
1454
|
+
appUrl: adapter ? adapter.appLink(row) : null,
|
|
1455
|
+
cancellationReasons: adapter && storedReasons(row.cancellationReasons) !== null ? reasonsForOrder(adapter, row.cancellationReasons) : null
|
|
1413
1456
|
};
|
|
1414
1457
|
return [row.orderId, state];
|
|
1415
1458
|
})
|
|
@@ -1473,7 +1516,7 @@ function createMarketplaceEngine(config) {
|
|
|
1473
1516
|
runOutbound: /* @__PURE__ */ __name((payload, attempt) => runOutbound(ctx, payload, attempt), "runOutbound"),
|
|
1474
1517
|
runFetchOrder: /* @__PURE__ */ __name((payload, attempt) => runFetchOrder(ctx, payload, attempt), "runFetchOrder"),
|
|
1475
1518
|
informStatus: /* @__PURE__ */ __name((input) => informStatus(ctx, input), "informStatus"),
|
|
1476
|
-
...courierEngine(ctx),
|
|
1519
|
+
...{ ...courierEngine(ctx), ...conformityEngine(ctx) },
|
|
1477
1520
|
// Null too when the host bound no catalogue port: nothing could be published.
|
|
1478
1521
|
catalogueMode: /* @__PURE__ */ __name((provider) => ports.catalogue ? registry.get(provider)?.catalogue?.mode ?? null : null, "catalogueMode"),
|
|
1479
1522
|
publish: /* @__PURE__ */ __name((input) => publishToCatalogue(ctx, input), "publish"),
|
|
@@ -1491,12 +1534,17 @@ function createMarketplaceEngine(config) {
|
|
|
1491
1534
|
}
|
|
1492
1535
|
__name(createMarketplaceEngine, "createMarketplaceEngine");
|
|
1493
1536
|
export {
|
|
1537
|
+
AcknowledgeRetryError,
|
|
1494
1538
|
AvailabilityRetryError,
|
|
1495
1539
|
CATALOGUE_GIVE_UP_MS,
|
|
1496
1540
|
CATALOGUE_STALE_MS,
|
|
1541
|
+
CONFIRMED_BEFORE_ORDER,
|
|
1542
|
+
CancellationReasonsRetryError,
|
|
1497
1543
|
CatalogueRetryError,
|
|
1498
1544
|
FetchOrderRetryError,
|
|
1545
|
+
MARKETPLACE_ACKNOWLEDGE_JOB,
|
|
1499
1546
|
MARKETPLACE_AVAILABILITY_JOB,
|
|
1547
|
+
MARKETPLACE_CANCELLATION_REASONS_JOB,
|
|
1500
1548
|
MARKETPLACE_CATALOGUE_JOB,
|
|
1501
1549
|
MARKETPLACE_FETCH_ORDER_JOB,
|
|
1502
1550
|
MARKETPLACE_OUTBOUND_JOB,
|