@pmcretail/mapper-library 0.0.1 → 0.0.2

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 (50) hide show
  1. package/README.md +2 -2
  2. package/bundles/pmcretail-mapper-library.umd.js +6133 -0
  3. package/bundles/pmcretail-mapper-library.umd.js.map +1 -0
  4. package/bundles/pmcretail-mapper-library.umd.min.js +16 -0
  5. package/bundles/pmcretail-mapper-library.umd.min.js.map +1 -0
  6. package/esm2015/lib/RJ-mapper.class.js +1061 -0
  7. package/esm2015/lib/TransactionDocumentBuilder.js +1535 -0
  8. package/esm2015/lib/basket.service.js +851 -0
  9. package/esm2015/lib/mapper-library.component.js +27 -0
  10. package/esm2015/lib/mapper-library.model.js +974 -0
  11. package/esm2015/lib/mapper-library.module.js +21 -0
  12. package/esm2015/lib/number-util.service.js +77 -0
  13. package/esm2015/pmcretail-mapper-library.js +10 -0
  14. package/esm2015/public-api.js +12 -0
  15. package/esm5/lib/RJ-mapper.class.js +1262 -0
  16. package/esm5/lib/TransactionDocumentBuilder.js +2469 -0
  17. package/esm5/lib/basket.service.js +1076 -0
  18. package/esm5/lib/mapper-library.component.js +29 -0
  19. package/esm5/lib/mapper-library.model.js +974 -0
  20. package/esm5/lib/mapper-library.module.js +25 -0
  21. package/esm5/lib/number-util.service.js +94 -0
  22. package/esm5/pmcretail-mapper-library.js +10 -0
  23. package/esm5/public-api.js +12 -0
  24. package/{fesm2020/pmcretail-mapper-library.mjs → fesm2015/pmcretail-mapper-library.js} +2627 -602
  25. package/fesm2015/pmcretail-mapper-library.js.map +1 -0
  26. package/fesm5/pmcretail-mapper-library.js +5919 -0
  27. package/fesm5/pmcretail-mapper-library.js.map +1 -0
  28. package/lib/TransactionDocumentBuilder.d.ts +1 -1
  29. package/lib/basket.service.d.ts +1 -5
  30. package/lib/mapper-library.component.d.ts +0 -3
  31. package/lib/mapper-library.module.d.ts +0 -5
  32. package/lib/number-util.service.d.ts +2 -4
  33. package/package.json +16 -26
  34. package/pmcretail-mapper-library.d.ts +1 -1
  35. package/pmcretail-mapper-library.metadata.json +1 -0
  36. package/public-api.d.ts +0 -1
  37. package/esm2020/lib/RJ-mapper.class.mjs +0 -597
  38. package/esm2020/lib/TransactionDocumentBuilder.mjs +0 -1240
  39. package/esm2020/lib/basket.service.mjs +0 -527
  40. package/esm2020/lib/mapper-library.component.mjs +0 -26
  41. package/esm2020/lib/mapper-library.model.mjs +0 -20
  42. package/esm2020/lib/mapper-library.module.mjs +0 -21
  43. package/esm2020/lib/mapper-library.service.mjs +0 -56
  44. package/esm2020/lib/number-util.service.mjs +0 -41
  45. package/esm2020/pmcretail-mapper-library.mjs +0 -5
  46. package/esm2020/public-api.mjs +0 -8
  47. package/fesm2015/pmcretail-mapper-library.mjs +0 -2526
  48. package/fesm2015/pmcretail-mapper-library.mjs.map +0 -1
  49. package/fesm2020/pmcretail-mapper-library.mjs.map +0 -1
  50. package/lib/mapper-library.service.d.ts +0 -9
@@ -1,68 +1,1032 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, Inject, Component, NgModule } from '@angular/core';
3
- import * as JsonToXML from 'js2xmlparser';
1
+ import { Component, NgModule, Injectable, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
4
2
  import { BehaviorSubject } from 'rxjs';
3
+ import { CurrencyPipe } from '@angular/common';
5
4
 
6
- var TRANSACTION_TYPE;
7
- (function (TRANSACTION_TYPE) {
8
- TRANSACTION_TYPE["SALE"] = "SALE";
9
- TRANSACTION_TYPE["REFUND"] = "REFUND";
10
- TRANSACTION_TYPE["SALE_REFUND"] = "SALE_REFUND";
11
- TRANSACTION_TYPE["SALE_EXCHANGE"] = "SALE_EXCHANGE";
12
- TRANSACTION_TYPE["VOID"] = "VOID";
13
- })(TRANSACTION_TYPE || (TRANSACTION_TYPE = {}));
14
- var DELIVERY_METHODS;
15
- (function (DELIVERY_METHODS) {
16
- DELIVERY_METHODS[DELIVERY_METHODS["DELIVERY"] = 1] = "DELIVERY";
17
- DELIVERY_METHODS[DELIVERY_METHODS["DROP_SHIP"] = 2] = "DROP_SHIP";
18
- DELIVERY_METHODS[DELIVERY_METHODS["COLLECT_FROM_STORE"] = 3] = "COLLECT_FROM_STORE";
19
- })(DELIVERY_METHODS || (DELIVERY_METHODS = {}));
20
- var DISCOUNTTYPE;
21
- (function (DISCOUNTTYPE) {
22
- DISCOUNTTYPE["PERCENT"] = "Percent";
23
- DISCOUNTTYPE["AMOUNT"] = "AMOUNT";
24
- })(DISCOUNTTYPE || (DISCOUNTTYPE = {}));
25
-
26
- class NumberUtilService {
27
- constructor(cp) {
28
- this.cp = cp;
29
- }
30
- trimTo2Decimal(no) {
31
- //return Math.floor(no * 100) / 100;
32
- return no;
33
- }
34
- trimTo2Decimal2(no) {
35
- return Number(this.getFlooredFixed(no, 2));
36
- }
37
- getFlooredFixed(v, d) {
38
- return (Math.floor(v * Math.pow(10, d)) / Math.pow(10, d)).toFixed(d);
39
- }
40
- AppendWithCurrencySymbol(numValue, currencyCode) {
41
- let returnValue = "";
42
- if (numValue) {
43
- const numb = parseFloat(numValue.toString().replace(',', ''));
44
- returnValue = this.cp.transform(Number(numValue).toFixed(2), currencyCode.toLocaleUpperCase(), "symbol");
45
- console.log("AppendWithCurrencySymbol :" + returnValue);
46
- }
47
- else {
48
- returnValue = this.cp.transform("0.00", currencyCode.toLocaleUpperCase(), "symbol");
49
- }
50
- return returnValue;
5
+ /**
6
+ * @fileoverview added by tsickle
7
+ * Generated from: lib/mapper-library.component.ts
8
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
9
+ */
10
+ class MapperLibraryComponent {
11
+ constructor() { }
12
+ /**
13
+ * @return {?}
14
+ */
15
+ ngOnInit() {
51
16
  }
52
17
  }
53
- NumberUtilService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NumberUtilService, deps: [{ token: null }], target: i0.ɵɵFactoryTarget.Injectable });
54
- NumberUtilService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NumberUtilService, providedIn: "root" });
55
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NumberUtilService, decorators: [{
56
- type: Injectable,
57
- args: [{
58
- providedIn: "root",
59
- }]
60
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
61
- type: Inject,
62
- args: [null]
63
- }] }]; } });
18
+ MapperLibraryComponent.decorators = [
19
+ { type: Component, args: [{
20
+ selector: 'lib-mapper-library',
21
+ template: `
22
+ <p>
23
+ mapper-library works!
24
+ </p>
25
+ `
26
+ }] }
27
+ ];
28
+ /** @nocollapse */
29
+ MapperLibraryComponent.ctorParameters = () => [];
30
+
31
+ /**
32
+ * @fileoverview added by tsickle
33
+ * Generated from: lib/mapper-library.module.ts
34
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
35
+ */
36
+ class MapperLibraryModule {
37
+ }
38
+ MapperLibraryModule.decorators = [
39
+ { type: NgModule, args: [{
40
+ declarations: [
41
+ MapperLibraryComponent
42
+ ],
43
+ imports: [],
44
+ exports: [
45
+ MapperLibraryComponent
46
+ ]
47
+ },] }
48
+ ];
64
49
 
