@labdigital/commercetools-mock 2.54.0 → 2.56.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/dist/index.d.ts +107 -77
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +455 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/lib/predicateParser.test.ts +13 -37
- package/src/lib/predicateParser.ts +12 -1
- package/src/lib/productSearchFilter.test.ts +1 -0
- package/src/lib/projectionSearchFilter.test.ts +1 -0
- package/src/priceSelector.test.ts +1 -0
- package/src/product-projection-search.ts +2 -0
- package/src/product-search.ts +1 -0
- package/src/repositories/cart/actions.ts +178 -0
- package/src/repositories/cart/helpers.ts +170 -3
- package/src/repositories/cart/index.test.ts +86 -2
- package/src/repositories/cart/index.ts +19 -2
- package/src/repositories/cart-discount/index.ts +1 -1
- package/src/repositories/customer/index.ts +2 -0
- package/src/repositories/discount-group/actions.ts +50 -0
- package/src/repositories/discount-group/index.ts +29 -0
- package/src/repositories/index.ts +6 -0
- package/src/repositories/order/index.test.ts +126 -125
- package/src/repositories/payment/actions.ts +87 -0
- package/src/repositories/payment/index.ts +1 -1
- package/src/repositories/product/index.ts +1 -0
- package/src/repositories/product-type.ts +1 -0
- package/src/repositories/quote/index.ts +1 -0
- package/src/repositories/quote-request/index.test.ts +1 -0
- package/src/repositories/quote-request/index.ts +1 -0
- package/src/repositories/recurrence-policy/actions.ts +53 -0
- package/src/repositories/recurrence-policy/index.ts +36 -0
- package/src/repositories/recurring-order/actions.ts +157 -0
- package/src/repositories/recurring-order/index.ts +52 -0
- package/src/repositories/review.test.ts +2 -0
- package/src/repositories/shopping-list/actions.ts +1 -0
- package/src/repositories/shopping-list/index.ts +1 -0
- package/src/services/cart.test.ts +282 -0
- package/src/services/discount-group.test.ts +270 -0
- package/src/services/discount-group.ts +16 -0
- package/src/services/index.ts +12 -0
- package/src/services/my-cart.test.ts +1 -0
- package/src/services/my-payment.test.ts +1 -0
- package/src/services/payment.test.ts +1 -0
- package/src/services/product-projection.test.ts +4 -0
- package/src/services/product-type.test.ts +1 -0
- package/src/services/product.test.ts +1 -0
- package/src/services/recurrence-policy.test.ts +316 -0
- package/src/services/recurrence-policy.ts +16 -0
- package/src/services/recurring-order.test.ts +424 -0
- package/src/services/recurring-order.ts +16 -0
- package/src/services/shopping-list.test.ts +3 -0
- package/src/storage/in-memory.ts +6 -0
- package/src/types.ts +6 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CartDraft,
|
|
3
|
+
RecurringOrderDraft,
|
|
4
|
+
} from "@commercetools/platform-sdk";
|
|
5
|
+
import supertest from "supertest";
|
|
6
|
+
import { describe, expect, test } from "vitest";
|
|
7
|
+
import { CommercetoolsMock } from "../index";
|
|
8
|
+
|
|
9
|
+
const ctMock = new CommercetoolsMock();
|
|
10
|
+
|
|
11
|
+
describe("RecurringOrder", () => {
|
|
12
|
+
const createTestCart = async () => {
|
|
13
|
+
await supertest(ctMock.app).post("/dummy/product-types").send({
|
|
14
|
+
key: "test-product-type",
|
|
15
|
+
name: "Test Product Type",
|
|
16
|
+
description: "A test product type",
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const productResponse = await supertest(ctMock.app)
|
|
20
|
+
.post("/dummy/products")
|
|
21
|
+
.send({
|
|
22
|
+
key: "test-product",
|
|
23
|
+
name: { en: "Test Product" },
|
|
24
|
+
productType: {
|
|
25
|
+
typeId: "product-type",
|
|
26
|
+
key: "test-product-type",
|
|
27
|
+
},
|
|
28
|
+
slug: { en: "test-product" },
|
|
29
|
+
masterVariant: {
|
|
30
|
+
id: 1,
|
|
31
|
+
sku: "test-sku",
|
|
32
|
+
prices: [
|
|
33
|
+
{
|
|
34
|
+
value: {
|
|
35
|
+
type: "centPrecision",
|
|
36
|
+
currencyCode: "EUR",
|
|
37
|
+
centAmount: 1000,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
variants: [],
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const cartDraft: CartDraft = {
|
|
46
|
+
currency: "EUR",
|
|
47
|
+
country: "NL",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const cartResponse = await supertest(ctMock.app)
|
|
51
|
+
.post("/dummy/carts")
|
|
52
|
+
.send(cartDraft);
|
|
53
|
+
|
|
54
|
+
await supertest(ctMock.app)
|
|
55
|
+
.post(`/dummy/carts/${cartResponse.body.id}`)
|
|
56
|
+
.send({
|
|
57
|
+
version: cartResponse.body.version,
|
|
58
|
+
actions: [
|
|
59
|
+
{
|
|
60
|
+
action: "addLineItem",
|
|
61
|
+
productId: productResponse.body.id,
|
|
62
|
+
variantId: 1,
|
|
63
|
+
quantity: 2,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const updatedCartResponse = await supertest(ctMock.app).get(
|
|
69
|
+
`/dummy/carts/${cartResponse.body.id}`,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return updatedCartResponse.body;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
test("Create recurring order", async () => {
|
|
76
|
+
const cart = await createTestCart();
|
|
77
|
+
|
|
78
|
+
const draft: RecurringOrderDraft = {
|
|
79
|
+
key: "weekly-order",
|
|
80
|
+
cart: {
|
|
81
|
+
typeId: "cart",
|
|
82
|
+
id: cart.id,
|
|
83
|
+
},
|
|
84
|
+
cartVersion: cart.version,
|
|
85
|
+
startsAt: "2025-01-01T10:00:00.000Z",
|
|
86
|
+
expiresAt: "2025-12-31T23:59:59.000Z",
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const response = await supertest(ctMock.app)
|
|
90
|
+
.post("/dummy/recurring-orders")
|
|
91
|
+
.send(draft);
|
|
92
|
+
|
|
93
|
+
expect(response.status).toBe(201);
|
|
94
|
+
|
|
95
|
+
expect(response.body).toEqual({
|
|
96
|
+
createdAt: expect.anything(),
|
|
97
|
+
id: expect.anything(),
|
|
98
|
+
key: "weekly-order",
|
|
99
|
+
lastModifiedAt: expect.anything(),
|
|
100
|
+
cart: {
|
|
101
|
+
typeId: "cart",
|
|
102
|
+
id: cart.id,
|
|
103
|
+
},
|
|
104
|
+
originOrder: {
|
|
105
|
+
typeId: "order",
|
|
106
|
+
id: expect.anything(),
|
|
107
|
+
},
|
|
108
|
+
startsAt: "2025-01-01T10:00:00.000Z",
|
|
109
|
+
expiresAt: "2025-12-31T23:59:59.000Z",
|
|
110
|
+
recurringOrderState: "Active",
|
|
111
|
+
schedule: {
|
|
112
|
+
type: "standard",
|
|
113
|
+
intervalUnit: "month",
|
|
114
|
+
value: 1,
|
|
115
|
+
},
|
|
116
|
+
version: 1,
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("Get recurring order", async () => {
|
|
121
|
+
const cart = await createTestCart();
|
|
122
|
+
|
|
123
|
+
const draft: RecurringOrderDraft = {
|
|
124
|
+
key: "get-test-order",
|
|
125
|
+
cart: {
|
|
126
|
+
typeId: "cart",
|
|
127
|
+
id: cart.id,
|
|
128
|
+
},
|
|
129
|
+
cartVersion: cart.version,
|
|
130
|
+
startsAt: "2025-01-01T10:00:00.000Z",
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const createResponse = await supertest(ctMock.app)
|
|
134
|
+
.post("/dummy/recurring-orders")
|
|
135
|
+
.send(draft);
|
|
136
|
+
|
|
137
|
+
expect(createResponse.status).toBe(201);
|
|
138
|
+
|
|
139
|
+
const response = await supertest(ctMock.app).get(
|
|
140
|
+
`/dummy/recurring-orders/${createResponse.body.id}`,
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
expect(response.status).toBe(200);
|
|
144
|
+
expect(response.body).toEqual(createResponse.body);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test("Get recurring order by key", async () => {
|
|
148
|
+
const cart = await createTestCart();
|
|
149
|
+
|
|
150
|
+
const draft: RecurringOrderDraft = {
|
|
151
|
+
key: "key-test-order",
|
|
152
|
+
cart: {
|
|
153
|
+
typeId: "cart",
|
|
154
|
+
id: cart.id,
|
|
155
|
+
},
|
|
156
|
+
cartVersion: cart.version,
|
|
157
|
+
startsAt: "2025-01-01T10:00:00.000Z",
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const createResponse = await supertest(ctMock.app)
|
|
161
|
+
.post("/dummy/recurring-orders")
|
|
162
|
+
.send(draft);
|
|
163
|
+
|
|
164
|
+
expect(createResponse.status).toBe(201);
|
|
165
|
+
|
|
166
|
+
const response = await supertest(ctMock.app).get(
|
|
167
|
+
"/dummy/recurring-orders/key=key-test-order",
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
expect(response.status).toBe(200);
|
|
171
|
+
expect(response.body).toEqual(createResponse.body);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
test("Query recurring orders", async () => {
|
|
175
|
+
const cart = await createTestCart();
|
|
176
|
+
|
|
177
|
+
const draft: RecurringOrderDraft = {
|
|
178
|
+
key: "query-test-order",
|
|
179
|
+
cart: {
|
|
180
|
+
typeId: "cart",
|
|
181
|
+
id: cart.id,
|
|
182
|
+
},
|
|
183
|
+
cartVersion: cart.version,
|
|
184
|
+
startsAt: "2025-01-01T10:00:00.000Z",
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const createResponse = await supertest(ctMock.app)
|
|
188
|
+
.post("/dummy/recurring-orders")
|
|
189
|
+
.send(draft);
|
|
190
|
+
|
|
191
|
+
expect(createResponse.status).toBe(201);
|
|
192
|
+
|
|
193
|
+
const response = await supertest(ctMock.app).get("/dummy/recurring-orders");
|
|
194
|
+
|
|
195
|
+
expect(response.status).toBe(200);
|
|
196
|
+
expect(response.body.count).toBeGreaterThan(0);
|
|
197
|
+
expect(response.body.results).toContainEqual(createResponse.body);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
test("Update recurring order - setKey", async () => {
|
|
201
|
+
const cart = await createTestCart();
|
|
202
|
+
|
|
203
|
+
const draft: RecurringOrderDraft = {
|
|
204
|
+
key: "original-key",
|
|
205
|
+
cart: {
|
|
206
|
+
typeId: "cart",
|
|
207
|
+
id: cart.id,
|
|
208
|
+
},
|
|
209
|
+
cartVersion: cart.version,
|
|
210
|
+
startsAt: "2025-01-01T10:00:00.000Z",
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const createResponse = await supertest(ctMock.app)
|
|
214
|
+
.post("/dummy/recurring-orders")
|
|
215
|
+
.send(draft);
|
|
216
|
+
|
|
217
|
+
expect(createResponse.status).toBe(201);
|
|
218
|
+
|
|
219
|
+
const updateResponse = await supertest(ctMock.app)
|
|
220
|
+
.post(`/dummy/recurring-orders/${createResponse.body.id}`)
|
|
221
|
+
.send({
|
|
222
|
+
version: createResponse.body.version,
|
|
223
|
+
actions: [
|
|
224
|
+
{
|
|
225
|
+
action: "setKey",
|
|
226
|
+
key: "updated-key",
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
expect(updateResponse.status).toBe(200);
|
|
232
|
+
expect(updateResponse.body.key).toBe("updated-key");
|
|
233
|
+
expect(updateResponse.body.version).toBe(2);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test("Update recurring order - setStartsAt", async () => {
|
|
237
|
+
const cart = await createTestCart();
|
|
238
|
+
|
|
239
|
+
const draft: RecurringOrderDraft = {
|
|
240
|
+
key: "starts-at-test",
|
|
241
|
+
cart: {
|
|
242
|
+
typeId: "cart",
|
|
243
|
+
id: cart.id,
|
|
244
|
+
},
|
|
245
|
+
cartVersion: cart.version,
|
|
246
|
+
startsAt: "2025-01-01T10:00:00.000Z",
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
const createResponse = await supertest(ctMock.app)
|
|
250
|
+
.post("/dummy/recurring-orders")
|
|
251
|
+
.send(draft);
|
|
252
|
+
|
|
253
|
+
expect(createResponse.status).toBe(201);
|
|
254
|
+
|
|
255
|
+
const updateResponse = await supertest(ctMock.app)
|
|
256
|
+
.post(`/dummy/recurring-orders/${createResponse.body.id}`)
|
|
257
|
+
.send({
|
|
258
|
+
version: createResponse.body.version,
|
|
259
|
+
actions: [
|
|
260
|
+
{
|
|
261
|
+
action: "setStartsAt",
|
|
262
|
+
startsAt: "2025-02-01T10:00:00.000Z",
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
expect(updateResponse.status).toBe(200);
|
|
268
|
+
expect(updateResponse.body.startsAt).toBe("2025-02-01T10:00:00.000Z");
|
|
269
|
+
expect(updateResponse.body.version).toBe(2);
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test("Update recurring order - setExpiresAt", async () => {
|
|
273
|
+
const cart = await createTestCart();
|
|
274
|
+
|
|
275
|
+
const draft: RecurringOrderDraft = {
|
|
276
|
+
key: "expires-at-test",
|
|
277
|
+
cart: {
|
|
278
|
+
typeId: "cart",
|
|
279
|
+
id: cart.id,
|
|
280
|
+
},
|
|
281
|
+
cartVersion: cart.version,
|
|
282
|
+
startsAt: "2025-01-01T10:00:00.000Z",
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
const createResponse = await supertest(ctMock.app)
|
|
286
|
+
.post("/dummy/recurring-orders")
|
|
287
|
+
.send(draft);
|
|
288
|
+
|
|
289
|
+
expect(createResponse.status).toBe(201);
|
|
290
|
+
|
|
291
|
+
const updateResponse = await supertest(ctMock.app)
|
|
292
|
+
.post(`/dummy/recurring-orders/${createResponse.body.id}`)
|
|
293
|
+
.send({
|
|
294
|
+
version: createResponse.body.version,
|
|
295
|
+
actions: [
|
|
296
|
+
{
|
|
297
|
+
action: "setExpiresAt",
|
|
298
|
+
expiresAt: "2026-01-01T00:00:00.000Z",
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
expect(updateResponse.status).toBe(200);
|
|
304
|
+
expect(updateResponse.body.expiresAt).toBe("2026-01-01T00:00:00.000Z");
|
|
305
|
+
expect(updateResponse.body.version).toBe(2);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
test("Update recurring order - setRecurringOrderState to paused", async () => {
|
|
309
|
+
const cart = await createTestCart();
|
|
310
|
+
|
|
311
|
+
const draft: RecurringOrderDraft = {
|
|
312
|
+
key: "state-test",
|
|
313
|
+
cart: {
|
|
314
|
+
typeId: "cart",
|
|
315
|
+
id: cart.id,
|
|
316
|
+
},
|
|
317
|
+
cartVersion: cart.version,
|
|
318
|
+
startsAt: "2025-01-01T10:00:00.000Z",
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const createResponse = await supertest(ctMock.app)
|
|
322
|
+
.post("/dummy/recurring-orders")
|
|
323
|
+
.send(draft);
|
|
324
|
+
|
|
325
|
+
expect(createResponse.status).toBe(201);
|
|
326
|
+
|
|
327
|
+
const updateResponse = await supertest(ctMock.app)
|
|
328
|
+
.post(`/dummy/recurring-orders/${createResponse.body.id}`)
|
|
329
|
+
.send({
|
|
330
|
+
version: createResponse.body.version,
|
|
331
|
+
actions: [
|
|
332
|
+
{
|
|
333
|
+
action: "setRecurringOrderState",
|
|
334
|
+
recurringOrderState: {
|
|
335
|
+
type: "paused",
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
],
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
expect(updateResponse.status).toBe(200);
|
|
342
|
+
expect(updateResponse.body.recurringOrderState).toBe("Paused");
|
|
343
|
+
expect(updateResponse.body.version).toBe(2);
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
test("Update recurring order - setOrderSkipConfiguration", async () => {
|
|
347
|
+
const cart = await createTestCart();
|
|
348
|
+
|
|
349
|
+
const draft: RecurringOrderDraft = {
|
|
350
|
+
key: "skip-test",
|
|
351
|
+
cart: {
|
|
352
|
+
typeId: "cart",
|
|
353
|
+
id: cart.id,
|
|
354
|
+
},
|
|
355
|
+
cartVersion: cart.version,
|
|
356
|
+
startsAt: "2025-01-01T10:00:00.000Z",
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
const createResponse = await supertest(ctMock.app)
|
|
360
|
+
.post("/dummy/recurring-orders")
|
|
361
|
+
.send(draft);
|
|
362
|
+
|
|
363
|
+
expect(createResponse.status).toBe(201);
|
|
364
|
+
|
|
365
|
+
const updateResponse = await supertest(ctMock.app)
|
|
366
|
+
.post(`/dummy/recurring-orders/${createResponse.body.id}`)
|
|
367
|
+
.send({
|
|
368
|
+
version: createResponse.body.version,
|
|
369
|
+
actions: [
|
|
370
|
+
{
|
|
371
|
+
action: "setOrderSkipConfiguration",
|
|
372
|
+
skipConfiguration: {
|
|
373
|
+
type: "totalSkip",
|
|
374
|
+
totalToSkip: 2,
|
|
375
|
+
},
|
|
376
|
+
updatedExpiresAt: "2025-06-01T00:00:00.000Z",
|
|
377
|
+
},
|
|
378
|
+
],
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
expect(updateResponse.status).toBe(200);
|
|
382
|
+
expect(updateResponse.body.skipConfiguration).toEqual({
|
|
383
|
+
type: "totalSkip",
|
|
384
|
+
totalToSkip: 2,
|
|
385
|
+
skipped: 0,
|
|
386
|
+
lastSkippedAt: undefined,
|
|
387
|
+
});
|
|
388
|
+
expect(updateResponse.body.expiresAt).toBe("2025-06-01T00:00:00.000Z");
|
|
389
|
+
expect(updateResponse.body.version).toBe(2);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
test("Delete recurring order", async () => {
|
|
393
|
+
const cart = await createTestCart();
|
|
394
|
+
|
|
395
|
+
const draft: RecurringOrderDraft = {
|
|
396
|
+
key: "delete-test",
|
|
397
|
+
cart: {
|
|
398
|
+
typeId: "cart",
|
|
399
|
+
id: cart.id,
|
|
400
|
+
},
|
|
401
|
+
cartVersion: cart.version,
|
|
402
|
+
startsAt: "2025-01-01T10:00:00.000Z",
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const createResponse = await supertest(ctMock.app)
|
|
406
|
+
.post("/dummy/recurring-orders")
|
|
407
|
+
.send(draft);
|
|
408
|
+
|
|
409
|
+
expect(createResponse.status).toBe(201);
|
|
410
|
+
|
|
411
|
+
const deleteResponse = await supertest(ctMock.app)
|
|
412
|
+
.delete(`/dummy/recurring-orders/${createResponse.body.id}`)
|
|
413
|
+
.query({ version: createResponse.body.version });
|
|
414
|
+
|
|
415
|
+
expect(deleteResponse.status).toBe(200);
|
|
416
|
+
expect(deleteResponse.body).toEqual(createResponse.body);
|
|
417
|
+
|
|
418
|
+
const getResponse = await supertest(ctMock.app).get(
|
|
419
|
+
`/dummy/recurring-orders/${createResponse.body.id}`,
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
expect(getResponse.status).toBe(404);
|
|
423
|
+
});
|
|
424
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { RecurringOrderRepository } from "../repositories/recurring-order/index";
|
|
3
|
+
import AbstractService from "./abstract";
|
|
4
|
+
|
|
5
|
+
export class RecurringOrderService extends AbstractService {
|
|
6
|
+
public repository: RecurringOrderRepository;
|
|
7
|
+
|
|
8
|
+
constructor(parent: Router, repository: RecurringOrderRepository) {
|
|
9
|
+
super(parent);
|
|
10
|
+
this.repository = repository;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getBasePath() {
|
|
14
|
+
return "recurring-orders";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -20,6 +20,7 @@ const shoppingList: ShoppingList = {
|
|
|
20
20
|
quantity: 1,
|
|
21
21
|
productSlug: {},
|
|
22
22
|
variantId: 2,
|
|
23
|
+
published: true,
|
|
23
24
|
},
|
|
24
25
|
],
|
|
25
26
|
textLineItems: [],
|
|
@@ -40,6 +41,7 @@ export const product: Product = {
|
|
|
40
41
|
masterData: {
|
|
41
42
|
staged: {
|
|
42
43
|
name: {},
|
|
44
|
+
attributes: [],
|
|
43
45
|
categories: [],
|
|
44
46
|
slug: {},
|
|
45
47
|
masterVariant: {
|
|
@@ -52,6 +54,7 @@ export const product: Product = {
|
|
|
52
54
|
current: {
|
|
53
55
|
name: {},
|
|
54
56
|
slug: {},
|
|
57
|
+
attributes: [],
|
|
55
58
|
categories: [],
|
|
56
59
|
masterVariant: {
|
|
57
60
|
id: 1,
|
package/src/storage/in-memory.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import assert from "node:assert";
|
|
2
2
|
import type {
|
|
3
|
+
DiscountGroup,
|
|
3
4
|
InvalidJsonInputError,
|
|
5
|
+
RecurrencePolicy,
|
|
6
|
+
RecurringOrder,
|
|
4
7
|
ReferencedResourceNotFoundError,
|
|
5
8
|
ShoppingListLineItem,
|
|
6
9
|
} from "@commercetools/platform-sdk";
|
|
@@ -181,6 +184,7 @@ export class InMemoryStorage extends AbstractStorage {
|
|
|
181
184
|
customer: new Map<string, Customer>(),
|
|
182
185
|
"customer-group": new Map<string, CustomerGroup>(),
|
|
183
186
|
"discount-code": new Map<string, DiscountCode>(),
|
|
187
|
+
"discount-group": new Map<string, DiscountGroup>(),
|
|
184
188
|
extension: new Map<string, Extension>(),
|
|
185
189
|
"inventory-entry": new Map<string, InventoryEntry>(),
|
|
186
190
|
"key-value-document": new Map<string, CustomObject>(),
|
|
@@ -195,6 +199,8 @@ export class InMemoryStorage extends AbstractStorage {
|
|
|
195
199
|
"product-type": new Map<string, ProductType>(),
|
|
196
200
|
"product-projection": new Map<string, ProductProjection>(),
|
|
197
201
|
"product-tailoring": new Map<string, ProductTailoring>(),
|
|
202
|
+
"recurrence-policy": new Map<string, RecurrencePolicy>(),
|
|
203
|
+
"recurring-order": new Map<string, RecurringOrder>(),
|
|
198
204
|
review: new Map<string, any>(),
|
|
199
205
|
"shipping-method": new Map<string, ShippingMethod>(),
|
|
200
206
|
"staged-quote": new Map<string, StagedQuote>(),
|
package/src/types.ts
CHANGED
|
@@ -51,6 +51,7 @@ export type ResourceMap = {
|
|
|
51
51
|
"customer-password-token": never;
|
|
52
52
|
customer: ctp.Customer;
|
|
53
53
|
"discount-code": ctp.DiscountCode;
|
|
54
|
+
"discount-group": ctp.DiscountGroup;
|
|
54
55
|
extension: ctp.Extension;
|
|
55
56
|
"inventory-entry": ctp.InventoryEntry;
|
|
56
57
|
"key-value-document": ctp.CustomObject;
|
|
@@ -74,6 +75,8 @@ export type ResourceMap = {
|
|
|
74
75
|
state: ctp.State;
|
|
75
76
|
store: ctp.Store;
|
|
76
77
|
subscription: ctp.Subscription;
|
|
78
|
+
"recurring-order": ctp.RecurringOrder;
|
|
79
|
+
"recurrence-policy": ctp.RecurrencePolicy;
|
|
77
80
|
"tax-category": ctp.TaxCategory;
|
|
78
81
|
type: ctp.Type;
|
|
79
82
|
zone: ctp.Zone;
|
|
@@ -92,6 +95,7 @@ export type PagedQueryResponseMap = {
|
|
|
92
95
|
"customer-password-token": never;
|
|
93
96
|
customer: ctp.CustomerPagedQueryResponse;
|
|
94
97
|
"discount-code": ctp.DiscountCodePagedQueryResponse;
|
|
98
|
+
"discount-group": ctp.DiscountGroupPagedQueryResponse;
|
|
95
99
|
extension: ctp.ExtensionPagedQueryResponse;
|
|
96
100
|
"inventory-entry": ctp.InventoryPagedQueryResponse;
|
|
97
101
|
"key-value-document": ctp.CustomObjectPagedQueryResponse;
|
|
@@ -115,6 +119,8 @@ export type PagedQueryResponseMap = {
|
|
|
115
119
|
state: ctp.StatePagedQueryResponse;
|
|
116
120
|
store: ctp.StorePagedQueryResponse;
|
|
117
121
|
subscription: ctp.SubscriptionPagedQueryResponse;
|
|
122
|
+
"recurring-order": ctp.RecurringOrderPagedQueryResponse;
|
|
123
|
+
"recurrence-policy": ctp.RecurrencePolicyPagedQueryResponse;
|
|
118
124
|
"tax-category": ctp.TaxCategoryPagedQueryResponse;
|
|
119
125
|
type: ctp.TypePagedQueryResponse;
|
|
120
126
|
zone: ctp.ZonePagedQueryResponse;
|