@deliverart/sdk-js-integration 2.25.2 → 2.27.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/README.md +303 -56
- package/dist/index.cjs +3154 -1739
- package/dist/index.d.cts +31616 -2404
- package/dist/index.d.ts +31616 -2404
- package/dist/index.js +3111 -1681
- package/package.json +16 -12
package/README.md
CHANGED
|
@@ -11,12 +11,14 @@ npm install @deliverart/sdk-js-integration @deliverart/sdk-js-core
|
|
|
11
11
|
## Exported Types
|
|
12
12
|
|
|
13
13
|
### Core Types
|
|
14
|
+
|
|
14
15
|
- `Integration` - Integration configuration
|
|
15
16
|
- `ActivatableIntegration` - Integration that can be activated/deactivated
|
|
16
17
|
- `IntegrationActivationRequest` - Request to activate an integration
|
|
17
18
|
- `IntegrationCancellationRequest` - Request to cancel an integration
|
|
18
19
|
|
|
19
20
|
### Integration Types
|
|
21
|
+
|
|
20
22
|
Integration types vary by service (delivery partners, payment gateways, etc.)
|
|
21
23
|
|
|
22
24
|
The ecommerce info payload exposes the cached menu DTO. Item entries include
|
|
@@ -27,6 +29,7 @@ and `pointOfSale`, so storefronts can format menu prices, totals, payment
|
|
|
27
29
|
summaries, and order history without assuming EUR.
|
|
28
30
|
|
|
29
31
|
### IRI Types
|
|
32
|
+
|
|
30
33
|
- `IntegrationIri` - Integration IRI (`/integrations/:id`)
|
|
31
34
|
- `ActivationRequestIri` - Activation request IRI
|
|
32
35
|
- `CancellationRequestIri` - Cancellation request IRI
|
|
@@ -34,60 +37,70 @@ summaries, and order history without assuming EUR.
|
|
|
34
37
|
## Available Requests
|
|
35
38
|
|
|
36
39
|
### GetIntegrations
|
|
40
|
+
|
|
37
41
|
Get list of available integrations.
|
|
38
42
|
|
|
39
43
|
```typescript
|
|
40
|
-
import { GetIntegrations } from '@deliverart/sdk-js-integration'
|
|
41
|
-
|
|
42
|
-
const integrations = await sdk.call(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
44
|
+
import { GetIntegrations } from '@deliverart/sdk-js-integration'
|
|
45
|
+
|
|
46
|
+
const integrations = await sdk.call(
|
|
47
|
+
new GetIntegrations({
|
|
48
|
+
query: {
|
|
49
|
+
company: '/companies/123',
|
|
50
|
+
type: 'DELIVERY',
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
)
|
|
48
54
|
```
|
|
49
55
|
|
|
50
56
|
---
|
|
51
57
|
|
|
52
58
|
### GetIntegrationDetails
|
|
59
|
+
|
|
53
60
|
Get detailed information about an integration.
|
|
54
61
|
|
|
55
62
|
```typescript
|
|
56
|
-
import { GetIntegrationDetails } from '@deliverart/sdk-js-integration'
|
|
63
|
+
import { GetIntegrationDetails } from '@deliverart/sdk-js-integration'
|
|
57
64
|
|
|
58
|
-
const integration = await sdk.call(new GetIntegrationDetails('integration-123'))
|
|
65
|
+
const integration = await sdk.call(new GetIntegrationDetails('integration-123'))
|
|
59
66
|
```
|
|
60
67
|
|
|
61
68
|
---
|
|
62
69
|
|
|
63
70
|
### ActivateIntegration
|
|
71
|
+
|
|
64
72
|
Request activation of an integration.
|
|
65
73
|
|
|
66
74
|
```typescript
|
|
67
|
-
import { ActivateIntegration } from '@deliverart/sdk-js-integration'
|
|
68
|
-
|
|
69
|
-
const activation = await sdk.call(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
75
|
+
import { ActivateIntegration } from '@deliverart/sdk-js-integration'
|
|
76
|
+
|
|
77
|
+
const activation = await sdk.call(
|
|
78
|
+
new ActivateIntegration({
|
|
79
|
+
integration: '/integrations/123',
|
|
80
|
+
pointOfSale: '/point_of_sales/456',
|
|
81
|
+
config: {
|
|
82
|
+
apiKey: 'your-api-key',
|
|
83
|
+
// ... integration-specific config
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
)
|
|
77
87
|
```
|
|
78
88
|
|
|
79
89
|
---
|
|
80
90
|
|
|
81
91
|
### CancelIntegration
|
|
92
|
+
|
|
82
93
|
Request cancellation of an active integration.
|
|
83
94
|
|
|
84
95
|
```typescript
|
|
85
|
-
import { CancelIntegration } from '@deliverart/sdk-js-integration'
|
|
86
|
-
|
|
87
|
-
const cancellation = await sdk.call(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
import { CancelIntegration } from '@deliverart/sdk-js-integration'
|
|
97
|
+
|
|
98
|
+
const cancellation = await sdk.call(
|
|
99
|
+
new CancelIntegration({
|
|
100
|
+
integration: '/integrations/123',
|
|
101
|
+
reason: 'No longer needed',
|
|
102
|
+
}),
|
|
103
|
+
)
|
|
91
104
|
```
|
|
92
105
|
|
|
93
106
|
---
|
|
@@ -100,55 +113,289 @@ Deliveroo integrations expose `manualActivationCompleted` and `manualActivationC
|
|
|
100
113
|
import {
|
|
101
114
|
GetIntegrationDeliverooList,
|
|
102
115
|
UpdateIntegrationDeliveroo,
|
|
103
|
-
} from '@deliverart/sdk-js-integration'
|
|
116
|
+
} from '@deliverart/sdk-js-integration'
|
|
117
|
+
|
|
118
|
+
const pending = await sdk.call(
|
|
119
|
+
new GetIntegrationDeliverooList({
|
|
120
|
+
query: {
|
|
121
|
+
manualActivationCompleted: false,
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
await sdk.call(
|
|
127
|
+
new UpdateIntegrationDeliveroo('deliveroo-integration-id', {
|
|
128
|
+
manualActivationCompleted: true,
|
|
129
|
+
}),
|
|
130
|
+
)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### CassaInCloud Catalog Channel Policies
|
|
104
136
|
|
|
105
|
-
|
|
106
|
-
query: {
|
|
107
|
-
manualActivationCompleted: false,
|
|
108
|
-
},
|
|
109
|
-
}));
|
|
137
|
+
CassaInCloud exposes separate remote channel policies:
|
|
110
138
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
139
|
+
- `inboundProductChannels` filters the Cassa categories and products imported into Deliverart.
|
|
140
|
+
- `outboundProductChannels` is captured and applied when Deliverart creates remote Cassa
|
|
141
|
+
categories and products.
|
|
142
|
+
- `productChannels` is a deprecated alias for `inboundProductChannels` and remains available
|
|
143
|
+
for one compatibility release only.
|
|
144
|
+
|
|
145
|
+
Audits and explicit channel reconciliation run asynchronously through the nested API Platform
|
|
146
|
+
`catalog_mapping_processes` resource. The process preserves its operation, scopes, target
|
|
147
|
+
channel snapshot, counters, and typed issues.
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
import {
|
|
151
|
+
CreateIntegrationCassaInCloudCatalogMappingProcess,
|
|
152
|
+
GetIntegrationCassaInCloudCatalogMappingProcessIssues,
|
|
153
|
+
GetIntegrationCassaInCloudCatalogMappingProcessDetails,
|
|
154
|
+
GetIntegrationCassaInCloudCatalogMappingProcesses,
|
|
155
|
+
RetryIntegrationCassaInCloudCatalogMappingProcess,
|
|
156
|
+
} from '@deliverart/sdk-js-integration'
|
|
157
|
+
|
|
158
|
+
const process = await sdk.call(
|
|
159
|
+
new CreateIntegrationCassaInCloudCatalogMappingProcess('integration-id', {
|
|
160
|
+
operation: 'reconcile_channels',
|
|
161
|
+
scopes: ['categories', 'products'],
|
|
162
|
+
}),
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
const details = await sdk.call(
|
|
166
|
+
new GetIntegrationCassaInCloudCatalogMappingProcessDetails('integration-id', process.id),
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
const history = await sdk.call(
|
|
170
|
+
new GetIntegrationCassaInCloudCatalogMappingProcesses('integration-id', {
|
|
171
|
+
query: { operation: 'audit', 'order[createdAt]': 'desc' },
|
|
172
|
+
}),
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
const issues = await sdk.call(
|
|
176
|
+
new GetIntegrationCassaInCloudCatalogMappingProcessIssues('integration-id', process.id, {
|
|
177
|
+
query: { retryable: true },
|
|
178
|
+
}),
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
const retry = await sdk.call(
|
|
182
|
+
new RetryIntegrationCassaInCloudCatalogMappingProcess('integration-id', process.id),
|
|
183
|
+
)
|
|
114
184
|
```
|
|
115
185
|
|
|
116
186
|
---
|
|
117
187
|
|
|
188
|
+
### Elephant Integrations
|
|
189
|
+
|
|
190
|
+
Elephant uses one integration per point of sale and one or more nested Restaurant
|
|
191
|
+
memberships. Create the integration first, then provision each Restaurant with its
|
|
192
|
+
Deliverart optional sales mode, required fallback category, catalog channels, order
|
|
193
|
+
type, preparation time, and acceptance timeout. Set `salesMode` to `null` to use base
|
|
194
|
+
catalog prices.
|
|
195
|
+
|
|
196
|
+
The activation-request and lead contracts accept `service: 'elephant'` with the same
|
|
197
|
+
`integrationElephantDataSchema` payload. This includes create, detail, update/response,
|
|
198
|
+
lead conversion, and all response schemas used by HUB and Admin.
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
import {
|
|
202
|
+
CreateIntegrationElephantRestaurantMapping,
|
|
203
|
+
CreateIntegrationElephant,
|
|
204
|
+
CreateIntegrationElephantRestaurant,
|
|
205
|
+
GetIntegrationElephantCatalogImportProcessDetails,
|
|
206
|
+
GetIntegrationElephantCatalogImportProcesses,
|
|
207
|
+
GetIntegrationElephantOrderReleases,
|
|
208
|
+
GetIntegrationElephantRestaurantCatalogProducts,
|
|
209
|
+
GetIntegrationElephantRestaurantMappings,
|
|
210
|
+
GetIntegrationElephantRestaurants,
|
|
211
|
+
GetIntegrationRequestLogs,
|
|
212
|
+
RefreshIntegrationElephantRestaurantCatalog,
|
|
213
|
+
RetryIntegrationElephantProvisioning,
|
|
214
|
+
StartIntegrationElephantCatalogImport,
|
|
215
|
+
UpdateIntegrationElephant,
|
|
216
|
+
UpdateIntegrationElephantRestaurant,
|
|
217
|
+
} from '@deliverart/sdk-js-integration'
|
|
218
|
+
|
|
219
|
+
const integration = await sdk.call(
|
|
220
|
+
new CreateIntegrationElephant({
|
|
221
|
+
pointOfSale: '/point_of_sales/8a745a0b-a68b-4f98-87ca-74df04a3bfe3',
|
|
222
|
+
credentialMode: 'managed',
|
|
223
|
+
}),
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
const restaurant = await sdk.call(
|
|
227
|
+
new CreateIntegrationElephantRestaurant(integration.id, {
|
|
228
|
+
name: 'Restaurant Centre',
|
|
229
|
+
platform: 'migros_yemek',
|
|
230
|
+
platformRestaurantId: 'restaurant-123',
|
|
231
|
+
platformChainId: 'group-456',
|
|
232
|
+
authentication: {
|
|
233
|
+
secret_key: '12345678901234567890123456789012',
|
|
234
|
+
x_api_key: 'write-only-platform-key',
|
|
235
|
+
store_id: 'restaurant-123',
|
|
236
|
+
store_group_id: 'group-456',
|
|
237
|
+
},
|
|
238
|
+
salesMode: null,
|
|
239
|
+
category: '/menu_item_categories/20c71a6a-c924-42e0-9078-e3f672704dbb',
|
|
240
|
+
defaultTaxRate: 10,
|
|
241
|
+
channels: ['application', 'elephant'],
|
|
242
|
+
orderType: 'delivery',
|
|
243
|
+
defaultPreparationTime: 15,
|
|
244
|
+
acceptanceTimeout: 5,
|
|
245
|
+
}),
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
await sdk.call(
|
|
249
|
+
new UpdateIntegrationElephant(integration.id, {
|
|
250
|
+
defaultRestaurantMembership: `/integrations/elephant/${integration.id}/restaurants/${restaurant.id}`,
|
|
251
|
+
}),
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
await sdk.call(
|
|
255
|
+
new UpdateIntegrationElephantRestaurant(integration.id, restaurant.id, {
|
|
256
|
+
acceptanceTimeout: 10,
|
|
257
|
+
}),
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
const staleRestaurants = await sdk.call(
|
|
261
|
+
new GetIntegrationElephantRestaurants(integration.id, {
|
|
262
|
+
query: {
|
|
263
|
+
catalogStatus: 'stale',
|
|
264
|
+
status: ['active', 'paused'],
|
|
265
|
+
'order[name]': 'asc',
|
|
266
|
+
},
|
|
267
|
+
}),
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
await sdk.call(new RetryIntegrationElephantProvisioning(integration.id))
|
|
271
|
+
await sdk.call(new RefreshIntegrationElephantRestaurantCatalog(integration.id, restaurant.id))
|
|
272
|
+
|
|
273
|
+
const catalogImport = await sdk.call(
|
|
274
|
+
new StartIntegrationElephantCatalogImport(integration.id, restaurant.id),
|
|
275
|
+
)
|
|
276
|
+
const catalogImportDetails = await sdk.call(
|
|
277
|
+
new GetIntegrationElephantCatalogImportProcessDetails(
|
|
278
|
+
integration.id,
|
|
279
|
+
restaurant.id,
|
|
280
|
+
catalogImport.id,
|
|
281
|
+
),
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
const platformProducts = await sdk.call(
|
|
285
|
+
new GetIntegrationElephantRestaurantCatalogProducts(integration.id, restaurant.id, {
|
|
286
|
+
query: { q: 'pizza', page: 1 },
|
|
287
|
+
}),
|
|
288
|
+
)
|
|
289
|
+
const mappings = await sdk.call(
|
|
290
|
+
new GetIntegrationElephantRestaurantMappings(integration.id, restaurant.id, {
|
|
291
|
+
query: { role: 'product', page: 1 },
|
|
292
|
+
}),
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
await sdk.call(
|
|
296
|
+
new CreateIntegrationElephantRestaurantMapping(integration.id, restaurant.id, {
|
|
297
|
+
role: 'product',
|
|
298
|
+
platformReference: platformProducts.data[0].platformReference!,
|
|
299
|
+
platformGroupReference: null,
|
|
300
|
+
appMenuItemId: 'deliverart-menu-item-id',
|
|
301
|
+
appModifierId: null,
|
|
302
|
+
appVariantId: null,
|
|
303
|
+
appSalesModeId: null,
|
|
304
|
+
}),
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
const releases = await sdk.call(
|
|
308
|
+
new GetIntegrationElephantOrderReleases(integration.id, {
|
|
309
|
+
query: { status: ['preparing', 'failed'], page: 1 },
|
|
310
|
+
}),
|
|
311
|
+
)
|
|
312
|
+
const requestLogs = await sdk.call(
|
|
313
|
+
new GetIntegrationRequestLogs(integration.id, {
|
|
314
|
+
query: { outcome: 'server_error', page: 1 },
|
|
315
|
+
}),
|
|
316
|
+
)
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Use `credentialMode: 'provided'` only when attaching an existing Elephant Tenant and
|
|
320
|
+
App; `tenantId`, `appId`, and `personalAccessToken` are then all required. Restaurant
|
|
321
|
+
authentication is write-only. Deleting a Restaurant membership starts its asynchronous
|
|
322
|
+
`removing` lifecycle; the Elephant integration itself does not expose a direct DELETE
|
|
323
|
+
operation.
|
|
324
|
+
|
|
325
|
+
The following request classes cover the current API surface:
|
|
326
|
+
|
|
327
|
+
- `GetIntegrationElephantList`, `GetIntegrationElephantDetails`
|
|
328
|
+
- `CreateIntegrationElephant`, `UpdateIntegrationElephant`
|
|
329
|
+
- `GetIntegrationElephantRestaurants`, `GetIntegrationElephantRestaurantDetails`
|
|
330
|
+
- `CreateIntegrationElephantRestaurant`, `UpdateIntegrationElephantRestaurant`
|
|
331
|
+
- `DeleteIntegrationElephantRestaurant`
|
|
332
|
+
- `RetryIntegrationElephantProvisioning`, `TestIntegrationElephantConnection`,
|
|
333
|
+
`ReconcileIntegrationElephant`
|
|
334
|
+
- `RetryIntegrationElephantRestaurantProvisioning`,
|
|
335
|
+
`TestIntegrationElephantRestaurantConnection`,
|
|
336
|
+
`RefreshIntegrationElephantRestaurantCatalog`,
|
|
337
|
+
`PauseIntegrationElephantRestaurant`, `ResumeIntegrationElephantRestaurant`
|
|
338
|
+
- `GetIntegrationElephantRestaurantCatalogProducts`,
|
|
339
|
+
`GetIntegrationElephantRestaurantCatalogOptions`,
|
|
340
|
+
`GetIntegrationElephantRestaurantCatalogVariants`,
|
|
341
|
+
`GetIntegrationElephantRestaurantAppCatalogMirror`
|
|
342
|
+
- `GetIntegrationElephantRestaurantMappings`,
|
|
343
|
+
`CreateIntegrationElephantRestaurantMapping`,
|
|
344
|
+
`DeleteIntegrationElephantRestaurantMapping`
|
|
345
|
+
- `GetIntegrationElephantCatalogImportProcesses`,
|
|
346
|
+
`StartIntegrationElephantCatalogImport`,
|
|
347
|
+
`GetIntegrationElephantCatalogImportProcessDetails`
|
|
348
|
+
- `GetIntegrationElephantOrderReleases`, `GetIntegrationElephantOrderReleaseDetails`
|
|
349
|
+
- `GetIntegrationRequestLogs`, `GetIntegrationRequestLogDetails`
|
|
350
|
+
|
|
351
|
+
Restaurant, catalog, mapping, order-release, and request-log collections are paginated.
|
|
352
|
+
Catalog-import history is intentionally unpaginated and supports status, step, date, and
|
|
353
|
+
ordering filters; only one pending or running import is allowed per Restaurant membership.
|
|
354
|
+
Use their exported query types rather than constructing query strings manually. Request logs
|
|
355
|
+
are the API's sanitized diagnostics model: tokens and payload bodies are deliberately absent.
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
118
359
|
## Complete Usage Example
|
|
119
360
|
|
|
120
361
|
```typescript
|
|
121
|
-
import { sdk } from './lib/sdk'
|
|
362
|
+
import { sdk } from './lib/sdk'
|
|
122
363
|
import {
|
|
123
364
|
GetIntegrations,
|
|
124
365
|
ActivateIntegration,
|
|
125
|
-
CancelIntegration
|
|
126
|
-
} from '@deliverart/sdk-js-integration'
|
|
366
|
+
CancelIntegration,
|
|
367
|
+
} from '@deliverart/sdk-js-integration'
|
|
127
368
|
|
|
128
369
|
async function integrationManagement() {
|
|
129
370
|
// Get available delivery integrations
|
|
130
|
-
const integrations = await sdk.call(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
371
|
+
const integrations = await sdk.call(
|
|
372
|
+
new GetIntegrations({
|
|
373
|
+
query: {
|
|
374
|
+
type: 'DELIVERY',
|
|
375
|
+
company: '/companies/123',
|
|
376
|
+
},
|
|
377
|
+
}),
|
|
378
|
+
)
|
|
136
379
|
|
|
137
380
|
// Activate delivery partner
|
|
138
|
-
const activation = await sdk.call(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
381
|
+
const activation = await sdk.call(
|
|
382
|
+
new ActivateIntegration({
|
|
383
|
+
integration: integrations.data[0]['@id'],
|
|
384
|
+
pointOfSale: '/point_of_sales/456',
|
|
385
|
+
config: {
|
|
386
|
+
apiKey: process.env.DELIVERY_API_KEY,
|
|
387
|
+
webhookUrl: 'https://myapp.com/webhooks/delivery',
|
|
388
|
+
},
|
|
389
|
+
}),
|
|
390
|
+
)
|
|
146
391
|
|
|
147
392
|
// Cancel integration
|
|
148
|
-
await sdk.call(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
393
|
+
await sdk.call(
|
|
394
|
+
new CancelIntegration({
|
|
395
|
+
integration: activation.integration,
|
|
396
|
+
reason: 'Switching to different provider',
|
|
397
|
+
}),
|
|
398
|
+
)
|
|
152
399
|
}
|
|
153
400
|
```
|
|
154
401
|
|