50
+ /**
51
+ * @fileoverview added by tsickle
52
+ * Generated from: lib/mapper-library.model.ts
53
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
54
+ */
55
+ /** @enum {string} */
56
+ const TRANSACTION_TYPE = {
57
+ SALE: "SALE",
58
+ REFUND: "REFUND",
59
+ SALE_REFUND: "SALE_REFUND",
60
+ SALE_EXCHANGE: "SALE_EXCHANGE",
61
+ VOID: "VOID",
62
+ };
63
+ /**
64
+ * @record
65
+ */
66
+ function ItemDiscount() { }
67
+ if (false) {
68
+ /** @type {?} */
69
+ ItemDiscount.prototype.trnDiscountsPortion;
70
+ /** @type {?} */
71
+ ItemDiscount.prototype.trnPromotionsPortion;
72
+ /** @type {?} */
73
+ ItemDiscount.prototype.refundPortion;
74
+ /** @type {?|undefined} */
75
+ ItemDiscount.prototype.currentRefundPortion;
76
+ }
77
+ /** @enum {number} */
78
+ const DELIVERY_METHODS = {
79
+ DELIVERY: 1,
80
+ DROP_SHIP: 2,
81
+ COLLECT_FROM_STORE: 3,
82
+ };
83
+ DELIVERY_METHODS[DELIVERY_METHODS.DELIVERY] = 'DELIVERY';
84
+ DELIVERY_METHODS[DELIVERY_METHODS.DROP_SHIP] = 'DROP_SHIP';
85
+ DELIVERY_METHODS[DELIVERY_METHODS.COLLECT_FROM_STORE] = 'COLLECT_FROM_STORE';
86
+ /**
87
+ * @record
88
+ */
89
+ function ProductChange() { }
90
+ if (false) {
91
+ /** @type {?|undefined} */
92
+ ProductChange.prototype.itemLineId;
93
+ /** @type {?} */
94
+ ProductChange.prototype.SKU;
95
+ /** @type {?} */
96
+ ProductChange.prototype.quantity;
97
+ /** @type {?|undefined} */
98
+ ProductChange.prototype.selectedPrice;
99
+ /** @type {?|undefined} */
100
+ ProductChange.prototype.lineDiscount;
101
+ /** @type {?|undefined} */
102
+ ProductChange.prototype.linePromotions;
103
+ /** @type {?|undefined} */
104
+ ProductChange.prototype.exchange;
105
+ /** @type {?|undefined} */
106
+ ProductChange.prototype.refundedQuantity;
107
+ /** @type {?|undefined} */
108
+ ProductChange.prototype.refundPromotionalQuantity;
109
+ /** @type {?|undefined} */
110
+ ProductChange.prototype.refunded;
111
+ /** @type {?|undefined} */
112
+ ProductChange.prototype.refundedTotal;
113
+ /** @type {?|undefined} */
114
+ ProductChange.prototype.refundedReason;
115
+ /** @type {?|undefined} */
116
+ ProductChange.prototype.refundedReasonDescription;
117
+ /** @type {?|undefined} */
118
+ ProductChange.prototype.isChecked;
119
+ /** @type {?|undefined} */
120
+ ProductChange.prototype.sealed;
121
+ /** @type {?|undefined} */
122
+ ProductChange.prototype.isLastExchanged;
123
+ }
124
+ /**
125
+ * Product
126
+ * @record
127
+ */
128
+ function Product() { }
129
+ if (false) {
130
+ /** @type {?|undefined} */
131
+ Product.prototype.itemLineId;
132
+ /** @type {?} */
133
+ Product.prototype.status;
134
+ /** @type {?} */
135
+ Product.prototype.subGroup;
136
+ /** @type {?} */
137
+ Product.prototype.brand;
138
+ /** @type {?} */
139
+ Product.prototype.currency;
140
+ /** @type {?} */
141
+ Product.prototype.category;
142
+ /** @type {?} */
143
+ Product.prototype.countryofOrigin;
144
+ /** @type {?} */
145
+ Product.prototype.productId;
146
+ /** @type {?} */
147
+ Product.prototype.productType;
148
+ /** @type {?|undefined} */
149
+ Product.prototype.name;
150
+ /** @type {?} */
151
+ Product.prototype.imageUrls;
152
+ /** @type {?|undefined} */
153
+ Product.prototype.isImageFailToLoad;
154
+ /** @type {?} */
155
+ Product.prototype.size;
156
+ /** @type {?} */
157
+ Product.prototype.type;
158
+ /** @type {?} */
159
+ Product.prototype.season;
160
+ /** @type {?} */
161
+ Product.prototype.productGroup;
162
+ /** @type {?} */
163
+ Product.prototype.styleCode;
164
+ /** @type {?} */
165
+ Product.prototype.nodeStructure;
166
+ /** @type {?} */
167
+ Product.prototype.barcode;
168
+ /** @type {?} */
169
+ Product.prototype.price;
170
+ /** @type {?} */
171
+ Product.prototype.colour;
172
+ /** @type {?} */
173
+ Product.prototype.description;
174
+ /** @type {?} */
175
+ Product.prototype.totalLinePrice;
176
+ /** @type {?} */
177
+ Product.prototype.total;
178
+ /** @type {?|undefined} */
179
+ Product.prototype.addedInBasket;
180
+ /** @type {?|undefined} */
181
+ Product.prototype.selectedVAT;
182
+ /** @type {?|undefined} */
183
+ Product.prototype.selectedVATCode;
184
+ /** @type {?|undefined} */
185
+ Product.prototype.selectedRRPPrice;
186
+ /** @type {?|undefined} */
187
+ Product.prototype.lineDiscount;
188
+ /** @type {?|undefined} */
189
+ Product.prototype.exchange;
190
+ /** @type {?|undefined} */
191
+ Product.prototype.refundPromotionalQuantity;
192
+ /** @type {?|undefined} */
193
+ Product.prototype.exchangeReason;
194
+ /** @type {?|undefined} */
195
+ Product.prototype.exchangeQuantity;
196
+ /** @type {?} */
197
+ Product.prototype.itemDiscounts;
198
+ /** @type {?|undefined} */
199
+ Product.prototype.giftCardNumberIssued;
200
+ /** @type {?|undefined} */
201
+ Product.prototype.giftCardAmount;
202
+ /** @type {?|undefined} */
203
+ Product.prototype.giftCardRecipientEmail;
204
+ /** @type {?|undefined} */
205
+ Product.prototype.giftCardExpiryDate;
206
+ /** @type {?|undefined} */
207
+ Product.prototype.giftCardRecipientName;
208
+ /** @type {?|undefined} */
209
+ Product.prototype.giftCard;
210
+ /** @type {?} */
211
+ Product.prototype.discountable;
212
+ /** @type {?} */
213
+ Product.prototype.excludePromotion;
214
+ /** @type {?} */
215
+ Product.prototype.categories;
216
+ /** @type {?} */
217
+ Product.prototype.descriptions;
218
+ /** @type {?} */
219
+ Product.prototype.barcodes;
220
+ /** @type {?} */
221
+ Product.prototype.externalId;
222
+ /** @type {?} */
223
+ Product.prototype.createdDate;
224
+ /** @type {?} */
225
+ Product.prototype.updatedDate;
226
+ /** @type {?} */
227
+ Product.prototype.createdBy;
228
+ /** @type {?} */
229
+ Product.prototype.updatedBy;
230
+ /** @type {?} */
231
+ Product.prototype.attributes;
232
+ /** @type {?} */
233
+ Product.prototype.id;
234
+ /** @type {?} */
235
+ Product.prototype.long_description;
236
+ /** @type {?|undefined} */
237
+ Product.prototype.isWebOrder;
238
+ /** @type {?} */
239
+ Product.prototype.fullfilmentId;
240
+ /** @type {?|undefined} */
241
+ Product.prototype.fullfilmentLocationName;
242
+ /** @type {?|undefined} */
243
+ Product.prototype.deliveryMethod;
244
+ /** @type {?|undefined} */
245
+ Product.prototype.deliveryGroup;
246
+ /** @type {?|undefined} */
247
+ Product.prototype.selectedInventory;
248
+ /** @type {?|undefined} */
249
+ Product.prototype.leadTime;
250
+ }
251
+ /**
252
+ * @record
253
+ */
254
+ function leadTime() { }
255
+ if (false) {
256
+ /** @type {?} */
257
+ leadTime.prototype.type;
258
+ /** @type {?} */
259
+ leadTime.prototype.value;
260
+ }
261
+ /**
262
+ * @record
263
+ */
264
+ function Exchange() { }
265
+ if (false) {
266
+ /** @type {?} */
267
+ Exchange.prototype.exchangeId;
268
+ /** @type {?} */
269
+ Exchange.prototype.lineItemId;
270
+ /** @type {?} */
271
+ Exchange.prototype.reason;
272
+ /** @type {?} */
273
+ Exchange.prototype.quantity;
274
+ /** @type {?} */
275
+ Exchange.prototype.newItems;
276
+ }
277
+ /**
278
+ * @record
279
+ */
280
+ function Categories() { }
281
+ if (false) {
282
+ /** @type {?} */
283
+ Categories.prototype.id;
284
+ /** @type {?} */
285
+ Categories.prototype.parentId;
286
+ /** @type {?} */
287
+ Categories.prototype.name;
288
+ /** @type {?} */
289
+ Categories.prototype.categoryId;
290
+ /** @type {?} */
291
+ Categories.prototype.status;
292
+ }
293
+ /**
294
+ * @record
295
+ */
296
+ function Descriptions() { }
297
+ if (false) {
298
+ /** @type {?} */
299
+ Descriptions.prototype.name;
300
+ /** @type {?} */
301
+ Descriptions.prototype.countryCode;
302
+ /** @type {?} */
303
+ Descriptions.prototype.value;
304
+ }
305
+ /**
306
+ * @record
307
+ */
308
+ function CoreAttribute() { }
309
+ if (false) {
310
+ /** @type {?} */
311
+ CoreAttribute.prototype.name;
312
+ /** @type {?} */
313
+ CoreAttribute.prototype.value;
314
+ /** @type {?} */
315
+ CoreAttribute.prototype.searchable;
316
+ /** @type {?} */
317
+ CoreAttribute.prototype.countryCode;
318
+ }
319
+ /**
320
+ * Basket
321
+ * @record
322
+ */
323
+ function Basket() { }
324
+ if (false) {
325
+ /** @type {?|undefined} */
326
+ Basket.prototype.subsidiaryId;
327
+ /** @type {?} */
328
+ Basket.prototype.products;
329
+ /** @type {?} */
330
+ Basket.prototype.transactionDiscount;
331
+ /** @type {?} */
332
+ Basket.prototype.quantity;
333
+ /** @type {?} */
334
+ Basket.prototype.total;
335
+ /** @type {?} */
336
+ Basket.prototype.saleTotal;
337
+ /** @type {?|undefined} */
338
+ Basket.prototype.discountTotal;
339
+ /** @type {?|undefined} */
340
+ Basket.prototype.transactionId;
341
+ /** @type {?|undefined} */
342
+ Basket.prototype.offlineTransactionId;
343
+ /** @type {?} */
344
+ Basket.prototype.baseCurrency;
345
+ /** @type {?|undefined} */
346
+ Basket.prototype.basketTotal;
347
+ /** @type {?|undefined} */
348
+ Basket.prototype.refundTotal;
349
+ /** @type {?|undefined} */
350
+ Basket.prototype.transactionPromotion;
351
+ /** @type {?|undefined} */
352
+ Basket.prototype.customer;
353
+ /** @type {?|undefined} */
354
+ Basket.prototype.exchange;
355
+ /** @type {?|undefined} */
356
+ Basket.prototype.inStoreFlag;
357
+ }
358
+ /**
359
+ * Price
360
+ * @record
361
+ */
362
+ function Price() { }
363
+ if (false) {
364
+ /** @type {?} */
365
+ Price.prototype.VAT;
366
+ /** @type {?} */
367
+ Price.prototype.VATCode;
368
+ /** @type {?} */
369
+ Price.prototype.salesPrice;
370
+ /** @type {?} */
371
+ Price.prototype.currencyCode;
372
+ /** @type {?} */
373
+ Price.prototype.RRPPrice;
374
+ }
375
+ /**
376
+ * Node structure
377
+ * @record
378
+ */
379
+ function NodeStructure() { }
380
+ if (false) {
381
+ /** @type {?} */
382
+ NodeStructure.prototype.status;
383
+ /** @type {?} */
384
+ NodeStructure.prototype.name;
385
+ /** @type {?} */
386
+ NodeStructure.prototype.nodeType;
387
+ /** @type {?} */
388
+ NodeStructure.prototype.isOverride;
389
+ /** @type {?} */
390
+ NodeStructure.prototype.nodeId;
391
+ /** @type {?} */
392
+ NodeStructure.prototype.parentId;
393
+ }
394
+ /**
395
+ * Line Discount
396
+ * @record
397
+ */
398
+ function LineDiscount() { }
399
+ if (false) {
400
+ /** @type {?} */
401
+ LineDiscount.prototype.itemLineId;
402
+ /** @type {?} */
403
+ LineDiscount.prototype.discountAmount;
404
+ /** @type {?} */
405
+ LineDiscount.prototype.discountType;
406
+ /** @type {?|undefined} */
407
+ LineDiscount.prototype.name;
408
+ /** @type {?} */
409
+ LineDiscount.prototype.unitPrice;
410
+ /** @type {?|undefined} */
411
+ LineDiscount.prototype.discountedLinePrice;
412
+ /** @type {?|undefined} */
413
+ LineDiscount.prototype.priceManagerOverride;
414
+ /** @type {?|undefined} */
415
+ LineDiscount.prototype.priceOverrideReasonCode;
416
+ /** @type {?|undefined} */
417
+ LineDiscount.prototype.priceOverrideReasonName;
418
+ /** @type {?|undefined} */
419
+ LineDiscount.prototype.priceOverrideAmount;
420
+ /** @type {?|undefined} */
421
+ LineDiscount.prototype.percentageDiscountManagerOverride;
422
+ /** @type {?|undefined} */
423
+ LineDiscount.prototype.percentageDiscountReasonCode;
424
+ /** @type {?|undefined} */
425
+ LineDiscount.prototype.percentageDiscountReasonName;
426
+ /** @type {?|undefined} */
427
+ LineDiscount.prototype.percentageDiscountValue;
428
+ }
429
+ /**
430
+ * User Override
431
+ * @record
432
+ */
433
+ function UserOverride() { }
434
+ if (false) {
435
+ /** @type {?} */
436
+ UserOverride.prototype.userId;
437
+ /** @type {?} */
438
+ UserOverride.prototype.automaticApprove;
439
+ /** @type {?} */
440
+ UserOverride.prototype.originalUserId;
441
+ }
442
+ /**
443
+ * line Promotions
444
+ * @record
445
+ */
446
+ function LinePromotions() { }
447
+ if (false) {
448
+ /** @type {?} */
449
+ LinePromotions.prototype.trigger;
450
+ /** @type {?} */
451
+ LinePromotions.prototype.itemLineId;
452
+ /** @type {?} */
453
+ LinePromotions.prototype.promotionId;
454
+ /** @type {?} */
455
+ LinePromotions.prototype.displayText;
456
+ /** @type {?} */
457
+ LinePromotions.prototype.promotionType;
458
+ /** @type {?} */
459
+ LinePromotions.prototype.promotionAmount;
460
+ /** @type {?} */
461
+ LinePromotions.prototype.name;
462
+ /** @type {?} */
463
+ LinePromotions.prototype.promotionInfo;
464
+ /** @type {?} */
465
+ LinePromotions.prototype.promotionLinePrice;
466
+ /** @type {?|undefined} */
467
+ LinePromotions.prototype.refunded;
468
+ }
469
+ /**
470
+ * trigger
471
+ * @record
472
+ */
473
+ function Trigger() { }
474
+ if (false) {
475
+ /** @type {?} */
476
+ Trigger.prototype.itemLineId;
477
+ /** @type {?|undefined} */
478
+ Trigger.prototype.quantity;
479
+ /** @type {?|undefined} */
480
+ Trigger.prototype.totalQuantity;
481
+ }
482
+ /**
483
+ * Transaction Promotion
484
+ * @record
485
+ */
486
+ function TransactionPromotion() { }
487
+ if (false) {
488
+ /** @type {?} */
489
+ TransactionPromotion.prototype.displayText;
490
+ /** @type {?} */
491
+ TransactionPromotion.prototype.name;
492
+ /** @type {?} */
493
+ TransactionPromotion.prototype.promotionAmount;
494
+ /** @type {?} */
495
+ TransactionPromotion.prototype.promotionId;
496
+ /** @type {?} */
497
+ TransactionPromotion.prototype.promotionInfo;
498
+ /** @type {?} */
499
+ TransactionPromotion.prototype.promotionType;
500
+ /** @type {?} */
501
+ TransactionPromotion.prototype.itemLineIds;
502
+ }
503
+ /**
504
+ * @record
505
+ */
506
+ function RefundProductChange() { }
507
+ if (false) {
508
+ /** @type {?|undefined} */
509
+ RefundProductChange.prototype.itemLineId;
510
+ /** @type {?|undefined} */
511
+ RefundProductChange.prototype.refundedQuantity;
512
+ /** @type {?|undefined} */
513
+ RefundProductChange.prototype.refundedPromotionalQuantity;
514
+ /** @type {?|undefined} */
515
+ RefundProductChange.prototype.refundTotal;
516
+ /** @type {?|undefined} */
517
+ RefundProductChange.prototype.refundedReason;
518
+ /** @type {?|undefined} */
519
+ RefundProductChange.prototype.refundedReasonDescription;
520
+ /** @type {?} */
521
+ RefundProductChange.prototype.refundWithPromotion;
522
+ /** @type {?|undefined} */
523
+ RefundProductChange.prototype.isLastExchanged;
524
+ }
525
+ /**
526
+ * @record
527
+ */
528
+ function InventoryInfo() { }
529
+ if (false) {
530
+ /** @type {?} */
531
+ InventoryInfo.prototype.storeName;
532
+ /** @type {?} */
533
+ InventoryInfo.prototype.storeId;
534
+ /** @type {?} */
535
+ InventoryInfo.prototype.quantityAvailable;
536
+ /** @type {?} */
537
+ InventoryInfo.prototype.quantityRequired;
538
+ }
539
+ /**
540
+ * @record
541
+ */
542
+ function InventoryRequestInfo() { }
543
+ if (false) {
544
+ /** @type {?} */
545
+ InventoryRequestInfo.prototype.requestedQuantity;
546
+ /** @type {?} */
547
+ InventoryRequestInfo.prototype.requestedAction;
548
+ }
549
+ /**
550
+ * @record
551
+ */
552
+ function DeliveryInfo() { }
553
+ if (false) {
554
+ /** @type {?} */
555
+ DeliveryInfo.prototype.groups;
556
+ }
557
+ /**
558
+ * @record
559
+ */
560
+ function DeliveryGroupInfo() { }
561
+ if (false) {
562
+ /** @type {?} */
563
+ DeliveryGroupInfo.prototype.groupNumber;
564
+ /** @type {?} */
565
+ DeliveryGroupInfo.prototype.items;
566
+ /** @type {?|undefined} */
567
+ DeliveryGroupInfo.prototype.estimate;
568
+ }
569
+ /**
570
+ * @record
571
+ */
572
+ function Estimate() { }
573
+ if (false) {
574
+ /** @type {?} */
575
+ Estimate.prototype.type;
576
+ /** @type {?} */
577
+ Estimate.prototype.value;
578
+ }
579
+ /**
580
+ * @record
581
+ */
582
+ function TransactionDocument() { }
583
+ if (false) {
584
+ /** @type {?|undefined} */
585
+ TransactionDocument.prototype.transactionId;
586
+ /** @type {?|undefined} */
587
+ TransactionDocument.prototype.subsidiaryId;
588
+ /** @type {?|undefined} */
589
+ TransactionDocument.prototype.offlineTransactionId;
590
+ /** @type {?|undefined} */
591
+ TransactionDocument.prototype.transactionRef;
592
+ /** @type {?|undefined} */
593
+ TransactionDocument.prototype.dateTime;
594
+ /** @type {?} */
595
+ TransactionDocument.prototype.orgCode;
596
+ /** @type {?} */
597
+ TransactionDocument.prototype.storeId;
598
+ /** @type {?} */
599
+ TransactionDocument.prototype.storeNodeId;
600
+ /** @type {?} */
601
+ TransactionDocument.prototype.storeNodeStructure;
602
+ /** @type {?} */
603
+ TransactionDocument.prototype.deviceId;
604
+ /** @type {?} */
605
+ TransactionDocument.prototype.terminalId;
606
+ /** @type {?} */
607
+ TransactionDocument.prototype.initiatingModule;
608
+ /** @type {?} */
609
+ TransactionDocument.prototype.export;
610
+ /** @type {?|undefined} */
611
+ TransactionDocument.prototype.userId;
612
+ /** @type {?|undefined} */
613
+ TransactionDocument.prototype.userName;
614
+ /** @type {?|undefined} */
615
+ TransactionDocument.prototype.customer;
616
+ /** @type {?} */
617
+ TransactionDocument.prototype.basket;
618
+ /** @type {?} */
619
+ TransactionDocument.prototype.basketSummary;
620
+ /** @type {?} */
621
+ TransactionDocument.prototype.baseCurrency;
622
+ /** @type {?|undefined} */
623
+ TransactionDocument.prototype.splitPayment;
624
+ /** @type {?|undefined} */
625
+ TransactionDocument.prototype.isPaymentCompleted;
626
+ /** @type {?|undefined} */
627
+ TransactionDocument.prototype.paymentDetails;
628
+ /** @type {?|undefined} */
629
+ TransactionDocument.prototype.type;
630
+ /** @type {?|undefined} */
631
+ TransactionDocument.prototype.operationStatus;
632
+ /** @type {?|undefined} */
633
+ TransactionDocument.prototype.createdAt;
634
+ /** @type {?|undefined} */
635
+ TransactionDocument.prototype.updatedAt;
636
+ /** @type {?|undefined} */
637
+ TransactionDocument.prototype.transCompletedAt;
638
+ /** @type {?|undefined} */
639
+ TransactionDocument.prototype.id;
640
+ /** @type {?|undefined} */
641
+ TransactionDocument.prototype.saleTotal;
642
+ /** @type {?|undefined} */
643
+ TransactionDocument.prototype.reasonCode;
644
+ /** @type {?|undefined} */
645
+ TransactionDocument.prototype.reasonDescription;
646
+ /** @type {?|undefined} */
647
+ TransactionDocument.prototype.override;
648
+ /** @type {?|undefined} */
649
+ TransactionDocument.prototype.originalTransId;
650
+ /** @type {?|undefined} */
651
+ TransactionDocument.prototype.originalExternalId;
652
+ /** @type {?|undefined} */
653
+ TransactionDocument.prototype.apiResponse;
654
+ /** @type {?|undefined} */
655
+ TransactionDocument.prototype.unreferencedRefund;
656
+ /** @type {?|undefined} */
657
+ TransactionDocument.prototype.giftedReceipt;
658
+ /** @type {?|undefined} */
659
+ TransactionDocument.prototype.currentTransactionDetails;
660
+ /** @type {?|undefined} */
661
+ TransactionDocument.prototype.isChecked;
662
+ }
663
+ /**
664
+ * @record
665
+ */
666
+ function APIResponse() { }
667
+ if (false) {
668
+ /** @type {?|undefined} */
669
+ APIResponse.prototype.internalId;
670
+ /** @type {?|undefined} */
671
+ APIResponse.prototype.tranid;
672
+ }
673
+ /**
674
+ * @record
675
+ */
676
+ function CurrentTransactionDetails() { }
677
+ if (false) {
678
+ /** @type {?} */
679
+ CurrentTransactionDetails.prototype.products;
680
+ /** @type {?|undefined} */
681
+ CurrentTransactionDetails.prototype.lineDiscount;
682
+ /** @type {?|undefined} */
683
+ CurrentTransactionDetails.prototype.linePromotion;
684
+ /** @type {?|undefined} */
685
+ CurrentTransactionDetails.prototype.transactionPromotion;
686
+ /** @type {?|undefined} */
687
+ CurrentTransactionDetails.prototype.transactionDiscount;
688
+ /** @type {?|undefined} */
689
+ CurrentTransactionDetails.prototype.basketSummary;
690
+ /** @type {?|undefined} */
691
+ CurrentTransactionDetails.prototype.taxBreakdown;
692
+ /** @type {?|undefined} */
693
+ CurrentTransactionDetails.prototype.totalTaxSummary;
694
+ }
695
+ /**
696
+ * @record
697
+ */
698
+ function BasketSummary() { }
699
+ if (false) {
700
+ /** @type {?} */
701
+ BasketSummary.prototype.totalItems;
702
+ /** @type {?} */
703
+ BasketSummary.prototype.saleTotal;
704
+ /** @type {?} */
705
+ BasketSummary.prototype.VATTotal;
706
+ /** @type {?} */
707
+ BasketSummary.prototype.discountTotal;
708
+ /** @type {?} */
709
+ BasketSummary.prototype.basketTotal;
710
+ /** @type {?|undefined} */
711
+ BasketSummary.prototype.refundTotal;
712
+ }
713
+ /**
714
+ * @record
715
+ */
716
+ function TransactionDiscount() { }
717
+ if (false) {
718
+ /** @type {?} */
719
+ TransactionDiscount.prototype.discountAmount;
720
+ /** @type {?} */
721
+ TransactionDiscount.prototype.discountType;
722
+ /** @type {?} */
723
+ TransactionDiscount.prototype.reasonCode;
724
+ /** @type {?|undefined} */
725
+ TransactionDiscount.prototype.override;
726
+ /** @type {?|undefined} */
727
+ TransactionDiscount.prototype.itemLineIds;
728
+ }
729
+ /**
730
+ * @record
731
+ */
732
+ function TBasket() { }
733
+ if (false) {
734
+ /** @type {?} */
735
+ TBasket.prototype.products;
736
+ /** @type {?} */
737
+ TBasket.prototype.lineDiscount;
738
+ /** @type {?} */
739
+ TBasket.prototype.exchange;
740
+ /** @type {?} */
741
+ TBasket.prototype.linePromotion;
742
+ /** @type {?|undefined} */
743
+ TBasket.prototype.transactionPromotion;
744
+ /** @type {?|undefined} */
745
+ TBasket.prototype.transactionDiscount;
746
+ /** @type {?|undefined} */
747
+ TBasket.prototype.taxBreakdown;
748
+ /** @type {?|undefined} */
749
+ TBasket.prototype.totalTaxSummary;
750
+ }
751
+ /**
752
+ * @record
753
+ */
754
+ function TExchange() { }
755
+ if (false) {
756
+ /** @type {?|undefined} */
757
+ TExchange.prototype.exchangeId;
758
+ /** @type {?|undefined} */
759
+ TExchange.prototype.lineItemId;
760
+ /** @type {?|undefined} */
761
+ TExchange.prototype.reason;
762
+ /** @type {?|undefined} */
763
+ TExchange.prototype.quantity;
764
+ /** @type {?|undefined} */
765
+ TExchange.prototype.newItems;
766
+ }
767
+ /**
768
+ * @record
769
+ */
770
+ function TNewItems() { }
771
+ if (false) {
772
+ /** @type {?} */
773
+ TNewItems.prototype.lineItemId;
774
+ /** @type {?} */
775
+ TNewItems.prototype.Quantity;
776
+ }
777
+ /**
778
+ * @record
779
+ */
780
+ function TProduct() { }
781
+ if (false) {
782
+ /** @type {?} */
783
+ TProduct.prototype.itemLineId;
784
+ /** @type {?} */
785
+ TProduct.prototype.SKU;
786
+ /** @type {?} */
787
+ TProduct.prototype.description;
788
+ /** @type {?} */
789
+ TProduct.prototype.imageUrls;
790
+ /** @type {?} */
791
+ TProduct.prototype.price;
792
+ /** @type {?|undefined} */
793
+ TProduct.prototype.taxCode;
794
+ /** @type {?|undefined} */
795
+ TProduct.prototype.taxPercent;
796
+ /** @type {?} */
797
+ TProduct.prototype.quantity;
798
+ /** @type {?|undefined} */
799
+ TProduct.prototype.refundedQuantity;
800
+ /** @type {?|undefined} */
801
+ TProduct.prototype.refundedPromotionalQuantity;
802
+ /** @type {?|undefined} */
803
+ TProduct.prototype.refunded;
804
+ /** @type {?|undefined} */
805
+ TProduct.prototype.refundedTotal;
806
+ /** @type {?|undefined} */
807
+ TProduct.prototype.refundedReason;
808
+ /** @type {?|undefined} */
809
+ TProduct.prototype.refundedReasonDescription;
810
+ /** @type {?|undefined} */
811
+ TProduct.prototype.selectedRRPPrice;
812
+ /** @type {?} */
813
+ TProduct.prototype.totalLinePrice;
814
+ /** @type {?|undefined} */
815
+ TProduct.prototype.barCode;
816
+ /** @type {?|undefined} */
817
+ TProduct.prototype.barcodes;
818
+ /** @type {?|undefined} */
819
+ TProduct.prototype.flagged;
820
+ /** @type {?|undefined} */
821
+ TProduct.prototype.exchange;
822
+ /** @type {?} */
823
+ TProduct.prototype.excludePromotion;
824
+ /** @type {?|undefined} */
825
+ TProduct.prototype.discountable;
826
+ /** @type {?|undefined} */
827
+ TProduct.prototype.itemDiscounts;
828
+ /** @type {?|undefined} */
829
+ TProduct.prototype.isLastExchanged;
830
+ /** @type {?} */
831
+ TProduct.prototype.fullfilmentId;
832
+ /** @type {?} */
833
+ TProduct.prototype.fullfilmentLocationName;
834
+ /** @type {?|undefined} */
835
+ TProduct.prototype.deliveryMethod;
836
+ /** @type {?|undefined} */
837
+ TProduct.prototype.deliveryGroup;
838
+ /** @type {?|undefined} */
839
+ TProduct.prototype.giftCardNumberIssued;
840
+ /** @type {?|undefined} */
841
+ TProduct.prototype.giftCardAmount;
842
+ /** @type {?|undefined} */
843
+ TProduct.prototype.giftCardRecipientEmail;
844
+ /** @type {?|undefined} */
845
+ TProduct.prototype.giftCardExpiryDate;
846
+ /** @type {?|undefined} */
847
+ TProduct.prototype.giftCardRecipientName;
848
+ /** @type {?|undefined} */
849
+ TProduct.prototype.giftCard;
850
+ /** @type {?|undefined} */
851
+ TProduct.prototype.currency;
852
+ /** @type {?|undefined} */
853
+ TProduct.prototype.isWebOrder;
854
+ /** @type {?|undefined} */
855
+ TProduct.prototype.leadTime;
856
+ /** @type {?|undefined} */
857
+ TProduct.prototype.lineDiscount;
858
+ }
859
+ /**
860
+ * @record
861
+ */
862
+ function ItemDiscounts() { }
863
+ if (false) {
864
+ /** @type {?} */
865
+ ItemDiscounts.prototype.trnDiscountsPortion;
866
+ /** @type {?} */
867
+ ItemDiscounts.prototype.trnPromotionsPortion;
868
+ /** @type {?} */
869
+ ItemDiscounts.prototype.refundPortion;
870
+ }
871
+ /**
872
+ * @record
873
+ */
874
+ function Customer() { }
875
+ if (false) {
876
+ /** @type {?} */
877
+ Customer.prototype.id;
878
+ /** @type {?|undefined} */
879
+ Customer.prototype.title;
880
+ /** @type {?} */
881
+ Customer.prototype.firstName;
882
+ /** @type {?} */
883
+ Customer.prototype.lastName;
884
+ /** @type {?} */
885
+ Customer.prototype.email;
886
+ /** @type {?} */
887
+ Customer.prototype.postCode;
888
+ /** @type {?|undefined} */
889
+ Customer.prototype.telephone;
890
+ /** @type {?|undefined} */
891
+ Customer.prototype.billingAddress;
892
+ /** @type {?|undefined} */
893
+ Customer.prototype.shippingAddress;
894
+ /** @type {?|undefined} */
895
+ Customer.prototype.addressDetail;
896
+ /** @type {?|undefined} */
897
+ Customer.prototype.noCustomerSelected;
898
+ /** @type {?|undefined} */
899
+ Customer.prototype.externalId;
900
+ }
901
+ /**
902
+ * @record
903
+ */
904
+ function Address() { }
905
+ if (false) {
906
+ /** @type {?|undefined} */
907
+ Address.prototype.address1;
908
+ /** @type {?|undefined} */
909
+ Address.prototype.address2;
910
+ /** @type {?|undefined} */
911
+ Address.prototype.address3;
912
+ /** @type {?|undefined} */
913
+ Address.prototype.city;
914
+ /** @type {?|undefined} */
915
+ Address.prototype.county;
916
+ /** @type {?|undefined} */
917
+ Address.prototype.postCode;
918
+ /** @type {?|undefined} */
919
+ Address.prototype.country;
920
+ }
921
+ /**
922
+ * @record
923
+ */
924
+ function PaymentDetails() { }
925
+ if (false) {
926
+ /** @type {?|undefined} */
927
+ PaymentDetails.prototype.cardNumber;
928
+ /** @type {?|undefined} */
929
+ PaymentDetails.prototype.sqNo;
930
+ /** @type {?|undefined} */
931
+ PaymentDetails.prototype.result;
932
+ /** @type {?} */
933
+ PaymentDetails.prototype.currency;
934
+ /** @type {?} */
935
+ PaymentDetails.prototype.amount;
936
+ /** @type {?|undefined} */
937
+ PaymentDetails.prototype.authcode;
938
+ /** @type {?|undefined} */
939
+ PaymentDetails.prototype.pan;
940
+ /** @type {?|undefined} */
941
+ PaymentDetails.prototype.cardType;
942
+ /** @type {?|undefined} */
943
+ PaymentDetails.prototype.transactionDate;
944
+ /** @type {?|undefined} */
945
+ PaymentDetails.prototype.mid;
946
+ /** @type {?|undefined} */
947
+ PaymentDetails.prototype.tid;
948
+ /** @type {?|undefined} */
949
+ PaymentDetails.prototype.cvm;
950
+ /** @type {?|undefined} */
951
+ PaymentDetails.prototype.hostReferenceId;
952
+ /** @type {?|undefined} */
953
+ PaymentDetails.prototype.aid;
954
+ /** @type {?|undefined} */
955
+ PaymentDetails.prototype.receiptNo;
956
+ /** @type {?|undefined} */
957
+ PaymentDetails.prototype.expirydate;
958
+ /** @type {?} */
959
+ PaymentDetails.prototype.transactionReference;
960
+ /** @type {?|undefined} */
961
+ PaymentDetails.prototype.applicationVersion;
962
+ /** @type {?|undefined} */
963
+ PaymentDetails.prototype.entryMethod;
964
+ /** @type {?} */
965
+ PaymentDetails.prototype.transactionType;
966
+ /** @type {?} */
967
+ PaymentDetails.prototype.totalamount;
968
+ /** @type {?|undefined} */
969
+ PaymentDetails.prototype.paymentType;
970
+ }
971
+ /**
972
+ * @record
973
+ */
974
+ function TaxBreakdown() { }
975
+ if (false) {
976
+ /** @type {?} */
977
+ TaxBreakdown.prototype.taxLines;
978
+ /** @type {?} */
979
+ TaxBreakdown.prototype.totalTaxableAmount;
980
+ }
981
+ /**
982
+ * @record
983
+ */
984
+ function TotalTaxSummary() { }
985
+ if (false) {
986
+ /** @type {?} */
987
+ TotalTaxSummary.prototype.VATCode;
988
+ /** @type {?} */
989
+ TotalTaxSummary.prototype.VAT;
990
+ /** @type {?} */
991
+ TotalTaxSummary.prototype.PreTaxSum;
992
+ /** @type {?} */
993
+ TotalTaxSummary.prototype.TaxSum;
994
+ /** @type {?} */
995
+ TotalTaxSummary.prototype.TXrateSum;
996
+ }
997
+ /**
998
+ * @record
999
+ */
1000
+ function TaxLine() { }
1001
+ if (false) {
1002
+ /** @type {?} */
1003
+ TaxLine.prototype.itemLineId;
1004
+ /** @type {?} */
1005
+ TaxLine.prototype.taxableAmount;
1006
+ /** @type {?} */
1007
+ TaxLine.prototype.taxLineTotal;
1008
+ /** @type {?} */
1009
+ TaxLine.prototype.VAT;
1010
+ /** @type {?} */
1011
+ TaxLine.prototype.VATCode;
1012
+ /** @type {?} */
1013
+ TaxLine.prototype.PreTax;
1014
+ }
1015
+ /** @enum {string} */
1016
+ const DISCOUNTTYPE = {
1017
+ PERCENT: "Percent",
1018
+ AMOUNT: "AMOUNT",
1019
+ };
1020
+
1021
+ /**
1022
+ * @fileoverview added by tsickle
1023
+ * Generated from: lib/basket.service.ts
1024
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1025
+ */
65
1026
  class BasketService {
1027
+ /**
1028
+ * @param {?} numberUtilService
1029
+ */
66
1030
  constructor(numberUtilService) {
67
1031
  this.numberUtilService = numberUtilService;
68
1032
  this.currentBasket = {
@@ -82,12 +1046,23 @@ class BasketService {
82
1046
  this.scanSource = new BehaviorSubject(false);
83
1047
  this.scanner = this.scanSource.asObservable();
84
1048
  }
1049
+ /**
1050
+ * @return {?}
1051
+ */
85
1052
  get isMixedBasketSales() {
86
1053
  return this._isMixedBasketSales;
87
1054
  }
1055
+ /**
1056
+ * @param {?} v
1057
+ * @return {?}
1058
+ */
88
1059
  set isMixedBasketSales(v) {
89
1060
  this._isMixedBasketSales = v;
90
1061
  }
1062
+ /**
1063
+ * @param {?} basket
1064
+ * @return {?}
1065
+ */
91
1066
  updateBasket(basket) {
92
1067
  this.currentBasket = basket;
93
1068
  this.isMixedBasketSales = this.filterProductListWithWebOrder(true).length > 0;
@@ -95,8 +1070,9 @@ class BasketService {
95
1070
  }
96
1071
  /**
97
1072
  * calculates the total basket value and quantity
98
- * @param null
99
- * @returns void
1073
+ * @param {?} basketDetails
1074
+ * @param {?} basketState
1075
+ * @return {?} void
100
1076
  */
101
1077
  updateBasketTotal(basketDetails, basketState) {
102
1078
  basketDetails.quantity = 0;
@@ -113,8 +1089,9 @@ class BasketService {
113
1089
  }
114
1090
  /**
115
1091
  * add Line promotion
116
- * @param null
117
- * @returns basketDetails
1092
+ * @param {?} promotionList
1093
+ * @param {?} basketDetails
1094
+ * @return {?} basketDetails
118
1095
  */
119
1096
  addlinePromotion(promotionList, basketDetails) {
120
1097
  console.log("e:basket :basket Service : promotionList and basketDetails for linePromotions", JSON.stringify(promotionList), JSON.stringify(basketDetails));
@@ -135,8 +1112,9 @@ class BasketService {
135
1112
  }
136
1113
  /**
137
1114
  * add Transaction promotion
138
- * @param null
139
- * @returns basketDetails
1115
+ * @param {?} promotionList
1116
+ * @param {?} basketdetails
1117
+ * @return {?} basketDetails
140
1118
  */
141
1119
  addTransactionPromotion(promotionList, basketdetails) {
142
1120
  console.log("e:basket :basket Service : promotionList and basketDetails for transactionPromotion", JSON.stringify(promotionList), JSON.stringify(basketdetails), JSON.stringify(basketdetails.transactionPromotion));
@@ -144,21 +1122,34 @@ class BasketService {
144
1122
  promotionList.result &&
145
1123
  promotionList.result.transactionPromotion &&
146
1124
  promotionList.result.transactionPromotion.length > 0) {
147
- promotionList.result.transactionPromotion.forEach((tPromotion) => {
1125
+ promotionList.result.transactionPromotion.forEach((/**
1126
+ * @param {?} tPromotion
1127
+ * @return {?}
1128
+ */
1129
+ (tPromotion) => {
1130
+ /** @type {?} */
148
1131
  let transactionPromotionEntryUpdated = Object.assign({}, tPromotion);
149
- transactionPromotionEntryUpdated.itemLineIds = basketdetails.products.map((product) => {
1132
+ transactionPromotionEntryUpdated.itemLineIds = basketdetails.products.map((/**
1133
+ * @param {?} product
1134
+ * @return {?}
1135
+ */
1136
+ (product) => {
150
1137
  return product.itemLineId;
151
- });
1138
+ }));
152
1139
  if (!basketdetails.transactionPromotion) {
153
1140
  basketdetails.transactionPromotion = [];
154
1141
  }
155
1142
  basketdetails.transactionPromotion.push(transactionPromotionEntryUpdated);
156
1143
  basketdetails = this.transactionPromotionProductPortionCalc(basketdetails, transactionPromotionEntryUpdated);
157
- });
1144
+ }));
158
1145
  }
159
1146
  console.log("basket details in refund calculation file", JSON.stringify(basketdetails));
160
1147
  return basketdetails;
161
1148
  }
1149
+ /**
1150
+ * @param {?} basketDetails
1151
+ * @return {?}
1152
+ */
162
1153
  updateProductTotalForSummary(basketDetails) {
163
1154
  /*sale- product refundedQuantity = undefined
164
1155
  partial refund - product refundedQuantity is > 0
@@ -196,6 +1187,10 @@ class BasketService {
196
1187
  }
197
1188
  return this.updateBasketTotalForSummary(basketDetails);
198
1189
  }
1190
+ /**
1191
+ * @param {?} basketDetails
1192
+ * @return {?}
1193
+ */
199
1194
  updateBasketTotalForSummary(basketDetails) {
200
1195
  basketDetails.basketTotal = basketDetails.total;
201
1196
  console.info("ebasket : basket Service : update Basket Total for transaction transactionDiscount ", JSON.stringify(basketDetails.transactionDiscount));
@@ -206,25 +1201,49 @@ class BasketService {
206
1201
  console.info("ebasket : basket Service : update Basket Total: basketTotal after promotion applied for basketTotal", basketDetails.basketTotal);
207
1202
  return basketDetails;
208
1203
  }
1204
+ /**
1205
+ * @param {?} basketDetails
1206
+ * @return {?}
1207
+ */
209
1208
  updateTransactionDiscount(basketDetails) {
210
1209
  if (basketDetails.transactionDiscount &&
211
1210
  basketDetails.transactionDiscount.length > 0) {
212
- const discountTotal = basketDetails.transactionDiscount.reduce((n, { discountAmount }) => n + discountAmount, 0);
1211
+ /** @type {?} */
1212
+ const discountTotal = basketDetails.transactionDiscount.reduce((/**
1213
+ * @param {?} n
1214
+ * @param {?} __1
1215
+ * @return {?}
1216
+ */
1217
+ (n, { discountAmount }) => n + discountAmount), 0);
213
1218
  console.log("ebasket : basket Service : discountTotal ", discountTotal);
214
1219
  basketDetails.basketTotal =
215
1220
  basketDetails.basketTotal - Math.abs(discountTotal);
216
1221
  }
217
1222
  return basketDetails;
218
1223
  }
1224
+ /**
1225
+ * @param {?} basketDetails
1226
+ * @return {?}
1227
+ */
219
1228
  updateTransactionPromotion(basketDetails) {
220
1229
  if (basketDetails.transactionPromotion &&
221
1230
  basketDetails.transactionPromotion.length > 0) {
222
- const discountTotal = basketDetails.transactionPromotion.reduce((n, { promotionAmount }) => n + promotionAmount, 0);
1231
+ /** @type {?} */
1232
+ const discountTotal = basketDetails.transactionPromotion.reduce((/**
1233
+ * @param {?} n
1234
+ * @param {?} __1
1235
+ * @return {?}
1236
+ */
1237
+ (n, { promotionAmount }) => n + promotionAmount), 0);
223
1238
  basketDetails.basketTotal =
224
1239
  basketDetails.basketTotal - Math.abs(discountTotal);
225
1240
  }
226
1241
  return basketDetails;
227
1242
  }
1243
+ /**
1244
+ * @param {?} basket
1245
+ * @return {?}
1246
+ */
228
1247
  updateBasketTotalWithoutDiscount(basket) {
229
1248
  basket.total = 0;
230
1249
  basket.quantity = 0;
@@ -257,47 +1276,92 @@ class BasketService {
257
1276
  basket.basketTotal = basket.total;
258
1277
  return basket;
259
1278
  }
1279
+ /**
1280
+ * @param {?} basket
1281
+ * @return {?}
1282
+ */
260
1283
  updateBasketTotalWithDiscounts(basket) {
261
1284
  console.log("e:basket :RefundBasketScreen : this.basketDetails new values", basket, JSON.stringify(basket.basketTotal));
262
1285
  if (basket.transactionPromotion && basket.transactionPromotion.length > 0) {
263
- const discountTotal = basket.transactionPromotion.reduce((n, { promotionAmount }) => n + promotionAmount, 0);
1286
+ /** @type {?} */
1287
+ const discountTotal = basket.transactionPromotion.reduce((/**
1288
+ * @param {?} n
1289
+ * @param {?} __1
1290
+ * @return {?}
1291
+ */
1292
+ (n, { promotionAmount }) => n + promotionAmount), 0);
264
1293
  basket.basketTotal = basket.basketTotal - discountTotal;
265
1294
  }
266
1295
  if (basket.transactionDiscount && basket.transactionDiscount.length > 0) {
267
- const discountTotal = basket.transactionDiscount.reduce((n, { discountAmount }) => n + discountAmount, 0);
1296
+ /** @type {?} */
1297
+ const discountTotal = basket.transactionDiscount.reduce((/**
1298
+ * @param {?} n
1299
+ * @param {?} __1
1300
+ * @return {?}
1301
+ */
1302
+ (n, { discountAmount }) => n + discountAmount), 0);
268
1303
  basket.basketTotal = basket.basketTotal - discountTotal;
269
1304
  }
270
1305
  console.log("e:basket :RefundBasketScreen : basket new values", JSON.stringify(basket));
271
1306
  return basket;
272
1307
  }
1308
+ /**
1309
+ * @param {?} basket
1310
+ * @return {?}
1311
+ */
273
1312
  transactionDiscountAndPromotionProductortionCalculation(basket) {
274
1313
  if (basket.transactionDiscount && basket.transactionDiscount.length > 0) {
275
- basket.transactionDiscount.forEach((discount) => (basket = this.transactionDiscountProductPortionCalc(basket, discount)));
1314
+ basket.transactionDiscount.forEach((/**
1315
+ * @param {?} discount
1316
+ * @return {?}
1317
+ */
1318
+ (discount) => (basket = this.transactionDiscountProductPortionCalc(basket, discount))));
276
1319
  }
277
1320
  if (basket.transactionPromotion && basket.transactionPromotion.length > 0) {
278
- basket.transactionPromotion.forEach((promotion) => {
1321
+ basket.transactionPromotion.forEach((/**
1322
+ * @param {?} promotion
1323
+ * @return {?}
1324
+ */
1325
+ (promotion) => {
279
1326
  basket = this.transactionPromotionProductPortionCalc(basket, promotion);
280
- });
1327
+ }));
281
1328
  }
282
1329
  console.log("ebasket: basket item discount protion calculation", basket, basket.products);
283
1330
  return basket;
284
1331
  }
1332
+ /**
1333
+ * @param {?} basket
1334
+ * @param {?} promotion
1335
+ * @return {?}
1336
+ */
285
1337
  transactionPromotionProductPortionCalc(basket, promotion) {
1338
+ /** @type {?} */
286
1339
  let total = 0;
1340
+ /** @type {?} */
287
1341
  let percentage = 0;
288
1342
  {
289
- basket.products.forEach((p) => {
1343
+ basket.products.forEach((/**
1344
+ * @param {?} p
1345
+ * @return {?}
1346
+ */
1347
+ (p) => {
290
1348
  if (promotion.itemLineIds.includes(p.itemLineId)) {
291
1349
  p = this.validateProductItemDiscount(p);
1350
+ /** @type {?} */
292
1351
  const productContributionInTotal = this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnDiscountsPortion) +
293
1352
  this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnPromotionsPortion) -
294
1353
  this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.refundPortion);
295
1354
  total += (p.total - this.numberUtilService.trimTo2Decimal2(productContributionInTotal));
296
1355
  }
297
- });
1356
+ }));
298
1357
  console.log(`ebasket: trnsactionPromotion: ${JSON.stringify(promotion)}, selected products total: ${total}`);
299
- basket.products.forEach((product) => {
1358
+ basket.products.forEach((/**
1359
+ * @param {?} product
1360
+ * @return {?}
1361
+ */
1362
+ (product) => {
300
1363
  product = this.validateProductItemDiscount(product);
1364
+ /** @type {?} */
301
1365
  const productContributionInTotal = this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnDiscountsPortion) +
302
1366
  this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnPromotionsPortion) -
303
1367
  this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.refundPortion);
@@ -307,26 +1371,43 @@ class BasketService {
307
1371
  (promotion.promotionAmount * percentage) / 100;
308
1372
  product.itemDiscounts.trnPromotionsPortion = this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnPromotionsPortion);
309
1373
  }
310
- });
1374
+ }));
311
1375
  }
312
1376
  return basket;
313
1377
  }
1378
+ /**
1379
+ * @param {?} basket
1380
+ * @param {?} discount
1381
+ * @return {?}
1382
+ */
314
1383
  transactionDiscountProductPortionCalc(basket, discount) {
1384
+ /** @type {?} */
315
1385
  let total = 0;
1386
+ /** @type {?} */
316
1387
  let percentage = 0;
317
- basket.products.forEach((p) => {
1388
+ basket.products.forEach((/**
1389
+ * @param {?} p
1390
+ * @return {?}
1391
+ */
1392
+ (p) => {
318
1393
  if (discount.itemLineIds.includes(p.itemLineId)) {
319
1394
  p = this.validateProductItemDiscount(p);
1395
+ /** @type {?} */
320
1396
  const productContributionInTotal = this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnDiscountsPortion) +
321
1397
  this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnPromotionsPortion) -
322
1398
  this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.refundPortion);
323
1399
  total += (p.total - this.numberUtilService.trimTo2Decimal2(productContributionInTotal));
324
1400
  }
325
- });
1401
+ }));
326
1402
  console.log(`ebasket: trnsactionDiscount: ${JSON.stringify(discount)}, selected products total: ${total}`);
