@pmcretail/mapper-library 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/pmcretail-mapper-library.umd.js +102 -66
- package/bundles/pmcretail-mapper-library.umd.js.map +1 -1
- package/bundles/pmcretail-mapper-library.umd.min.js +1 -1
- package/bundles/pmcretail-mapper-library.umd.min.js.map +1 -1
- package/esm2015/lib/RJ-mapper.class.js +88 -67
- package/esm2015/lib/mapper-library.component.js +5 -5
- package/esm2015/lib/mapper-library.module.js +1 -1
- package/esm5/lib/RJ-mapper.class.js +103 -67
- package/esm5/lib/mapper-library.component.js +1 -1
- package/esm5/lib/mapper-library.module.js +1 -1
- package/fesm2015/pmcretail-mapper-library.js +91 -70
- package/fesm2015/pmcretail-mapper-library.js.map +1 -1
- package/fesm5/pmcretail-mapper-library.js +102 -66
- package/fesm5/pmcretail-mapper-library.js.map +1 -1
- package/lib/RJ-mapper.class.d.ts +5 -0
- package/package.json +1 -1
- package/pmcretail-mapper-library.metadata.json +1 -1
|
@@ -4874,32 +4874,6 @@
|
|
|
4874
4874
|
this.itemCount = 0;
|
|
4875
4875
|
this.largestNumber = 0;
|
|
4876
4876
|
this.rjObject = {};
|
|
4877
|
-
this.paymentTypes = [
|
|
4878
|
-
{
|
|
4879
|
-
paymentType: 'Card',
|
|
4880
|
-
type: 'SEPAY',
|
|
4881
|
-
tenderType: '5',
|
|
4882
|
-
tenderSubType: '8',
|
|
4883
|
-
},
|
|
4884
|
-
{
|
|
4885
|
-
paymentType: 'Cash',
|
|
4886
|
-
type: 'TMC_CASH',
|
|
4887
|
-
tenderType: '1',
|
|
4888
|
-
tenderSubType: '0'
|
|
4889
|
-
},
|
|
4890
|
-
{
|
|
4891
|
-
paymentType: 'PDQ',
|
|
4892
|
-
type: 'Unintegrated',
|
|
4893
|
-
tenderType: '2',
|
|
4894
|
-
tenderSubType: '8'
|
|
4895
|
-
},
|
|
4896
|
-
{
|
|
4897
|
-
paymentType: 'Gift Card',
|
|
4898
|
-
type: 'TMC_GIFTCARD',
|
|
4899
|
-
tenderType: '5',
|
|
4900
|
-
tenderSubType: '8'
|
|
4901
|
-
}
|
|
4902
|
-
];
|
|
4903
4877
|
if (transactionDoc) {
|
|
4904
4878
|
this.transactionDocument = transactionDoc;
|
|
4905
4879
|
}
|
|
@@ -4932,6 +4906,8 @@
|
|
|
4932
4906
|
}
|
|
4933
4907
|
this.initilizeItemCount();
|
|
4934
4908
|
this.setLineNumberForProducts();
|
|
4909
|
+
this.createdAt = this.getdate(this.transactionDocument.createdAt);
|
|
4910
|
+
this.updatedAt = this.getdate(this.transactionDocument.updatedAt);
|
|
4935
4911
|
}
|
|
4936
4912
|
/**
|
|
4937
4913
|
* @template THIS
|
|
@@ -4945,9 +4921,9 @@
|
|
|
4945
4921
|
*/
|
|
4946
4922
|
function () {
|
|
4947
4923
|
(/** @type {?} */ (this)).rjObject['Keyword'] = (/** @type {?} */ (this)).generateKeyword();
|
|
4948
|
-
(/** @type {?} */ (this)).rjObject['ID'] = (/** @type {?} */ (this)).generateId((/** @type {?} */ (this)).
|
|
4924
|
+
(/** @type {?} */ (this)).rjObject['ID'] = (/** @type {?} */ (this)).generateId((/** @type {?} */ (this)).createdAt);
|
|
4949
4925
|
(/** @type {?} */ (this)).rjObject['XMLSchemaVersion'] = '2';
|
|
4950
|
-
(/** @type {?} */ (this)).rjObject['LastUpdated'] = (/** @type {?} */ (this)).
|
|
4926
|
+
(/** @type {?} */ (this)).rjObject['LastUpdated'] = (/** @type {?} */ (this)).updatedAt;
|
|
4951
4927
|
(/** @type {?} */ (this)).rjObject['MajorVersion'] = (/** @type {?} */ (this)).majorVersion;
|
|
4952
4928
|
(/** @type {?} */ (this)).rjObject['MinorVersion'] = (/** @type {?} */ (this)).minorVersion;
|
|
4953
4929
|
(/** @type {?} */ (this)).rjObject['ManifestVersion'] = (/** @type {?} */ (this)).manifestVersion;
|
|
@@ -4970,7 +4946,7 @@
|
|
|
4970
4946
|
function () {
|
|
4971
4947
|
(/** @type {?} */ (this)).rjObject['Header'] = {};
|
|
4972
4948
|
(/** @type {?} */ (this)).rjObject['Header'].TimeZoneOffset = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).generateTimezoneoffset((/** @type {?} */ (this)).transactionDocument.createdAt));
|
|
4973
|
-
(/** @type {?} */ (this)).rjObject['Header'].DateTimeCreated = (/** @type {?} */ (this)).
|
|
4949
|
+
(/** @type {?} */ (this)).rjObject['Header'].DateTimeCreated = (/** @type {?} */ (this)).createdAt;
|
|
4974
4950
|
(/** @type {?} */ (this)).rjObject['Header'].OriginatedBy = {};
|
|
4975
4951
|
(/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.DeviceID = (/** @type {?} */ (this)).deviceId;
|
|
4976
4952
|
(/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.CashierID = (/** @type {?} */ (this)).cashierId;
|
|
@@ -4987,7 +4963,7 @@
|
|
|
4987
4963
|
(/** @type {?} */ (this)).rjObject['Header'].TradingRegionID = (/** @type {?} */ (this)).tradingRegionId;
|
|
4988
4964
|
(/** @type {?} */ (this)).rjObject['Header'].Eurozone = " "; //unknown
|
|
4989
4965
|
(/** @type {?} */ (this)).rjObject['Header'].EuroBaseExchangeRate = ""; //unknown
|
|
4990
|
-
(/** @type {?} */ (this)).rjObject['Header'].PrintableName =
|
|
4966
|
+
(/** @type {?} */ (this)).rjObject['Header'].PrintableName = (/** @type {?} */ (this)).transactionDocument.userName; //unknown
|
|
4991
4967
|
return (/** @type {?} */ (this));
|
|
4992
4968
|
};
|
|
4993
4969
|
/**
|
|
@@ -5132,7 +5108,7 @@
|
|
|
5132
5108
|
obj['NetValue'] = element.discountAmount < 0 ? element.discountAmount : -element.discountAmount;
|
|
5133
5109
|
obj['EffectiveNetValue'] = element.discountAmount < 0 ? element.discountAmount : -element.discountAmount;
|
|
5134
5110
|
obj['Description'] = element.reasonCode;
|
|
5135
|
-
obj['UserID'] = (/** @type {?} */ (_this)).transactionDocument.
|
|
5111
|
+
obj['UserID'] = (/** @type {?} */ (_this)).transactionDocument.userName;
|
|
5136
5112
|
obj['ReasonCodeID'] = element.reasonCode;
|
|
5137
5113
|
obj['DiscountType'] = element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1; // todo - compare values
|
|
5138
5114
|
obj['RoundingRule'] = 2;
|
|
@@ -5171,8 +5147,8 @@
|
|
|
5171
5147
|
obj.EffectiveNetValue = 0;
|
|
5172
5148
|
obj.Description = data.percentageDiscountReasonName ? data.percentageDiscountReasonName : data.priceOverrideReasonName;
|
|
5173
5149
|
obj.DeviceID = this.deviceId;
|
|
5174
|
-
obj.UserID = this.
|
|
5175
|
-
obj.DateTimeCreated = this.
|
|
5150
|
+
obj.UserID = this.transactionDocument.userName;
|
|
5151
|
+
obj.DateTimeCreated = this.updatedAt;
|
|
5176
5152
|
obj.AuthorisingUserID = this.userId;
|
|
5177
5153
|
obj.ReasonCodeID = data.percentageDiscountReasonCode ? data.percentageDiscountReasonCode : data.priceOverrideReasonCode;
|
|
5178
5154
|
obj.ModifiedLineNumber = lineNo;
|
|
@@ -5193,10 +5169,10 @@
|
|
|
5193
5169
|
function () {
|
|
5194
5170
|
var _this = this;
|
|
5195
5171
|
(/** @type {?} */ (this)).rjObject['Trailer'] = {};
|
|
5196
|
-
(/** @type {?} */ (this)).rjObject.Trailer.DateTimeCompleted = (/** @type {?} */ (this)).
|
|
5172
|
+
(/** @type {?} */ (this)).rjObject.Trailer.DateTimeCompleted = (/** @type {?} */ (this)).updatedAt;
|
|
5197
5173
|
(/** @type {?} */ (this)).rjObject.Trailer.CompletedBy = {};
|
|
5198
|
-
(/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.DeviceID = (/** @type {?} */ (this)).deviceId;
|
|
5199
|
-
(/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.CashierID = (/** @type {?} */ (this)).cashierId;
|
|
5174
|
+
(/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.DeviceID = (/** @type {?} */ (this)).deviceId;
|
|
5175
|
+
(/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.CashierID = (/** @type {?} */ (this)).cashierId;
|
|
5200
5176
|
(/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.StoreID = (/** @type {?} */ (this)).transactionDocument.storeId;
|
|
5201
5177
|
(/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.BranchID = (/** @type {?} */ (this)).branchId;
|
|
5202
5178
|
(/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.TerminalNumber = (/** @type {?} */ (this)).transactionDocument.terminalId;
|
|
@@ -5300,7 +5276,7 @@
|
|
|
5300
5276
|
* @param {?} x
|
|
5301
5277
|
* @return {?}
|
|
5302
5278
|
*/
|
|
5303
|
-
function (x) { return x.
|
|
5279
|
+
function (x) { return x.name.toUpperCase() === element.paymentType.toUpperCase(); }));
|
|
5304
5280
|
if (element.paymentType.toUpperCase() === 'GIFT CARD') {
|
|
5305
5281
|
/** @type {?} */
|
|
5306
5282
|
var obj = {
|
|
@@ -5308,13 +5284,10 @@
|
|
|
5308
5284
|
LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
|
|
5309
5285
|
NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
|
|
5310
5286
|
EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
|
|
5311
|
-
Description: (/** @type {?} */ (_this)).getDescription(value[0].
|
|
5312
|
-
//todo
|
|
5287
|
+
Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
|
|
5313
5288
|
DeviceID: (/** @type {?} */ (_this)).deviceId,
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
//todo
|
|
5317
|
-
DateTimeCreated: (/** @type {?} */ (_this)).transactionDocument.updatedAt,
|
|
5289
|
+
UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
|
|
5290
|
+
DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
|
|
5318
5291
|
TenderType: value[0].tenderType,
|
|
5319
5292
|
TenderSubType: value[0].tenderSubType,
|
|
5320
5293
|
TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
|
|
@@ -5336,13 +5309,10 @@
|
|
|
5336
5309
|
//todo
|
|
5337
5310
|
NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
5338
5311
|
EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
5339
|
-
Description: (/** @type {?} */ (_this)).getDescription(value[0].
|
|
5340
|
-
//todo
|
|
5312
|
+
Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
|
|
5341
5313
|
DeviceID: (/** @type {?} */ (_this)).deviceId,
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
//todo
|
|
5345
|
-
DateTimeCreated: (/** @type {?} */ (_this)).transactionDocument.updatedAt,
|
|
5314
|
+
UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
|
|
5315
|
+
DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
|
|
5346
5316
|
TenderType: value[0].tenderType,
|
|
5347
5317
|
TenderSubType: value[0].tenderSubType,
|
|
5348
5318
|
TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
@@ -5660,7 +5630,7 @@
|
|
|
5660
5630
|
* @return {THIS}
|
|
5661
5631
|
*/
|
|
5662
5632
|
function (value) {
|
|
5663
|
-
(/** @type {?} */ (this)).cashierId =
|
|
5633
|
+
(/** @type {?} */ (this)).cashierId = ((/** @type {?} */ (this)).transactionDocument && (/** @type {?} */ (this)).transactionDocument.userName) ? (/** @type {?} */ (this)).transactionDocument.userName : '';
|
|
5664
5634
|
return (/** @type {?} */ (this));
|
|
5665
5635
|
};
|
|
5666
5636
|
/**
|
|
@@ -5743,6 +5713,22 @@
|
|
|
5743
5713
|
(/** @type {?} */ (this)).branchId = value;
|
|
5744
5714
|
return (/** @type {?} */ (this));
|
|
5745
5715
|
};
|
|
5716
|
+
/**
|
|
5717
|
+
* @template THIS
|
|
5718
|
+
* @this {THIS}
|
|
5719
|
+
* @param {?} value
|
|
5720
|
+
* @return {THIS}
|
|
5721
|
+
*/
|
|
5722
|
+
RJMapperBuilderClass.prototype.setPaymentDetails = /**
|
|
5723
|
+
* @template THIS
|
|
5724
|
+
* @this {THIS}
|
|
5725
|
+
* @param {?} value
|
|
5726
|
+
* @return {THIS}
|
|
5727
|
+
*/
|
|
5728
|
+
function (value) {
|
|
5729
|
+
(/** @type {?} */ (this)).paymentTypes = value;
|
|
5730
|
+
return (/** @type {?} */ (this));
|
|
5731
|
+
};
|
|
5746
5732
|
/**
|
|
5747
5733
|
* @param {?} date
|
|
5748
5734
|
* @return {?}
|
|
@@ -5809,6 +5795,12 @@
|
|
|
5809
5795
|
function (element, lineDiscount) {
|
|
5810
5796
|
/** @type {?} */
|
|
5811
5797
|
var obj = {};
|
|
5798
|
+
/** @type {?} */
|
|
5799
|
+
var taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
5800
|
+
* @param {?} item
|
|
5801
|
+
* @return {?}
|
|
5802
|
+
*/
|
|
5803
|
+
function (item) { return item.itemLineId == element['itemLineId']; }));
|
|
5812
5804
|
obj['XMLSchemaVersion'] = this.xmlSchemaVersion;
|
|
5813
5805
|
obj['LineNumber'] = element['itemLineId'];
|
|
5814
5806
|
obj['NetValue'] = this.removeDecimal(element['refundedTotal']);
|
|
@@ -5816,7 +5808,7 @@
|
|
|
5816
5808
|
obj['Description'] = element['description'];
|
|
5817
5809
|
obj['DeviceID'] = this.transactionDocument['terminalId'];
|
|
5818
5810
|
obj['UserID'] = this.userId;
|
|
5819
|
-
obj['DateTimeCreated'] = this.
|
|
5811
|
+
obj['DateTimeCreated'] = this.createdAt;
|
|
5820
5812
|
obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
|
|
5821
5813
|
obj['UnitPrice'] = this.removeDecimal(element['price']);
|
|
5822
5814
|
obj['Quantity'] = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : -element['refundedQuantity'].toFixed(1);
|
|
@@ -5839,15 +5831,8 @@
|
|
|
5839
5831
|
obj['MMGroupID'] = this.getAttributes();
|
|
5840
5832
|
obj['CustomerDetails'] = ""; // todo - blank
|
|
5841
5833
|
obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
var taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
5845
|
-
* @param {?} item
|
|
5846
|
-
* @return {?}
|
|
5847
|
-
*/
|
|
5848
|
-
function (item) { return item.itemLineId == element['itemLineId']; }));
|
|
5849
|
-
obj['OriginalTaxAmount'] = taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal); //todo
|
|
5850
|
-
obj['taxAmount'] = taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal);
|
|
5834
|
+
obj['OriginalTaxAmount'] = this.convertToString(this.getoriginltax(element, taxTotal.VAT) * -1);
|
|
5835
|
+
obj['taxAmount'] = taxTotal.taxLineTotal < 0 ? (taxTotal.taxLineTotal) : (-taxTotal.taxLineTotal);
|
|
5851
5836
|
if (lineDiscount) {
|
|
5852
5837
|
if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {
|
|
5853
5838
|
// line discount
|
|
@@ -5909,10 +5894,8 @@
|
|
|
5909
5894
|
EffectiveNetValue: this.removeDecimal(element.totalLinePrice),
|
|
5910
5895
|
Description: element.description,
|
|
5911
5896
|
DeviceID: this.deviceId,
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
//to do,
|
|
5915
|
-
DateTimeCreated: this.transactionDocument.createdAt,
|
|
5897
|
+
UserID: this.transactionDocument.userName,
|
|
5898
|
+
DateTimeCreated: this.createdAt,
|
|
5916
5899
|
ExtendedValue: this.removeDecimal(element.price),
|
|
5917
5900
|
UnitPrice: this.removeDecimal(element.price),
|
|
5918
5901
|
MMGroupID: this.getAttributes(),
|
|
@@ -5927,8 +5910,8 @@
|
|
|
5927
5910
|
function (item) { return item.itemLineId == element['itemLineId']; })).VATCode,
|
|
5928
5911
|
TaxModifiable: 1,
|
|
5929
5912
|
//todo
|
|
5930
|
-
OriginalTaxAmount:
|
|
5931
|
-
TaxAmount:
|
|
5913
|
+
OriginalTaxAmount: this.convertToString(this.getoriginltax(element, taxTotal.VAT)),
|
|
5914
|
+
TaxAmount: this.convertToString(taxTotal.taxLineTotal),
|
|
5932
5915
|
OriginalTaxAmountSet: 1,
|
|
5933
5916
|
//todo
|
|
5934
5917
|
ProductID: element.SKU,
|
|
@@ -5973,6 +5956,23 @@
|
|
|
5973
5956
|
}
|
|
5974
5957
|
return obj;
|
|
5975
5958
|
};
|
|
5959
|
+
/**
|
|
5960
|
+
* @param {?} element
|
|
5961
|
+
* @param {?} VAT
|
|
5962
|
+
* @return {?}
|
|
5963
|
+
*/
|
|
5964
|
+
RJMapperBuilderClass.prototype.getoriginltax = /**
|
|
5965
|
+
* @param {?} element
|
|
5966
|
+
* @param {?} VAT
|
|
5967
|
+
* @return {?}
|
|
5968
|
+
*/
|
|
5969
|
+
function (element, VAT) {
|
|
5970
|
+
/** @type {?} */
|
|
5971
|
+
var pricebeforetax = (element.price * 100) / (100 + VAT);
|
|
5972
|
+
/** @type {?} */
|
|
5973
|
+
var originaltax = element.price - pricebeforetax;
|
|
5974
|
+
return originaltax;
|
|
5975
|
+
};
|
|
5976
5976
|
/**
|
|
5977
5977
|
* @param {?} value
|
|
5978
5978
|
* @return {?}
|
|
@@ -6039,6 +6039,32 @@
|
|
|
6039
6039
|
return "";
|
|
6040
6040
|
}
|
|
6041
6041
|
};
|
|
6042
|
+
/**
|
|
6043
|
+
* @param {?} date
|
|
6044
|
+
* @return {?}
|
|
6045
|
+
*/
|
|
6046
|
+
RJMapperBuilderClass.prototype.getdate = /**
|
|
6047
|
+
* @param {?} date
|
|
6048
|
+
* @return {?}
|
|
6049
|
+
*/
|
|
6050
|
+
function (date) {
|
|
6051
|
+
/** @type {?} */
|
|
6052
|
+
var offset = this.generateTimezoneoffset(date) * -1;
|
|
6053
|
+
/** @type {?} */
|
|
6054
|
+
var offsetHours = Math.abs(Math.floor(offset / 60));
|
|
6055
|
+
/** @type {?} */
|
|
6056
|
+
var offsetMinutes = Math.abs(offset) - offsetHours * 60;
|
|
6057
|
+
/** @type {?} */
|
|
6058
|
+
var offsetSign = '+';
|
|
6059
|
+
if (offset < 0) {
|
|
6060
|
+
offsetSign = '-';
|
|
6061
|
+
}
|
|
6062
|
+
/** @type {?} */
|
|
6063
|
+
var newdate = date.substring(0, 19);
|
|
6064
|
+
/** @type {?} */
|
|
6065
|
+
var x = (newdate + offsetSign + offsetHours + ':' + offsetMinutes).toString();
|
|
6066
|
+
return x;
|
|
6067
|
+
};
|
|
6042
6068
|
return RJMapperBuilderClass;
|
|
6043
6069
|
}());
|
|
6044
6070
|
if (false) {
|
|
@@ -6152,6 +6178,16 @@
|
|
|
6152
6178
|
* @private
|
|
6153
6179
|
*/
|
|
6154
6180
|
RJMapperBuilderClass.prototype.branchId;
|
|
6181
|
+
/**
|
|
6182
|
+
* @type {?}
|
|
6183
|
+
* @private
|
|
6184
|
+
*/
|
|
6185
|
+
RJMapperBuilderClass.prototype.createdAt;
|
|
6186
|
+
/**
|
|
6187
|
+
* @type {?}
|
|
6188
|
+
* @private
|
|
6189
|
+
*/
|
|
6190
|
+
RJMapperBuilderClass.prototype.updatedAt;
|
|
6155
6191
|
/**
|
|
6156
6192
|
* @type {?}
|
|
6157
6193
|
* @private
|