@pmcretail/mapper-library 0.0.28 → 0.0.29

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.
@@ -59,6 +59,7 @@ const TRANSACTION_TYPE = {
59
59
  SALE_REFUND: "SALE_REFUND",
60
60
  SALE_EXCHANGE: "SALE_EXCHANGE",
61
61
  VOID: "VOID",
62
+ WEB_RETURNS: "WEB_RETURNS",
62
63
  };
63
64
  /**
64
65
  * @record
@@ -79,10 +80,12 @@ const DELIVERY_METHODS = {
79
80
  DELIVERY: 1,
80
81
  DROP_SHIP: 2,
81
82
  COLLECT_FROM_STORE: 3,
83
+ SHIP_TO_STORE: 4,
82
84
  };
83
85
  DELIVERY_METHODS[DELIVERY_METHODS.DELIVERY] = 'DELIVERY';
84
86
  DELIVERY_METHODS[DELIVERY_METHODS.DROP_SHIP] = 'DROP_SHIP';
85
87
  DELIVERY_METHODS[DELIVERY_METHODS.COLLECT_FROM_STORE] = 'COLLECT_FROM_STORE';
88
+ DELIVERY_METHODS[DELIVERY_METHODS.SHIP_TO_STORE] = 'SHIP_TO_STORE';
86
89
  /**
87
90
  * @record
88
91
  */
@@ -659,6 +662,8 @@ if (false) {
659
662
  TransactionDocument.prototype.currentTransactionDetails;
660
663
  /** @type {?|undefined} */
661
664
  TransactionDocument.prototype.isChecked;
665
+ /** @type {?|undefined} */
666
+ TransactionDocument.prototype.externalTransactionDetails;
662
667
  }
663
668
  /**
664
669
  * @record
@@ -697,18 +702,50 @@ if (false) {
697
702
  */
698
703
  function BasketSummary() { }
699
704
  if (false) {
700
- /** @type {?} */
705
+ /** @type {?|undefined} */
701
706
  BasketSummary.prototype.totalItems;
702
- /** @type {?} */
707
+ /** @type {?|undefined} */
703
708
  BasketSummary.prototype.saleTotal;
704
- /** @type {?} */
709
+ /** @type {?|undefined} */
705
710
  BasketSummary.prototype.VATTotal;
706
- /** @type {?} */
711
+ /** @type {?|undefined} */
707
712
  BasketSummary.prototype.discountTotal;
708
- /** @type {?} */
713
+ /** @type {?|undefined} */
709
714
  BasketSummary.prototype.basketTotal;
710
715
  /** @type {?|undefined} */
711
716
  BasketSummary.prototype.refundTotal;
717
+ /** @type {?|undefined} */
718
+ BasketSummary.prototype.shippingTotal;
719
+ /** @type {?|undefined} */
720
+ BasketSummary.prototype.basketTotalWithShippingTotal;
721
+ /** @type {?|undefined} */
722
+ BasketSummary.prototype.inStore;
723
+ /** @type {?|undefined} */
724
+ BasketSummary.prototype.webOrder;
725
+ /** @type {?|undefined} */
726
+ BasketSummary.prototype.cnc;
727
+ }
728
+ /**
729
+ * @record
730
+ */
731
+ function BasketSummaryDetails() { }
732
+ if (false) {
733
+ /** @type {?|undefined} */
734
+ BasketSummaryDetails.prototype.totalItems;
735
+ /** @type {?|undefined} */
736
+ BasketSummaryDetails.prototype.saleTotal;
737
+ /** @type {?|undefined} */
738
+ BasketSummaryDetails.prototype.VATTotal;
739
+ /** @type {?|undefined} */
740
+ BasketSummaryDetails.prototype.discountTotal;
741
+ /** @type {?|undefined} */
742
+ BasketSummaryDetails.prototype.basketTotal;
743
+ /** @type {?|undefined} */
744
+ BasketSummaryDetails.prototype.refundTotal;
745
+ /** @type {?|undefined} */
746
+ BasketSummaryDetails.prototype.shippingTotal;
747
+ /** @type {?|undefined} */
748
+ BasketSummaryDetails.prototype.basketTotalWithShippingTotal;
712
749
  }
713
750
  /**
714
751
  * @record
@@ -894,6 +931,8 @@ if (false) {
894
931
  /** @type {?|undefined} */
895
932
  Customer.prototype.shippingAddress;
896
933
  /** @type {?|undefined} */
934
+ Customer.prototype.shipmentDetails;
935
+ /** @type {?|undefined} */
897
936
  Customer.prototype.addressDetail;
898
937
  /** @type {?|undefined} */
899
938
  Customer.prototype.noCustomerSelected;
