@daffodil/order 0.94.1 → 0.95.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.
Files changed (40) hide show
  1. package/fesm2022/daffodil-order-driver-in-memory.mjs +191 -159
  2. package/fesm2022/daffodil-order-driver-in-memory.mjs.map +1 -1
  3. package/fesm2022/daffodil-order-driver-magento-2.4.0-testing.mjs +0 -4
  4. package/fesm2022/daffodil-order-driver-magento-2.4.0.mjs +288 -297
  5. package/fesm2022/daffodil-order-driver-magento-2.4.0.mjs.map +1 -1
  6. package/fesm2022/daffodil-order-driver-magento-2.4.1-testing.mjs +813 -424
  7. package/fesm2022/daffodil-order-driver-magento-2.4.1-testing.mjs.map +1 -1
  8. package/fesm2022/daffodil-order-driver-magento-2.4.1.mjs +370 -428
  9. package/fesm2022/daffodil-order-driver-magento-2.4.1.mjs.map +1 -1
  10. package/fesm2022/daffodil-order-driver-magento-auto-testing.mjs +7 -0
  11. package/fesm2022/daffodil-order-driver-magento-auto-testing.mjs.map +1 -0
  12. package/fesm2022/daffodil-order-driver-magento-auto.mjs +7 -0
  13. package/fesm2022/daffodil-order-driver-magento-auto.mjs.map +1 -0
  14. package/fesm2022/daffodil-order-driver-testing.mjs +113 -74
  15. package/fesm2022/daffodil-order-driver-testing.mjs.map +1 -1
  16. package/fesm2022/daffodil-order-driver.mjs +18 -29
  17. package/fesm2022/daffodil-order-driver.mjs.map +1 -1
  18. package/fesm2022/daffodil-order-state-testing.mjs +147 -111
  19. package/fesm2022/daffodil-order-state-testing.mjs.map +1 -1
  20. package/fesm2022/daffodil-order-state.mjs +547 -546
  21. package/fesm2022/daffodil-order-state.mjs.map +1 -1
  22. package/fesm2022/daffodil-order-testing.mjs +841 -470
  23. package/fesm2022/daffodil-order-testing.mjs.map +1 -1
  24. package/fesm2022/daffodil-order.mjs +12 -17
  25. package/fesm2022/daffodil-order.mjs.map +1 -1
  26. package/package.json +1 -1
  27. package/types/daffodil-order-driver-in-memory.d.ts +53 -51
  28. package/types/daffodil-order-driver-magento-2.4.0-testing.d.ts +1 -2
  29. package/types/daffodil-order-driver-magento-2.4.0.d.ts +142 -158
  30. package/types/daffodil-order-driver-magento-2.4.1-testing.d.ts +238 -258
  31. package/types/daffodil-order-driver-magento-2.4.1.d.ts +205 -234
  32. package/types/daffodil-order-driver-magento-auto-testing.d.ts +1 -0
  33. package/types/daffodil-order-driver-magento-auto.d.ts +1 -0
  34. package/types/daffodil-order-driver-testing.d.ts +27 -24
  35. package/types/daffodil-order-driver.d.ts +23 -31
  36. package/types/daffodil-order-state-testing.d.ts +52 -47
  37. package/types/daffodil-order-state.d.ts +293 -317
  38. package/types/daffodil-order-testing.d.ts +228 -246
  39. package/types/daffodil-order.d.ts +141 -158
  40. package/fesm2022/daffodil-order-driver-magento-2.4.0-testing.mjs.map +0 -1