327
- basket.products.forEach((product) => {
1403
+ basket.products.forEach((/**
1404
+ * @param {?} product
1405
+ * @return {?}
1406
+ */
1407
+ (product) => {
328
1408
  product = this.validateProductItemDiscount(product);
329
1409
  console.log(product.discountable, "ebasket : basket service : discountable in basket service");
1410
+ /** @type {?} */
330
1411
  const productContributionInTotal = this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnDiscountsPortion) +
331
1412
  this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnPromotionsPortion) -
332
1413
  this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.refundPortion);
@@ -336,9 +1417,13 @@ class BasketService {
336
1417
  (discount.discountAmount * percentage) / 100;
337
1418
  product.itemDiscounts.trnDiscountsPortion = this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnDiscountsPortion);
338
1419
  }
339
- });
1420
+ }));
340
1421
  return basket;
341
1422
  }
1423
+ /**
1424
+ * @param {?} product
1425
+ * @return {?}
1426
+ */
342
1427
  validateProductItemDiscount(product) {
343
1428
  if (!product.itemDiscounts) {
344
1429
  product.itemDiscounts = {
@@ -349,48 +1434,107 @@ class BasketService {
349
1434
  }
350
1435
  return product;
351
1436
  }
1437
+ /**
1438
+ * @param {?} product
1439
+ * @return {?}
1440
+ */
352
1441
  markProduct(product) {
353
1442
  this.productSource.next(product);
354
1443
  }
1444
+ /**
1445
+ * @param {?} peerSync
1446
+ * @return {?}
1447
+ */
355
1448
  stopPeerSyncProcess(peerSync) {
356
1449
  this.peerSource.next(peerSync);
357
1450
  }
1451
+ /**
1452
+ * @param {?} isScanning
1453
+ * @return {?}
1454
+ */
358
1455
  scanStart(isScanning) {
359
1456
  this.scanSource.next(isScanning);
360
1457
  }
1458
+ /**
1459
+ * @param {?} promotion
1460
+ * @return {?}
1461
+ */
361
1462
  promotionRemainingCalculation(promotion) {
1463
+ /** @type {?} */
362
1464
  var promotionValue = 0;
363
- promotion.forEach((element) => {
1465
+ promotion.forEach((/**
1466
+ * @param {?} element
1467
+ * @return {?}
1468
+ */
1469
+ (element) => {
364
1470
  promotionValue += element.promotionAmount;
365
- });
1471
+ }));
366
1472
  return promotionValue;
367
1473
  }
1474
+ /**
1475
+ * @param {?} discount
1476
+ * @return {?}
1477
+ */
368
1478
  discountRemainingCalculation(discount) {
1479
+ /** @type {?} */
369
1480
  var discountValue = 0;
370
- discount.forEach((element) => {
1481
+ discount.forEach((/**
1482
+ * @param {?} element
1483
+ * @return {?}
1484
+ */
1485
+ (element) => {
371
1486
  discountValue += element.discountAmount;
372
- });
1487
+ }));
373
1488
  return discountValue;
374
1489
  }
1490
+ /**
1491
+ * @param {?} discount
1492
+ * @return {?}
1493
+ */
375
1494
  discountRefundedCalculation(discount) {
1495
+ /** @type {?} */
376
1496
  var discountValue = 0;
377
- discount.forEach((element) => {
1497
+ discount.forEach((/**
1498
+ * @param {?} element
1499
+ * @return {?}
1500
+ */
1501
+ (element) => {
378
1502
  if (element.discountAmount < 0) {
379
1503
  discountValue += element.discountAmount;
380
1504
  }
381
- });
1505
+ }));
382
1506
  return discountValue;
383
1507
  }
1508
+ /**
1509
+ * @param {?} products
1510
+ * @return {?}
1511
+ */
384
1512
  generateNewItemLineId(products) {
1513
+ /** @type {?} */
385
1514
  let largestNumber = 0;
386
1515
  if (products.length > 0) {
387
- let itemLineIdArray = products.map((product) => {
1516
+ /** @type {?} */
1517
+ let itemLineIdArray = products.map((/**
1518
+ * @param {?} product
1519
+ * @return {?}
1520
+ */
1521
+ (product) => {
388
1522
  return product.itemLineId;
389
- });
390
- largestNumber = itemLineIdArray.reduce((a, b) => Math.max(a, b));
1523
+ }));
1524
+ largestNumber = itemLineIdArray.reduce((/**
1525
+ * @param {?} a
1526
+ * @param {?} b
1527
+ * @return {?}
1528
+ */
1529
+ (a, b) => Math.max(a, b)));
391
1530
  }
392
1531
  return largestNumber + 1;
393
1532
  }
1533
+ /**
1534
+ * @param {?} product
1535
+ * @param {?} quantity
1536
+ * @return {?}
1537
+ */
394
1538
  updateBasketProductDataAsPerQuantity(product, quantity) {
395
1539
  console.log(`ebasket: updateBasketProductDataAsPerQuantity : ${quantity} product: ${JSON.stringify(product)}`);
396
1540
  product.quantity = quantity;
@@ -413,40 +1557,93 @@ class BasketService {
413
1557
  console.log(`ebasket: updateBasketProductDataAsPerQuantity : ${quantity} product: ${JSON.stringify(product)}`);
414
1558
  return product;
415
1559
  }
1560
+ /**
1561
+ * @param {?} isWebOrder
1562
+ * @return {?}
1563
+ */
416
1564
  filterProductListWithWebOrder(isWebOrder) {
417
1565
  console.log("ebasket: filterProductListWithWebOrder hit", JSON.stringify(this.currentBasket.products));
418
1566
  if (isWebOrder)
419
- return this.currentBasket.products.filter((x) => x.isWebOrder);
1567
+ return this.currentBasket.products.filter((/**
1568
+ * @param {?} x
1569
+ * @return {?}
1570
+ */
1571
+ (x) => x.isWebOrder));
420
1572
  else {
421
- return this.currentBasket.products.filter((x) => !x.isWebOrder);
1573
+ return this.currentBasket.products.filter((/**
1574
+ * @param {?} x
1575
+ * @return {?}
1576
+ */
1577
+ (x) => !x.isWebOrder));
422
1578
  }
423
1579
  }
1580
+ /**
1581
+ * @return {?}
1582
+ */
424
1583
  filterProductListWithDelivery() {
425
1584
  console.log("ebasket: filterProductListWithDelivery hit", JSON.stringify(this.currentBasket.products));
426
- return this.currentBasket.products.filter((x) => x.deliveryMethod === DELIVERY_METHODS.DELIVERY.toString());
1585
+ return this.currentBasket.products.filter((/**
1586
+ * @param {?} x
1587
+ * @return {?}
1588
+ */
1589
+ (x) => x.deliveryMethod === DELIVERY_METHODS.DELIVERY.toString()));
427
1590
  }
1591
+ /**
1592
+ * @param {?} group
1593
+ * @param {?} products
1594
+ * @return {?}
1595
+ */
428
1596
  filterProductListWithDeliveryGroup(group, products) {
429
1597
  console.log("ebasket: filterProductListWithDeliveryGroup hit", JSON.stringify(products));
430
- return products.filter((x) => x.deliveryGroup === group);
1598
+ return products.filter((/**
1599
+ * @param {?} x
1600
+ * @return {?}
1601
+ */
1602
+ (x) => x.deliveryGroup === group));
431
1603
  }
1604
+ /**
1605
+ * @param {?} products
1606
+ * @return {?}
1607
+ */
432
1608
  generateNewDeliveryGroupNumber(products) {
1609
+ /** @type {?} */
433
1610
  let largestNumber = 0;
434
1611
  if (products.length > 0) {
435
- let deliveryGroupArr = products.map((product) => {
1612
+ /** @type {?} */
1613
+ let deliveryGroupArr = products.map((/**
1614
+ * @param {?} product
1615
+ * @return {?}
1616
+ */
1617
+ (product) => {
436
1618
  if (product.deliveryGroup) {
437
1619
  return parseInt(product.deliveryGroup);
438
1620
  }
439
1621
  return 0;
440
- });
441
- largestNumber = deliveryGroupArr.reduce((a, b) => Math.max(a, b));
1622
+ }));
1623
+ largestNumber = deliveryGroupArr.reduce((/**
1624
+ * @param {?} a
1625
+ * @param {?} b
1626
+ * @return {?}
1627
+ */
1628
+ (a, b) => Math.max(a, b)));
442
1629
  }
443
1630
  return (largestNumber + 1).toString();
444
1631
  }
1632
+ /**
1633
+ * @param {?} products
1634
+ * @return {?}
1635
+ */
445
1636
  getDeliveryGroupNumbers(products) {
446
1637
  console.log("getDeliveryGroupNumbers initiating : ", JSON.stringify(products));
1638
+ /** @type {?} */
447
1639
  let uniqueAndsortedResult = [];
448
1640
  if (products.length > 0) {
449
- let deliveryGroupArr = products.map((product) => {
1641
+ /** @type {?} */
1642
+ let deliveryGroupArr = products.map((/**
1643
+ * @param {?} product
1644
+ * @return {?}
1645
+ */
1646
+ (product) => {
450
1647
  if (product.deliveryGroup) {
451
1648
  return parseInt(product.deliveryGroup);
452
1649
  }
@@ -454,33 +1651,62 @@ class BasketService {
454
1651
  return 1;
455
1652
  }
456
1653
  return 0;
457
- });
458
- uniqueAndsortedResult = Array.from(new Set(deliveryGroupArr)).sort((a, b) => a - b);
1654
+ }));
1655
+ uniqueAndsortedResult = Array.from(new Set(deliveryGroupArr)).sort((/**
1656
+ * @param {?} a
1657
+ * @param {?} b
1658
+ * @return {?}
1659
+ */
1660
+ (a, b) => a - b));
459
1661
  console.log("getDeliveryGroupNumbers : ", JSON.stringify(uniqueAndsortedResult));
460
1662
  }
461
1663
  return uniqueAndsortedResult;
462
1664
  }
1665
+ /**
1666
+ * @param {?} products
1667
+ * @return {?}
1668
+ */
463
1669
  updateProductsWithNewDeliveryGroupNumber(products) {
464
1670
  console.log("updateProductsWithNewDeliveryGroupNumber initiating : ", JSON.stringify(products));
1671
+ /** @type {?} */
465
1672
  let newGroupNumber = this.generateNewDeliveryGroupNumber(this.currentBasket.products);
466
1673
  if (products.length > 0) {
467
- this.currentBasket.products.forEach(cBProducts => {
468
- products.forEach(element => {
1674
+ this.currentBasket.products.forEach((/**
1675
+ * @param {?} cBProducts
1676
+ * @return {?}
1677
+ */
1678
+ cBProducts => {
1679
+ products.forEach((/**
1680
+ * @param {?} element
1681
+ * @return {?}
1682
+ */
1683
+ element => {
469
1684
  if (cBProducts.itemLineId === element.itemLineId) {
470
1685
  cBProducts.deliveryGroup = newGroupNumber;
471
1686
  }
472
- });
473
- });
1687
+ }));
1688
+ }));
474
1689
  }
475
1690
  this.updateBasket(this.currentBasket);
476
1691
  return;
477
1692
  }
1693
+ /**
1694
+ * @param {?} products
1695
+ * @return {?}
1696
+ */
478
1697
  calculateEstimatedTime(products) {
479
1698
  try {
1699
+ /** @type {?} */
480
1700
  let time;
1701
+ /** @type {?} */
481
1702
  let estmatedTime = 0;
1703
+ /** @type {?} */
482
1704
  let estimatedDays = "Hours";
483
- products.forEach((element) => {
1705
+ products.forEach((/**
1706
+ * @param {?} element
1707
+ * @return {?}
1708
+ */
1709
+ (element) => {
484
1710
  if (element.leadTime.type.toLocaleLowerCase() === "weeks") {
485
1711
  time = Number(element.leadTime.value) * 24 * 7;
486
1712
  estmatedTime = Math.max(estmatedTime, time);
@@ -511,7 +1737,7 @@ class BasketService {
511
1737
  estimatedDays = (estmatedTime === time) ? element.leadTime.type : estimatedDays;
512
1738
  console.log("hours", estmatedTime, estimatedDays);
513
1739
  }
514
- });
1740
+ }));
515
1741
  if (estimatedDays.toLocaleLowerCase() === "days") {
516
1742
  estmatedTime = estmatedTime / 24;
517
1743
  }
@@ -524,6 +1750,7 @@ class BasketService {
524
1750
  else if (estimatedDays.toLocaleLowerCase() === "years") {
525
1751
  estmatedTime = estmatedTime / (24 * 365);
526
1752
  }
1753
+ /** @type {?} */
527
1754
  let estimate = {
528
1755
  value: estmatedTime.toString(),
529
1756
  type: estimatedDays
@@ -535,23 +1762,41 @@ class BasketService {
535
1762
  }
536
1763
  return 0;
537
1764
  }
1765
+ /**
1766
+ * @param {?} oldGroup
1767
+ * @param {?} newGroup
1768
+ * @return {?}
1769
+ */
538
1770
  updateProductsWithDeliveryGroupNumber(oldGroup, newGroup) {
539
1771
  console.log("updateProductsWithDeliveryGroupNumber initiating");
540
- this.currentBasket.products.forEach(cBProducts => {
1772
+ this.currentBasket.products.forEach((/**
1773
+ * @param {?} cBProducts
1774
+ * @return {?}
1775
+ */
1776
+ cBProducts => {
541
1777
  if (cBProducts.deliveryGroup === oldGroup) {
542
1778
  cBProducts.deliveryGroup = newGroup;
543
1779
  }
544
- });
1780
+ }));
545
1781
  this.updateBasket(this.currentBasket);
546
1782
  return;
547
1783
  }
1784
+ /**
1785
+ * @return {?}
1786
+ */
548
1787
  getDeliveryInfo() {
549
1788
  console.log("getDeliveryGroupInfor initiating");
550
1789
  try {
1790
+ /** @type {?} */
551
1791
  let groupInfo = {
552
1792
  groups: []
553
1793
  };
554
- this.getDeliveryGroupNumbers(this.currentBasket.products).forEach((groupNumber) => {
1794
+ this.getDeliveryGroupNumbers(this.currentBasket.products).forEach((/**
1795
+ * @param {?} groupNumber
1796
+ * @return {?}
1797
+ */
1798
+ (groupNumber) => {
1799
+ /** @type {?} */
555
1800
  let group = {
556
1801
  groupNumber: groupNumber,
557
1802
  items: [],
@@ -560,34 +1805,155 @@ class BasketService {
560
1805
  value: "0"
561
1806
  }
562
1807
  };
563
- this.currentBasket.products.forEach(cBProducts => {
1808
+ this.currentBasket.products.forEach((/**
1809
+ * @param {?} cBProducts
1810
+ * @return {?}
1811
+ */
1812
+ cBProducts => {
564
1813
  if (cBProducts.deliveryGroup === groupNumber.toString()) {
565
1814
  group.items.push(cBProducts);
566
1815
  }
567
- });
1816
+ }));
568
1817
  group.estimate = this.calculateEstimatedTime(group.items);
569
1818
  groupInfo.groups.push(group);
570
- });
1819
+ }));
571
1820
  return groupInfo;
572
1821
  }
573
- catch (error) {
574
- console.log("error", error);
1822
+ catch (error) {
1823
+ console.log("error", error);
1824
+ }
1825
+ }
1826
+ }
1827
+ if (false) {
1828
+ /** @type {?} */
1829
+ BasketService.prototype.currentBasket;
1830
+ /**
1831
+ * @type {?}
1832
+ * @private
1833
+ */
1834
+ BasketService.prototype.basketSource;
1835
+ /** @type {?} */
1836
+ BasketService.prototype.basket;
1837
+ /**
1838
+ * @type {?}
1839
+ * @private
1840
+ */
1841
+ BasketService.prototype.productSource;
1842
+ /** @type {?} */
1843
+ BasketService.prototype.product;
1844
+ /**
1845
+ * @type {?}
1846
+ * @private
1847
+ */
1848
+ BasketService.prototype.peerSource;
1849
+ /** @type {?} */
1850
+ BasketService.prototype.peerSync;
1851
+ /**
1852
+ * @type {?}
1853
+ * @private
1854
+ */
1855
+ BasketService.prototype.scanSource;
1856
+ /** @type {?} */
1857
+ BasketService.prototype.scanner;
1858
+ /**
1859
+ * @type {?}
1860
+ * @private
1861
+ */
1862
+ BasketService.prototype._isMixedBasketSales;
1863
+ /**
1864
+ * @type {?}
1865
+ * @private
1866
+ */
1867
+ BasketService.prototype.numberUtilService;
1868
+ }
1869
+
1870
+ /**
1871
+ * @fileoverview added by tsickle
1872
+ * Generated from: lib/number-util.service.ts
1873
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1874
+ */
1875
+ class NumberUtilService {
1876
+ /**
1877
+ * @param {?} cp
1878
+ */
1879
+ constructor(cp) {
1880
+ this.cp = cp;
1881
+ }
1882
+ /**
1883
+ * @param {?} no
1884
+ * @return {?}
1885
+ */
1886
+ trimTo2Decimal(no) {
1887
+ //return Math.floor(no * 100) / 100;
1888
+ return no;
1889
+ }
1890
+ /**
1891
+ * @param {?} no
1892
+ * @return {?}
1893
+ */
1894
+ trimTo2Decimal2(no) {
1895
+ return Number(this.getFlooredFixed(no, 2));
1896
+ }
1897
+ /**
1898
+ * @param {?} v
1899
+ * @param {?} d
1900
+ * @return {?}
1901
+ */
1902
+ getFlooredFixed(v, d) {
1903
+ return (Math.floor(v * Math.pow(10, d)) / Math.pow(10, d)).toFixed(d);
1904
+ }
1905
+ /**
1906
+ * @param {?} numValue
1907
+ * @param {?} currencyCode
1908
+ * @return {?}
1909
+ */
1910
+ AppendWithCurrencySymbol(numValue, currencyCode) {
1911
+ /** @type {?} */
1912
+ let returnValue = "";
1913
+ if (numValue) {
1914
+ /** @type {?} */
1915
+ const numb = parseFloat(numValue.toString().replace(',', ''));
1916
+ returnValue = this.cp.transform(Number(numValue).toFixed(2), currencyCode.toLocaleUpperCase(), "symbol");
1917
+ console.log("AppendWithCurrencySymbol :" + returnValue);
1918
+ }
1919
+ else {
1920
+ returnValue = this.cp.transform("0.00", currencyCode.toLocaleUpperCase(), "symbol");
575
1921
  }
1922
+ return returnValue;
576
1923
  }
577
1924
  }
578
- BasketService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BasketService, deps: [{ token: NumberUtilService }], target: i0.ɵɵFactoryTarget.Injectable });
579
- BasketService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BasketService, providedIn: "root" });
580
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BasketService, decorators: [{
581
- type: Injectable,
582
- args: [{
583
- providedIn: "root",
584
- }]
585
- }], ctorParameters: function () { return [{ type: NumberUtilService }]; } });
1925
+ NumberUtilService.decorators = [
1926
+ { type: Injectable, args: [{
1927
+ providedIn: "root",
1928
+ },] }
1929
+ ];
1930
+ /** @nocollapse */
1931
+ NumberUtilService.ctorParameters = () => [
1932
+ { type: CurrencyPipe }
1933
+ ];
1934
+ /** @nocollapse */ NumberUtilService.ngInjectableDef = ɵɵdefineInjectable({ factory: function NumberUtilService_Factory() { return new NumberUtilService(ɵɵinject(CurrencyPipe)); }, token: NumberUtilService, providedIn: "root" });
1935
+ if (false) {
1936
+ /**
1937
+ * @type {?}
1938
+ * @private
1939
+ */
1940
+ NumberUtilService.prototype.cp;
1941
+ }
586
1942
 
1943
+ /**
1944
+ * @fileoverview added by tsickle
1945
+ * Generated from: lib/TransactionDocumentBuilder.ts
1946
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1947
+ */
587
1948
  /**
588
1949
  * Transaction document builder
589
1950
  */
590
1951
  class TransactionDocumentBuilder {
1952
+ /**
1953
+ * @param {?=} transactionDoc
1954
+ * @param {?=} currencyPipe
1955
+ * @param {?=} basketService
1956
+ */
591
1957
  constructor(transactionDoc, currencyPipe, basketService) {
592
1958
  this.currencyPipe = currencyPipe;
593
1959
  this.basketService = basketService;
@@ -612,26 +1978,29 @@ class TransactionDocumentBuilder {
612
1978
  userId: "",
613
1979
  initiatingModule: "eBasket",
614
1980
  export: false,
615
- basket: {},
616
- basketSummary: {},
1981
+ basket: (/** @type {?} */ ({})),
1982
+ basketSummary: (/** @type {?} */ ({})),
617
1983
  baseCurrency: "",
618
1984
  type: "",
619
1985
  operationStatus: "",
620
1986
  createdAt: "",
621
1987
  updatedAt: "",
622
1988
  id: "",
623
- currentTransactionDetails: {},
1989
+ currentTransactionDetails: (/** @type {?} */ ({})),
624
1990
  saleTotal: 0,
625
1991
  };
626
1992
  }
627
1993
  }
628
1994
  /**
629
1995
  * Transactions ref
630
- * @returns ref
1996
+ * @return {?} ref
631
1997
  */
632
1998
  transactionRef() {
1999
+ /** @type {?} */
633
2000
  const storeDetails = JSON.parse(localStorage.getItem('storeInfo') || '{}');
2001
+ /** @type {?} */
634
2002
  const date = new Date();
2003
+ /** @type {?} */
635
2004
  const random = (((1 + Math.random()) * 0x10000) | 0)
636
2005
  .toString(16)
637
2006
  .substring(1);
@@ -642,8 +2011,9 @@ class TransactionDocumentBuilder {
642
2011
  }
643
2012
  /**
644
2013
  * Transactions id
645
- * @param transactionID
646
- * @returns id
2014
+ * @param {?} transactionID
2015
+ * @param {?=} isOnline
2016
+ * @return {?} id
647
2017
  */
648
2018
  transactionId(transactionID, isOnline = true) {
649
2019
  if (isOnline) {
@@ -653,8 +2023,9 @@ class TransactionDocumentBuilder {
653
2023
  }
654
2024
  /**
655
2025
  * Transactions id
656
- * @param transactionID
657
- * @returns id
2026
+ * @param {?} transactionID
2027
+ * @param {?} isOnline
2028
+ * @return {?} id
658
2029
  */
659
2030
  offlineTransactionId(transactionID, isOnline) {
660
2031
  if (!isOnline) {
@@ -663,27 +2034,27 @@ class TransactionDocumentBuilder {
663
2034
  return this;
664
2035
  }
665
2036
  /**
666
- * storeNode Id
667
- * @param storeNodeId
668
- * @returns id
669
- */
2037
+ * storeNode Id
2038
+ * @param {?} storeNodeId
2039
+ * @return {?} id
2040
+ */
670
2041
  storeNodeId(storeNodeId) {
671
2042
  this.transactionDocument.storeNodeId = storeNodeId;
672
2043
  return this;
673
2044
  }
674
2045
  /**
675
- * storeNode structure
676
- * @param storeNodeStructure
677
- * @returns id
678
- */
2046
+ * storeNode structure
2047
+ * @param {?} storeNodeStructure
2048
+ * @return {?} id
2049
+ */
679
2050
  storeNodeStructure(storeNodeStructure) {
680
2051
  this.transactionDocument.storeNodeStructure = storeNodeStructure;
681
2052
  return this;
682
2053
  }
683
2054
  /**
684
2055
  * Orgs code
685
- * @param orgCode
686
- * @returns code
2056
+ * @param {?} orgCode
2057
+ * @return {?} code
687
2058
  */
688
2059
  orgCode(orgCode) {
689
2060
  this.transactionDocument.orgCode = orgCode;
@@ -691,8 +2062,8 @@ class TransactionDocumentBuilder {
691
2062
  }
692
2063
  /**
693
2064
  * Stores id
694
- * @param storeId
695
- * @returns id
2065
+ * @param {?} storeId
2066
+ * @return {?} id
696
2067
  */
697
2068
  storeId(storeId) {
698
2069
  this.transactionDocument.storeId = storeId;
@@ -700,60 +2071,67 @@ class TransactionDocumentBuilder {
700
2071
  }
701
2072
  /**
702
2073
  * Dates time
703
- * @returns time
2074
+ * @return {?} time
704
2075
  */
705
2076
  dateTime() {
2077
+ /** @type {?} */
706
2078
  const date = new Date();
707
2079
  this.transactionDocument.dateTime = date.toISOString();
708
2080
  return this;
709
2081
  }
710
2082
  /**
711
2083
  * Devices id
712
- * @param deviceId
713
- * @returns id
2084
+ * @param {?} deviceId
2085
+ * @return {?} id
714
2086
  */
715
2087
  deviceId(deviceId) {
716
2088
  this.transactionDocument.deviceId = deviceId;
717
2089
  return this;
718
2090
  }
719
2091
  /**
720
- * terminal id
721
- * @param terminalId
722
- * @returns id
723
- */
2092
+ * terminal id
2093
+ * @param {?} terminalId
2094
+ * @return {?} id
2095
+ */
724
2096
  terminalId(terminalId) {
725
2097
  this.transactionDocument.terminalId = terminalId;
726
2098
  return this;
727
2099
  }
728
2100
  /**
729
- * saleExport
730
- * @param saleExport
731
- * @returns id
732
- */
2101
+ * saleExport
2102
+ * @param {?} saleExport
2103
+ * @return {?} id
2104
+ */
733
2105
  export(saleExport) {
734
2106
  this.transactionDocument.export = saleExport;
735
2107
  return this;
736
2108
  }
737
2109
  /* customer(): TransactionDocumentBuilder {
738
- const user = JSON.parse(localStorage.getItem('userDetails'));
739
- this.transactionDocument.customer = user;
740
- return this;
741
- } */
2110
+ const user = JSON.parse(localStorage.getItem('userDetails'));
2111
+ this.transactionDocument.customer = user;
2112
+ return this;
2113
+ } */
742
2114
  /**
743
2115
  * Baskets transaction document builder
744
- * @param basketDetails
745
- * @returns basket
2116
+ * @param {?} basketDetails
2117
+ * @return {?} basket
746
2118
  */
747
2119
  basket(basketDetails) {
748
2120
  console.log("ebasket: basket details update in transaction document", JSON.stringify(basketDetails));
749
2121
  this.transactionDocument.subsidiaryId = basketDetails.subsidiaryId || (localStorage.getItem('subsidiaryId') || '');
750
- this.transactionDocument.basket.products = [];
2122
+ this.transactionDocument.basket.products = (/** @type {?} */ ([]));
751
2123
  this.transactionDocument.basket.lineDiscount = [];
752
2124
  this.transactionDocument.basket.linePromotion = [];
753
2125
  this.transactionDocument.basket.transactionPromotion = [];
754
- basketDetails.products.forEach((product, index) => {
755
- const p = {};
756
- p.itemDiscounts = {};
2126
+ basketDetails.products.forEach((/**
2127
+ * @param {?} product
2128
+ * @param {?} index
2129
+ * @return {?}
2130
+ */
2131
+ (product, index) => {
2132
+ /** @type {?} */
2133
+ const p = (/** @type {?} */ ({}));
2134
+ p.itemDiscounts = (/** @type {?} */ ({}));
757
2135
  p.SKU = product.SKU;
758
2136
  p.excludePromotion = product.excludePromotion;
759
2137
  p.barCode = product.barcode;
@@ -794,26 +2172,35 @@ class TransactionDocumentBuilder {
794
2172
  if (product.lineDiscount) {
795
2173
  p.lineDiscount = product.lineDiscount;
796
2174
  }
797
- p.itemDiscounts = product.itemDiscounts;
2175
+ p.itemDiscounts = (/** @type {?} */ (product.itemDiscounts));
798
2176
  this.transactionDocument.basket.products.push(p);
799
2177
  this.lineDiscount(basketDetails);
800
- });
2178
+ }));
801
2179
  console.info("ebasket: transactiondocument basket details updated", JSON.stringify(this.transactionDocument.basket));
802
2180
  return this;
803
2181
  }
804
2182
  /**
805
- * current transaction Details Total(New Products)
806
- * @returns currentTransactionDetails
807
- */
2183
+ * current transaction Details Total(New Products)
2184
+ * @param {?} basket
2185
+ * @return {?} currentTransactionDetails
2186
+ */
808
2187
  currentTransactionDetails(basket) {
809
2188
  console.log("ebasket: current transaction details for exchanges", basket);
810
- this.transactionDocument.currentTransactionDetails.products = [];
811
- this.transactionDocument.currentTransactionDetails.linePromotion = [];
812
- this.transactionDocument.currentTransactionDetails.lineDiscount = [];
2189
+ this.transactionDocument.currentTransactionDetails.products = (/** @type {?} */ ([]));
2190
+ this.transactionDocument.currentTransactionDetails.linePromotion = (/** @type {?} */ ([]));
2191
+ this.transactionDocument.currentTransactionDetails.lineDiscount = (/** @type {?} */ ([]));
813
2192
  this.transactionDocument.currentTransactionDetails.transactionDiscount = [];
814
2193
  this.transactionDocument.currentTransactionDetails.products = basket.products;
815
- this.transactionDocument.currentTransactionDetails.products = this.transactionDocument.currentTransactionDetails.products.filter((proj) => proj.refundedQuantity != 0);
816
- this.transactionDocument.currentTransactionDetails.products.forEach((product) => {
2194
+ this.transactionDocument.currentTransactionDetails.products = this.transactionDocument.currentTransactionDetails.products.filter((/**
2195
+ * @param {?} proj
2196
+ * @return {?}
2197
+ */
2198
+ (proj) => proj.refundedQuantity != 0));
2199
+ this.transactionDocument.currentTransactionDetails.products.forEach((/**
2200
+ * @param {?} product
2201
+ * @return {?}
2202
+ */
2203
+ (product) => {
817
2204
  if (product.refundedQuantity) {
818
2205
  product.quantity = product.refundedQuantity;
819
2206
  // updating total line price with actual price to be refunded including the refunding qty
@@ -830,12 +2217,12 @@ class TransactionDocumentBuilder {
830
2217
  if (product.lineDiscount && !product.refundedQuantity) {
831
2218
  this.transactionDocument.currentTransactionDetails.lineDiscount.push(product.lineDiscount);
832
2219
  }
833
- });
2220
+ }));
834
2221
  console.log("ebasket: current transaction details after removing old products", this.transactionDocument.currentTransactionDetails.products);
835
2222
  if (basket.transactionDiscount && basket.transactionDiscount.length > 0) {
836
2223
  this.transactionDocument.currentTransactionDetails.transactionDiscount.push(...basket.transactionDiscount);
837
2224
  }
838
- this.transactionDocument.currentTransactionDetails.basketSummary = {};
2225
+ this.transactionDocument.currentTransactionDetails.basketSummary = (/** @type {?} */ ({}));
839
2226
  this.transactionDocument.currentTransactionDetails.basketSummary.saleTotal = this.numberUtilService.trimTo2Decimal2(this.updateSaleTotal(this.transactionDocument.currentTransactionDetails));
840
2227
  this.transactionDocument.currentTransactionDetails.basketSummary.totalItems = basket.quantity;
841
2228
  this.transactionDocument.currentTransactionDetails.basketSummary.basketTotal = basket.basketTotal;
@@ -846,10 +2233,15 @@ class TransactionDocumentBuilder {
846
2233
  }
847
2234
  else {
848
2235
  if (this.transactionDocument.currentTransactionDetails.transactionDiscount && this.transactionDocument.currentTransactionDetails.transactionDiscount.length > 0) {
2236
+ /** @type {?} */
849
2237
  let discountTotal = 0;
850
- this.transactionDocument.currentTransactionDetails.transactionDiscount.forEach((discount) => {
2238
+ this.transactionDocument.currentTransactionDetails.transactionDiscount.forEach((/**
2239
+ * @param {?} discount
2240
+ * @return {?}
2241
+ */
2242
+ (discount) => {
851
2243
  discountTotal += discount.discountAmount;
852
- });
2244
+ }));
853
2245
  this.transactionDocument.currentTransactionDetails.basketSummary.discountTotal = Math.abs(discountTotal);
854
2246
  }
855
2247
  else {
@@ -860,22 +2252,34 @@ class TransactionDocumentBuilder {
860
2252
  return this;
861
2253
  }
862
2254
  /**
863
- * current transaction Tax Total
864
- * @returns Tax Total
865
- */
2255
+ * current transaction Tax Total
2256
+ * @param {?} basketDetails
2257
+ * @return {?} Tax Total
2258
+ */
866
2259
  updateCurrentTransactionDetailsTaxBreakdown(basketDetails) {
2260
+ /** @type {?} */
867
2261
  let transactionDiscountTotal = 0;
2262
+ /** @type {?} */
868
2263
  let taxBreakdown = {
869
2264
  taxLines: [],
870
2265
  totalTaxableAmount: 0,
871
2266
  };
872
2267
  if (this.transactionDocument.currentTransactionDetails.transactionDiscount && this.transactionDocument.currentTransactionDetails.transactionDiscount.length > 0) {
873
- this.transactionDocument.currentTransactionDetails.transactionDiscount.forEach((discount) => {
2268
+ this.transactionDocument.currentTransactionDetails.transactionDiscount.forEach((/**
2269
+ * @param {?} discount
2270
+ * @return {?}
2271
+ */
2272
+ (discount) => {
874
2273
  transactionDiscountTotal += discount.discountAmount;
875
- });
2274
+ }));
876
2275
  }
877
2276
  if (this.transactionDocument.currentTransactionDetails.products && this.transactionDocument.currentTransactionDetails.products.length > 0) {
878
- this.transactionDocument.currentTransactionDetails.products.forEach((product) => {
2277
+ this.transactionDocument.currentTransactionDetails.products.forEach((/**
2278
+ * @param {?} product
2279
+ * @return {?}
2280
+ */
2281
+ (product) => {
2282
+ /** @type {?} */
879
2283
  let taxLine = {
880
2284
  itemLineId: product.itemLineId,
881
2285
  VAT: product.selectedVAT ? product.selectedVAT : 0,
@@ -902,12 +2306,17 @@ class TransactionDocumentBuilder {
902
2306
  // step 4 - update tax Line total
903
2307
  taxLine.taxLineTotal = this.numberUtilService.trimTo2Decimal2(taxLine.taxableAmount - taxLine.PreTax);
904
2308
  taxBreakdown.taxLines.push(taxLine);
905
- });
2309
+ }));
906
2310
  }
907
2311
  taxBreakdown.totalTaxableAmount = this.numberUtilService.trimTo2Decimal2(taxBreakdown.totalTaxableAmount);
908
2312
  this.transactionDocument.currentTransactionDetails.taxBreakdown = taxBreakdown;
909
2313
  if (this.transactionDocument.currentTransactionDetails.taxBreakdown && this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines && this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines.length > 0) {
910
- this.transactionDocument.currentTransactionDetails.basketSummary.VATTotal = this.numberUtilService.trimTo2Decimal2(this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines.reduce((n, { taxLineTotal }) => n + taxLineTotal, 0));
2314
+ this.transactionDocument.currentTransactionDetails.basketSummary.VATTotal = this.numberUtilService.trimTo2Decimal2(this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines.reduce((/**
2315
+ * @param {?} n
2316
+ * @param {?} __1
2317
+ * @return {?}
2318
+ */
2319
+ (n, { taxLineTotal }) => n + taxLineTotal), 0));
911
2320
  }
912
2321
  else {
913
2322
  this.transactionDocument.currentTransactionDetails.basketSummary.VATTotal = 0.00;
@@ -915,12 +2324,22 @@ class TransactionDocumentBuilder {
915
2324
  console.log("eBasket:after calculating tax currenttransactionDetails", this.transactionDocument.currentTransactionDetails);
916
2325
  return this;
917
2326
  }
2327
+ /**
2328
+ * @return {?}
2329
+ */
918
2330
  updateCurrentTransactionDetailsTotalTaxSummary() {
919
2331
  console.log("Total Tax Summery Request :", JSON.stringify(this.transactionDocument.currentTransactionDetails.taxBreakdown));
2332
+ /** @type {?} */
920
2333
  let totalTaxSummaryArray = [];
2334
+ /** @type {?} */
921
2335
  let totalTaxSummaryGroup = [];
922
2336
  console.log("Tax Lines for Total Tax Summery :", JSON.stringify(this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines));
923
- this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines.forEach((element) => {
2337
+ this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines.forEach((/**
2338
+ * @param {?} element
2339
+ * @return {?}
2340
+ */
2341
+ (element) => {
2342
+ /** @type {?} */
924
2343
  let TaxSummary = {
925
2344
  VATCode: "",
926
2345
  VAT: -12345,
@@ -934,10 +2353,20 @@ class TransactionDocumentBuilder {
934
2353
  TaxSummary.TaxSum = this.numberUtilService.trimTo2Decimal2(element.taxLineTotal);
935
2354
  TaxSummary.TXrateSum = this.numberUtilService.trimTo2Decimal2(TaxSummary.PreTaxSum + TaxSummary.TaxSum);
936
2355
  totalTaxSummaryArray.push(TaxSummary);
937
- });
2356
+ }));
938
2357
  console.log("Total Tax Summery Without Grouped : ", JSON.stringify(totalTaxSummaryArray));
939
- totalTaxSummaryGroup = totalTaxSummaryArray.reduce((preparedArray, currentObj) => {
940
- let ind = preparedArray.findIndex((x) => x.VAT === currentObj.VAT);
2358
+ totalTaxSummaryGroup = totalTaxSummaryArray.reduce((/**
2359
+ * @param {?} preparedArray
2360
+ * @param {?} currentObj
2361
+ * @return {?}
2362
+ */
2363
+ (preparedArray, currentObj) => {
2364
+ /** @type {?} */
2365
+ let ind = preparedArray.findIndex((/**
2366
+ * @param {?} x
2367
+ * @return {?}
2368
+ */
2369
+ (x) => x.VAT === currentObj.VAT));
941
2370
  if (ind === -1) {
942
2371
  preparedArray.push(currentObj);
943
2372
  }
@@ -949,7 +2378,7 @@ class TransactionDocumentBuilder {
949
2378
  preparedArray[ind].TXrateSum += currentObj.TXrateSum;
950
2379
  }
951
2380
  return preparedArray;
952
- }, []);
2381
+ }), []);
953
2382
  // listOfTags.map(x => unique.filter(a => a.label == x.label && a.color == x.color).length > 0 ? null : unique.push(x));
954
2383
  console.log("Total Tax Summer Group :", JSON.stringify(totalTaxSummaryGroup));
955
2384
  this.transactionDocument.currentTransactionDetails.totalTaxSummary = totalTaxSummaryGroup;
@@ -957,23 +2386,27 @@ class TransactionDocumentBuilder {
957
2386
  }
958
2387
  /**
959
2388
  * current transaction Disocunt Total
960
- * @returns Discount Total
2389
+ * @return {?} Discount Total
961
2390
  */
962
2391
  updateCurrentTransactionDetailsDiscountTotal() {
2392
+ /** @type {?} */
963
2393
  let refundTotal = this.transactionDocument.currentTransactionDetails.basketSummary.refundTotal ? this.transactionDocument.currentTransactionDetails.basketSummary.refundTotal : 0;
964
2394
  console.log("e-basket: transaction builder updateCurrentTransactionDetailsDiscountTotal: discountTotal", refundTotal, this.transactionDocument.currentTransactionDetails.basketSummary.basketTotal, this.transactionDocument.currentTransactionDetails.basketSummary.saleTotal);
2395
+ /** @type {?} */
965
2396
  const discountTotal = Math.abs(Math.abs(this.transactionDocument.currentTransactionDetails.basketSummary.saleTotal) -
966
2397
  (Math.abs(this.transactionDocument.currentTransactionDetails.basketSummary.basketTotal) + Math.abs(refundTotal)));
967
2398
  console.log("e-basket: transaction builder updateCurrentTransactionDetailsDiscountTotal: discountTotal", discountTotal);
968
2399
  return Number(discountTotal.toFixed(2));
969
2400
  }
970
2401
  /**
971
- * current transaction Refund Total
972
- * @returns Refund Total
973
- */
2402
+ * current transaction Refund Total
2403
+ * @return {?} Refund Total
2404
+ */
974
2405
  updateCurrentTransactionDetailsRefundTotal() {
2406
+ /** @type {?} */
975
2407
  let totalRefund = 0;
976
2408
  for (let index = 0; index < this.transactionDocument.currentTransactionDetails.products.length; index++) {
2409
+ /** @type {?} */
977
2410
  const product = this.transactionDocument.currentTransactionDetails.products[index];
978
2411
  if (product.refundedTotal) {
979
2412
  totalRefund = totalRefund + product.refundedTotal;
@@ -984,8 +2417,8 @@ class TransactionDocumentBuilder {
984
2417
  }
985
2418
  /**
986
2419
  * Baskets summary
987
- * @param basketDetails
988
- * @returns summary
2420
+ * @param {?} basketDetails
2421
+ * @return {?} summary
989
2422
  */
990
2423
  basketSummary(basketDetails) {
991
2424
  this.transactionDocument.basketSummary.basketTotal = this.numberUtilService.trimTo2Decimal(basketDetails.basketTotal);
@@ -997,7 +2430,12 @@ class TransactionDocumentBuilder {
997
2430
  }
998
2431
  this.transactionDocument.basketSummary.totalItems = basketDetails.quantity;
999
2432
  if (this.transactionDocument.basket.taxBreakdown) {
1000
- this.transactionDocument.basketSummary.VATTotal = this.numberUtilService.trimTo2Decimal2(this.transactionDocument.basket.taxBreakdown.taxLines.reduce((n, { taxLineTotal }) => n + taxLineTotal, 0));
2433
+ this.transactionDocument.basketSummary.VATTotal = this.numberUtilService.trimTo2Decimal2(this.transactionDocument.basket.taxBreakdown.taxLines.reduce((/**
2434
+ * @param {?} n
2435
+ * @param {?} __1
2436
+ * @return {?}
2437
+ */
2438
+ (n, { taxLineTotal }) => n + taxLineTotal), 0));
1001
2439
  }
1002
2440
  else {
1003
2441
  this.transactionDocument.basketSummary.VATTotal = 0.00;
@@ -1007,21 +2445,31 @@ class TransactionDocumentBuilder {
1007
2445
  }
1008
2446
  /**
1009
2447
  * Line Discount
1010
- * @param basketDetails
1011
- * @returns line Discount
2448
+ * @param {?} basketDetails
2449
+ * @return {?} line Discount
1012
2450
  */
1013
2451
  lineDiscount(basketDetails) {
1014
2452
  this.transactionDocument.basket.lineDiscount = [];
1015
2453
  for (let index = 0; index < basketDetails.products.length; index++) {
2454
+ /** @type {?} */
1016
2455
  const element = basketDetails.products[index];
1017
2456
  if (element.lineDiscount) {
1018
2457
  this.transactionDocument.basket.lineDiscount.push(element.lineDiscount);
1019
- this.transactionDocument.basket.lineDiscount = this.transactionDocument.basket.lineDiscount.reduce((acc, val) => {
1020
- if (!acc.find((el) => el.itemLineId === val.itemLineId)) {
2458
+ this.transactionDocument.basket.lineDiscount = this.transactionDocument.basket.lineDiscount.reduce((/**
2459
+ * @param {?} acc
2460
+ * @param {?} val
2461
+ * @return {?}
2462
+ */
2463
+ (acc, val) => {
2464
+ if (!acc.find((/**
2465
+ * @param {?} el
2466
+ * @return {?}
2467
+ */
2468
+ (el) => el.itemLineId === val.itemLineId))) {
1021
2469
  acc.push(val);
1022
2470
  }
1023
2471
  return acc;
1024
- }, []);
2472
+ }), []);
1025
2473
  }
1026
2474
  // console.info(
1027
2475
  // "e-basket :line discount updated in transaction document",
@@ -1032,19 +2480,28 @@ class TransactionDocumentBuilder {
1032
2480
  }
1033
2481
  /**
1034
2482
  * exchange
1035
- * @param basketDetails
1036
- * @returns exchange
2483
+ * @param {?} basketDetails
2484
+ * @return {?} exchange
1037
2485
  */
1038
2486
  exchange(basketDetails) {
1039
2487
  this.transactionDocument.basket.exchange = basketDetails.exchange && basketDetails.exchange.length > 0 ? [...basketDetails.exchange] : [];
1040
2488
  for (let index = 0; index < basketDetails.products.length; index++) {
2489
+ /** @type {?} */
1041
2490
  const element = basketDetails.products[index];
1042
2491
  if (element.exchange != undefined) {
1043
- const isPresent = this.transactionDocument.basket.exchange.some((el) => el.exchangeId === element.exchange.exchangeId);
2492
+ /** @type {?} */
2493
+ const isPresent = this.transactionDocument.basket.exchange.some((/**
2494
+ * @param {?} el
2495
+ * @return {?}
2496
+ */
2497
+ (el) => el.exchangeId === element.exchange.exchangeId));
1044
2498
  if (!isPresent) {
2499
+ /** @type {?} */
1045
2500
  let exchangeItems = [];
1046
2501
  for (let j = 0; j < element.exchange.newItems.length; j++) {
2502
+ /** @type {?} */
1047
2503
  const item = element.exchange.newItems[j];
2504
+ /** @type {?} */
1048
2505
  let newItems = { lineItemId: item.itemLineId, Quantity: item.quantity };
1049
2506
  exchangeItems.push(newItems);
1050
2507
  }
@@ -1057,39 +2514,49 @@ class TransactionDocumentBuilder {
1057
2514
  return this;
1058
2515
  }
1059
2516
  /**
1060
- * add previous exchange data
1061
- * @param originalTransactionDocument
1062
- * @returns line Promotions
1063
- */
2517
+ * add previous exchange data
2518
+ * @param {?} originalTransactionDocument
2519
+ * @return {?} line Promotions
2520
+ */
1064
2521
  addExchangeData(originalTransactionDocument) {
1065
2522
  this.transactionDocument.basket.exchange = originalTransactionDocument.basket.exchange ? [...originalTransactionDocument.basket.exchange] : null;
1066
2523
  return this;
1067
2524
  }
1068
2525
  /**
1069
2526
  * line Promotions
1070
- * @param basketDetails
1071
- * @returns line Promotions
2527
+ * @param {?} basketDetails
2528
+ * @return {?} line Promotions
1072
2529
  */
1073
2530
  linePromotion(basketDetails) {
1074
2531
  this.transactionDocument.basket.linePromotion = [];
1075
2532
  for (let index = 0; index < basketDetails.products.length; index++) {
2533
+ /** @type {?} */
1076
2534
  const element = basketDetails.products[index];
1077
2535
  if (element.linePromotions) {
1078
2536
  this.transactionDocument.basket.linePromotion.push(element.linePromotions);
1079
- this.transactionDocument.basket.linePromotion = this.transactionDocument.basket.linePromotion.reduce((acc, val) => {
1080
- if (!acc.find((el) => el.itemLineId === val.itemLineId)) {
2537
+ this.transactionDocument.basket.linePromotion = this.transactionDocument.basket.linePromotion.reduce((/**
2538
+ * @param {?} acc
2539
+ * @param {?} val
2540
+ * @return {?}
2541
+ */
2542
+ (acc, val) => {
2543
+ if (!acc.find((/**
2544
+ * @param {?} el
2545
+ * @return {?}
2546
+ */
2547
+ (el) => el.itemLineId === val.itemLineId))) {
1081
2548
  acc.push(val);
1082
2549
  }
1083
2550
  return acc;
1084
- }, []);
2551
+ }), []);
1085
2552
  }
1086
2553
  }
1087
2554
  return this;
1088
2555
  }
1089
2556
  /**
1090
2557
  * transaction Promotion
1091
- * @param basketDetails
1092
- * @returns transaction Promotion
2558
+ * @param {?} basketDetails
2559
+ * @return {?} transaction Promotion
1093
2560
  */
1094
2561
  transactionPromotion(basketDetails) {
1095
2562
  if (basketDetails.transactionPromotion) {
@@ -1108,6 +2575,10 @@ class TransactionDocumentBuilder {
1108
2575
  }
1109
2576
  return this;
1110
2577
  }
2578
+ /**
2579
+ * @param {?} basketDetails
2580
+ * @return {?}
2581
+ */
1111
2582
  transactionDiscount(basketDetails) {
1112
2583
  if (basketDetails.transactionDiscount) {
1113
2584
  this.transactionDocument.basket.transactionDiscount =
@@ -1118,45 +2589,52 @@ class TransactionDocumentBuilder {
1118
2589
  }
1119
2590
  /**
1120
2591
  * Payments details
1121
- * @param paymentDetails
1122
- * @returns
2592
+ * @template THIS
2593
+ * @this {THIS}
2594
+ * @param {?} paymentDetails
2595
+ * @return {THIS}
1123
2596
  */
1124
2597
  paymentDetails(paymentDetails) {
1125
2598
  console.info("ebasket : payment details after transaction completed", JSON.stringify(paymentDetails));
1126
- this.transactionDocument.paymentDetails = paymentDetails;
1127
- return this;
2599
+ (/** @type {?} */ (this)).transactionDocument.paymentDetails = paymentDetails;
2600
+ return (/** @type {?} */ (this));
1128
2601
  }
1129
2602
  /**
1130
2603
  * Payments details
1131
- * @param paymentDetails
1132
- * @returns
2604
+ * @template THIS
2605
+ * @this {THIS}
2606
+ * @param {?} splitPayment
2607
+ * @return {THIS}
1133
2608
  */
1134
2609
  splitPayment(splitPayment) {
1135
- this.transactionDocument.splitPayment = splitPayment;
1136
- return this;
2610
+ (/** @type {?} */ (this)).transactionDocument.splitPayment = splitPayment;
2611
+ return (/** @type {?} */ (this));
1137
2612
  }
1138
2613
  /**
1139
- * Payments details
1140
- * @param paymentDetails
1141
- * @returns
1142
- */
2614
+ * Payments details
2615
+ * @template THIS
2616
+ * @this {THIS}
2617
+ * @param {?} isPaymentCompleted
2618
+ * @return {THIS}
2619
+ */
1143
2620
  isPaymentCompleted(isPaymentCompleted) {
1144
- this.transactionDocument.isPaymentCompleted = isPaymentCompleted;
1145
- return this;
2621
+ (/** @type {?} */ (this)).transactionDocument.isPaymentCompleted = isPaymentCompleted;
2622
+ return (/** @type {?} */ (this));
1146
2623
  }
1147
2624
  /**
1148
2625
  * Bases currency
1149
- * @param currency
1150
- * @returns currency
2626
+ * @param {?} currency
2627
+ * @return {?} currency
1151
2628
  */
1152
2629
  baseCurrency(currency) {
1153
2630
  this.transactionDocument.baseCurrency = currency;
1154
2631
  return this;
1155
2632
  }
1156
2633
  /**
1157
- * gift option at
1158
- * @returns at
1159
- */
2634
+ * gift option at
2635
+ * @param {?} gift
2636
+ * @return {?} at
2637
+ */
1160
2638
  giftOption(gift) {
1161
2639
  console.log("e-basket :TransactionDocumentBuilder: this.transactionDocument.giftoption", gift);
1162
2640
  if (gift) {
@@ -1165,12 +2643,12 @@ class TransactionDocumentBuilder {
1165
2643
  return this;
1166
2644
  }
1167
2645
  /**
1168
-
1169
- /**
1170
- * manual Discount
1171
- * @param discountData
1172
- * @returns
1173
- */
2646
+
2647
+ /**
2648
+ * manual Discount
2649
+ * @param discountData
2650
+ * @returns
2651
+ */
1174
2652
  // manualDiscount(discountData : basketDiscount):TransactionDocumentBuilder {
1175
2653
  // let saleTotal = this.transactionDocument.basketSummary.basketTotal;
1176
2654
  // if(discountData.discountType =='Percent'){
@@ -1185,8 +2663,8 @@ class TransactionDocumentBuilder {
1185
2663
  // }
1186
2664
  /**
1187
2665
  * Types transaction document builder
1188
- * @param t
1189
- * @returns type
2666
+ * @param {?} t
2667
+ * @return {?} type
1190
2668
  */
1191
2669
  type(t) {
1192
2670
  this.transactionDocument.type = t;
@@ -1194,8 +2672,8 @@ class TransactionDocumentBuilder {
1194
2672
  }
1195
2673
  /**
1196
2674
  * Operations status
1197
- * @param o
1198
- * @returns status
2675
+ * @param {?} o
2676
+ * @return {?} status
1199
2677
  */
1200
2678
  operationStatus(o) {
1201
2679
  this.transactionDocument.operationStatus = o;
@@ -1203,9 +2681,10 @@ class TransactionDocumentBuilder {
1203
2681
  }
1204
2682
  /**
1205
2683
  * Created at
1206
- * @returns at
2684
+ * @return {?} at
1207
2685
  */
1208
2686
  createdAt() {
2687
+ /** @type {?} */
1209
2688
  const date = new Date();
1210
2689
  this.transactionDocument.createdAt = date.toISOString();
1211
2690
  this.transactionDocument.updatedAt = date.toISOString();
@@ -1213,33 +2692,35 @@ class TransactionDocumentBuilder {
1213
2692
  }
1214
2693
  /**
1215
2694
  * Updated at
1216
- * @returns at
2695
+ * @return {?} at
1217
2696
  */
1218
2697
  updatedAt() {
2698
+ /** @type {?} */
1219
2699
  const date = new Date();
1220
2700
  this.transactionDocument.updatedAt = date.toISOString();
1221
2701
  return this;
1222
2702
  }
1223
2703
  /**
1224
2704
  * transsaction completion at
1225
- * @returns transaction completion date
2705
+ * @return {?} transaction completion date
1226
2706
  */
1227
2707
  transactionCompletedAt() {
2708
+ /** @type {?} */
1228
2709
  const date = new Date();
1229
2710
  this.transactionDocument.transCompletedAt = date.toISOString();
1230
2711
  return this;
1231
2712
  }
1232
2713
  /**
1233
2714
  * Builds transaction document builder
1234
- * @returns build
2715
+ * @return {?} build
1235
2716
  */
1236
2717
  build() {
1237
2718
  return this.transactionDocument;
1238
2719
  }
1239
2720
  /**
1240
2721
  * Sales total in refund
1241
- * @param saleTotal
1242
- * @returns total in refund
2722
+ * @param {?} saleTotal
2723
+ * @return {?} total in refund
1243
2724
  */
1244
2725
  saleTotalInRefund(saleTotal) {
1245
2726
  this.transactionDocument.saleTotal = saleTotal;
@@ -1247,10 +2728,11 @@ class TransactionDocumentBuilder {
1247
2728
  }
1248
2729
  /**
1249
2730
  * Gets basket details
1250
- * @returns basket details
2731
+ * @return {?} basket details
1251
2732
  */
1252
2733
  getBasketDetails() {
1253
2734
  console.info("ebasket: Getting Basket for transactionDocument", JSON.stringify(this.transactionDocument));
2735
+ /** @type {?} */
1254
2736
  let basket = {
1255
2737
  subsidiaryId: this.transactionDocument.subsidiaryId,
1256
2738
  transactionDiscount: this.transactionDocument.basket.transactionDiscount,
@@ -1267,10 +2749,16 @@ class TransactionDocumentBuilder {
1267
2749
  baseCurrency: this.transactionDocument.baseCurrency,
1268
2750
  customer: this.transactionDocument.customer,
1269
2751
  };
1270
- basket.products = [];
1271
- this.transactionDocument.basket.products.forEach((product, index) => {
2752
+ basket.products = (/** @type {?} */ ([]));
2753
+ this.transactionDocument.basket.products.forEach((/**
2754
+ * @param {?} product
2755
+ * @param {?} index
2756
+ * @return {?}
2757
+ */
2758
+ (product, index) => {
1272
2759
  console.log(JSON.stringify(product), "ebasket: basket detail update in basket");
1273
- const p = {};
2760
+ /** @type {?} */
2761
+ const p = (/** @type {?} */ ({}));
1274
2762
  p.SKU = product.SKU;
1275
2763
  p.barcode = product.barCode;
1276
2764
  p.barcodes = product.barcodes;
@@ -1299,30 +2787,42 @@ class TransactionDocumentBuilder {
1299
2787
  p.giftCardRecipientName = product.giftCardRecipientName;
1300
2788
  if (this.transactionDocument.basket.lineDiscount &&
1301
2789
  this.transactionDocument.basket.lineDiscount.length > 0) {
1302
- this.transactionDocument.basket.lineDiscount.forEach((lineDiscount) => {
2790
+ this.transactionDocument.basket.lineDiscount.forEach((/**
2791
+ * @param {?} lineDiscount
2792
+ * @return {?}
2793
+ */
2794
+ (lineDiscount) => {
1303
2795
  if (product.itemLineId === lineDiscount.itemLineId.toString()) {
1304
2796
  p.lineDiscount = lineDiscount;
1305
2797
  p.total = lineDiscount.discountedLinePrice;
1306
2798
  }
1307
- });
2799
+ }));
1308
2800
  }
1309
2801
  if (this.transactionDocument.basket.linePromotion &&
1310
2802
  this.transactionDocument.basket.linePromotion.length > 0) {
1311
- this.transactionDocument.basket.linePromotion.forEach((linePromotion) => {
2803
+ this.transactionDocument.basket.linePromotion.forEach((/**
2804
+ * @param {?} linePromotion
2805
+ * @return {?}
2806
+ */
2807
+ (linePromotion) => {
1312
2808
  if (product.itemLineId === linePromotion.itemLineId.toString()) {
1313
2809
  p.linePromotions = linePromotion;
1314
2810
  p.total = linePromotion.promotionLinePrice;
1315
2811
  }
1316
- });
2812
+ }));
1317
2813
  }
1318
2814
  if (this.transactionDocument.basket.taxBreakdown &&
1319
2815
  this.transactionDocument.basket.taxBreakdown.taxLines.length > 0) {
1320
- this.transactionDocument.basket.taxBreakdown.taxLines.forEach((taxLine) => {
2816
+ this.transactionDocument.basket.taxBreakdown.taxLines.forEach((/**
2817
+ * @param {?} taxLine
2818
+ * @return {?}
2819
+ */
2820
+ (taxLine) => {
1321
2821
  if (product.itemLineId && product.itemLineId === taxLine.itemLineId.toString()) {
1322
2822
  p.selectedVAT = taxLine.VAT;
1323
2823
  p.selectedVATCode = taxLine.VATCode;
1324
2824
  }
1325
- });
2825
+ }));
1326
2826
  }
1327
2827
  if (this.transactionDocument.type === TRANSACTION_TYPE.REFUND) {
1328
2828
  p.total = product.refundedTotal;
@@ -1345,7 +2845,7 @@ class TransactionDocumentBuilder {
1345
2845
  }
1346
2846
  }
1347
2847
  basket.products.push(p);
1348
- });
2848
+ }));
1349
2849
  basket = this.getTransactionDiscountAndTransactionPromotionPortion(basket);
1350
2850
  basket.total = (basket.basketTotal || 0) + this.getTotalDiscountWithTransactionDiscountsAndPromotions(basket);
1351
2851
  if (this.transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND) {
@@ -1356,7 +2856,8 @@ class TransactionDocumentBuilder {
1356
2856
  }
1357
2857
  /**
1358
2858
  * Gets basket details
1359
- * @returns refund basket details
2859
+ * @param {?} basket
2860
+ * @return {?} refund basket details
1360
2861
  */
1361
2862
  // getRefundBasketDetails(): Basket {
1362
2863
  // let basket: Basket = {
@@ -1492,53 +2993,96 @@ class TransactionDocumentBuilder {
1492
2993
  getTransactionDiscountAndTransactionPromotionPortion(basket) {
1493
2994
  if (basket.transactionDiscount &&
1494
2995
  basket.transactionDiscount.length > 0) {
1495
- basket.transactionDiscount.forEach((discount) => {
2996
+ basket.transactionDiscount.forEach((/**
2997
+ * @param {?} discount
2998
+ * @return {?}
2999
+ */
3000
+ (discount) => {
1496
3001
  if (!discount.itemLineIds) {
1497
- discount.itemLineIds = basket.products.map((product) => {
3002
+ discount.itemLineIds = basket.products.map((/**
3003
+ * @param {?} product
3004
+ * @return {?}
3005
+ */
3006
+ (product) => {
1498
3007
  return product.itemLineId;
1499
- });
3008
+ }));
1500
3009
  }
1501
- basket = this.basketService?.transactionDiscountProductPortionCalc(basket, discount);
1502
- });
3010
+ basket = this.basketService.transactionDiscountProductPortionCalc(basket, discount);
3011
+ }));
1503
3012
  }
1504
3013
  if (basket.transactionPromotion &&
1505
3014
  basket.transactionPromotion.length > 0) {
1506
- basket.transactionPromotion.forEach((tPromotion) => {
3015
+ basket.transactionPromotion.forEach((/**
3016
+ * @param {?} tPromotion
3017
+ * @return {?}
3018
+ */
3019
+ (tPromotion) => {
1507
3020
  if (!tPromotion.itemLineIds) {
1508
- const filteredData = basket.products.filter((item) => {
3021
+ /** @type {?} */
3022
+ const filteredData = basket.products.filter((/**
3023
+ * @param {?} item
3024
+ * @return {?}
3025
+ */
3026
+ (item) => {
1509
3027
  return item.excludePromotion === false;
1510
- });
3028
+ }));
1511
3029
  tPromotion.itemLineIds =
1512
- filteredData.map((product) => {
3030
+ filteredData.map((/**
3031
+ * @param {?} product
3032
+ * @return {?}
3033
+ */
3034
+ (product) => {
1513
3035
  return product.itemLineId;
1514
- });
3036
+ }));
1515
3037
  }
1516
- basket = this.basketService?.transactionPromotionProductPortionCalc(basket, tPromotion);
1517
- });
3038
+ basket = this.basketService.transactionPromotionProductPortionCalc(basket, tPromotion);
3039
+ }));
1518
3040
  }
1519
3041
  return basket;
1520
3042
  }
3043
+ /**
3044
+ * @param {?} basketDetails
3045
+ * @return {?}
3046
+ */
1521
3047
  getTotalDiscountWithTransactionDiscountsAndPromotions(basketDetails) {
3048
+ /** @type {?} */
1522
3049
  let discountTotal = 0;
1523
3050
  if (basketDetails.transactionPromotion &&
1524
3051
  basketDetails.transactionPromotion.length > 0) {
1525
- discountTotal += basketDetails.transactionPromotion.reduce((n, { promotionAmount }) => n + promotionAmount, 0);
3052
+ discountTotal += basketDetails.transactionPromotion.reduce((/**
3053
+ * @param {?} n
3054
+ * @param {?} __1
3055
+ * @return {?}
3056
+ */
3057
+ (n, { promotionAmount }) => n + promotionAmount), 0);
1526
3058
  }
1527
3059
  if (basketDetails.transactionDiscount &&
1528
3060
  basketDetails.transactionDiscount.length > 0) {
1529
- discountTotal += basketDetails.transactionDiscount.reduce((n, { discountAmount }) => n + discountAmount, 0);
3061
+ discountTotal += basketDetails.transactionDiscount.reduce((/**
3062
+ * @param {?} n
3063
+ * @param {?} __1
3064
+ * @return {?}
3065
+ */
3066
+ (n, { discountAmount }) => n + discountAmount), 0);
1530
3067
  }
1531
3068
  console.log("ebasket : TransactionDocumentBuilder : Transaction discount Total:", discountTotal);
1532
3069
  return discountTotal;
1533
3070
  }
3071
+ /**
3072
+ * @param {?} currency
3073
+ * @param {?} value
3074
+ * @return {?}
3075
+ */
1534
3076
  appendCurrencySymbol(currency, value) {
1535
3077
  // value=this.decimalpipe.transform(value,'1.2');
1536
3078
  if (value >= 0) {
3079
+ /** @type {?} */
1537
3080
  const returnval = currency + value;
1538
3081
  console.log(returnval, "ebasket: add currency with value");
1539
3082
  return returnval;
1540
3083
  }
1541
3084
  else {
3085
+ /** @type {?} */
1542
3086
  const returnval = "-" + (currency + value * -1);
1543
3087
  console.log(returnval, "-(currency+(value*-1))");
1544
3088
  return returnval;
@@ -1616,14 +3160,25 @@ class TransactionDocumentBuilder {
1616
3160
  // }
1617
3161
  /**
1618
3162
  * Sale Total
1619
- * @param basketDetails
1620
- * @returns Sale Total
3163
+ * @param {?} basketDetails
3164
+ * @return {?} Sale Total
1621
3165
  */
1622
3166
  updateSaleTotal(basketDetails) {
1623
- const saleTotal = basketDetails.products.reduce((n, { totalLinePrice }) => n + totalLinePrice, 0);
3167
+ /** @type {?} */
3168
+ const saleTotal = basketDetails.products.reduce((/**
3169
+ * @param {?} n
3170
+ * @param {?} __1
3171
+ * @return {?}
3172
+ */
3173
+ (n, { totalLinePrice }) => n + totalLinePrice), 0);
1624
3174
  return saleTotal;
1625
3175
  }
3176
+ /**
3177
+ * @param {?} basketDetails
3178
+ * @return {?}
3179
+ */
1626
3180
  getTotalWithLineDiscountAndLinePromotionApplied(basketDetails) {
3181
+ /** @type {?} */
1627
3182
  let saletotal = 0.0;
1628
3183
  for (let product of basketDetails.products) {
1629
3184
  // if (product.linePromotions) {
@@ -1643,9 +3198,15 @@ class TransactionDocumentBuilder {
1643
3198
  }
1644
3199
  return saletotal;
1645
3200
  }
3201
+ /**
3202
+ * @param {?} basketDetails
3203
+ * @return {?}
3204
+ */
1646
3205
  getRefundedTotalWithQuantity(basketDetails) {
3206
+ /** @type {?} */
1647
3207
  let quantity = 0;
1648
3208
  for (let index = 0; index < basketDetails.products.length; index++) {
3209
+ /** @type {?} */
1649
3210
  const product = basketDetails.products[index];
1650
3211
  if (!product.refundedReasonDescription) {
1651
3212
  quantity = quantity + product.quantity;
@@ -1659,39 +3220,66 @@ class TransactionDocumentBuilder {
1659
3220
  }
1660
3221
  /**
1661
3222
  * Discount Total
1662
- * @returns Discount Total
3223
+ * @return {?} Discount Total
1663
3224
  */
1664
3225
  updateDiscountTotal() {
3226
+ /** @type {?} */
1665
3227
  let refundTotal = this.transactionDocument.basketSummary.refundTotal ? this.transactionDocument.basketSummary.refundTotal : 0;
1666
3228
  console.info("e-basket: transaction builder: refundTotal", JSON.stringify(refundTotal), JSON.stringify(this.transactionDocument.basketSummary));
3229
+ /** @type {?} */
1667
3230
  const discountTotal = Math.abs(Math.abs(this.transactionDocument.basketSummary.saleTotal) -
1668
3231
  (Math.abs(this.transactionDocument.basketSummary.basketTotal) + Math.abs(refundTotal)));
1669
3232
  console.log("e-basket: transaction builder: discountTotal", JSON.stringify(discountTotal));
1670
3233
  return Number(discountTotal.toFixed(2));
1671
3234
  }
3235
+ /**
3236
+ * @param {?} reasonCode
3237
+ * @return {?}
3238
+ */
1672
3239
  updateReasonCode(reasonCode) {
1673
3240
  this.transactionDocument.reasonCode = reasonCode.code;
1674
3241
  this.transactionDocument.reasonDescription = reasonCode.name;
1675
3242
  return this;
1676
3243
  }
3244
+ /**
3245
+ * @param {?} useroverride
3246
+ * @return {?}
3247
+ */
1677
3248
  updateManagerOverride(useroverride) {
1678
3249
  this.transactionDocument.override = useroverride;
1679
3250
  return this;
1680
3251
  }
3252
+ /**
3253
+ * @param {?} userID
3254
+ * @return {?}
3255
+ */
1681
3256
  updateUserID(userID) {
1682
3257
  this.transactionDocument.userId = userID;
1683
3258
  return this;
1684
3259
  }
3260
+ /**
3261
+ * @param {?} name
3262
+ * @return {?}
3263
+ */
1685
3264
  updateUserName(name) {
1686
3265
  this.transactionDocument.userName = name;
1687
3266
  return this;
1688
3267
  }
3268
+ /**
3269
+ * @param {?} customerDetail
3270
+ * @return {?}
3271
+ */
1689
3272
  addCustomerDetails(customerDetail) {
1690
3273
  this.transactionDocument.customer = customerDetail;
1691
3274
  return this;
1692
3275
  }
3276
+ /**
3277
+ * @param {?} basketDetails
3278
+ * @return {?}
3279
+ */
1693
3280
  updateTaxBreakdown(basketDetails) {
1694
3281
  // let transactionDiscountTotal = 0;
3282
+ /** @type {?} */
1695
3283
  let taxBreakdown = {
1696
3284
  taxLines: [],
1697
3285
  totalTaxableAmount: 0,
@@ -1708,7 +3296,12 @@ class TransactionDocumentBuilder {
1708
3296
  // }
1709
3297
  // );
1710
3298
  // }
1711
- basketDetails.products.forEach((product) => {
3299
+ basketDetails.products.forEach((/**
3300
+ * @param {?} product
3301
+ * @return {?}
3302
+ */
3303
+ (product) => {
3304
+ /** @type {?} */
1712
3305
  let taxLine = {
1713
3306
  itemLineId: product.itemLineId,
1714
3307
  VAT: product.selectedVAT ? product.selectedVAT : 0,
@@ -1721,7 +3314,8 @@ class TransactionDocumentBuilder {
1721
3314
  // step 1
1722
3315
  // if Transaction Discount and/or promotion applied, find net selling price of each product as taxableamount
1723
3316
  // if (transactionDiscountTotal > 0) {
1724
- product = this.basketService?.validateProductItemDiscount(product);
3317
+ product = this.basketService.validateProductItemDiscount(product);
3318
+ /** @type {?} */
1725
3319
  const productContributionInTotal = product.itemDiscounts.trnDiscountsPortion +
1726
3320
  product.itemDiscounts.trnPromotionsPortion -
1727
3321
  product.itemDiscounts.refundPortion;
@@ -1738,17 +3332,27 @@ class TransactionDocumentBuilder {
1738
3332
  // step 4 - update tax Line total
1739
3333
  taxLine.taxLineTotal = this.numberUtilService.trimTo2Decimal2(taxLine.taxableAmount - taxLine.PreTax);
1740
3334
  taxBreakdown.taxLines.push(taxLine);
1741
- });
3335
+ }));
1742
3336
  taxBreakdown.totalTaxableAmount = this.numberUtilService.trimTo2Decimal2(taxBreakdown.totalTaxableAmount);
1743
3337
  this.transactionDocument.basket.taxBreakdown = taxBreakdown;
1744
3338
  return this;
1745
3339
  }
3340
+ /**
3341
+ * @return {?}
3342
+ */
1746
3343
  updateTotalTaxSummary() {
1747
3344
  console.log("Total Tax Summery Request :", JSON.stringify(this.transactionDocument.basket.taxBreakdown));
3345
+ /** @type {?} */
1748
3346
  let totalTaxSummaryArray = [];
3347
+ /** @type {?} */
1749
3348
  let totalTaxSummaryGroup = [];
1750
3349
  console.log("Tax Lines for Total Tax Summery :", JSON.stringify(this.transactionDocument.basket.taxBreakdown.taxLines));
1751
- this.transactionDocument.basket.taxBreakdown.taxLines.forEach((element) => {
3350
+ this.transactionDocument.basket.taxBreakdown.taxLines.forEach((/**
3351
+ * @param {?} element
3352
+ * @return {?}
3353
+ */
3354
+ (element) => {
3355
+ /** @type {?} */
1752
3356
  let TaxSummary = {
1753
3357
  VATCode: "",
1754
3358
  VAT: -12345,
@@ -1762,10 +3366,20 @@ class TransactionDocumentBuilder {
1762
3366
  TaxSummary.TaxSum = this.numberUtilService.trimTo2Decimal2(element.taxLineTotal);
1763
3367
  TaxSummary.TXrateSum = this.numberUtilService.trimTo2Decimal2(TaxSummary.PreTaxSum + TaxSummary.TaxSum);
1764
3368
  totalTaxSummaryArray.push(TaxSummary);
1765
- });
3369
+ }));
1766
3370
  console.log("Total Tax Summery Without Grouped : ", JSON.stringify(totalTaxSummaryArray));
1767
- totalTaxSummaryGroup = totalTaxSummaryArray.reduce((preparedArray, currentObj) => {
1768
- let ind = preparedArray.findIndex((x) => x.VAT === currentObj.VAT);
3371
+ totalTaxSummaryGroup = totalTaxSummaryArray.reduce((/**
3372
+ * @param {?} preparedArray
3373
+ * @param {?} currentObj
3374
+ * @return {?}
3375
+ */
3376
+ (preparedArray, currentObj) => {
3377
+ /** @type {?} */
3378
+ let ind = preparedArray.findIndex((/**
3379
+ * @param {?} x
3380
+ * @return {?}
3381
+ */
3382
+ (x) => x.VAT === currentObj.VAT));
1769
3383
  if (ind === -1) {
1770
3384
  preparedArray.push(currentObj);
1771
3385
  }
@@ -1777,14 +3391,15 @@ class TransactionDocumentBuilder {
1777
3391
  preparedArray[ind].TXrateSum += currentObj.TXrateSum;
1778
3392
  }
1779
3393
  return preparedArray;
1780
- }, []);
3394
+ }), []);
1781
3395
  console.log("Total Tax Summer Group :", totalTaxSummaryGroup);
1782
3396
  this.transactionDocument.basket.totalTaxSummary = totalTaxSummaryGroup;
1783
3397
  return this;
1784
3398
  }
1785
3399
  /**
1786
3400
  * TransactionId
1787
- * @returns OriginalTransactionId
3401
+ * @param {?} tranDoc
3402
+ * @return {?} OriginalTransactionId
1788
3403
  */
1789
3404
  addOriginalTransId(tranDoc) {
1790
3405
  if (this.transactionDocument.type === TRANSACTION_TYPE.REFUND || this.transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND || this.transactionDocument.type === TRANSACTION_TYPE.SALE_EXCHANGE) {
@@ -1797,15 +3412,20 @@ class TransactionDocumentBuilder {
1797
3412
  }
1798
3413
  /**
1799
3414
  * unreferenced Refund
1800
- * @returns boolean value
3415
+ * @return {?} boolean value
1801
3416
  */
1802
3417
  addUnreferencedRefund() {
1803
3418
  this.transactionDocument.unreferencedRefund = true;
1804
3419
  return this;
1805
3420
  }
3421
+ /**
3422
+ * @return {?}
3423
+ */
1806
3424
  getRefundTotal() {
3425
+ /** @type {?} */
1807
3426
  let totalRefund = 0;
1808
3427
  for (let index = 0; index < this.transactionDocument.basket.products.length; index++) {
3428
+ /** @type {?} */
1809
3429
  const product = this.transactionDocument.basket.products[index];
1810
3430
  if (product.refundedTotal) {
1811
3431
  totalRefund = totalRefund + product.refundedTotal;
@@ -1814,13 +3434,52 @@ class TransactionDocumentBuilder {
1814
3434
  }
1815
3435
  return totalRefund;
1816
3436
  }
3437
+ /**
3438
+ * @param {?} docId
3439
+ * @return {?}
3440
+ */
1817
3441
  docId(docId) {
1818
3442
  this.transactionDocument.id = docId;
1819
3443
  return this;
1820
3444
  }
3445
+ }
3446
+ if (false) {
3447
+ /**
3448
+ * @type {?}
3449
+ * @private
3450
+ */
3451
+ TransactionDocumentBuilder.prototype.transactionDocument;
3452
+ /**
3453
+ * @type {?}
3454
+ * @private
3455
+ */
3456
+ TransactionDocumentBuilder.prototype.numberUtilService;
3457
+ /**
3458
+ * @type {?}
3459
+ * @private
3460
+ */
3461
+ TransactionDocumentBuilder.prototype.storeInfo;
3462
+ /**
3463
+ * @type {?}
3464
+ * @private
3465
+ */
3466
+ TransactionDocumentBuilder.prototype.currencyPipe;
3467
+ /**
3468
+ * @type {?}
3469
+ * @private
3470
+ */
3471
+ TransactionDocumentBuilder.prototype.basketService;
1821
3472
  }
1822
3473
 
3474
+ /**
3475
+ * @fileoverview added by tsickle
3476
+ * Generated from: lib/RJ-mapper.class.ts
3477
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3478
+ */
1823
3479
  class RJMapperBuilderClass {
3480
+ /**
3481
+ * @param {?=} transactionDoc
3482
+ */
1824
3483
  constructor(transactionDoc) {
1825
3484
  this.productQuantity = 0;
1826
3485
  this.itemCount = 0;
@@ -1870,143 +3529,207 @@ class RJMapperBuilderClass {
1870
3529
  userId: "",
1871
3530
  initiatingModule: "eBasket",
1872
3531
  export: false,
1873
- basket: {},
1874
- basketSummary: {},
3532
+ basket: (/** @type {?} */ ({})),
3533
+ basketSummary: (/** @type {?} */ ({})),
1875
3534
  baseCurrency: "",
1876
3535
  type: "",
1877
3536
  operationStatus: "",
1878
3537
  createdAt: "",
1879
3538
  updatedAt: "",
1880
3539
  id: "",
1881
- currentTransactionDetails: {},
3540
+ currentTransactionDetails: (/** @type {?} */ ({})),
1882
3541
  saleTotal: 0,
1883
3542
  };
1884
3543
  }
1885
3544
  this.initilizeItemCount();
1886
3545
  this.setLineNumberForProducts();
1887
3546
  }
3547
+ /**
3548
+ * @template THIS
3549
+ * @this {THIS}
3550
+ * @return {THIS}
3551
+ */
1888
3552
  getPosbasketInfo() {
1889
- this.rjObject['Keyword'] = this.generateKeyword();
1890
- this.rjObject['ID'] = this.generateId(this.transactionDocument.createdAt);
1891
- this.rjObject['XMLSchemaVersion'] = '2';
1892
- this.rjObject['LastUpdated'] = this.transactionDocument.updatedAt;
1893
- this.rjObject['MajorVersion'] = this.majorVersion;
1894
- this.rjObject['MinorVersion'] = this.minorVersion;
1895
- this.rjObject['ManifestVersion'] = this.manifestVersion;
1896
- this.rjObject['DatabaseSchemaVersion'] = this.databaseSchemaVersion;
1897
- this.rjObject['BasketType'] = this.basketType;
1898
- this.rjObject['State'] = this.getState();
1899
- this.rjObject['ExternalState'] = this.externalState;
1900
- return this;
3553
+ (/** @type {?} */ (this)).rjObject['Keyword'] = (/** @type {?} */ (this)).generateKeyword();
3554
+ (/** @type {?} */ (this)).rjObject['ID'] = (/** @type {?} */ (this)).generateId((/** @type {?} */ (this)).transactionDocument.createdAt);
3555
+ (/** @type {?} */ (this)).rjObject['XMLSchemaVersion'] = '2';
3556
+ (/** @type {?} */ (this)).rjObject['LastUpdated'] = (/** @type {?} */ (this)).transactionDocument.updatedAt;
3557
+ (/** @type {?} */ (this)).rjObject['MajorVersion'] = (/** @type {?} */ (this)).majorVersion;
3558
+ (/** @type {?} */ (this)).rjObject['MinorVersion'] = (/** @type {?} */ (this)).minorVersion;
3559
+ (/** @type {?} */ (this)).rjObject['ManifestVersion'] = (/** @type {?} */ (this)).manifestVersion;
3560
+ (/** @type {?} */ (this)).rjObject['DatabaseSchemaVersion'] = (/** @type {?} */ (this)).databaseSchemaVersion;
3561
+ (/** @type {?} */ (this)).rjObject['BasketType'] = (/** @type {?} */ (this)).basketType;
3562
+ (/** @type {?} */ (this)).rjObject['State'] = (/** @type {?} */ (this)).getState();
3563
+ (/** @type {?} */ (this)).rjObject['ExternalState'] = (/** @type {?} */ (this)).externalState;
3564
+ return (/** @type {?} */ (this));
1901
3565
  }
3566
+ /**
3567
+ * @template THIS
3568
+ * @this {THIS}
3569
+ * @return {THIS}
3570
+ */
1902
3571
  getheaderInfo() {
1903
- this.rjObject['Header'] = {};
1904
- this.rjObject['Header'].TimeZoneOffset = this.convertToString(this.generateTimezoneoffset(this.transactionDocument.createdAt));
1905
- this.rjObject['Header'].DateTimeCreated = this.transactionDocument.createdAt;
1906
- this.rjObject['Header'].OriginatedBy = {};
1907
- this.rjObject['Header'].OriginatedBy.DeviceID = this.deviceId;
1908
- this.rjObject['Header'].OriginatedBy.CashierID = this.cashierId;
1909
- this.rjObject['Header'].OriginatedBy.CompanyID = this.companyId;
1910
- this.rjObject['Header'].OriginatedBy.StoreID = this.transactionDocument.storeId;
1911
- this.rjObject['Header'].OriginatedBy.BranchID = this.transactionDocument.storeId;
1912
- this.rjObject['Header'].OriginatedBy.TerminalNumber = this.terminalNumber;
1913
- this.rjObject['Header'].OriginatedBy.TransactionNumber = this.transactionNumber;
1914
- this.rjObject['Header'].TaxMethodID = this.taxMethodId;
1915
- this.rjObject['Header'].DynamicStockLookup = this.generateDynamicStockLookUp(); //todo
1916
- this.rjObject['Header'].BasketLanguageID = this.basketLanguageId; //todo
1917
- this.rjObject['Header'].BasketCountryID = this.basketCountryId; //todo
1918
- this.rjObject['Header'].BasketCurrencyID = this.transactionDocument.baseCurrency;
1919
- this.rjObject['Header'].TradingRegionID = this.tradingRegionId;
1920
- this.rjObject['Header'].Eurozone = " "; //unknown
1921
- this.rjObject['Header'].EuroBaseExchangeRate = ""; //unknown
1922
- this.rjObject['Header'].PrintableName = ""; //unknown
1923
- return this;
3572
+ (/** @type {?} */ (this)).rjObject['Header'] = {};
3573
+ (/** @type {?} */ (this)).rjObject['Header'].TimeZoneOffset = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).generateTimezoneoffset((/** @type {?} */ (this)).transactionDocument.createdAt));
3574
+ (/** @type {?} */ (this)).rjObject['Header'].DateTimeCreated = (/** @type {?} */ (this)).transactionDocument.createdAt;
3575
+ (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy = {};
3576
+ (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.DeviceID = (/** @type {?} */ (this)).deviceId;
3577
+ (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.CashierID = (/** @type {?} */ (this)).cashierId;
3578
+ (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.CompanyID = (/** @type {?} */ (this)).companyId;
3579
+ (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.StoreID = (/** @type {?} */ (this)).transactionDocument.storeId;
3580
+ (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.BranchID = (/** @type {?} */ (this)).transactionDocument.storeId;
3581
+ (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.TerminalNumber = (/** @type {?} */ (this)).terminalNumber;
3582
+ (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.TransactionNumber = (/** @type {?} */ (this)).transactionNumber;
3583
+ (/** @type {?} */ (this)).rjObject['Header'].TaxMethodID = (/** @type {?} */ (this)).taxMethodId;
3584
+ (/** @type {?} */ (this)).rjObject['Header'].DynamicStockLookup = (/** @type {?} */ (this)).generateDynamicStockLookUp(); //todo
3585
+ (/** @type {?} */ (this)).rjObject['Header'].BasketLanguageID = (/** @type {?} */ (this)).basketLanguageId; //todo
3586
+ (/** @type {?} */ (this)).rjObject['Header'].BasketCountryID = (/** @type {?} */ (this)).basketCountryId; //todo
3587
+ (/** @type {?} */ (this)).rjObject['Header'].BasketCurrencyID = (/** @type {?} */ (this)).transactionDocument.baseCurrency;
3588
+ (/** @type {?} */ (this)).rjObject['Header'].TradingRegionID = (/** @type {?} */ (this)).tradingRegionId;
3589
+ (/** @type {?} */ (this)).rjObject['Header'].Eurozone = " "; //unknown
3590
+ (/** @type {?} */ (this)).rjObject['Header'].EuroBaseExchangeRate = ""; //unknown
3591
+ (/** @type {?} */ (this)).rjObject['Header'].PrintableName = ""; //unknown
3592
+ return (/** @type {?} */ (this));
1924
3593
  }
3594
+ /**
3595
+ * @template THIS
3596
+ * @this {THIS}
3597
+ * @return {THIS}
3598
+ */
1925
3599
  rjMapper() {
1926
- if (this.transactionDocument.type === TRANSACTION_TYPE.SALE) {
1927
- this.rjObject['ProductSale'] = [];
1928
- this.rjObject['ModifierItem'] = [];
1929
- this.transactionDocument.basket.products.forEach((element) => {
3600
+ if ((/** @type {?} */ (this)).transactionDocument.type === TRANSACTION_TYPE.SALE) {
3601
+ (/** @type {?} */ (this)).rjObject['ProductSale'] = [];
3602
+ (/** @type {?} */ (this)).rjObject['ModifierItem'] = [];
3603
+ (/** @type {?} */ (this)).transactionDocument.basket.products.forEach((/**
3604
+ * @param {?} element
3605
+ * @return {?}
3606
+ */
3607
+ (element) => {
3608
+ /** @type {?} */
1930
3609
  let lineDiscount = [];
1931
- if (this.transactionDocument.basket.lineDiscount && this.transactionDocument.basket.lineDiscount.length > 0) {
1932
- lineDiscount = this.transactionDocument.basket.lineDiscount.filter((x) => x.itemLineId === element.itemLineId);
3610
+ if ((/** @type {?} */ (this)).transactionDocument.basket.lineDiscount && (/** @type {?} */ (this)).transactionDocument.basket.lineDiscount.length > 0) {
3611
+ lineDiscount = (/** @type {?} */ (this)).transactionDocument.basket.lineDiscount.filter((/**
3612
+ * @param {?} x
3613
+ * @return {?}
3614
+ */
3615
+ (x) => x.itemLineId === element.itemLineId));
1933
3616
  if (lineDiscount.length > 0) {
1934
- const index = this.transactionDocument.basket.lineDiscount.indexOf(lineDiscount[0]);
3617
+ /** @type {?} */
3618
+ const index = (/** @type {?} */ (this)).transactionDocument.basket.lineDiscount.indexOf(lineDiscount[0]);
1935
3619
  if (index > -1) {
1936
- this.transactionDocument.basket.lineDiscount.splice(index, 1);
3620
+ (/** @type {?} */ (this)).transactionDocument.basket.lineDiscount.splice(index, 1);
1937
3621
  }
1938
3622
  }
1939
3623
  }
1940
- let data = this.addProduct(element, (lineDiscount.length > 0 ? lineDiscount[0] : null));
1941
- this.rjObject['ProductSale'].push(data);
1942
- this.getModifierItem(lineDiscount.length > 0 ? lineDiscount[0] : null, element.itemLineId);
1943
- });
1944
- }
1945
- else if (this.transactionDocument.type === TRANSACTION_TYPE.REFUND) {
1946
- this.rjObject['ProductReturn'] = [];
1947
- this.rjObject['ModifierItem'] = [];
1948
- this.transactionDocument.basket.products.forEach((element) => {
1949
- let data = this.returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
1950
- this.rjObject['ProductReturn'].push(data);
1951
- this.getModifierItem(element.lineDiscount, element.itemLineId);
1952
- });
1953
- }
1954
- else if (this.transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND) {
1955
- this.rjObject['ProductReturn'] = [];
1956
- this.rjObject['ModifierItem'] = [];
1957
- let transactionDoc = new TransactionDocumentBuilder().basket(this.transactionDocument.currentTransactionDetails).build();
1958
- transactionDoc.basket.products.forEach((element) => {
1959
- let data = this.returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
1960
- this.rjObject['ProductReturn'].push(data);
1961
- this.getModifierItem(element.lineDiscount, element.itemLineId);
1962
- });
1963
- }
1964
- else if (this.transactionDocument.type === TRANSACTION_TYPE.SALE_EXCHANGE) {
1965
- this.rjObject['ProductReturn'] = [];
1966
- this.rjObject['ProductSale'] = [];
1967
- this.rjObject['ModifierItem'] = [];
1968
- let transactionDoc = new TransactionDocumentBuilder().basket(this.transactionDocument.currentTransactionDetails).build();
1969
- transactionDoc.basket.products.forEach((element) => {
3624
+ /** @type {?} */
3625
+ let data = (/** @type {?} */ (this)).addProduct(element, (lineDiscount.length > 0 ? lineDiscount[0] : null));
3626
+ (/** @type {?} */ (this)).rjObject['ProductSale'].push(data);
3627
+ (/** @type {?} */ (this)).getModifierItem(lineDiscount.length > 0 ? lineDiscount[0] : null, element.itemLineId);
3628
+ }));
3629
+ }
3630
+ else if ((/** @type {?} */ (this)).transactionDocument.type === TRANSACTION_TYPE.REFUND) {
3631
+ (/** @type {?} */ (this)).rjObject['ProductReturn'] = [];
3632
+ (/** @type {?} */ (this)).rjObject['ModifierItem'] = [];
3633
+ (/** @type {?} */ (this)).transactionDocument.basket.products.forEach((/**
3634
+ * @param {?} element
3635
+ * @return {?}
3636
+ */
3637
+ (element) => {
3638
+ /** @type {?} */
3639
+ let data = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
3640
+ (/** @type {?} */ (this)).rjObject['ProductReturn'].push(data);
3641
+ (/** @type {?} */ (this)).getModifierItem(element.lineDiscount, element.itemLineId);
3642
+ }));
3643
+ }
3644
+ else if ((/** @type {?} */ (this)).transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND) {
3645
+ (/** @type {?} */ (this)).rjObject['ProductReturn'] = [];
3646
+ (/** @type {?} */ (this)).rjObject['ModifierItem'] = [];
3647
+ /** @type {?} */
3648
+ let transactionDoc = new TransactionDocumentBuilder().basket((/** @type {?} */ (this)).transactionDocument.currentTransactionDetails).build();
3649
+ transactionDoc.basket.products.forEach((/**
3650
+ * @param {?} element
3651
+ * @return {?}
3652
+ */
3653
+ (element) => {
3654
+ /** @type {?} */
3655
+ let data = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
3656
+ (/** @type {?} */ (this)).rjObject['ProductReturn'].push(data);
3657
+ (/** @type {?} */ (this)).getModifierItem(element.lineDiscount, element.itemLineId);
3658
+ }));
3659
+ }
3660
+ else if ((/** @type {?} */ (this)).transactionDocument.type === TRANSACTION_TYPE.SALE_EXCHANGE) {
3661
+ (/** @type {?} */ (this)).rjObject['ProductReturn'] = [];
3662
+ (/** @type {?} */ (this)).rjObject['ProductSale'] = [];
3663
+ (/** @type {?} */ (this)).rjObject['ModifierItem'] = [];
3664
+ /** @type {?} */
3665
+ let transactionDoc = new TransactionDocumentBuilder().basket((/** @type {?} */ (this)).transactionDocument.currentTransactionDetails).build();
3666
+ transactionDoc.basket.products.forEach((/**
3667
+ * @param {?} element
3668
+ * @return {?}
3669
+ */
3670
+ (element) => {
1970
3671
  if (element.refundedQuantity > 0) {
1971
- let returnProduct = this.returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
1972
- this.rjObject['ProductReturn'].push(returnProduct);
3672
+ /** @type {?} */
3673
+ let returnProduct = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
3674
+ (/** @type {?} */ (this)).rjObject['ProductReturn'].push(returnProduct);
1973
3675
  }
1974
3676
  else {
1975
- let addProduct = this.addProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
1976
- this.rjObject['ProductSale'].push(addProduct);
3677
+ /** @type {?} */
3678
+ let addProduct = (/** @type {?} */ (this)).addProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
3679
+ (/** @type {?} */ (this)).rjObject['ProductSale'].push(addProduct);
1977
3680
  }
1978
- this.getModifierItem(element.lineDiscount, element.itemLineId);
1979
- });
3681
+ (/** @type {?} */ (this)).getModifierItem(element.lineDiscount, element.itemLineId);
3682
+ }));
1980
3683
  }
1981
- return this;
3684
+ return (/** @type {?} */ (this));
1982
3685
  }
3686
+ /**
3687
+ * @template THIS
3688
+ * @this {THIS}
3689
+ * @return {THIS}
3690
+ */
1983
3691
  getBasketDiscount() {
1984
- this.rjObject['BasketDiscount'] = [];
1985
- if (!this.transactionDocument.basket.transactionDiscount)
1986
- return this;
1987
- this.transactionDocument.basket.transactionDiscount.forEach((element) => {
3692
+ (/** @type {?} */ (this)).rjObject['BasketDiscount'] = [];
3693
+ if (!(/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount)
3694
+ return (/** @type {?} */ (this));
3695
+ (/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount.forEach((/**
3696
+ * @param {?} element
3697
+ * @return {?}
3698
+ */
3699
+ (element) => {
3700
+ /** @type {?} */
1988
3701
  let obj = {};
1989
3702
  obj['XMLSchemaVersion'] = 1;
1990
3703
  obj['NetValue'] = element.discountAmount < 0 ? element.discountAmount : -element.discountAmount;
1991
3704
  obj['EffectiveNetValue'] = element.discountAmount < 0 ? element.discountAmount : -element.discountAmount;
1992
3705
  obj['Description'] = element.reasonCode;
1993
- obj['UserID'] = this.transactionDocument.basket.userId;
3706
+ obj['UserID'] = (/** @type {?} */ (this)).transactionDocument.basket.userId;
1994
3707
  obj['ReasonCodeID'] = element.reasonCode;
1995
3708
  obj['DiscountType'] = element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1; // todo - compare values
1996
3709
  obj['RoundingRule'] = 2;
1997
3710
  obj['ModifiedLineNumber '] = [];
1998
- element.itemLineIds.forEach((element) => {
3711
+ element.itemLineIds.forEach((/**
3712
+ * @param {?} element
3713
+ * @return {?}
3714
+ */
3715
+ (element) => {
1999
3716
  obj['ModifiedLineNumber'].push(element);
2000
- });
2001
- obj['LineNumber'] = this.generateLineNumber();
3717
+ }));
3718
+ obj['LineNumber'] = (/** @type {?} */ (this)).generateLineNumber();
2002
3719
  // obj['DiscountedValue'] = obj['discountAmount'] // todo - confirm value before discount;
2003
3720
  // obj['DiscountPercentage'] = obj['discountAmount'] / 100 ; // todo - optional
2004
- this.rjObject['BasketDiscount'].push(obj);
2005
- });
2006
- return this;
3721
+ (/** @type {?} */ (this)).rjObject['BasketDiscount'].push(obj);
3722
+ }));
3723
+ return (/** @type {?} */ (this));
2007
3724
  }
3725
+ /**
3726
+ * @param {?} data
3727
+ * @param {?} lineNo
3728
+ * @return {?}
3729
+ */
2008
3730
  getModifierItem(data, lineNo) {
2009
3731
  if (data && lineNo) {
3732
+ /** @type {?} */
2010
3733
  let obj = {};
2011
3734
  obj.XMLSchemaVersion = 1;
2012
3735
  obj.LineNumber = this.generateLineNumber();
@@ -2023,132 +3746,217 @@ class RJMapperBuilderClass {
2023
3746
  this.rjObject['ModifierItem'].push(obj);
2024
3747
  }
2025
3748
  }
3749
+ /**
3750
+ * @template THIS
3751
+ * @this {THIS}
3752
+ * @return {THIS}
3753
+ */
2026
3754
  getTrailerInfo() {
2027
- this.rjObject['Trailer'] = {};
2028
- this.rjObject.Trailer.DateTimeCompleted = this.transactionDocument.updatedAt;
2029
- this.rjObject.Trailer.CompletedBy = {};
2030
- this.rjObject.Trailer.CompletedBy.DeviceID = this.deviceId; //todo
2031
- this.rjObject.Trailer.CompletedBy.CashierID = this.cashierId; //todo
2032
- this.rjObject.Trailer.CompletedBy.StoreID = this.transactionDocument.storeId;
2033
- this.rjObject.Trailer.CompletedBy.BranchID = this.transactionDocument.storeId;
2034
- this.rjObject.Trailer.CompletedBy.TerminalNumber = this.transactionDocument.terminalId;
2035
- this.rjObject.Trailer.Total = this.convertToString(this.transactionDocument.basketSummary.basketTotal * 100);
2036
- this.rjObject.Trailer.ItemCount = this.itemCount; //gives total count for product
2037
- this.rjObject.Trailer.ItemQuantity = this.convertToString(this.transactionDocument.basketSummary.totalItems);
2038
- this.rjObject.Trailer.NetItemQuantity = this.convertToString(this.transactionDocument.basketSummary.totalItems);
2039
- this.rjObject.Trailer.TaxTotal = this.convertToString(this.transactionDocument.basketSummary.VATTotal);
2040
- this.rjObject.Trailer.SequenceDeviceID = this.deviceId;
2041
- this.rjObject.Trailer.SequenceNumber = 'snsn'; //static for now
2042
- this.rjObject['Trailer']['TaxItem'] = [];
2043
- this.transactionDocument.basket.taxBreakdown.taxLines.forEach((element) => {
3755
+ (/** @type {?} */ (this)).rjObject['Trailer'] = {};
3756
+ (/** @type {?} */ (this)).rjObject.Trailer.DateTimeCompleted = (/** @type {?} */ (this)).transactionDocument.updatedAt;
3757
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy = {};
3758
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.DeviceID = (/** @type {?} */ (this)).deviceId; //todo
3759
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.CashierID = (/** @type {?} */ (this)).cashierId; //todo
3760
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.StoreID = (/** @type {?} */ (this)).transactionDocument.storeId;
3761
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.BranchID = (/** @type {?} */ (this)).transactionDocument.storeId;
3762
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.TerminalNumber = (/** @type {?} */ (this)).transactionDocument.terminalId;
3763
+ (/** @type {?} */ (this)).rjObject.Trailer.Total = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.basketTotal * 100);
3764
+ (/** @type {?} */ (this)).rjObject.Trailer.ItemCount = (/** @type {?} */ (this)).itemCount; //gives total count for product
3765
+ (/** @type {?} */ (this)).rjObject.Trailer.ItemQuantity = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.totalItems);
3766
+ (/** @type {?} */ (this)).rjObject.Trailer.NetItemQuantity = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.totalItems);
3767
+ (/** @type {?} */ (this)).rjObject.Trailer.TaxTotal = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.VATTotal);
3768
+ (/** @type {?} */ (this)).rjObject.Trailer.SequenceDeviceID = (/** @type {?} */ (this)).deviceId;
3769
+ (/** @type {?} */ (this)).rjObject.Trailer.SequenceNumber = 'snsn'; //static for now
3770
+ (/** @type {?} */ (this)).rjObject['Trailer']['TaxItem'] = [];
3771
+ (/** @type {?} */ (this)).transactionDocument.basket.taxBreakdown.taxLines.forEach((/**
3772
+ * @param {?} element
3773
+ * @return {?}
3774
+ */
3775
+ (element) => {
3776
+ /** @type {?} */
2044
3777
  let obj = {};
2045
- obj['XMLSchemaVersion'] = this.xmlSchemaVersion;
3778
+ obj['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
2046
3779
  obj['TaxRate'] = element.VAT;
2047
- obj['TaxableTotal'] = this.convertToString(element.taxableAmount);
2048
- obj['TaxTotal'] = this.convertToString(element.taxLineTotal);
2049
- obj['TaxDescription'] = this.convertToString(element.VATCode);
3780
+ obj['TaxableTotal'] = (/** @type {?} */ (this)).convertToString(element.taxableAmount);
3781
+ obj['TaxTotal'] = (/** @type {?} */ (this)).convertToString(element.taxLineTotal);
3782
+ obj['TaxDescription'] = (/** @type {?} */ (this)).convertToString(element.VATCode);
2050
3783
  obj['TaxIncluded'] = '1';
2051
3784
  obj['TaxPercentage'] = element.VAT; // todo
2052
- this.rjObject['Trailer']['TaxItem'].push(obj);
2053
- });
3785
+ (/** @type {?} */ (this)).rjObject['Trailer']['TaxItem'].push(obj);
3786
+ }));
2054
3787
  // TODO: make Trailer object from promotion
2055
- this.rjObject['Trailer']['PromotionItem'] = [];
2056
- this.transactionDocument.basket.linePromotion.forEach((element) => {
3788
+ (/** @type {?} */ (this)).rjObject['Trailer']['PromotionItem'] = [];
3789
+ (/** @type {?} */ (this)).transactionDocument.basket.linePromotion.forEach((/**
3790
+ * @param {?} element
3791
+ * @return {?}
3792
+ */
3793
+ (element) => {
3794
+ /** @type {?} */
2057
3795
  let obj = {};
2058
3796
  obj['PromotionID'] = element.promotionId;
2059
3797
  obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
2060
3798
  obj['PromotionQuantity'] = ""; // todo - not avaialble
2061
3799
  obj['PromotionDescription'] = element.displayText;
2062
- obj['PromotionHit']['XMLSchemaVersion'] = this.transactionDocument.storeId;
3800
+ obj['PromotionHit']['XMLSchemaVersion'] = (/** @type {?} */ (this)).transactionDocument.storeId;
2063
3801
  obj['PromotionHit']['HitNumber'] = ""; // todo;
2064
3802
  obj['PromotionHit']['HitQuantity'] = ""; // todo;
2065
3803
  obj['PromotionHit']['HitSaving'] = ""; // todo;
2066
3804
  obj['PromotionHit']['PromotionTrigger'] = [];
2067
- element.trigger.forEach((subElement) => {
3805
+ element.trigger.forEach((/**
3806
+ * @param {?} subElement
3807
+ * @return {?}
3808
+ */
3809
+ (subElement) => {
3810
+ /** @type {?} */
2068
3811
  let objSub = {};
2069
- let product = this.transactionDocument.basket.products.find((item) => item.lineItemId == subElement.itemLineId);
2070
- objSub['XMLSchemaVersion'] = this.xmlSchemaVersion;
2071
- objSub['ProductID'] = this.transactionDocument.basket.products.find((item) => item.itemLineId === subElement.itemLineId).SKU;
2072
- objSub['UnitValue'] = this.convertToString(element.promotionLinePrice / product.quantity);
2073
- objSub['LineNumber'] = this.convertToString(subElement.itemLineId);
2074
- objSub['Quantity'] = this.convertToString(subElement.quantity.toFixed(1));
2075
- objSub['TaxCode'] = this.transactionDocument.basket.taxBreakdown.taxLines.find((item) => item.itemLineId == element.itemLineId).VATCode; // todo
3812
+ /** @type {?} */
3813
+ let product = (/** @type {?} */ (this)).transactionDocument.basket.products.find((/**
3814
+ * @param {?} item
3815
+ * @return {?}
3816
+ */
3817
+ (item) => item.lineItemId == subElement.itemLineId));
3818
+ objSub['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
3819
+ objSub['ProductID'] = (/** @type {?} */ (this)).transactionDocument.basket.products.find((/**
3820
+ * @param {?} item
3821
+ * @return {?}
3822
+ */
3823
+ (item) => item.itemLineId === subElement.itemLineId)).SKU;
3824
+ objSub['UnitValue'] = (/** @type {?} */ (this)).convertToString(element.promotionLinePrice / product.quantity);
3825
+ objSub['LineNumber'] = (/** @type {?} */ (this)).convertToString(subElement.itemLineId);
3826
+ objSub['Quantity'] = (/** @type {?} */ (this)).convertToString(subElement.quantity.toFixed(1));
3827
+ objSub['TaxCode'] = (/** @type {?} */ (this)).transactionDocument.basket.taxBreakdown.taxLines.find((/**
3828
+ * @param {?} item
3829
+ * @return {?}
3830
+ */
3831
+ (item) => item.itemLineId == element.itemLineId)).VATCode; // todo
2076
3832
  obj['PromotionHit']['PromotionTrigger'].push(objSub);
2077
- });
2078
- this.rjObject['Trailer']['PromotionItem'].push(obj);
2079
- });
3833
+ }));
3834
+ (/** @type {?} */ (this)).rjObject['Trailer']['PromotionItem'].push(obj);
3835
+ }));
2080
3836
  //console.log(this.rjObject);
2081
- return this;
3837
+ return (/** @type {?} */ (this));
2082
3838
  }
3839
+ /**
3840
+ * @template THIS
3841
+ * @this {THIS}
3842
+ * @return {THIS}
3843
+ */
2083
3844
  getTenderInfo() {
2084
- this.rjObject['CashTender'] = [];
2085
- if (this.transactionDocument.paymentDetails && this.transactionDocument.paymentDetails.length > 0) {
2086
- this.transactionDocument.paymentDetails.forEach((element) => {
2087
- let value = this.paymentTypes.filter(x => x.paymentType?.toUpperCase() === element.paymentType.toUpperCase());
3845
+ (/** @type {?} */ (this)).rjObject['CashTender'] = [];
3846
+ if ((/** @type {?} */ (this)).transactionDocument.paymentDetails && (/** @type {?} */ (this)).transactionDocument.paymentDetails.length > 0) {
3847
+ (/** @type {?} */ (this)).transactionDocument.paymentDetails.forEach((/**
3848
+ * @param {?} element
3849
+ * @return {?}
3850
+ */
3851
+ (element) => {
3852
+ /** @type {?} */
3853
+ let value = (/** @type {?} */ (this)).paymentTypes.filter((/**
3854
+ * @param {?} x
3855
+ * @return {?}
3856
+ */
3857
+ x => x.paymentType.toUpperCase() === element.paymentType.toUpperCase()));
2088
3858
  if (element.paymentType.toUpperCase() === 'GIFT CARD') {
3859
+ /** @type {?} */
2089
3860
  let obj = {
2090
- XMLSchemaVersion: this.xmlSchemaVersion,
2091
- LineNumber: this.generateLineNumber(),
2092
- NetValue: this.convertToString(-1 * (Math.round(element.amount))),
2093
- EffectiveNetValue: this.convertToString(-1 * (Math.round(element.amount))),
2094
- Description: this.getDescription(value[0].paymentType, element),
2095
- DeviceID: this.deviceId,
2096
- UserID: this.userId,
2097
- DateTimeCreated: this.transactionDocument.updatedAt,
3861
+ XMLSchemaVersion: (/** @type {?} */ (this)).xmlSchemaVersion,
3862
+ LineNumber: (/** @type {?} */ (this)).generateLineNumber(),
3863
+ NetValue: (/** @type {?} */ (this)).convertToString(-1 * (Math.round(element.amount))),
3864
+ EffectiveNetValue: (/** @type {?} */ (this)).convertToString(-1 * (Math.round(element.amount))),
3865
+ Description: (/** @type {?} */ (this)).getDescription(value[0].paymentType, element),
3866
+ //todo
3867
+ DeviceID: (/** @type {?} */ (this)).deviceId,
3868
+ //todo
3869
+ UserID: (/** @type {?} */ (this)).userId,
3870
+ //todo
3871
+ DateTimeCreated: (/** @type {?} */ (this)).transactionDocument.updatedAt,
2098
3872
  TenderType: value[0].tenderType,
2099
3873
  TenderSubType: value[0].tenderSubType,
2100
- TenderAmount: this.convertToString(-1 * (Math.round(element.amount))),
2101
- CurrencyID: this.transactionDocument.baseCurrency,
2102
- CurrencyDescription: this.transactionDocument.baseCurrency,
3874
+ TenderAmount: (/** @type {?} */ (this)).convertToString(-1 * (Math.round(element.amount))),
3875
+ CurrencyID: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
3876
+ CurrencyDescription: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
2103
3877
  GiftVoucherSalesAllowed: '',
3878
+ //todo
2104
3879
  AllowRechargeableVoucherSales: '',
3880
+ //todo
2105
3881
  GiftVoucherID: ''
2106
3882
  };
2107
- this.rjObject['CashTender'].push(obj);
3883
+ (/** @type {?} */ (this)).rjObject['CashTender'].push(obj);
2108
3884
  }
2109
3885
  else {
3886
+ /** @type {?} */
2110
3887
  let obj1 = {
2111
3888
  XMLSchemaVersion: "1",
2112
- LineNumber: this.generateLineNumber(),
3889
+ LineNumber: (/** @type {?} */ (this)).generateLineNumber(),
3890
+ //todo
2113
3891
  NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
2114
3892
  EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
2115
- Description: this.getDescription(value[0].paymentType, element),
2116
- DeviceID: this.deviceId,
2117
- UserID: this.userId,
2118
- DateTimeCreated: this.transactionDocument.updatedAt,
3893
+ Description: (/** @type {?} */ (this)).getDescription(value[0].paymentType, element),
3894
+ //todo
3895
+ DeviceID: (/** @type {?} */ (this)).deviceId,
3896
+ //todo
3897
+ UserID: (/** @type {?} */ (this)).userId,
3898
+ //todo
3899
+ DateTimeCreated: (/** @type {?} */ (this)).transactionDocument.updatedAt,
2119
3900
  TenderType: value[0].tenderType,
2120
3901
  TenderSubType: value[0].tenderSubType,
2121
3902
  TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
2122
- CurrencyID: this.transactionDocument.baseCurrency,
2123
- CurrencyDescription: this.transactionDocument.baseCurrency,
3903
+ CurrencyID: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
3904
+ CurrencyDescription: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
2124
3905
  IncludeInTransactionTotalCheck: "1",
2125
3906
  AllowRechargeableVoucherSales: "1",
2126
3907
  OpenDrawerAtEnd: "1"
2127
3908
  };
2128
- this.rjObject['CashTender'].push(obj1);
3909
+ (/** @type {?} */ (this)).rjObject['CashTender'].push(obj1);
2129
3910
  }
2130
- });
3911
+ }));
2131
3912
  }
2132
- return this;
3913
+ return (/** @type {?} */ (this));
2133
3914
  }
3915
+ /**
3916
+ * @return {?}
3917
+ */
2134
3918
  setLineNumberForProducts() {
3919
+ /** @type {?} */
2135
3920
  let itemLineIdArray = [];
2136
- itemLineIdArray = this.transactionDocument.basket.products.map((product) => {
3921
+ itemLineIdArray = this.transactionDocument.basket.products.map((/**
3922
+ * @param {?} product
3923
+ * @return {?}
3924
+ */
3925
+ (product) => {
2137
3926
  return parseInt(product.itemLineId);
2138
- });
2139
- this.largestNumber = itemLineIdArray.reduce((a, b) => Math.max(a, b));
3927
+ }));
3928
+ this.largestNumber = itemLineIdArray.reduce((/**
3929
+ * @param {?} a
3930
+ * @param {?} b
3931
+ * @return {?}
3932
+ */
3933
+ (a, b) => Math.max(a, b)));
2140
3934
  }
3935
+ /**
3936
+ * @return {?}
3937
+ */
2141
3938
  generateLineNumber() {
2142
3939
  this.largestNumber += 1;
2143
3940
  this.itemCount += 1;
2144
3941
  return this.largestNumber;
2145
3942
  }
3943
+ /**
3944
+ * @return {?}
3945
+ */
2146
3946
  initilizeItemCount() {
2147
3947
  this.itemCount = this.transactionDocument.basket.products.length;
2148
3948
  }
3949
+ /**
3950
+ * @return {?}
3951
+ */
2149
3952
  build() {
2150
3953
  return this.rjObject;
2151
3954
  }
3955
+ /**
3956
+ * @param {?} paymentType
3957
+ * @param {?} element
3958
+ * @return {?}
3959
+ */
2152
3960
  getDescription(paymentType, element) {
2153
3961
  if (paymentType.toUpperCase() === 'CARD') {
2154
3962
  return element.cardType;
@@ -2157,94 +3965,224 @@ class RJMapperBuilderClass {
2157
3965
  return paymentType;
2158
3966
  }
2159
3967
  }
3968
+ /**
3969
+ * @template THIS
3970
+ * @this {THIS}
3971
+ * @param {?} id
3972
+ * @return {THIS}
3973
+ */
2160
3974
  setDeviceInfo(id) {
2161
- this.deviceId = id;
2162
- return this;
3975
+ (/** @type {?} */ (this)).deviceId = id;
3976
+ return (/** @type {?} */ (this));
2163
3977
  }
3978
+ /**
3979
+ * @template THIS
3980
+ * @this {THIS}
3981
+ * @param {?} id
3982
+ * @return {THIS}
3983
+ */
2164
3984
  setUserInfo(id) {
2165
- this.userId = id;
2166
- return this;
3985
+ (/** @type {?} */ (this)).userId = id;
3986
+ return (/** @type {?} */ (this));
2167
3987
  }
3988
+ /**
3989
+ * @param {?} value
3990
+ * @return {?}
3991
+ */
2168
3992
  removeDecimal(value) {
2169
3993
  return value * 100;
2170
3994
  }
3995
+ /**
3996
+ * @template THIS
3997
+ * @this {THIS}
3998
+ * @param {?} value
3999
+ * @return {THIS}
4000
+ */
2171
4001
  setTransactionNumber(value) {
2172
- this.transactionNumber = value;
2173
- return this;
4002
+ (/** @type {?} */ (this)).transactionNumber = value;
4003
+ return (/** @type {?} */ (this));
2174
4004
  }
4005
+ /**
4006
+ * @template THIS
4007
+ * @this {THIS}
4008
+ * @param {?} value
4009
+ * @return {THIS}
4010
+ */
2175
4011
  setManifestVersion(value) {
2176
- this.manifestVersion = value;
2177
- return this;
4012
+ (/** @type {?} */ (this)).manifestVersion = value;
4013
+ return (/** @type {?} */ (this));
2178
4014
  }
4015
+ /**
4016
+ * @template THIS
4017
+ * @this {THIS}
4018
+ * @param {?} value
4019
+ * @return {THIS}
4020
+ */
2179
4021
  setDatabaseSchemaVersion(value) {
2180
- this.databaseSchemaVersion = value;
2181
- return this;
4022
+ (/** @type {?} */ (this)).databaseSchemaVersion = value;
4023
+ return (/** @type {?} */ (this));
2182
4024
  }
4025
+ /**
4026
+ * @template THIS
4027
+ * @this {THIS}
4028
+ * @param {?} value
4029
+ * @return {THIS}
4030
+ */
2183
4031
  setBasketType(value) {
2184
- this.basketType = value;
2185
- return this;
4032
+ (/** @type {?} */ (this)).basketType = value;
4033
+ return (/** @type {?} */ (this));
2186
4034
  }
4035
+ /**
4036
+ * @template THIS
4037
+ * @this {THIS}
4038
+ * @param {?} value
4039
+ * @return {THIS}
4040
+ */
2187
4041
  setTradingRegionID(value) {
2188
- this.tradingRegionId = value;
2189
- return this;
4042
+ (/** @type {?} */ (this)).tradingRegionId = value;
4043
+ return (/** @type {?} */ (this));
2190
4044
  }
4045
+ /**
4046
+ * @template THIS
4047
+ * @this {THIS}
4048
+ * @param {?} value
4049
+ * @return {THIS}
4050
+ */
2191
4051
  setCompanyID(value) {
2192
- this.companyId = value;
2193
- return this;
4052
+ (/** @type {?} */ (this)).companyId = value;
4053
+ return (/** @type {?} */ (this));
2194
4054
  }
4055
+ /**
4056
+ * @template THIS
4057
+ * @this {THIS}
4058
+ * @param {?} value
4059
+ * @return {THIS}
4060
+ */
2195
4061
  setTaxMethodID(value) {
2196
- this.taxMethodId = value;
2197
- return this;
4062
+ (/** @type {?} */ (this)).taxMethodId = value;
4063
+ return (/** @type {?} */ (this));
2198
4064
  }
4065
+ /**
4066
+ * @template THIS
4067
+ * @this {THIS}
4068
+ * @param {?} value
4069
+ * @return {THIS}
4070
+ */
2199
4071
  setMajorVersion(value) {
2200
- this.majorVersion = value;
2201
- return this;
4072
+ (/** @type {?} */ (this)).majorVersion = value;
4073
+ return (/** @type {?} */ (this));
2202
4074
  }
4075
+ /**
4076
+ * @template THIS
4077
+ * @this {THIS}
4078
+ * @param {?} value
4079
+ * @return {THIS}
4080
+ */
2203
4081
  setMinorVersion(value) {
2204
- this.minorVersion = value;
2205
- return this;
4082
+ (/** @type {?} */ (this)).minorVersion = value;
4083
+ return (/** @type {?} */ (this));
2206
4084
  }
4085
+ /**
4086
+ * @template THIS
4087
+ * @this {THIS}
4088
+ * @param {?} value
4089
+ * @return {THIS}
4090
+ */
2207
4091
  setXMLSchemaVersion(value) {
2208
- this.xmlSchemaVersion = value;
2209
- return this;
4092
+ (/** @type {?} */ (this)).xmlSchemaVersion = value;
4093
+ return (/** @type {?} */ (this));
2210
4094
  }
4095
+ /**
4096
+ * @template THIS
4097
+ * @this {THIS}
4098
+ * @param {?} value
4099
+ * @return {THIS}
4100
+ */
2211
4101
  setExternalState(value) {
2212
- this.externalState = value;
2213
- return this;
4102
+ (/** @type {?} */ (this)).externalState = value;
4103
+ return (/** @type {?} */ (this));
2214
4104
  }
4105
+ /**
4106
+ * @template THIS
4107
+ * @this {THIS}
4108
+ * @param {?} value
4109
+ * @return {THIS}
4110
+ */
2215
4111
  setCashierID(value) {
2216
- this.cashierId = value;
2217
- return this;
4112
+ (/** @type {?} */ (this)).cashierId = value;
4113
+ return (/** @type {?} */ (this));
2218
4114
  }
4115
+ /**
4116
+ * @template THIS
4117
+ * @this {THIS}
4118
+ * @param {?} value
4119
+ * @return {THIS}
4120
+ */
2219
4121
  setTerminalNumber(value) {
2220
- this.terminalNumber = value;
2221
- return this;
4122
+ (/** @type {?} */ (this)).terminalNumber = value;
4123
+ return (/** @type {?} */ (this));
2222
4124
  }
4125
+ /**
4126
+ * @template THIS
4127
+ * @this {THIS}
4128
+ * @param {?} value
4129
+ * @return {THIS}
4130
+ */
2223
4131
  setBasketLanguageID(value) {
2224
- this.basketLanguageId = value;
2225
- return this;
4132
+ (/** @type {?} */ (this)).basketLanguageId = value;
4133
+ return (/** @type {?} */ (this));
2226
4134
  }
4135
+ /**
4136
+ * @template THIS
4137
+ * @this {THIS}
4138
+ * @param {?} value
4139
+ * @return {THIS}
4140
+ */
2227
4141
  setBasketCountryID(value) {
2228
- this.basketCountryId = value;
2229
- return this;
4142
+ (/** @type {?} */ (this)).basketCountryId = value;
4143
+ return (/** @type {?} */ (this));
2230
4144
  }
4145
+ /**
4146
+ * @template THIS
4147
+ * @this {THIS}
4148
+ * @param {?} value
4149
+ * @return {THIS}
4150
+ */
2231
4151
  setBasketCurrencyID(value) {
2232
- this.basketCurrencyId = value;
2233
- return this;
4152
+ (/** @type {?} */ (this)).basketCurrencyId = value;
4153
+ return (/** @type {?} */ (this));
2234
4154
  }
4155
+ /**
4156
+ * @param {?} date
4157
+ * @return {?}
4158
+ */
2235
4159
  generateId(date) {
4160
+ /** @type {?} */
2236
4161
  let newDateTime = date.replace(/[^0-9]/g, '');
4162
+ /** @type {?} */
2237
4163
  let id = (this.deviceId + '|' + newDateTime + '|' + this.transactionNumber).toString();
2238
4164
  return id;
2239
4165
  }
4166
+ /**
4167
+ * @param {?} date
4168
+ * @return {?}
4169
+ */
2240
4170
  generateTimezoneoffset(date) {
4171
+ /** @type {?} */
2241
4172
  let x = date ? date : '';
2242
4173
  return new Date(x).getTimezoneOffset();
2243
4174
  }
4175
+ /**
4176
+ * @return {?}
4177
+ */
2244
4178
  generateKeyword() {
4179
+ /** @type {?} */
2245
4180
  let x = (this.companyId + '|' + this.transactionDocument.storeId + '|' + this.terminalNumber + '|' + this.transactionNumber).toString();
2246
4181
  return x;
2247
4182
  }
4183
+ /**
4184
+ * @return {?}
4185
+ */
2248
4186
  getState() {
2249
4187
  if (this.transactionDocument.operationStatus === 'PAY_SUCCESS') {
2250
4188
  return 'Completed';
@@ -2253,7 +4191,13 @@ class RJMapperBuilderClass {
2253
4191
  return 'Cancelled';
2254
4192
  }
2255
4193
  }
4194
+ /**
4195
+ * @param {?} element
4196
+ * @param {?} lineDiscount
4197
+ * @return {?}
4198
+ */
2256
4199
  returnProduct(element, lineDiscount) {
4200
+ /** @type {?} */
2257
4201
  let obj = {};
2258
4202
  obj['LineNumber'] = element['itemLineId'];
2259
4203
  obj['NetValue'] = this.removeDecimal(element['refundedTotal']);
@@ -2273,14 +4217,24 @@ class RJMapperBuilderClass {
2273
4217
  obj['Return']['ReturnReasonID'] = element['refundedReason'];
2274
4218
  obj['Return']['ReturnDescription'] = element['refundedReasonDescription'];
2275
4219
  obj['Return']['ReturnToStock'] = element['refundedQuantity'] > 0 ? element['refundedQuantity'] : -1 * element['refundedQuantity'];
2276
- obj['TaxCode'] = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((item) => item.itemLineId == element['itemLineId']).VATCode;
4220
+ obj['TaxCode'] = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
4221
+ * @param {?} item
4222
+ * @return {?}
4223
+ */
4224
+ (item) => item.itemLineId == element['itemLineId'])).VATCode;
2277
4225
  obj['DisplayTaxCode'] = ''; // todo
2278
4226
  obj['ProductAttributes'] = ''; //todo - not required
2279
4227
  obj['Perishable'] = this.getAttributes();
2280
4228
  obj['MMGroupID'] = this.getAttributes();
2281
4229
  obj['CustomerDetails'] = ""; // todo - blank
2282
4230
  obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO
2283
- let taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((item) => item.itemLineId == element['itemLineId']);
4231
+ // TODO
4232
+ /** @type {?} */
4233
+ let taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
4234
+ * @param {?} item
4235
+ * @return {?}
4236
+ */
4237
+ (item) => item.itemLineId == element['itemLineId']));
2284
4238
  obj['OriginalTaxAmount'] = taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal); //todo
2285
4239
  obj['taxAmount'] = taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal);
2286
4240
  if (lineDiscount) {
@@ -2312,14 +4266,20 @@ class RJMapperBuilderClass {
2312
4266
  obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
2313
4267
  }
2314
4268
  //update the product price
2315
- obj.NetValue = ((lineDiscount?.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
2316
- obj.EffectiveNetValue = ((lineDiscount?.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
2317
- obj.ExtendedValue = ((lineDiscount?.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
2318
- obj.UnitPrice = ((lineDiscount?.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
4269
+ obj.NetValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
4270
+ obj.EffectiveNetValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
4271
+ obj.ExtendedValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
4272
+ obj.UnitPrice = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
2319
4273
  }
2320
4274
  return obj;
2321
4275
  }
4276
+ /**
4277
+ * @param {?} element
4278
+ * @param {?} lineDiscount
4279
+ * @return {?}
4280
+ */
2322
4281
  addProduct(element, lineDiscount) {
4282
+ /** @type {?} */
2323
4283
  let obj = {
2324
4284
  XMLSchemaVersion: this.xmlSchemaVersion,
2325
4285
  LineNumber: element.itemLineId,
@@ -2327,21 +4287,30 @@ class RJMapperBuilderClass {
2327
4287
  EffectiveNetValue: this.removeDecimal(element.totalLinePrice),
2328
4288
  Description: element.description,
2329
4289
  DeviceID: this.deviceId,
4290
+ //to do
2330
4291
  UserID: this.userId,
4292
+ //to do,
2331
4293
  DateTimeCreated: this.transactionDocument.createdAt,
2332
4294
  ExtendedValue: this.removeDecimal(element.price),
2333
4295
  UnitPrice: this.removeDecimal(element.price),
2334
4296
  MMGroupID: this.getAttributes(),
4297
+ //todo
2335
4298
  Quantity: element.quantity.toFixed(1),
2336
4299
  SalespersonID: this.transactionDocument.userId,
2337
4300
  SalespersonName: this.transactionDocument.userName,
2338
4301
  TaxCode: 0,
4302
+ //todo
2339
4303
  TaxModifiable: 1,
4304
+ //todo
2340
4305
  TaxAmount: 0,
4306
+ //todo
2341
4307
  OriginalTaxAmount: 0,
4308
+ //todo
2342
4309
  OriginalTaxAmountSet: 1,
4310
+ //todo
2343
4311
  ProductID: element.SKU,
2344
4312
  HandKeyed: 1,
4313
+ //todo
2345
4314
  CustomerDetails: "",
2346
4315
  Perishable: this.getAttributes()
2347
4316
  };
@@ -2375,12 +4344,16 @@ class RJMapperBuilderClass {
2375
4344
  }
2376
4345
  //update the product price
2377
4346
  obj['NetValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);
2378
- obj['EffectiveNetValue'] = ((lineDiscount?.discountedLinePrice || 0) + lineDiscount.discountAmount);
2379
- obj['ExtendedValue'] = ((lineDiscount?.discountedLinePrice || 0) + lineDiscount.discountAmount);
2380
- obj['UnitPrice'] = ((lineDiscount?.discountedLinePrice || 0) + lineDiscount.discountAmount);
4347
+ obj['EffectiveNetValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);
4348
+ obj['ExtendedValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);
4349
+ obj['UnitPrice'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);
2381
4350
  }
2382
4351
  return obj;
2383
4352
  }
4353
+ /**
4354
+ * @param {?} value
4355
+ * @return {?}
4356
+ */
2384
4357
  convertToString(value) {
2385
4358
  try {
2386
4359
  value = JSON.stringify(value);
@@ -2390,22 +4363,42 @@ class RJMapperBuilderClass {
2390
4363
  console.log(value, ' can not be converted in string', e);
2391
4364
  }
2392
4365
  }
4366
+ /**
4367
+ * @return {?}
4368
+ */
2393
4369
  generateDynamicStockLookUp() {
4370
+ /** @type {?} */
2394
4371
  let x = '0';
2395
- this.transactionDocument.basket.products.forEach((element) => {
4372
+ this.transactionDocument.basket.products.forEach((/**
4373
+ * @param {?} element
4374
+ * @return {?}
4375
+ */
4376
+ (element) => {
2396
4377
  if (element.deliveryMethod === '1' || element.deliveryMethod === '2') {
2397
4378
  x = '1';
2398
4379
  }
2399
- });
4380
+ }));
2400
4381
  return x;
2401
4382
  }
4383
+ /**
4384
+ * @return {?}
4385
+ */
2402
4386
  getAttributes() {
4387
+ /** @type {?} */
2403
4388
  let name = [];
2404
- this.transactionDocument.basket.products.forEach((element) => {
4389
+ this.transactionDocument.basket.products.forEach((/**
4390
+ * @param {?} element
4391
+ * @return {?}
4392
+ */
4393
+ (element) => {
2405
4394
  if (element.attributes && element.attributes.length > 0) {
2406
- name = element.attributes.filter((x) => x.name.toUpperCase() === element.name?.toUpperCase());
4395
+ name = element.attributes.filter((/**
4396
+ * @param {?} x
4397
+ * @return {?}
4398
+ */
4399
+ (x) => x.name.toUpperCase() === element.name.toUpperCase()));
2407
4400
  }
2408
- });
4401
+ }));
2409
4402
  if (name.length > 0) {
2410
4403
  return name[0].value;
2411
4404
  }
@@ -2413,109 +4406,141 @@ class RJMapperBuilderClass {
2413
4406
  return "";
2414
4407
  }
2415
4408
  }
2416
- }
2417
-
2418
- class MapperLibraryService {
2419
- constructor() { }
2420
- saleDoc(transactionDoc) {
2421
- console.log('TransactionDocuments', transactionDoc);
2422
- let value = new RJMapperBuilderClass(transactionDoc)
2423
- .setTransactionNumber('tttt')
2424
- .setManifestVersion('mmmm')
2425
- .setDatabaseSchemaVersion('dddd')
2426
- .setTradingRegionID('trtr')
2427
- .setCompanyID('cccc')
2428
- .setTaxMethodID('tmtm')
2429
- .setBasketType('SALE')
2430
- .setMajorVersion('1')
2431
- .setMinorVersion('0')
2432
- .setXMLSchemaVersion('1')
2433
- .setExternalState('1')
2434
- .setCashierID('0009')
2435
- .setTerminalNumber('1')
2436
- .setUserInfo('123')
2437
- .setDeviceInfo('XYZ.ab.123')
2438
- .setBasketLanguageID('IT')
2439
- .setBasketCountryID('IT')
2440
- .setBasketCurrencyID('EUR')
2441
- .rjMapper()
2442
- .getBasketDiscount()
2443
- .getPosbasketInfo()
2444
- .getheaderInfo()
2445
- .getTrailerInfo()
2446
- .getTenderInfo()
2447
- .build();
2448
- console.log('JSONobject', value);
2449
- console.log('XML', JsonToXML.parse("POSBasket", value));
2450
- return JsonToXML.parse("POSBasket", value);
2451
- }
2452
- refundDoc(transactionDoc) {
2453
- console.log('TransactionDocument', transactionDoc);
2454
- let value = new RJMapperBuilderClass(transactionDoc)
2455
- .rjMapper()
2456
- .getTrailerInfo()
2457
- .build();
2458
- console.log('JSONobject', value);
2459
- }
2460
- }
2461
- MapperLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MapperLibraryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2462
- MapperLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MapperLibraryService, providedIn: 'root' });
2463
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MapperLibraryService, decorators: [{
2464
- type: Injectable,
2465
- args: [{
2466
- providedIn: 'root'
2467
- }]
2468
- }], ctorParameters: function () { return []; } });
2469
-
2470
- class MapperLibraryComponent {
2471
- constructor() { }
2472
- ngOnInit() {
2473
- }
2474
- }
2475
- MapperLibraryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MapperLibraryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2476
- MapperLibraryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: MapperLibraryComponent, selector: "lib-mapper-library", ngImport: i0, template: `
2477
- <p>
2478
- mapper-library works!
2479
- </p>
2480
- `, isInline: true });
2481
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MapperLibraryComponent, decorators: [{
2482
- type: Component,
2483
- args: [{
2484
- selector: 'lib-mapper-library',
2485
- template: `
2486
- <p>
2487
- mapper-library works!
2488
- </p>
2489
- `,
2490
- styles: []
2491
- }]
2492
- }], ctorParameters: function () { return []; } });
2493
-
2494
- class MapperLibraryModule {
2495
4409
  }
2496
- MapperLibraryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MapperLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2497
- MapperLibraryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MapperLibraryModule, declarations: [MapperLibraryComponent], exports: [MapperLibraryComponent] });
2498
- MapperLibraryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MapperLibraryModule, imports: [[]] });
2499
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MapperLibraryModule, decorators: [{
2500
- type: NgModule,
2501
- args: [{
2502
- declarations: [
2503
- MapperLibraryComponent
2504
- ],
2505
- imports: [],
2506
- exports: [
2507
- MapperLibraryComponent
2508
- ]
2509
- }]
2510
- }] });
4410
+ if (false) {
4411
+ /**
4412
+ * @type {?}
4413
+ * @private
4414
+ */
4415
+ RJMapperBuilderClass.prototype.transactionDocument;
4416
+ /**
4417
+ * @type {?}
4418
+ * @private
4419
+ */
4420
+ RJMapperBuilderClass.prototype.productQuantity;
4421
+ /**
4422
+ * @type {?}
4423
+ * @private
4424
+ */
4425
+ RJMapperBuilderClass.prototype.userId;
4426
+ /**
4427
+ * @type {?}
4428
+ * @private
4429
+ */
4430
+ RJMapperBuilderClass.prototype.deviceId;
4431
+ /**
4432
+ * @type {?}
4433
+ * @private
4434
+ */
4435
+ RJMapperBuilderClass.prototype.transactionNumber;
4436
+ /**
4437
+ * @type {?}
4438
+ * @private
4439
+ */
4440
+ RJMapperBuilderClass.prototype.manifestVersion;
4441
+ /**
4442
+ * @type {?}
4443
+ * @private
4444
+ */
4445
+ RJMapperBuilderClass.prototype.databaseSchemaVersion;
4446
+ /**
4447
+ * @type {?}
4448
+ * @private
4449
+ */
4450
+ RJMapperBuilderClass.prototype.basketType;
4451
+ /**
4452
+ * @type {?}
4453
+ * @private
4454
+ */
4455
+ RJMapperBuilderClass.prototype.xmlSchemaVersion;
4456
+ /**
4457
+ * @type {?}
4458
+ * @private
4459
+ */
4460
+ RJMapperBuilderClass.prototype.majorVersion;
4461
+ /**
4462
+ * @type {?}
4463
+ * @private
4464
+ */
4465
+ RJMapperBuilderClass.prototype.minorVersion;
4466
+ /**
4467
+ * @type {?}
4468
+ * @private
4469
+ */
4470
+ RJMapperBuilderClass.prototype.externalState;
4471
+ /**
4472
+ * @type {?}
4473
+ * @private
4474
+ */
4475
+ RJMapperBuilderClass.prototype.cashierId;
4476
+ /**
4477
+ * @type {?}
4478
+ * @private
4479
+ */
4480
+ RJMapperBuilderClass.prototype.companyId;
4481
+ /**
4482
+ * @type {?}
4483
+ * @private
4484
+ */
4485
+ RJMapperBuilderClass.prototype.terminalNumber;
4486
+ /**
4487
+ * @type {?}
4488
+ * @private
4489
+ */
4490
+ RJMapperBuilderClass.prototype.taxMethodId;
4491
+ /**
4492
+ * @type {?}
4493
+ * @private
4494
+ */
4495
+ RJMapperBuilderClass.prototype.tradingRegionId;
4496
+ /**
4497
+ * @type {?}
4498
+ * @private
4499
+ */
4500
+ RJMapperBuilderClass.prototype.basketCurrencyId;
4501
+ /**
4502
+ * @type {?}
4503
+ * @private
4504
+ */
4505
+ RJMapperBuilderClass.prototype.basketCountryId;
4506
+ /**
4507
+ * @type {?}
4508
+ * @private
4509
+ */
4510
+ RJMapperBuilderClass.prototype.basketLanguageId;
4511
+ /**
4512
+ * @type {?}
4513
+ * @private
4514
+ */
4515
+ RJMapperBuilderClass.prototype.itemCount;
4516
+ /**
4517
+ * @type {?}
4518
+ * @private
4519
+ */
4520
+ RJMapperBuilderClass.prototype.largestNumber;
4521
+ /**
4522
+ * @type {?}
4523
+ * @private
4524
+ */
4525
+ RJMapperBuilderClass.prototype.rjObject;
4526
+ /**
4527
+ * @type {?}
4528
+ * @private
4529
+ */
4530
+ RJMapperBuilderClass.prototype.paymentTypes;
4531
+ }
2511
4532
 
2512
- /*
2513
- * Public API Surface of mapper-library
4533
+ /**
4534
+ * @fileoverview added by tsickle
4535
+ * Generated from: public-api.ts
4536
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2514
4537
  */
2515
4538
 
2516
4539
  /**
2517
- * Generated bundle index. Do not edit.
4540
+ * @fileoverview added by tsickle
4541
+ * Generated from: pmcretail-mapper-library.ts
4542
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2518
4543
  */
2519
4544
 
2520
- export { MapperLibraryComponent, MapperLibraryModule, MapperLibraryService, RJMapperBuilderClass };
2521
- //# sourceMappingURL=pmcretail-mapper-library.mjs.map
4545
+ export { MapperLibraryComponent, MapperLibraryModule, RJMapperBuilderClass };
4546
+ //# sourceMappingURL=pmcretail-mapper-library.js.map