@@ -905,6 +944,10 @@ if (false) {
905
944
  */
906
945
  function Address() { }
907
946
  if (false) {
947
+ /** @type {?|undefined} */
948
+ Address.prototype.id;
949
+ /** @type {?|undefined} */
950
+ Address.prototype.countryCode;
908
951
  /** @type {?|undefined} */
909
952
  Address.prototype.address1;
910
953
  /** @type {?|undefined} */
@@ -920,6 +963,16 @@ if (false) {
920
963
  /** @type {?|undefined} */
921
964
  Address.prototype.country;
922
965
  }
966
+ /**
967
+ * @record
968
+ */
969
+ function ShipmentDetails() { }
970
+ if (false) {
971
+ /** @type {?|undefined} */
972
+ ShipmentDetails.prototype.id;
973
+ /** @type {?|undefined} */
974
+ ShipmentDetails.prototype.deliveryGroup;
975
+ }
923
976
  /**
924
977
  * @record
925
978
  */
@@ -1018,6 +1071,380 @@ if (false) {
1018
1071
  const DISCOUNTTYPE = {
1019
1072
  PERCENT: "Percent",
1020
1073
  AMOUNT: "AMOUNT",
1074
+ };
1075
+ /**
1076
+ * @record
1077
+ */
1078
+ function TransactionInfo() { }
1079
+ if (false) {
1080
+ /** @type {?|undefined} */
1081
+ TransactionInfo.prototype.shippingId;
1082
+ /** @type {?|undefined} */
1083
+ TransactionInfo.prototype.externalShippingId;
1084
+ }
1085
+ /**
1086
+ * @record
1087
+ */
1088
+ function externalTransactionDetails() { }
1089
+ if (false) {
1090
+ /** @type {?|undefined} */
1091
+ externalTransactionDetails.prototype.uniqueId;
1092
+ /** @type {?|undefined} */
1093
+ externalTransactionDetails.prototype.providerType;
1094
+ /** @type {?|undefined} */
1095
+ externalTransactionDetails.prototype.details;
1096
+ }
1097
+ /** @enum {string} */
1098
+ const INITIATING_MODULE = {
1099
+ EBASKET: "eBasket",
1100
+ };
1101
+ /**
1102
+ * @record
1103
+ */
1104
+ function pendingMethod() { }
1105
+ if (false) {
1106
+ /** @type {?|undefined} */
1107
+ pendingMethod.prototype._type;
1108
+ /** @type {?|undefined} */
1109
+ pendingMethod.prototype.type;
1110
+ /** @type {?|undefined} */
1111
+ pendingMethod.prototype.message;
1112
+ /** @type {?|undefined} */
1113
+ pendingMethod.prototype.path;
1114
+ /** @type {?|undefined} */
1115
+ pendingMethod.prototype.details;
1116
+ }
1117
+ /**
1118
+ * @record
1119
+ */
1120
+ function ShipmentId() { }
1121
+ if (false) {
1122
+ /** @type {?|undefined} */
1123
+ ShipmentId.prototype.shipmentId;
1124
+ }
1125
+ /**
1126
+ * @record
1127
+ */
1128
+ function CustomerAddress() { }
1129
+ if (false) {
1130
+ /** @type {?|undefined} */
1131
+ CustomerAddress.prototype._type;
1132
+ /** @type {?|undefined} */
1133
+ CustomerAddress.prototype.email;
1134
+ /** @type {?|undefined} */
1135
+ CustomerAddress.prototype.address1;
1136
+ /** @type {?|undefined} */
1137
+ CustomerAddress.prototype.city;
1138
+ /** @type {?|undefined} */
1139
+ CustomerAddress.prototype.country_code;
1140
+ /** @type {?|undefined} */
1141
+ CustomerAddress.prototype.first_name;
1142
+ /** @type {?|undefined} */
1143
+ CustomerAddress.prototype.full_name;
1144
+ /** @type {?|undefined} */
1145
+ CustomerAddress.prototype.id;
1146
+ /** @type {?|undefined} */
1147
+ CustomerAddress.prototype.last_name;
1148
+ /** @type {?|undefined} */
1149
+ CustomerAddress.prototype.phone;
1150
+ /** @type {?|undefined} */
1151
+ CustomerAddress.prototype.salutation;
1152
+ /** @type {?|undefined} */
1153
+ CustomerAddress.prototype.c_area;
1154
+ /** @type {?|undefined} */
1155
+ CustomerAddress.prototype.c_email;
1156
+ /** @type {?|undefined} */
1157
+ CustomerAddress.prototype.c_phoneWhatsApp;
1158
+ /** @type {?|undefined} */
1159
+ CustomerAddress.prototype.c_strValue;
1160
+ /** @type {?|undefined} */
1161
+ CustomerAddress.prototype.postal_code;
1162
+ }
1163
+ /**
1164
+ * @record
1165
+ */
1166
+ function CustomerInfo() { }
1167
+ if (false) {
1168
+ /** @type {?|undefined} */
1169
+ CustomerInfo.prototype._type;
1170
+ /** @type {?|undefined} */
1171
+ CustomerInfo.prototype.customer_id;
1172
+ /** @type {?|undefined} */
1173
+ CustomerInfo.prototype.email;
1174
+ }
1175
+ /**
1176
+ * @record
1177
+ */
1178
+ function GroupedTaxItem() { }
1179
+ if (false) {
1180
+ /** @type {?|undefined} */
1181
+ GroupedTaxItem.prototype._type;
1182
+ /** @type {?|undefined} */
1183
+ GroupedTaxItem.prototype.tax_rate;
1184
+ /** @type {?|undefined} */
1185
+ GroupedTaxItem.prototype.tax_value;
1186
+ }
1187
+ /**
1188
+ * @record
1189
+ */
1190
+ function additionalNotes() { }
1191
+ if (false) {
1192
+ /** @type {?|undefined} */
1193
+ additionalNotes.prototype._type;
1194
+ /** @type {?|undefined} */
1195
+ additionalNotes.prototype.link;
1196
+ }
1197
+ /**
1198
+ * @record
1199
+ */
1200
+ function ProductItem() { }
1201
+ if (false) {
1202
+ /** @type {?|undefined} */
1203
+ ProductItem.prototype._type;
1204
+ /** @type {?|undefined} */
1205
+ ProductItem.prototype.adjusted_tax;
1206
+ /** @type {?|undefined} */
1207
+ ProductItem.prototype.base_price;
1208
+ /** @type {?|undefined} */
1209
+ ProductItem.prototype.bonus_product_line_item;
1210
+ /** @type {?|undefined} */
1211
+ ProductItem.prototype.gift;
1212
+ /** @type {?|undefined} */
1213
+ ProductItem.prototype.item_id;
1214
+ /** @type {?|undefined} */
1215
+ ProductItem.prototype.item_text;
1216
+ /** @type {?|undefined} */
1217
+ ProductItem.prototype.price;
1218
+ /** @type {?|undefined} */
1219
+ ProductItem.prototype.price_adjustments;
1220
+ /** @type {?|undefined} */
1221
+ ProductItem.prototype.price_after_item_discount;
1222
+ /** @type {?|undefined} */
1223
+ ProductItem.prototype.price_after_order_discount;
1224
+ /** @type {?|undefined} */
1225
+ ProductItem.prototype.product_id;
1226
+ /** @type {?|undefined} */
1227
+ ProductItem.prototype.product_name;
1228
+ /** @type {?|undefined} */
1229
+ ProductItem.prototype.quantity;
1230
+ /** @type {?|undefined} */
1231
+ ProductItem.prototype.shipment_id;
1232
+ /** @type {?|undefined} */
1233
+ ProductItem.prototype.tax;
1234
+ /** @type {?|undefined} */
1235
+ ProductItem.prototype.tax_basis;
1236
+ /** @type {?|undefined} */
1237
+ ProductItem.prototype.tax_class_id;
1238
+ /** @type {?|undefined} */
1239
+ ProductItem.prototype.tax_rate;
1240
+ }
1241
+ /**
1242
+ * @record
1243
+ */
1244
+ function ShippingMethod() { }
1245
+ if (false) {
1246
+ /** @type {?|undefined} */
1247
+ ShippingMethod.prototype._type;
1248
+ /** @type {?|undefined} */
1249
+ ShippingMethod.prototype.description;
1250
+ /** @type {?|undefined} */
1251
+ ShippingMethod.prototype.id;
1252
+ /** @type {?|undefined} */
1253
+ ShippingMethod.prototype.name;
1254
+ /** @type {?|undefined} */
1255
+ ShippingMethod.prototype.price;
1256
+ /** @type {?|undefined} */
1257
+ ShippingMethod.prototype.c_approachingThresholdMessage;
1258
+ /** @type {?|undefined} */
1259
+ ShippingMethod.prototype.c_estimatedArrivalTime;
1260
+ /** @type {?|undefined} */
1261
+ ShippingMethod.prototype.c_isEmail;
1262
+ /** @type {?|undefined} */
1263
+ ShippingMethod.prototype.c_storePickupEnabled;
1264
+ /** @type {?|undefined} */
1265
+ ShippingMethod.prototype.c_thresholdValue;
1266
+ }
1267
+ /**
1268
+ * @record
1269
+ */
1270
+ function shipment() { }
1271
+ if (false) {
1272
+ /** @type {?|undefined} */
1273
+ shipment.prototype._type;
1274
+ /** @type {?|undefined} */
1275
+ shipment.prototype.adjusted_merchandize_total_tax;
1276
+ /** @type {?|undefined} */
1277
+ shipment.prototype.adjusted_shipping_total_tax;
1278
+ /** @type {?|undefined} */
1279
+ shipment.prototype.gift;
1280
+ /** @type {?|undefined} */
1281
+ shipment.prototype.merchandize_total_tax;
1282
+ /** @type {?|undefined} */
1283
+ shipment.prototype.product_sub_total;
1284
+ /** @type {?|undefined} */
1285
+ shipment.prototype.product_total;
1286
+ /** @type {?|undefined} */
1287
+ shipment.prototype.shipment_id;
1288
+ /** @type {?|undefined} */
1289
+ shipment.prototype.shipment_total;
1290
+ /** @type {?|undefined} */
1291
+ shipment.prototype.shipping_address;
1292
+ /** @type {?|undefined} */
1293
+ shipment.prototype.shipping_method;
1294
+ /** @type {?|undefined} */
1295
+ shipment.prototype.shipping_status;
1296
+ /** @type {?|undefined} */
1297
+ shipment.prototype.shipping_total;
1298
+ /** @type {?|undefined} */
1299
+ shipment.prototype.shipping_total_tax;
1300
+ /** @type {?|undefined} */
1301
+ shipment.prototype.tax_total;
1302
+ /** @type {?|undefined} */
1303
+ shipment.prototype.c_fromStoreId;
1304
+ }
1305
+ /**
1306
+ * @record
1307
+ */
1308
+ function ShippingItem() { }
1309
+ if (false) {
1310
+ /** @type {?|undefined} */
1311
+ ShippingItem.prototype._type;
1312
+ /** @type {?|undefined} */
1313
+ ShippingItem.prototype.adjusted_tax;
1314
+ /** @type {?|undefined} */
1315
+ ShippingItem.prototype.base_price;
1316
+ /** @type {?|undefined} */
1317
+ ShippingItem.prototype.item_id;
1318
+ /** @type {?|undefined} */
1319
+ ShippingItem.prototype.item_text;
1320
+ /** @type {?|undefined} */
1321
+ ShippingItem.prototype.price;
1322
+ /** @type {?|undefined} */
1323
+ ShippingItem.prototype.price_after_item_discount;
1324
+ /** @type {?|undefined} */
1325
+ ShippingItem.prototype.shipment_id;
1326
+ /** @type {?|undefined} */
1327
+ ShippingItem.prototype.tax;
1328
+ /** @type {?|undefined} */
1329
+ ShippingItem.prototype.tax_basis;
1330
+ /** @type {?|undefined} */
1331
+ ShippingItem.prototype.tax_class_id;
1332
+ /** @type {?|undefined} */
1333
+ ShippingItem.prototype.tax_rate;
1334
+ }
1335
+ /**
1336
+ * @record
1337
+ */
1338
+ function AppliedDiscount() { }
1339
+ if (false) {
1340
+ /** @type {?|undefined} */
1341
+ AppliedDiscount.prototype._type;
1342
+ /** @type {?|undefined} */
1343
+ AppliedDiscount.prototype.amount;
1344
+ /** @type {?|undefined} */
1345
+ AppliedDiscount.prototype.percentage;
1346
+ /** @type {?|undefined} */
1347
+ AppliedDiscount.prototype.type;
1348
+ }
1349
+ /**
1350
+ * @record
1351
+ */
1352
+ function PriceAdjustment() { }
1353
+ if (false) {
1354
+ /** @type {?|undefined} */
1355
+ PriceAdjustment.prototype._type;
1356
+ /** @type {?|undefined} */
1357
+ PriceAdjustment.prototype.applied_discount;
1358
+ /** @type {?|undefined} */
1359
+ PriceAdjustment.prototype.coupon_code;
1360
+ /** @type {?|undefined} */
1361
+ PriceAdjustment.prototype.creation_date;
1362
+ /** @type {?|undefined} */
1363
+ PriceAdjustment.prototype.custom;
1364
+ /** @type {?|undefined} */
1365
+ PriceAdjustment.prototype.item_text;
1366
+ /** @type {?|undefined} */
1367
+ PriceAdjustment.prototype.last_modified;
1368
+ /** @type {?|undefined} */
1369
+ PriceAdjustment.prototype.manual;
1370
+ /** @type {?|undefined} */
1371
+ PriceAdjustment.prototype.price;
1372
+ /** @type {?|undefined} */
1373
+ PriceAdjustment.prototype.price_adjustment_id;
1374
+ /** @type {?|undefined} */
1375
+ PriceAdjustment.prototype.promotion_id;
1376
+ /** @type {?|undefined} */
1377
+ PriceAdjustment.prototype.promotion_link;
1378
+ }
1379
+ /**
1380
+ * @record
1381
+ */
1382
+ function OrderDetails() { }
1383
+ if (false) {
1384
+ /** @type {?|undefined} */
1385
+ OrderDetails.prototype._v;
1386
+ /** @type {?|undefined} */
1387
+ OrderDetails.prototype._type;
1388
+ /** @type {?|undefined} */
1389
+ OrderDetails.prototype._resource_state;
1390
+ /** @type {?|undefined} */
1391
+ OrderDetails.prototype._flash;
1392
+ /** @type {?|undefined} */
1393
+ OrderDetails.prototype.adjusted_merchandize_total_tax;
1394
+ /** @type {?|undefined} */
1395
+ OrderDetails.prototype.adjusted_shipping_total_tax;
1396
+ /** @type {?|undefined} */
1397
+ OrderDetails.prototype.agent_basket;
1398
+ /** @type {?|undefined} */
1399
+ OrderDetails.prototype.basket_id;
1400
+ /** @type {?|undefined} */
1401
+ OrderDetails.prototype.billing_address;
1402
+ /** @type {?|undefined} */
1403
+ OrderDetails.prototype.channel_type;
1404
+ /** @type {?|undefined} */
1405
+ OrderDetails.prototype.creation_date;
1406
+ /** @type {?|undefined} */
1407
+ OrderDetails.prototype.currency;
1408
+ /** @type {?|undefined} */
1409
+ OrderDetails.prototype.customer_info;
1410
+ /** @type {?|undefined} */
1411
+ OrderDetails.prototype.grouped_tax_items;
1412
+ /** @type {?|undefined} */
1413
+ OrderDetails.prototype.last_modified;
1414
+ /** @type {?|undefined} */
1415
+ OrderDetails.prototype.merchandize_total_tax;
1416
+ /** @type {?|undefined} */
1417
+ OrderDetails.prototype.notes;
1418
+ /** @type {?|undefined} */
1419
+ OrderDetails.prototype.order_price_adjustments;
1420
+ /** @type {?|undefined} */
1421
+ OrderDetails.prototype.order_no;
1422
+ /** @type {?|undefined} */
1423
+ OrderDetails.prototype.order_total;
1424
+ /** @type {?|undefined} */
1425
+ OrderDetails.prototype.product_items;
1426
+ /** @type {?|undefined} */
1427
+ OrderDetails.prototype.product_sub_total;
1428
+ /** @type {?|undefined} */
1429
+ OrderDetails.prototype.product_total;
1430
+ /** @type {?|undefined} */
1431
+ OrderDetails.prototype.shipments;
1432
+ /** @type {?|undefined} */
1433
+ OrderDetails.prototype.shipping_items;
1434
+ /** @type {?|undefined} */
1435
+ OrderDetails.prototype.shipping_total;
1436
+ /** @type {?|undefined} */
1437
+ OrderDetails.prototype.shipping_total_tax;
1438
+ /** @type {?|undefined} */
1439
+ OrderDetails.prototype.taxation;
1440
+ /** @type {?|undefined} */
1441
+ OrderDetails.prototype.tax_rounded_at_group;
1442
+ /** @type {?|undefined} */
1443
+ OrderDetails.prototype.tax_total;
1444
+ }
1445
+ /** @enum {string} */
1446
+ const PROVIDERS = {
1447
+ SALESFORCE: "Salesforce",
1021
1448
  };
1022
1449
 
1023
1450
  /**
@@ -5216,6 +5643,484 @@ if (false) {
5216
5643
  WebReturnMapperBuilderClass.prototype.webReturnObject;
5217
5644
  }
5218
5645
 
5646
+ /**
5647
+ * @fileoverview added by tsickle
5648
+ * Generated from: lib/WebReturnSalesforceMapper.class.ts
5649
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5650
+ */
5651
+ class WebReturnSalesforceMapperBuilderClass {
5652
+ /**
5653
+ * @param {?} orderDetails
5654
+ */
5655
+ constructor(orderDetails) {
5656
+ this.webReturnObject = {
5657
+ id: '',
5658
+ orgCode: "",
5659
+ storeId: "",
5660
+ storeNodeId: "",
5661
+ storeNodeStructure: "",
5662
+ deviceId: "",
5663
+ terminalId: "",
5664
+ initiatingModule: "",
5665
+ export: false,
5666
+ basket: {},
5667
+ basketSummary: {},
5668
+ baseCurrency: "",
5669
+ customer: {
5670
+ id: '',
5671
+ email: '',
5672
+ firstName: '',
5673
+ lastName: '',
5674
+ billingAddress: [],
5675
+ shippingAddress: [],
5676
+ shipmentDetails: [],
5677
+ telephone: '',
5678
+ postCode: '',
5679
+ noCustomerSelected: false
5680
+ },
5681
+ currentTransactionDetails: (/** @type {?} */ ({}))
5682
+ };
5683
+ if (orderDetails) {
5684
+ this.orderDetails = orderDetails;
5685
+ }
5686
+ }
5687
+ /**
5688
+ * @template THIS
5689
+ * @this {THIS}
5690
+ * @return {THIS}
5691
+ */
5692
+ webReturnCommonMapper() {
5693
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: webReturnCommonMapper started...");
5694
+ (/** @type {?} */ (this)).webReturnObject['type'] = TRANSACTION_TYPE.WEB_RETURNS;
5695
+ (/** @type {?} */ (this)).webReturnObject['datetime'] = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).orderDetails.last_modified);
5696
+ (/** @type {?} */ (this)).webReturnObject.baseCurrency = (/** @type {?} */ (this)).orderDetails.currency;
5697
+ (/** @type {?} */ (this)).webReturnObject.subsidiaryId = '1';
5698
+ (/** @type {?} */ (this)).webReturnObject.export = true;
5699
+ (/** @type {?} */ (this)).webReturnObject.initiatingModule = INITIATING_MODULE.EBASKET;
5700
+ (/** @type {?} */ (this)).webReturnObject.createdAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).orderDetails.creation_date);
5701
+ (/** @type {?} */ (this)).webReturnObject.updatedAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).orderDetails.last_modified);
5702
+ (/** @type {?} */ (this)).webReturnObject.transCompletedAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).orderDetails.last_modified);
5703
+ (/** @type {?} */ (this)).webReturnObject['externalTransactionId'] = (/** @type {?} */ (this)).orderDetails.order_no;
5704
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: webReturnCommonMapper ended...");
5705
+ return (/** @type {?} */ (this));
5706
+ }
5707
+ // export(status, details) {
5708
+ // console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: export mapping started...");
5709
+ // console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: status:", status);
5710
+ // console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: details:", JSON.stringify(details));
5711
+ // if (status && details && details.providers && details.providers.length > 0) {
5712
+ // details.providers.forEach(
5713
+ // providerObj => {
5714
+ // if (providerObj.provider && providerObj.provider === PROVIDERS.SALESFORCE) {
5715
+ // this.webReturnObject.export = true;
5716
+ // } else {
5717
+ // this.webReturnObject.export = false;
5718
+ // }
5719
+ // }
5720
+ // );
5721
+ // } else {
5722
+ // this.webReturnObject.export = false;
5723
+ // }
5724
+ // console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: export mapping end...")
5725
+ // return this;
5726
+ // }
5727
+ /**
5728
+ * @return {?}
5729
+ */
5730
+ getDeliveryMethod() {
5731
+ if (this.orderDetails.shipments && this.orderDetails.shipments.length > 0) {
5732
+ /** @type {?} */
5733
+ const shipToStoreShipment = this.orderDetails.shipments.find((/**
5734
+ * @param {?} shipment
5735
+ * @return {?}
5736
+ */
5737
+ shipment => shipment.c_fromStoreId));
5738
+ if (shipToStoreShipment)
5739
+ return DELIVERY_METHODS.SHIP_TO_STORE;
5740
+ else
5741
+ return DELIVERY_METHODS.DELIVERY;
5742
+ }
5743
+ else {
5744
+ return '';
5745
+ }
5746
+ }
5747
+ /**
5748
+ * @template THIS
5749
+ * @this {THIS}
5750
+ * @return {THIS}
5751
+ */
5752
+ product() {
5753
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: product mapping started...");
5754
+ (/** @type {?} */ (this)).webReturnObject.basket['products'] = [];
5755
+ if ((/** @type {?} */ (this)).orderDetails.product_items && (/** @type {?} */ (this)).orderDetails.product_items.length > 0) {
5756
+ (/** @type {?} */ (this)).orderDetails.product_items.forEach((/**
5757
+ * @param {?} product
5758
+ * @param {?} index
5759
+ * @return {?}
5760
+ */
5761
+ (product, index) => {
5762
+ /** @type {?} */
5763
+ const productObj = {
5764
+ description: product.item_text ? product.item_text : '',
5765
+ SKU: product.product_id ? product.product_id : '',
5766
+ quantity: product.quantity ? product.quantity : 0,
5767
+ refundedQuantity: 0,
5768
+ price: product.price ? product.price : 0,
5769
+ itemLineId: index + 1,
5770
+ deliveryMethod: (/** @type {?} */ (this)).getDeliveryMethod().toString(),
5771
+ totalLinePrice: product.price_after_order_discount || product.price_after_item_discount || product.price ? product.price_after_order_discount * product.quantity || product.price_after_item_discount * product.quantity || product.price * product.quantity : 0
5772
+ };
5773
+ if (product && product.price != 0) {
5774
+ (/** @type {?} */ (this)).webReturnObject.basket['products'].push(productObj);
5775
+ }
5776
+ }));
5777
+ }
5778
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: product mapping ended...");
5779
+ return (/** @type {?} */ (this));
5780
+ }
5781
+ /**
5782
+ * @template THIS
5783
+ * @this {THIS}
5784
+ * @return {THIS}
5785
+ */
5786
+ linePromotion() {
5787
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: linePromotion mapping started...");
5788
+ (/** @type {?} */ (this)).webReturnObject.basket.linePromotion = (/** @type {?} */ ([]));
5789
+ /** @type {?} */
5790
+ let linePromotionArray = (/** @type {?} */ ([]));
5791
+ if ((/** @type {?} */ (this)).orderDetails.product_items && (/** @type {?} */ (this)).orderDetails.product_items.length > 0) {
5792
+ (/** @type {?} */ (this)).orderDetails.product_items.forEach((/**
5793
+ * @param {?} product
5794
+ * @param {?} index
5795
+ * @return {?}
5796
+ */
5797
+ (product, index) => {
5798
+ product.item_id = (index + 1).toString();
5799
+ if (product.price_adjustments && product.price_adjustments.length > 0) {
5800
+ product.price_adjustments.forEach((/**
5801
+ * @param {?} promotion
5802
+ * @return {?}
5803
+ */
5804
+ (promotion) => {
5805
+ /** @type {?} */
5806
+ let linePromotionObj = (/** @type {?} */ ({}));
5807
+ /** @type {?} */
5808
+ let trigger = (/** @type {?} */ ({}));
5809
+ trigger.itemLineId = product.item_id;
5810
+ trigger.quantity = product.quantity ? product.quantity : 0;
5811
+ linePromotionObj.trigger = (/** @type {?} */ ([]));
5812
+ linePromotionObj.trigger.push(trigger);
5813
+ linePromotionObj.itemLineId = index + 1;
5814
+ linePromotionObj.promotionId = promotion.promotion_id ? promotion.promotion_id : '';
5815
+ linePromotionObj.displayText = promotion.item_text ? promotion.item_text : '';
5816
+ linePromotionObj.promotionType = promotion.applied_discount && promotion.applied_discount.type ? promotion.applied_discount.type : '';
5817
+ linePromotionObj.promotionAmount = promotion.price ? Math.abs(promotion.price) : 0;
5818
+ linePromotionObj.name = promotion.item_text ? promotion.item_text : '';
5819
+ linePromotionObj.promotionInfo = promotion.item_text ? promotion.item_text : '';
5820
+ linePromotionObj.promotionLinePrice = product.price_after_item_discount ? product.price_after_item_discount : 0;
5821
+ linePromotionArray.push(linePromotionObj);
5822
+ }));
5823
+ }
5824
+ }));
5825
+ }
5826
+ (/** @type {?} */ (this)).webReturnObject.basket.linePromotion = linePromotionArray;
5827
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: linePromotion mapping ended...");
5828
+ return (/** @type {?} */ (this));
5829
+ }
5830
+ /**
5831
+ * @template THIS
5832
+ * @this {THIS}
5833
+ * @return {THIS}
5834
+ */
5835
+ transactionPromotion() {
5836
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: transactionPromotion mapping started...");
5837
+ /** @type {?} */
5838
+ let transactionPromotionArray = (/** @type {?} */ ([]));
5839
+ (/** @type {?} */ (this)).webReturnObject.basket.transactionPromotion = (/** @type {?} */ ([]));
5840
+ if ((/** @type {?} */ (this)).orderDetails.order_price_adjustments && (/** @type {?} */ (this)).orderDetails.order_price_adjustments.length > 0) {
5841
+ (/** @type {?} */ (this)).orderDetails.order_price_adjustments.forEach((/**
5842
+ * @param {?} transactionPromotion
5843
+ * @return {?}
5844
+ */
5845
+ (transactionPromotion) => {
5846
+ /** @type {?} */
5847
+ let transactionPromotionObj = (/** @type {?} */ ({}));
5848
+ transactionPromotionObj.displayText = transactionPromotion.item_text ? transactionPromotion.item_text : '';
5849
+ transactionPromotionObj.name = transactionPromotion.item_text ? transactionPromotion.item_text : '';
5850
+ transactionPromotionObj.promotionAmount = transactionPromotion.price ? Math.abs(transactionPromotion.price) : 0;
5851
+ transactionPromotionObj.promotionId = transactionPromotion.promotion_id ? transactionPromotion.promotion_id : '';
5852
+ transactionPromotionObj.promotionInfo = transactionPromotion.item_text ? transactionPromotion.item_text : '';
5853
+ transactionPromotionObj.promotionType = transactionPromotion.applied_discount && transactionPromotion.applied_discount.type ? transactionPromotion.applied_discount.type : '';
5854
+ transactionPromotionObj.itemLineIds = (/** @type {?} */ (this)).orderDetails.product_items.map((/**
5855
+ * @param {?} product
5856
+ * @param {?} index
5857
+ * @return {?}
5858
+ */
5859
+ (product, index) => index + 1));
5860
+ transactionPromotionArray.push(transactionPromotionObj);
5861
+ }));
5862
+ }
5863
+ (/** @type {?} */ (this)).webReturnObject.basket.transactionPromotion = transactionPromotionArray;
5864
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: transactionPromotion mapping ended...");
5865
+ return (/** @type {?} */ (this));
5866
+ }
5867
+ /**
5868
+ * @template THIS
5869
+ * @this {THIS}
5870
+ * @return {THIS}
5871
+ */
5872
+ customer() {
5873
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: customer mapping started...");
5874
+ /** @type {?} */
5875
+ let customerObj = (/** @type {?} */ ({}));
5876
+ customerObj.email = (/** @type {?} */ (this)).orderDetails.customer_info && (/** @type {?} */ (this)).orderDetails.customer_info.email ? (/** @type {?} */ (this)).orderDetails.customer_info.email : '';
5877
+ customerObj.firstName = (/** @type {?} */ (this)).orderDetails.billing_address && (/** @type {?} */ (this)).orderDetails.billing_address.first_name ? (/** @type {?} */ (this)).orderDetails.billing_address.first_name : '';
5878
+ customerObj.lastName = (/** @type {?} */ (this)).orderDetails.billing_address && (/** @type {?} */ (this)).orderDetails.billing_address.last_name ? (/** @type {?} */ (this)).orderDetails.billing_address.last_name : '';
5879
+ /** @type {?} */
5880
+ let shippingAddress = (/** @type {?} */ ([]));
5881
+ (/** @type {?} */ (this)).orderDetails.shipments.forEach((/**
5882
+ * @param {?} shipment
5883
+ * @return {?}
5884
+ */
5885
+ shipment => {
5886
+ /** @type {?} */
5887
+ let shippingAddressObj = (/** @type {?} */ ({}));
5888
+ shippingAddressObj.id = shipment.shipping_address && shipment.shipping_address.id ? shipment.shipping_address.id : '';
5889
+ shippingAddressObj.countryCode = shipment.shipping_address && shipment.shipping_address.country_code ? shipment.shipping_address.country_code : '';
5890
+ shippingAddressObj.address1 = shipment.shipping_address && shipment.shipping_address.address1 ? shipment.shipping_address.address1 : '';
5891
+ shippingAddressObj.city = shipment.shipping_address && shipment.shipping_address.city ? shipment.shipping_address.city : '';
5892
+ shippingAddressObj.country = '';
5893
+ shippingAddressObj.postCode = shipment.shipping_address && shipment.shipping_address.postal_code ? shipment.shipping_address.postal_code : '';
5894
+ shippingAddress.push(shippingAddressObj);
5895
+ }));
5896
+ customerObj.shippingAddress = shippingAddress;
5897
+ /** @type {?} */
5898
+ let billingAddress = (/** @type {?} */ ([]));
5899
+ /** @type {?} */
5900
+ let billingAddressObj = (/** @type {?} */ ({}));
5901
+ billingAddressObj.id = (/** @type {?} */ (this)).orderDetails.billing_address && (/** @type {?} */ (this)).orderDetails.billing_address.id ? (/** @type {?} */ (this)).orderDetails.billing_address.id : '';
5902
+ billingAddressObj.countryCode = (/** @type {?} */ (this)).orderDetails.billing_address && (/** @type {?} */ (this)).orderDetails.billing_address.country_code ? (/** @type {?} */ (this)).orderDetails.billing_address.country_code : '';
5903
+ billingAddressObj.address1 = (/** @type {?} */ (this)).orderDetails.billing_address && (/** @type {?} */ (this)).orderDetails.billing_address.address1 ? (/** @type {?} */ (this)).orderDetails.billing_address.address1 : '';
5904
+ billingAddressObj.city = (/** @type {?} */ (this)).orderDetails.billing_address && (/** @type {?} */ (this)).orderDetails.billing_address.city ? (/** @type {?} */ (this)).orderDetails.billing_address.city : '';
5905
+ billingAddressObj.country = '';
5906
+ billingAddressObj.postCode = '';
5907
+ billingAddress.push(billingAddressObj);
5908
+ customerObj.billingAddress = billingAddress;
5909
+ /** @type {?} */
5910
+ let shipmentDetails = (/** @type {?} */ ([]));
5911
+ (/** @type {?} */ (this)).orderDetails.shipments.forEach((/**
5912
+ * @param {?} shipment
5913
+ * @return {?}
5914
+ */
5915
+ shipment => {
5916
+ /** @type {?} */
5917
+ let shipmentDetailsObj = (/** @type {?} */ ({}));
5918
+ shipmentDetailsObj.id = shipment.shipment_id ? shipment.shipment_id : '';
5919
+ shipmentDetailsObj.deliveryGroup = shipment.shipment_id ? shipment.shipment_id : '';
5920
+ shipmentDetails.push(shipmentDetailsObj);
5921
+ }));
5922
+ customerObj.shipmentDetails = shipmentDetails;
5923
+ (/** @type {?} */ (this)).webReturnObject.customer = customerObj;
5924
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: customer mapping ended...");
5925
+ return (/** @type {?} */ (this));
5926
+ }
5927
+ /**
5928
+ * @template THIS
5929
+ * @this {THIS}
5930
+ * @return {THIS}
5931
+ */
5932
+ externalTransactionDetails() {
5933
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: externalTransactionDetails mapping started...");
5934
+ /** @type {?} */
5935
+ let externalTransactionDetails = (/** @type {?} */ ([]));
5936
+ if ((/** @type {?} */ (this)).orderDetails.shipments && (/** @type {?} */ (this)).orderDetails.shipments.length > 0) {
5937
+ (/** @type {?} */ (this)).orderDetails.shipments.forEach((/**
5938
+ * @param {?} shipment
5939
+ * @return {?}
5940
+ */
5941
+ shipment => {
5942
+ /** @type {?} */
5943
+ let externalTransactionDetailsObj = (/** @type {?} */ ({}));
5944
+ /** @type {?} */
5945
+ let transactionInfo = (/** @type {?} */ ({}));
5946
+ externalTransactionDetailsObj.uniqueId = (/** @type {?} */ (this)).orderDetails.order_no ? (/** @type {?} */ (this)).orderDetails.order_no : '';
5947
+ externalTransactionDetailsObj.providerType = PROVIDERS.SALESFORCE;
5948
+ transactionInfo.shippingId = shipment.shipping_method && shipment.shipping_method.id ? shipment.shipping_method.id : '';
5949
+ transactionInfo.externalShippingId = shipment.shipment_id ? shipment.shipment_id : '';
5950
+ externalTransactionDetailsObj.details = transactionInfo;
5951
+ externalTransactionDetails.push(externalTransactionDetailsObj);
5952
+ }));
5953
+ }
5954
+ (/** @type {?} */ (this)).webReturnObject.externalTransactionDetails = externalTransactionDetails;
5955
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: externalTransactionDetails mapping ended...");
5956
+ return (/** @type {?} */ (this));
5957
+ }
5958
+ /**
5959
+ * @template THIS
5960
+ * @this {THIS}
5961
+ * @return {THIS}
5962
+ */
5963
+ basketSummary() {
5964
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: basketSummary mapping started...");
5965
+ /** @type {?} */
5966
+ let basketSummary = (/** @type {?} */ ({}));
5967
+ /** @type {?} */
5968
+ let basketSummaryWebOrder = (/** @type {?} */ ({}));
5969
+ /** @type {?} */
5970
+ const linePromotionTotal = (/** @type {?} */ (this)).webReturnObject.basket.linePromotion.map((/**
5971
+ * @param {?} linePromotion
5972
+ * @return {?}
5973
+ */
5974
+ linePromotion => linePromotion.promotionAmount)).reduce((/**
5975
+ * @param {?} accumulator
5976
+ * @param {?} currentValue
5977
+ * @return {?}
5978
+ */
5979
+ (accumulator, currentValue) => accumulator + currentValue), 0);
5980
+ /** @type {?} */
5981
+ const transactionPromotionTotal = (/** @type {?} */ (this)).webReturnObject.basket.transactionPromotion.map((/**
5982
+ * @param {?} transactionPromotion
5983
+ * @return {?}
5984
+ */
5985
+ transactionPromotion => transactionPromotion.promotionAmount)).reduce((/**
5986
+ * @param {?} accumulator
5987
+ * @param {?} currentValue
5988
+ * @return {?}
5989
+ */
5990
+ (accumulator, currentValue) => accumulator + currentValue), 0);
5991
+ basketSummary.discountTotal = linePromotionTotal + transactionPromotionTotal;
5992
+ basketSummary.VATTotal = (/** @type {?} */ (this)).orderDetails.tax_total ? (/** @type {?} */ (this)).orderDetails.tax_total : 0;
5993
+ basketSummary.saleTotal = (/** @type {?} */ (this)).orderDetails.order_total ? (/** @type {?} */ (this)).orderDetails.order_total : 0;
5994
+ basketSummary.basketTotal = (/** @type {?} */ (this)).orderDetails.order_total ? (/** @type {?} */ (this)).orderDetails.order_total : 0;
5995
+ basketSummary.totalItems = (/** @type {?} */ (this)).orderDetails.product_items && (/** @type {?} */ (this)).orderDetails.product_items.length > 0 ? (/** @type {?} */ (this)).orderDetails.product_items.length : 0;
5996
+ basketSummary.basketTotalWithShippingTotal = (/** @type {?} */ (this)).orderDetails.order_total ? (/** @type {?} */ (this)).orderDetails.order_total : 0;
5997
+ basketSummaryWebOrder.shippingTotal = (/** @type {?} */ (this)).orderDetails.shipping_total ? (/** @type {?} */ (this)).orderDetails.shipping_total : 0;
5998
+ basketSummaryWebOrder.basketTotalWithShippingTotal = (/** @type {?} */ (this)).orderDetails.order_total ? (/** @type {?} */ (this)).orderDetails.order_total : 0;
5999
+ basketSummary.webOrder = basketSummaryWebOrder;
6000
+ (/** @type {?} */ (this)).webReturnObject.basketSummary = basketSummary;
6001
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: basketSummary mapping ended...");
6002
+ return (/** @type {?} */ (this));
6003
+ }
6004
+ /**
6005
+ * @template THIS
6006
+ * @this {THIS}
6007
+ * @param {?} deviceId
6008
+ * @return {THIS}
6009
+ */
6010
+ deviceId(deviceId) {
6011
+ (/** @type {?} */ (this)).webReturnObject.deviceId = deviceId;
6012
+ return (/** @type {?} */ (this));
6013
+ }
6014
+ /**
6015
+ * @template THIS
6016
+ * @this {THIS}
6017
+ * @param {?} terminalId
6018
+ * @return {THIS}
6019
+ */
6020
+ terminalId(terminalId) {
6021
+ (/** @type {?} */ (this)).webReturnObject.terminalId = terminalId;
6022
+ return (/** @type {?} */ (this));
6023
+ }
6024
+ /**
6025
+ * @template THIS
6026
+ * @this {THIS}
6027
+ * @param {?} orgCode
6028
+ * @return {THIS}
6029
+ */
6030
+ orgCode(orgCode) {
6031
+ (/** @type {?} */ (this)).webReturnObject.orgCode = orgCode;
6032
+ return (/** @type {?} */ (this));
6033
+ }
6034
+ /**
6035
+ * @template THIS
6036
+ * @this {THIS}
6037
+ * @param {?} storeId
6038
+ * @return {THIS}
6039
+ */
6040
+ storeId(storeId) {
6041
+ (/** @type {?} */ (this)).webReturnObject.storeId = storeId;
6042
+ return (/** @type {?} */ (this));
6043
+ }
6044
+ /**
6045
+ * @template THIS
6046
+ * @this {THIS}
6047
+ * @param {?} storeNodeId
6048
+ * @return {THIS}
6049
+ */
6050
+ storeNodeId(storeNodeId) {
6051
+ (/** @type {?} */ (this)).webReturnObject.storeNodeId = storeNodeId;
6052
+ return (/** @type {?} */ (this));
6053
+ }
6054
+ /**
6055
+ * @template THIS
6056
+ * @this {THIS}
6057
+ * @param {?} storeNodeStructure
6058
+ * @return {THIS}
6059
+ */
6060
+ storeNodeStructure(storeNodeStructure) {
6061
+ (/** @type {?} */ (this)).webReturnObject.storeNodeStructure = storeNodeStructure;
6062
+ return (/** @type {?} */ (this));
6063
+ }
6064
+ /**
6065
+ * @template THIS
6066
+ * @this {THIS}
6067
+ * @param {?} docId
6068
+ * @return {THIS}
6069
+ */
6070
+ docId(docId) {
6071
+ (/** @type {?} */ (this)).webReturnObject.id = docId;
6072
+ return (/** @type {?} */ (this));
6073
+ }
6074
+ /**
6075
+ * @template THIS
6076
+ * @this {THIS}
6077
+ * @param {?} userID
6078
+ * @return {THIS}
6079
+ */
6080
+ updateUserID(userID) {
6081
+ (/** @type {?} */ (this)).webReturnObject.userId = userID;
6082
+ return (/** @type {?} */ (this));
6083
+ }
6084
+ /**
6085
+ * @template THIS
6086
+ * @this {THIS}
6087
+ * @param {?} name
6088
+ * @return {THIS}
6089
+ */
6090
+ updateUserName(name) {
6091
+ (/** @type {?} */ (this)).webReturnObject.userName = name;
6092
+ return (/** @type {?} */ (this));
6093
+ }
6094
+ /**
6095
+ * @return {?}
6096
+ */
6097
+ build() {
6098
+ console.log("Mapper library: WebReturnSalesforceMapperBuilderClass: mapping done...");
6099
+ return this.webReturnObject;
6100
+ }
6101
+ /**
6102
+ * @param {?} date
6103
+ * @return {?}
6104
+ */
6105
+ getUTCDateTime(date) {
6106
+ if (date) {
6107
+ return new Date(date).toISOString();
6108
+ }
6109
+ }
6110
+ }
6111
+ if (false) {
6112
+ /**
6113
+ * @type {?}
6114
+ * @private
6115
+ */
6116
+ WebReturnSalesforceMapperBuilderClass.prototype.orderDetails;
6117
+ /**
6118
+ * @type {?}
6119
+ * @private
6120
+ */
6121
+ WebReturnSalesforceMapperBuilderClass.prototype.webReturnObject;
6122
+ }
6123
+
5219
6124
  /**
5220
6125
  * @fileoverview added by tsickle
5221
6126
  * Generated from: public-api.ts
@@ -5228,5 +6133,5 @@ if (false) {
5228
6133
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5229
6134
  */
5230
6135
 
5231
- export { MapperLibraryComponent, MapperLibraryModule, RJMapperBuilderClass, WebReturnMapperBuilderClass };
6136
+ export { MapperLibraryComponent, MapperLibraryModule, RJMapperBuilderClass, WebReturnMapperBuilderClass, WebReturnSalesforceMapperBuilderClass };
5232
6137
  //# sourceMappingURL=pmcretail-mapper-library.js.map