@@ -1,473 +1,844 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable } from '@angular/core';
3
- import { faker } from '@faker-js/faker/locale/en_US';
4
- import * as i2 from '@daffodil/core/testing';
5
- import { DaffModelFactory } from '@daffodil/core/testing';
6
- import { MockDaffPersonalAddress } from '@daffodil/geography/testing';
7
- import { DaffOrderItemType, DaffOrderTotalTypeEnum } from '@daffodil/order';
8
- import { daffIdentifiableArrayToDict } from '@daffodil/core';
9
-
10
- class MockOrderAddress extends MockDaffPersonalAddress {
11
- constructor() {
12
- super(...arguments);
13
- this.order_id = faker.string.uuid();
14
- }
15
- }
16
- class DaffOrderAddressFactory extends DaffModelFactory {
17
- constructor() {
18
- super(MockOrderAddress);
19
- }
20
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderAddressFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
21
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderAddressFactory, providedIn: 'root' }); }
22
- }
23
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderAddressFactory, decorators: [{
24
- type: Injectable,
25
- args: [{
26
- providedIn: 'root',
27
- }]
28
- }], ctorParameters: () => [] });
29
-
30
- class MockOrderCoupon {
31
- constructor() {
32
- this.code = faker.string.alphanumeric(10);
33
- }
34
- }
35
- ;
36
- class DaffOrderCouponFactory extends DaffModelFactory {
37
- constructor() {
38
- super(MockOrderCoupon);
39
- }
40
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderCouponFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
41
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderCouponFactory, providedIn: 'root' }); }
42
- }
43
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderCouponFactory, decorators: [{
44
- type: Injectable,
45
- args: [{
46
- providedIn: 'root',
47
- }]
48
- }], ctorParameters: () => [] });
49
-
50
- class MockOrderPayment {
51
- constructor() {
52
- this.id = faker.string.uuid();
53
- this.order_id = faker.string.uuid();
54
- this.created_at = faker.date.past().toString();
55
- this.updated_at = faker.date.past().toString();
56
- this.method = 'card';
57
- this.cc_type = 'visa';
58
- this.cc_last4 = faker.number.int({ min: 1000, max: 9999 }).toString();
59
- this.cc_owner = 'owner';
60
- this.cc_exp_month = 'month';
61
- this.cc_exp_year = 'year';
62
- }
63
- }
64
- class DaffOrderPaymentFactory extends DaffModelFactory {
65
- constructor() {
66
- super(MockOrderPayment);
67
- }
68
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderPaymentFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
69
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderPaymentFactory, providedIn: 'root' }); }
70
- }
71
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderPaymentFactory, decorators: [{
72
- type: Injectable,
73
- args: [{
74
- providedIn: 'root',
75
- }]
76
- }], ctorParameters: () => [] });
77
-
78
- class MockOrderItem {
79
- constructor() {
80
- this.id = faker.string.uuid();
81
- this.image = {
82
- url: faker.image.url(),
83
- id: faker.string.uuid(),
84
- label: faker.lorem.word(),
85
- };
86
- this.order_id = faker.string.uuid();
87
- this.qty_ordered = faker.number.int({ min: 1, max: 1000 });
88
- this.qty_canceled = faker.number.int({ min: 1, max: 1000 });
89
- this.qty_fulfilled = faker.number.int({ min: 1, max: 1000 });
90
- this.created_at = faker.date.past().toString();
91
- this.updated_at = faker.date.past().toString();
92
- this.product_id = faker.string.uuid();
93
- this.parent_item_id = faker.string.uuid();
94
- this.sku = faker.string.alphanumeric(20);
95
- this.name = faker.lorem.word();
96
- this.weight = faker.number.int({ min: 1, max: 1000 });
97
- this.qty = faker.number.int({ min: 1, max: 10 });
98
- this.price = faker.number.int({ min: 1, max: 1000 });
99
- this.discount_amount = faker.number.int({ min: 1, max: this.price });
100
- this.discount_percent = Math.floor(this.discount_amount / this.price * 100);
101
- this.tax_percent = faker.number.int({ min: 1, max: 10 });
102
- this.tax_amount = faker.number.int({ min: 1, max: 10 });
103
- this.row_total = this.price * this.qty;
104
- this.row_total_with_discount = (this.price - this.discount_amount) * this.qty;
105
- this.row_weight = faker.number.int({ min: 1, max: 100 });
106
- this.tax_before_discount = faker.number.int({ min: 1, max: 100 });
107
- this.type = DaffOrderItemType.Simple;
108
- }
109
- }
110
- class DaffOrderItemFactory extends DaffModelFactory {
111
- constructor() {
112
- super(MockOrderItem);
113
- }
114
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderItemFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
115
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderItemFactory, providedIn: 'root' }); }
116
- }
117
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderItemFactory, decorators: [{
118
- type: Injectable,
119
- args: [{
120
- providedIn: 'root',
121
- }]
122
- }], ctorParameters: () => [] });
123
-
124
- class MockOrderShipmentItem {
125
- constructor(itemFactory) {
126
- this.itemFactory = itemFactory;
127
- this.item = this.itemFactory.create();
128
- this.qty = faker.number.int({ min: 1, max: 100 });
129
- }
130
- }
131
- ;
132
- class DaffOrderShipmentItemFactory extends DaffModelFactory {
133
- constructor(itemFactory) {
134
- super(MockOrderShipmentItem, itemFactory);
135
- }
136
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShipmentItemFactory, deps: [{ token: DaffOrderItemFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
137
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShipmentItemFactory, providedIn: 'root' }); }
138
- }
139
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShipmentItemFactory, decorators: [{
140
- type: Injectable,
141
- args: [{
142
- providedIn: 'root',
143
- }]
144
- }], ctorParameters: () => [{ type: DaffOrderItemFactory }] });
145
-
146
- class MockOrderShippingMethod {
147
- constructor() {
148
- this.rate_id = faker.string.uuid();
149
- this.address_id = faker.string.uuid();
150
- this.order_id = faker.string.uuid();
151
- this.created_at = faker.date.past().toString();
152
- this.updated_at = faker.date.past().toString();
153
- this.carrier = faker.lorem.word();
154
- this.carrier_title = faker.lorem.word();
155
- this.code = faker.lorem.word();
156
- this.method = faker.lorem.word();
157
- this.method_description = faker.lorem.word();
158
- this.price = faker.number.int({ min: 1, max: 1000 });
159
- this.error_message = faker.lorem.word();
160
- this.method_title = faker.lorem.word();
161
- }
162
- }
163
- class DaffOrderShippingMethodFactory extends DaffModelFactory {
164
- constructor() {
165
- super(MockOrderShippingMethod);
166
- }
167
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShippingMethodFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
168
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShippingMethodFactory, providedIn: 'root' }); }
169
- }
170
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShippingMethodFactory, decorators: [{
171
- type: Injectable,
172
- args: [{
173
- providedIn: 'root',
174
- }]
175
- }], ctorParameters: () => [] });
176
-
177
- class MockOrderTotal {
178
- constructor() {
179
- this.label = faker.lorem.word();
180
- this.value = faker.number.int({ min: 1, max: 100 });
181
- this.sort_order = faker.number.int({ min: 1, max: 100 });
182
- this.type = faker.string.uuid();
183
- }
184
- }
185
- ;
186
- class DaffOrderTotalFactory extends DaffModelFactory {
187
- constructor() {
188
- super(MockOrderTotal);
189
- }
190
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderTotalFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
191
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderTotalFactory, providedIn: 'root' }); }
192
- }
193
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderTotalFactory, decorators: [{
194
- type: Injectable,
195
- args: [{
196
- providedIn: 'root',
197
- }]
198
- }], ctorParameters: () => [] });
199
-
200
- class MockOrderInvoice {
201
- constructor(itemFactory, addressFactory, paymentFactory, totalFactory, shippingMethodFactory) {
202
- this.itemFactory = itemFactory;
203
- this.addressFactory = addressFactory;
204
- this.paymentFactory = paymentFactory;
205
- this.totalFactory = totalFactory;
206
- this.shippingMethodFactory = shippingMethodFactory;
207
- this.items = this.itemFactory.createMany(faker.number.int({ min: 1, max: 3 }));
208
- this.totals = this.totalFactory.createMany(faker.number.int({ min: 1, max: 3 }));
209
- this.billing_address = this.addressFactory.create();
210
- this.shipping_address = this.addressFactory.create();
211
- this.payment = this.paymentFactory.create();
212
- this.shipping_method = this.shippingMethodFactory.create();
213
- }
214
- }
215
- ;
216
- class DaffOrderInvoiceFactory extends DaffModelFactory {
217
- constructor(itemFactory, addressFactory, paymentFactory, totalFactory, shippingMethodFactory) {
218
- super(MockOrderInvoice, itemFactory, addressFactory, paymentFactory, totalFactory, shippingMethodFactory);
219
- }
220
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderInvoiceFactory, deps: [{ token: DaffOrderShipmentItemFactory }, { token: DaffOrderAddressFactory }, { token: DaffOrderPaymentFactory }, { token: DaffOrderTotalFactory }, { token: DaffOrderShippingMethodFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
221
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderInvoiceFactory, providedIn: 'root' }); }
222
- }
223
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderInvoiceFactory, decorators: [{
224
- type: Injectable,
225
- args: [{
226
- providedIn: 'root',
227
- }]
228
- }], ctorParameters: () => [{ type: DaffOrderShipmentItemFactory }, { type: DaffOrderAddressFactory }, { type: DaffOrderPaymentFactory }, { type: DaffOrderTotalFactory }, { type: DaffOrderShippingMethodFactory }] });
229
-
230
- class MockCompositeOrderItem extends MockOrderItem {
231
- constructor() {
232
- super(...arguments);
233
- this.type = DaffOrderItemType.Composite;
234
- this.options = [
235
- {
236
- option_label: faker.lorem.word(),
237
- value_label: faker.lorem.word(),
238
- },
239
- {
240
- option_label: faker.lorem.word(),
241
- value_label: faker.lorem.word(),
242
- },
243
- ];
244
- }
245
- }
246
- class DaffCompositeOrderItemFactory extends DaffModelFactory {
247
- constructor() {
248
- super(MockCompositeOrderItem);
249
- }
250
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCompositeOrderItemFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
251
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCompositeOrderItemFactory, providedIn: 'root' }); }
252
- }
253
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCompositeOrderItemFactory, decorators: [{
254
- type: Injectable,
255
- args: [{
256
- providedIn: 'root',
257
- }]
258
- }], ctorParameters: () => [] });
259
-
260
- class MockConfigurableOrderItem extends MockOrderItem {
261
- constructor() {
262
- super(...arguments);
263
- this.type = DaffOrderItemType.Configurable;
264
- this.attributes = [
265
- {
266
- attribute_label: 'Color',
267
- value_label: 'Red',
268
- },
269
- {
270
- attribute_label: 'Size',
271
- value_label: 'M',
272
- },
273
- ];
274
- }
275
- }
276
- class DaffConfigurableOrderItemFactory extends DaffModelFactory {
277
- constructor() {
278
- super(MockConfigurableOrderItem);
279
- }
280
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffConfigurableOrderItemFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
281
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffConfigurableOrderItemFactory, providedIn: 'root' }); }
282
- }
283
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffConfigurableOrderItemFactory, decorators: [{
284
- type: Injectable,
285
- args: [{
286
- providedIn: 'root',
287
- }]
288
- }], ctorParameters: () => [] });
289
-
290
- class MockOrderShipmentTracking {
291
- constructor() {
292
- this.tracking_number = faker.string.alphanumeric(16);
293
- this.tracking_url = faker.internet.url();
294
- this.carrier = faker.lorem.word();
295
- this.carrier_logo = faker.internet.url();
296
- this.title = faker.lorem.word();
297
- }
298
- }
299
- ;
300
- class DaffOrderShipmentTrackingFactory extends DaffModelFactory {
301
- constructor() {
302
- super(MockOrderShipmentTracking);
303
- }
304
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShipmentTrackingFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
305
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShipmentTrackingFactory, providedIn: 'root' }); }
306
- }
307
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShipmentTrackingFactory, decorators: [{
308
- type: Injectable,
309
- args: [{
310
- providedIn: 'root',
311
- }]
312
- }], ctorParameters: () => [] });
313
-
314
- class MockOrderShipment {
315
- constructor(trackingFactory, itemFactory) {
316
- this.trackingFactory = trackingFactory;
317
- this.itemFactory = itemFactory;
318
- this.tracking = this.createTracking();
319
- this.items = this.createItems();
320
- this.carrier = faker.lorem.word();
321
- this.carrier_title = faker.lorem.word();
322
- this.code = faker.lorem.word();
323
- this.method = faker.lorem.word();
324
- this.method_description = faker.lorem.word();
325
- }
326
- createTracking() {
327
- return this.trackingFactory.createMany(faker.number.int({ min: 1, max: 3 }));
328
- }
329
- createItems() {
330
- return this.itemFactory.createMany(faker.number.int({ min: 1, max: 3 }));
331
- }
332
- }
333
- ;
334
- class DaffOrderShipmentFactory extends DaffModelFactory {
335
- constructor(trackingFactory, itemFactory) {
336
- super(MockOrderShipment, trackingFactory, itemFactory);
337
- }
338
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShipmentFactory, deps: [{ token: DaffOrderShipmentTrackingFactory }, { token: DaffOrderShipmentItemFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
339
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShipmentFactory, providedIn: 'root' }); }
340
- }
341
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderShipmentFactory, decorators: [{
342
- type: Injectable,
343
- args: [{
344
- providedIn: 'root',
345
- }]
346
- }], ctorParameters: () => [{ type: DaffOrderShipmentTrackingFactory }, { type: DaffOrderShipmentItemFactory }] });
347
-
348
- class MockOrder {
349
- constructor(totalFactory, couponFactory, itemFactory, addressFactory, shipmentFactory, paymentFactory, invoiceFactory) {
350
- this.totalFactory = totalFactory;
351
- this.couponFactory = couponFactory;
352
- this.itemFactory = itemFactory;
353
- this.addressFactory = addressFactory;
354
- this.shipmentFactory = shipmentFactory;
355
- this.paymentFactory = paymentFactory;
356
- this.invoiceFactory = invoiceFactory;
357
- this.id = faker.string.uuid();
358
- this.customer_id = faker.string.uuid();
359
- this.email = faker.internet.email();
360
- this.created_at = faker.date.past().toString();
361
- this.updated_at = faker.date.past().toString();
362
- this.status = faker.lorem.word();
363
- this.totals = this.createTotals();
364
- this.applied_codes = this.couponFactory.createMany(faker.number.int({ min: 1, max: 3 }));
365
- this.items = this.itemFactory.createMany(faker.number.int({ min: 1, max: 5 }));
366
- this.billing_addresses = this.addressFactory.createMany(faker.number.int({ min: 1, max: 3 }));
367
- this.shipping_addresses = this.addressFactory.createMany(faker.number.int({ min: 1, max: 3 }));
368
- this.shipments = this.shipmentFactory.createMany(faker.number.int({ min: 1, max: 3 }));
369
- this.payment = this.paymentFactory.create();
370
- this.invoices = this.invoiceFactory.createMany(faker.number.int({ min: 1, max: 3 }));
371
- this.credits = this.invoiceFactory.createMany(faker.number.int({ min: 1, max: 3 }));
372
- }
373
- createTotals() {
374
- return [
375
- this.totalFactory.create({
376
- label: 'Grand Total',
377
- type: DaffOrderTotalTypeEnum.GrandTotal,
378
- sort_order: 1,
379
- }),
380
- this.totalFactory.create({
381
- label: 'Subtotal',
382
- type: DaffOrderTotalTypeEnum.Subtotal,
383
- sort_order: 0,
384
- }),
385
- this.totalFactory.create({
386
- label: 'Shipping',
387
- type: DaffOrderTotalTypeEnum.Shipping,
388
- sort_order: 2,
389
- }),
390
- this.totalFactory.create({
391
- label: 'Tax',
392
- type: DaffOrderTotalTypeEnum.Tax,
393
- sort_order: 3,
394
- }),
395
- this.totalFactory.create({
396
- label: 'Discount',
397
- type: DaffOrderTotalTypeEnum.Discount,
398
- sort_order: 4,
399
- }),
400
- ];
401
- }
402
- }
403
- ;
404
- class DaffOrderFactory extends DaffModelFactory {
405
- constructor(totalFactory, couponFactory, itemFactory, addressFactory, shipmentFactory, paymentFactory, invoiceFactory) {
406
- super(MockOrder, totalFactory, couponFactory, itemFactory, addressFactory, shipmentFactory, paymentFactory, invoiceFactory);
407
- }
408
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderFactory, deps: [{ token: DaffOrderTotalFactory }, { token: DaffOrderCouponFactory }, { token: DaffOrderItemFactory }, { token: DaffOrderAddressFactory }, { token: DaffOrderShipmentFactory }, { token: DaffOrderPaymentFactory }, { token: DaffOrderInvoiceFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
409
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderFactory, providedIn: 'root' }); }
410
- }
411
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderFactory, decorators: [{
412
- type: Injectable,
413
- args: [{
414
- providedIn: 'root',
415
- }]
416
- }], ctorParameters: () => [{ type: DaffOrderTotalFactory }, { type: DaffOrderCouponFactory }, { type: DaffOrderItemFactory }, { type: DaffOrderAddressFactory }, { type: DaffOrderShipmentFactory }, { type: DaffOrderPaymentFactory }, { type: DaffOrderInvoiceFactory }] });
417
-
418
- /**
419
- * Mocked {@link DaffOrderCollection} object.
420
- */
421
- class MockOrderCollection {
422
- constructor(orderFactory, metadataFactory) {
423
- this.orderFactory = orderFactory;
424
- this.metadataFactory = metadataFactory;
425
- this.data = this.createOrders();
426
- const orders = Object.values(this.data);
427
- this.metadata = this.metadataFactory.create({
428
- count: orders.length,
429
- ids: orders.map(({ id }) => id),
430
- });
431
- }
432
- createOrders() {
433
- return daffIdentifiableArrayToDict(this.orderFactory.createMany(faker.number.int({ min: 3, max: 15 })));
434
- }
435
- }
436
- /**
437
- * Factory for creating DaffOrderCollections.
438
- */
439
- class DaffOrderCollectionFactory extends DaffModelFactory {
440
- constructor(orderFactory, metadataFactory) {
441
- super(MockOrderCollection, orderFactory, metadataFactory);
442
- }
443
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderCollectionFactory, deps: [{ token: DaffOrderFactory }, { token: i2.DaffCollectionMetadataFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
444
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderCollectionFactory, providedIn: 'root' }); }
445
- }
446
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffOrderCollectionFactory, decorators: [{
447
- type: Injectable,
448
- args: [{
449
- providedIn: 'root',
450
- }]
451
- }], ctorParameters: () => [{ type: DaffOrderFactory }, { type: i2.DaffCollectionMetadataFactory }] });
452
-
453
- /**
454
- * A helper function to verify that a model is a Order.
455
- *
456
- * @param order
457
- */
1
+ import * as i0 from "@angular/core";
2
+ import { Injectable } from "@angular/core";
3
+ import { faker } from "@faker-js/faker/locale/en_US";
4
+ import * as i2 from "@daffodil/core/testing";
5
+ import { DaffModelFactory } from "@daffodil/core/testing";
6
+ import { MockDaffPersonalAddress } from "@daffodil/geography/testing";
7
+ import { DaffOrderItemType, DaffOrderTotalTypeEnum } from "@daffodil/order";
8
+ import { daffIdentifiableArrayToDict } from "@daffodil/core";
9
+ var MockOrderAddress = class extends MockDaffPersonalAddress {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.order_id = faker.string.uuid();
13
+ }
14
+ };
15
+ var DaffOrderAddressFactory = class DaffOrderAddressFactory extends DaffModelFactory {
16
+ constructor() {
17
+ super(MockOrderAddress);
18
+ }
19
+ static {
20
+ this.ɵfac = i0.ɵɵngDeclareFactory({
21
+ minVersion: "12.0.0",
22
+ version: "22.2.4",
23
+ ngImport: i0,
24
+ type: DaffOrderAddressFactory,
25
+ deps: [],
26
+ target: i0.ɵɵFactoryTarget.Injectable
27
+ });
28
+ }
29
+ static {
30
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
31
+ minVersion: "12.0.0",
32
+ version: "22.2.4",
33
+ ngImport: i0,
34
+ type: DaffOrderAddressFactory,
35
+ providedIn: "root"
36
+ });
37
+ }
38
+ };
39
+ i0.ɵɵngDeclareClassMetadata({
40
+ minVersion: "12.0.0",
41
+ version: "22.2.4",
42
+ ngImport: i0,
43
+ type: DaffOrderAddressFactory,
44
+ decorators: [{
45
+ type: Injectable,
46
+ args: [{ providedIn: "root" }]
47
+ }],
48
+ ctorParameters: () => []
49
+ });
50
+ var MockOrderCoupon = class {
51
+ constructor() {
52
+ this.code = faker.string.alphanumeric(10);
53
+ }
54
+ };
55
+ var DaffOrderCouponFactory = class DaffOrderCouponFactory extends DaffModelFactory {
56
+ constructor() {
57
+ super(MockOrderCoupon);
58
+ }
59
+ static {
60
+ this.ɵfac = i0.ɵɵngDeclareFactory({
61
+ minVersion: "12.0.0",
62
+ version: "22.2.4",
63
+ ngImport: i0,
64
+ type: DaffOrderCouponFactory,
65
+ deps: [],
66
+ target: i0.ɵɵFactoryTarget.Injectable
67
+ });
68
+ }
69
+ static {
70
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
71
+ minVersion: "12.0.0",
72
+ version: "22.2.4",
73
+ ngImport: i0,
74
+ type: DaffOrderCouponFactory,
75
+ providedIn: "root"
76
+ });
77
+ }
78
+ };
79
+ i0.ɵɵngDeclareClassMetadata({
80
+ minVersion: "12.0.0",
81
+ version: "22.2.4",
82
+ ngImport: i0,
83
+ type: DaffOrderCouponFactory,
84
+ decorators: [{
85
+ type: Injectable,
86
+ args: [{ providedIn: "root" }]
87
+ }],
88
+ ctorParameters: () => []
89
+ });
90
+ var MockOrderPayment = class {
91
+ constructor() {
92
+ this.id = faker.string.uuid();
93
+ this.order_id = faker.string.uuid();
94
+ this.created_at = faker.date.past().toString();
95
+ this.updated_at = faker.date.past().toString();
96
+ this.method = "card";
97
+ this.cc_type = "visa";
98
+ this.cc_last4 = faker.number.int({
99
+ min: 1e3,
100
+ max: 9999
101
+ }).toString();
102
+ this.cc_owner = "owner";
103
+ this.cc_exp_month = "month";
104
+ this.cc_exp_year = "year";
105
+ }
106
+ };
107
+ var DaffOrderPaymentFactory = class DaffOrderPaymentFactory extends DaffModelFactory {
108
+ constructor() {
109
+ super(MockOrderPayment);
110
+ }
111
+ static {
112
+ this.ɵfac = i0.ɵɵngDeclareFactory({
113
+ minVersion: "12.0.0",
114
+ version: "22.2.4",
115
+ ngImport: i0,
116
+ type: DaffOrderPaymentFactory,
117
+ deps: [],
118
+ target: i0.ɵɵFactoryTarget.Injectable
119
+ });
120
+ }
121
+ static {
122
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
123
+ minVersion: "12.0.0",
124
+ version: "22.2.4",
125
+ ngImport: i0,
126
+ type: DaffOrderPaymentFactory,
127
+ providedIn: "root"
128
+ });
129
+ }
130
+ };
131
+ i0.ɵɵngDeclareClassMetadata({
132
+ minVersion: "12.0.0",
133
+ version: "22.2.4",
134
+ ngImport: i0,
135
+ type: DaffOrderPaymentFactory,
136
+ decorators: [{
137
+ type: Injectable,
138
+ args: [{ providedIn: "root" }]
139
+ }],
140
+ ctorParameters: () => []
141
+ });
142
+ var MockOrderItem = class {
143
+ constructor() {
144
+ this.id = faker.string.uuid();
145
+ this.image = {
146
+ url: faker.image.url(),
147
+ id: faker.string.uuid(),
148
+ label: faker.lorem.word()
149
+ };
150
+ this.order_id = faker.string.uuid();
151
+ this.qty_ordered = faker.number.int({
152
+ min: 1,
153
+ max: 1e3
154
+ });
155
+ this.qty_canceled = faker.number.int({
156
+ min: 1,
157
+ max: 1e3
158
+ });
159
+ this.qty_fulfilled = faker.number.int({
160
+ min: 1,
161
+ max: 1e3
162
+ });
163
+ this.created_at = faker.date.past().toString();
164
+ this.updated_at = faker.date.past().toString();
165
+ this.product_id = faker.string.uuid();
166
+ this.parent_item_id = faker.string.uuid();
167
+ this.sku = faker.string.alphanumeric(20);
168
+ this.name = faker.lorem.word();
169
+ this.weight = faker.number.int({
170
+ min: 1,
171
+ max: 1e3
172
+ });
173
+ this.qty = faker.number.int({
174
+ min: 1,
175
+ max: 10
176
+ });
177
+ this.price = faker.number.int({
178
+ min: 1,
179
+ max: 1e3
180
+ });
181
+ this.discount_amount = faker.number.int({
182
+ min: 1,
183
+ max: this.price
184
+ });
185
+ this.discount_percent = Math.floor(this.discount_amount / this.price * 100);
186
+ this.tax_percent = faker.number.int({
187
+ min: 1,
188
+ max: 10
189
+ });
190
+ this.tax_amount = faker.number.int({
191
+ min: 1,
192
+ max: 10
193
+ });
194
+ this.row_total = this.price * this.qty;
195
+ this.row_total_with_discount = (this.price - this.discount_amount) * this.qty;
196
+ this.row_weight = faker.number.int({
197
+ min: 1,
198
+ max: 100
199
+ });
200
+ this.tax_before_discount = faker.number.int({
201
+ min: 1,
202
+ max: 100
203
+ });
204
+ this.type = DaffOrderItemType.Simple;
205
+ }
206
+ };
207
+ var DaffOrderItemFactory = class DaffOrderItemFactory extends DaffModelFactory {
208
+ constructor() {
209
+ super(MockOrderItem);
210
+ }
211
+ static {
212
+ this.ɵfac = i0.ɵɵngDeclareFactory({
213
+ minVersion: "12.0.0",
214
+ version: "22.2.4",
215
+ ngImport: i0,
216
+ type: DaffOrderItemFactory,
217
+ deps: [],
218
+ target: i0.ɵɵFactoryTarget.Injectable
219
+ });
220
+ }
221
+ static {
222
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
223
+ minVersion: "12.0.0",
224
+ version: "22.2.4",
225
+ ngImport: i0,
226
+ type: DaffOrderItemFactory,
227
+ providedIn: "root"
228
+ });
229
+ }
230
+ };
231
+ i0.ɵɵngDeclareClassMetadata({
232
+ minVersion: "12.0.0",
233
+ version: "22.2.4",
234
+ ngImport: i0,
235
+ type: DaffOrderItemFactory,
236
+ decorators: [{
237
+ type: Injectable,
238
+ args: [{ providedIn: "root" }]
239
+ }],
240
+ ctorParameters: () => []
241
+ });
242
+ var MockOrderShipmentItem = class {
243
+ constructor(itemFactory) {
244
+ this.itemFactory = itemFactory;
245
+ this.item = this.itemFactory.create();
246
+ this.qty = faker.number.int({
247
+ min: 1,
248
+ max: 100
249
+ });
250
+ }
251
+ };
252
+ var DaffOrderShipmentItemFactory = class DaffOrderShipmentItemFactory extends DaffModelFactory {
253
+ constructor(itemFactory) {
254
+ super(MockOrderShipmentItem, itemFactory);
255
+ }
256
+ static {
257
+ this.ɵfac = i0.ɵɵngDeclareFactory({
258
+ minVersion: "12.0.0",
259
+ version: "22.2.4",
260
+ ngImport: i0,
261
+ type: DaffOrderShipmentItemFactory,
262
+ deps: [{ token: DaffOrderItemFactory }],
263
+ target: i0.ɵɵFactoryTarget.Injectable
264
+ });
265
+ }
266
+ static {
267
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
268
+ minVersion: "12.0.0",
269
+ version: "22.2.4",
270
+ ngImport: i0,
271
+ type: DaffOrderShipmentItemFactory,
272
+ providedIn: "root"
273
+ });
274
+ }
275
+ };
276
+ i0.ɵɵngDeclareClassMetadata({
277
+ minVersion: "12.0.0",
278
+ version: "22.2.4",
279
+ ngImport: i0,
280
+ type: DaffOrderShipmentItemFactory,
281
+ decorators: [{
282
+ type: Injectable,
283
+ args: [{ providedIn: "root" }]
284
+ }],
285
+ ctorParameters: () => [{ type: DaffOrderItemFactory }]
286
+ });
287
+ var MockOrderShippingMethod = class {
288
+ constructor() {
289
+ this.rate_id = faker.string.uuid();
290
+ this.address_id = faker.string.uuid();
291
+ this.order_id = faker.string.uuid();
292
+ this.created_at = faker.date.past().toString();
293
+ this.updated_at = faker.date.past().toString();
294
+ this.carrier = faker.lorem.word();
295
+ this.carrier_title = faker.lorem.word();
296
+ this.code = faker.lorem.word();
297
+ this.method = faker.lorem.word();
298
+ this.method_description = faker.lorem.word();
299
+ this.price = faker.number.int({
300
+ min: 1,
301
+ max: 1e3
302
+ });
303
+ this.error_message = faker.lorem.word();
304
+ this.method_title = faker.lorem.word();
305
+ }
306
+ };
307
+ var DaffOrderShippingMethodFactory = class DaffOrderShippingMethodFactory extends DaffModelFactory {
308
+ constructor() {
309
+ super(MockOrderShippingMethod);
310
+ }
311
+ static {
312
+ this.ɵfac = i0.ɵɵngDeclareFactory({
313
+ minVersion: "12.0.0",
314
+ version: "22.2.4",
315
+ ngImport: i0,
316
+ type: DaffOrderShippingMethodFactory,
317
+ deps: [],
318
+ target: i0.ɵɵFactoryTarget.Injectable
319
+ });
320
+ }
321
+ static {
322
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
323
+ minVersion: "12.0.0",
324
+ version: "22.2.4",
325
+ ngImport: i0,
326
+ type: DaffOrderShippingMethodFactory,
327
+ providedIn: "root"
328
+ });
329
+ }
330
+ };
331
+ i0.ɵɵngDeclareClassMetadata({
332
+ minVersion: "12.0.0",
333
+ version: "22.2.4",
334
+ ngImport: i0,
335
+ type: DaffOrderShippingMethodFactory,
336
+ decorators: [{
337
+ type: Injectable,
338
+ args: [{ providedIn: "root" }]
339
+ }],
340
+ ctorParameters: () => []
341
+ });
342
+ var MockOrderTotal = class {
343
+ constructor() {
344
+ this.label = faker.lorem.word();
345
+ this.value = faker.number.int({
346
+ min: 1,
347
+ max: 100
348
+ });
349
+ this.sort_order = faker.number.int({
350
+ min: 1,
351
+ max: 100
352
+ });
353
+ this.type = faker.string.uuid();
354
+ }
355
+ };
356
+ var DaffOrderTotalFactory = class DaffOrderTotalFactory extends DaffModelFactory {
357
+ constructor() {
358
+ super(MockOrderTotal);
359
+ }
360
+ static {
361
+ this.ɵfac = i0.ɵɵngDeclareFactory({
362
+ minVersion: "12.0.0",
363
+ version: "22.2.4",
364
+ ngImport: i0,
365
+ type: DaffOrderTotalFactory,
366
+ deps: [],
367
+ target: i0.ɵɵFactoryTarget.Injectable
368
+ });
369
+ }
370
+ static {
371
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
372
+ minVersion: "12.0.0",
373
+ version: "22.2.4",
374
+ ngImport: i0,
375
+ type: DaffOrderTotalFactory,
376
+ providedIn: "root"
377
+ });
378
+ }
379
+ };
380
+ i0.ɵɵngDeclareClassMetadata({
381
+ minVersion: "12.0.0",
382
+ version: "22.2.4",
383
+ ngImport: i0,
384
+ type: DaffOrderTotalFactory,
385
+ decorators: [{
386
+ type: Injectable,
387
+ args: [{ providedIn: "root" }]
388
+ }],
389
+ ctorParameters: () => []
390
+ });
391
+ var MockOrderInvoice = class {
392
+ constructor(itemFactory, addressFactory, paymentFactory, totalFactory, shippingMethodFactory) {
393
+ this.itemFactory = itemFactory;
394
+ this.addressFactory = addressFactory;
395
+ this.paymentFactory = paymentFactory;
396
+ this.totalFactory = totalFactory;
397
+ this.shippingMethodFactory = shippingMethodFactory;
398
+ this.items = this.itemFactory.createMany(faker.number.int({
399
+ min: 1,
400
+ max: 3
401
+ }));
402
+ this.totals = this.totalFactory.createMany(faker.number.int({
403
+ min: 1,
404
+ max: 3
405
+ }));
406
+ this.billing_address = this.addressFactory.create();
407
+ this.shipping_address = this.addressFactory.create();
408
+ this.payment = this.paymentFactory.create();
409
+ this.shipping_method = this.shippingMethodFactory.create();
410
+ }
411
+ };
412
+ var DaffOrderInvoiceFactory = class DaffOrderInvoiceFactory extends DaffModelFactory {
413
+ constructor(itemFactory, addressFactory, paymentFactory, totalFactory, shippingMethodFactory) {
414
+ super(MockOrderInvoice, itemFactory, addressFactory, paymentFactory, totalFactory, shippingMethodFactory);
415
+ }
416
+ static {
417
+ this.ɵfac = i0.ɵɵngDeclareFactory({
418
+ minVersion: "12.0.0",
419
+ version: "22.2.4",
420
+ ngImport: i0,
421
+ type: DaffOrderInvoiceFactory,
422
+ deps: [
423
+ { token: DaffOrderShipmentItemFactory },
424
+ { token: DaffOrderAddressFactory },
425
+ { token: DaffOrderPaymentFactory },
426
+ { token: DaffOrderTotalFactory },
427
+ { token: DaffOrderShippingMethodFactory }
428
+ ],
429
+ target: i0.ɵɵFactoryTarget.Injectable
430
+ });
431
+ }
432
+ static {
433
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
434
+ minVersion: "12.0.0",
435
+ version: "22.2.4",
436
+ ngImport: i0,
437
+ type: DaffOrderInvoiceFactory,
438
+ providedIn: "root"
439
+ });
440
+ }
441
+ };
442
+ i0.ɵɵngDeclareClassMetadata({
443
+ minVersion: "12.0.0",
444
+ version: "22.2.4",
445
+ ngImport: i0,
446
+ type: DaffOrderInvoiceFactory,
447
+ decorators: [{
448
+ type: Injectable,
449
+ args: [{ providedIn: "root" }]
450
+ }],
451
+ ctorParameters: () => [
452
+ { type: DaffOrderShipmentItemFactory },
453
+ { type: DaffOrderAddressFactory },
454
+ { type: DaffOrderPaymentFactory },
455
+ { type: DaffOrderTotalFactory },
456
+ { type: DaffOrderShippingMethodFactory }
457
+ ]
458
+ });
459
+ var MockCompositeOrderItem = class extends MockOrderItem {
460
+ constructor() {
461
+ super(...arguments);
462
+ this.type = DaffOrderItemType.Composite;
463
+ this.options = [{
464
+ option_label: faker.lorem.word(),
465
+ value_label: faker.lorem.word()
466
+ }, {
467
+ option_label: faker.lorem.word(),
468
+ value_label: faker.lorem.word()
469
+ }];
470
+ }
471
+ };
472
+ var DaffCompositeOrderItemFactory = class DaffCompositeOrderItemFactory extends DaffModelFactory {
473
+ constructor() {
474
+ super(MockCompositeOrderItem);
475
+ }
476
+ static {
477
+ this.ɵfac = i0.ɵɵngDeclareFactory({
478
+ minVersion: "12.0.0",
479
+ version: "22.2.4",
480
+ ngImport: i0,
481
+ type: DaffCompositeOrderItemFactory,
482
+ deps: [],
483
+ target: i0.ɵɵFactoryTarget.Injectable
484
+ });
485
+ }
486
+ static {
487
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
488
+ minVersion: "12.0.0",
489
+ version: "22.2.4",
490
+ ngImport: i0,
491
+ type: DaffCompositeOrderItemFactory,
492
+ providedIn: "root"
493
+ });
494
+ }
495
+ };
496
+ i0.ɵɵngDeclareClassMetadata({
497
+ minVersion: "12.0.0",
498
+ version: "22.2.4",
499
+ ngImport: i0,
500
+ type: DaffCompositeOrderItemFactory,
501
+ decorators: [{
502
+ type: Injectable,
503
+ args: [{ providedIn: "root" }]
504
+ }],
505
+ ctorParameters: () => []
506
+ });
507
+ var MockConfigurableOrderItem = class extends MockOrderItem {
508
+ constructor() {
509
+ super(...arguments);
510
+ this.type = DaffOrderItemType.Configurable;
511
+ this.attributes = [{
512
+ attribute_label: "Color",
513
+ value_label: "Red"
514
+ }, {
515
+ attribute_label: "Size",
516
+ value_label: "M"
517
+ }];
518
+ }
519
+ };
520
+ var DaffConfigurableOrderItemFactory = class DaffConfigurableOrderItemFactory extends DaffModelFactory {
521
+ constructor() {
522
+ super(MockConfigurableOrderItem);
523
+ }
524
+ static {
525
+ this.ɵfac = i0.ɵɵngDeclareFactory({
526
+ minVersion: "12.0.0",
527
+ version: "22.2.4",
528
+ ngImport: i0,
529
+ type: DaffConfigurableOrderItemFactory,
530
+ deps: [],
531
+ target: i0.ɵɵFactoryTarget.Injectable
532
+ });
533
+ }
534
+ static {
535
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
536
+ minVersion: "12.0.0",
537
+ version: "22.2.4",
538
+ ngImport: i0,
539
+ type: DaffConfigurableOrderItemFactory,
540
+ providedIn: "root"
541
+ });
542
+ }
543
+ };
544
+ i0.ɵɵngDeclareClassMetadata({
545
+ minVersion: "12.0.0",
546
+ version: "22.2.4",
547
+ ngImport: i0,
548
+ type: DaffConfigurableOrderItemFactory,
549
+ decorators: [{
550
+ type: Injectable,
551
+ args: [{ providedIn: "root" }]
552
+ }],
553
+ ctorParameters: () => []
554
+ });
555
+ var MockOrderShipmentTracking = class {
556
+ constructor() {
557
+ this.tracking_number = faker.string.alphanumeric(16);
558
+ this.tracking_url = faker.internet.url();
559
+ this.carrier = faker.lorem.word();
560
+ this.carrier_logo = faker.internet.url();
561
+ this.title = faker.lorem.word();
562
+ }
563
+ };
564
+ var DaffOrderShipmentTrackingFactory = class DaffOrderShipmentTrackingFactory extends DaffModelFactory {
565
+ constructor() {
566
+ super(MockOrderShipmentTracking);
567
+ }
568
+ static {
569
+ this.ɵfac = i0.ɵɵngDeclareFactory({
570
+ minVersion: "12.0.0",
571
+ version: "22.2.4",
572
+ ngImport: i0,
573
+ type: DaffOrderShipmentTrackingFactory,
574
+ deps: [],
575
+ target: i0.ɵɵFactoryTarget.Injectable
576
+ });
577
+ }
578
+ static {
579
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
580
+ minVersion: "12.0.0",
581
+ version: "22.2.4",
582
+ ngImport: i0,
583
+ type: DaffOrderShipmentTrackingFactory,
584
+ providedIn: "root"
585
+ });
586
+ }
587
+ };
588
+ i0.ɵɵngDeclareClassMetadata({
589
+ minVersion: "12.0.0",
590
+ version: "22.2.4",
591
+ ngImport: i0,
592
+ type: DaffOrderShipmentTrackingFactory,
593
+ decorators: [{
594
+ type: Injectable,
595
+ args: [{ providedIn: "root" }]
596
+ }],
597
+ ctorParameters: () => []
598
+ });
599
+ var MockOrderShipment = class {
600
+ constructor(trackingFactory, itemFactory) {
601
+ this.trackingFactory = trackingFactory;
602
+ this.itemFactory = itemFactory;
603
+ this.tracking = this.createTracking();
604
+ this.items = this.createItems();
605
+ this.carrier = faker.lorem.word();
606
+ this.carrier_title = faker.lorem.word();
607
+ this.code = faker.lorem.word();
608
+ this.method = faker.lorem.word();
609
+ this.method_description = faker.lorem.word();
610
+ }
611
+ createTracking() {
612
+ return this.trackingFactory.createMany(faker.number.int({
613
+ min: 1,
614
+ max: 3
615
+ }));
616
+ }
617
+ createItems() {
618
+ return this.itemFactory.createMany(faker.number.int({
619
+ min: 1,
620
+ max: 3
621
+ }));
622
+ }
623
+ };
624
+ var DaffOrderShipmentFactory = class DaffOrderShipmentFactory extends DaffModelFactory {
625
+ constructor(trackingFactory, itemFactory) {
626
+ super(MockOrderShipment, trackingFactory, itemFactory);
627
+ }
628
+ static {
629
+ this.ɵfac = i0.ɵɵngDeclareFactory({
630
+ minVersion: "12.0.0",
631
+ version: "22.2.4",
632
+ ngImport: i0,
633
+ type: DaffOrderShipmentFactory,
634
+ deps: [{ token: DaffOrderShipmentTrackingFactory }, { token: DaffOrderShipmentItemFactory }],
635
+ target: i0.ɵɵFactoryTarget.Injectable
636
+ });
637
+ }
638
+ static {
639
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
640
+ minVersion: "12.0.0",
641
+ version: "22.2.4",
642
+ ngImport: i0,
643
+ type: DaffOrderShipmentFactory,
644
+ providedIn: "root"
645
+ });
646
+ }
647
+ };
648
+ i0.ɵɵngDeclareClassMetadata({
649
+ minVersion: "12.0.0",
650
+ version: "22.2.4",
651
+ ngImport: i0,
652
+ type: DaffOrderShipmentFactory,
653
+ decorators: [{
654
+ type: Injectable,
655
+ args: [{ providedIn: "root" }]
656
+ }],
657
+ ctorParameters: () => [{ type: DaffOrderShipmentTrackingFactory }, { type: DaffOrderShipmentItemFactory }]
658
+ });
659
+ var MockOrder = class {
660
+ constructor(totalFactory, couponFactory, itemFactory, addressFactory, shipmentFactory, paymentFactory, invoiceFactory) {
661
+ this.totalFactory = totalFactory;
662
+ this.couponFactory = couponFactory;
663
+ this.itemFactory = itemFactory;
664
+ this.addressFactory = addressFactory;
665
+ this.shipmentFactory = shipmentFactory;
666
+ this.paymentFactory = paymentFactory;
667
+ this.invoiceFactory = invoiceFactory;
668
+ this.id = faker.string.uuid();
669
+ this.customer_id = faker.string.uuid();
670
+ this.email = faker.internet.email();
671
+ this.created_at = faker.date.past().toString();
672
+ this.updated_at = faker.date.past().toString();
673
+ this.status = faker.lorem.word();
674
+ this.totals = this.createTotals();
675
+ this.applied_codes = this.couponFactory.createMany(faker.number.int({
676
+ min: 1,
677
+ max: 3
678
+ }));
679
+ this.items = this.itemFactory.createMany(faker.number.int({
680
+ min: 1,
681
+ max: 5
682
+ }));
683
+ this.billing_addresses = this.addressFactory.createMany(faker.number.int({
684
+ min: 1,
685
+ max: 3
686
+ }));
687
+ this.shipping_addresses = this.addressFactory.createMany(faker.number.int({
688
+ min: 1,
689
+ max: 3
690
+ }));
691
+ this.shipments = this.shipmentFactory.createMany(faker.number.int({
692
+ min: 1,
693
+ max: 3
694
+ }));
695
+ this.payment = this.paymentFactory.create();
696
+ this.invoices = this.invoiceFactory.createMany(faker.number.int({
697
+ min: 1,
698
+ max: 3
699
+ }));
700
+ this.credits = this.invoiceFactory.createMany(faker.number.int({
701
+ min: 1,
702
+ max: 3
703
+ }));
704
+ }
705
+ createTotals() {
706
+ return [
707
+ this.totalFactory.create({
708
+ label: "Grand Total",
709
+ type: DaffOrderTotalTypeEnum.GrandTotal,
710
+ sort_order: 1
711
+ }),
712
+ this.totalFactory.create({
713
+ label: "Subtotal",
714
+ type: DaffOrderTotalTypeEnum.Subtotal,
715
+ sort_order: 0
716
+ }),
717
+ this.totalFactory.create({
718
+ label: "Shipping",
719
+ type: DaffOrderTotalTypeEnum.Shipping,
720
+ sort_order: 2
721
+ }),
722
+ this.totalFactory.create({
723
+ label: "Tax",
724
+ type: DaffOrderTotalTypeEnum.Tax,
725
+ sort_order: 3
726
+ }),
727
+ this.totalFactory.create({
728
+ label: "Discount",
729
+ type: DaffOrderTotalTypeEnum.Discount,
730
+ sort_order: 4
731
+ })
732
+ ];
733
+ }
734
+ };
735
+ var DaffOrderFactory = class DaffOrderFactory extends DaffModelFactory {
736
+ constructor(totalFactory, couponFactory, itemFactory, addressFactory, shipmentFactory, paymentFactory, invoiceFactory) {
737
+ super(MockOrder, totalFactory, couponFactory, itemFactory, addressFactory, shipmentFactory, paymentFactory, invoiceFactory);
738
+ }
739
+ static {
740
+ this.ɵfac = i0.ɵɵngDeclareFactory({
741
+ minVersion: "12.0.0",
742
+ version: "22.2.4",
743
+ ngImport: i0,
744
+ type: DaffOrderFactory,
745
+ deps: [
746
+ { token: DaffOrderTotalFactory },
747
+ { token: DaffOrderCouponFactory },
748
+ { token: DaffOrderItemFactory },
749
+ { token: DaffOrderAddressFactory },
750
+ { token: DaffOrderShipmentFactory },
751
+ { token: DaffOrderPaymentFactory },
752
+ { token: DaffOrderInvoiceFactory }
753
+ ],
754
+ target: i0.ɵɵFactoryTarget.Injectable
755
+ });
756
+ }
757
+ static {
758
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
759
+ minVersion: "12.0.0",
760
+ version: "22.2.4",
761
+ ngImport: i0,
762
+ type: DaffOrderFactory,
763
+ providedIn: "root"
764
+ });
765
+ }
766
+ };
767
+ i0.ɵɵngDeclareClassMetadata({
768
+ minVersion: "12.0.0",
769
+ version: "22.2.4",
770
+ ngImport: i0,
771
+ type: DaffOrderFactory,
772
+ decorators: [{
773
+ type: Injectable,
774
+ args: [{ providedIn: "root" }]
775
+ }],
776
+ ctorParameters: () => [
777
+ { type: DaffOrderTotalFactory },
778
+ { type: DaffOrderCouponFactory },
779
+ { type: DaffOrderItemFactory },
780
+ { type: DaffOrderAddressFactory },
781
+ { type: DaffOrderShipmentFactory },
782
+ { type: DaffOrderPaymentFactory },
783
+ { type: DaffOrderInvoiceFactory }
784
+ ]
785
+ });
786
+ var MockOrderCollection = class {
787
+ constructor(orderFactory, metadataFactory) {
788
+ this.orderFactory = orderFactory;
789
+ this.metadataFactory = metadataFactory;
790
+ this.data = this.createOrders();
791
+ const orders = Object.values(this.data);
792
+ this.metadata = this.metadataFactory.create({
793
+ count: orders.length,
794
+ ids: orders.map(({ id }) => id)
795
+ });
796
+ }
797
+ createOrders() {
798
+ return daffIdentifiableArrayToDict(this.orderFactory.createMany(faker.number.int({
799
+ min: 3,
800
+ max: 15
801
+ })));
802
+ }
803
+ };
804
+ var DaffOrderCollectionFactory = class DaffOrderCollectionFactory extends DaffModelFactory {
805
+ constructor(orderFactory, metadataFactory) {
806
+ super(MockOrderCollection, orderFactory, metadataFactory);
807
+ }
808
+ static {
809
+ this.ɵfac = i0.ɵɵngDeclareFactory({
810
+ minVersion: "12.0.0",
811
+ version: "22.2.4",
812
+ ngImport: i0,
813
+ type: DaffOrderCollectionFactory,
814
+ deps: [{ token: DaffOrderFactory }, { token: i2.DaffCollectionMetadataFactory }],
815
+ target: i0.ɵɵFactoryTarget.Injectable
816
+ });
817
+ }
818
+ static {
819
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
820
+ minVersion: "12.0.0",
821
+ version: "22.2.4",
822
+ ngImport: i0,
823
+ type: DaffOrderCollectionFactory,
824
+ providedIn: "root"
825
+ });
826
+ }
827
+ };
828
+ i0.ɵɵngDeclareClassMetadata({
829
+ minVersion: "12.0.0",
830
+ version: "22.2.4",
831
+ ngImport: i0,
832
+ type: DaffOrderCollectionFactory,
833
+ decorators: [{
834
+ type: Injectable,
835
+ args: [{ providedIn: "root" }]
836
+ }],
837
+ ctorParameters: () => [{ type: DaffOrderFactory }, { type: i2.DaffCollectionMetadataFactory }]
838
+ });
458
839
  function isOrder(order) {
459
- return !!order.id
460
- && !!order.customer_id
461
- && !!order.created_at
462
- && !!order.updated_at
463
- && !!order.status
464
- && !!order.applied_codes
465
- && !!order.totals;
840
+ return !!order.id && !!order.customer_id && !!order.created_at && !!order.updated_at && !!order.status && !!order.applied_codes && !!order.totals;
466
841
  }
467
-
468
- /**
469
- * Generated bundle index. Do not edit.
470
- */
471
-
472
842
  export { DaffCompositeOrderItemFactory, DaffConfigurableOrderItemFactory, DaffOrderAddressFactory, DaffOrderCollectionFactory, DaffOrderCouponFactory, DaffOrderFactory, DaffOrderInvoiceFactory, DaffOrderItemFactory, DaffOrderPaymentFactory, DaffOrderShipmentFactory, DaffOrderShipmentItemFactory, DaffOrderShipmentTrackingFactory, DaffOrderShippingMethodFactory, DaffOrderTotalFactory, MockCompositeOrderItem, MockConfigurableOrderItem, MockOrder, MockOrderAddress, MockOrderCollection, MockOrderCoupon, MockOrderInvoice, MockOrderItem, MockOrderPayment, MockOrderShipment, MockOrderShipmentItem, MockOrderShipmentTracking, MockOrderShippingMethod, MockOrderTotal, isOrder };
473
- //# sourceMappingURL=daffodil-order-testing.mjs.map
843
+
844
+ //# sourceMappingURL=daffodil-order-testing.mjs.map