@pmcretail/mapper-library 0.0.8 → 0.0.9
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 +96 -54
- 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 +82 -55
- package/esm5/lib/RJ-mapper.class.js +97 -55
- package/fesm2015/pmcretail-mapper-library.js +81 -54
- package/fesm2015/pmcretail-mapper-library.js.map +1 -1
- package/fesm5/pmcretail-mapper-library.js +96 -54
- 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
|
@@ -4654,32 +4654,6 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4654
4654
|
this.itemCount = 0;
|
|
4655
4655
|
this.largestNumber = 0;
|
|
4656
4656
|
this.rjObject = {};
|
|
4657
|
-
this.paymentTypes = [
|
|
4658
|
-
{
|
|
4659
|
-
paymentType: 'Card',
|
|
4660
|
-
type: 'SEPAY',
|
|
4661
|
-
tenderType: '5',
|
|
4662
|
-
tenderSubType: '8',
|
|
4663
|
-
},
|
|
4664
|
-
{
|
|
4665
|
-
paymentType: 'Cash',
|
|
4666
|
-
type: 'TMC_CASH',
|
|
4667
|
-
tenderType: '1',
|
|
4668
|
-
tenderSubType: '0'
|
|
4669
|
-
},
|
|
4670
|
-
{
|
|
4671
|
-
paymentType: 'PDQ',
|
|
4672
|
-
type: 'Unintegrated',
|
|
4673
|
-
tenderType: '2',
|
|
4674
|
-
tenderSubType: '8'
|
|
4675
|
-
},
|
|
4676
|
-
{
|
|
4677
|
-
paymentType: 'Gift Card',
|
|
4678
|
-
type: 'TMC_GIFTCARD',
|
|
4679
|
-
tenderType: '5',
|
|
4680
|
-
tenderSubType: '8'
|
|
4681
|
-
}
|
|
4682
|
-
];
|
|
4683
4657
|
if (transactionDoc) {
|
|
4684
4658
|
this.transactionDocument = transactionDoc;
|
|
4685
4659
|
}
|
|
@@ -4712,6 +4686,8 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4712
4686
|
}
|
|
4713
4687
|
this.initilizeItemCount();
|
|
4714
4688
|
this.setLineNumberForProducts();
|
|
4689
|
+
this.createdAt = this.getdate(this.transactionDocument.createdAt);
|
|
4690
|
+
this.updatedAt = this.getdate(this.transactionDocument.updatedAt);
|
|
4715
4691
|
}
|
|
4716
4692
|
/**
|
|
4717
4693
|
* @template THIS
|
|
@@ -4725,9 +4701,9 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4725
4701
|
*/
|
|
4726
4702
|
function () {
|
|
4727
4703
|
(/** @type {?} */ (this)).rjObject['Keyword'] = (/** @type {?} */ (this)).generateKeyword();
|
|
4728
|
-
(/** @type {?} */ (this)).rjObject['ID'] = (/** @type {?} */ (this)).generateId((/** @type {?} */ (this)).
|
|
4704
|
+
(/** @type {?} */ (this)).rjObject['ID'] = (/** @type {?} */ (this)).generateId((/** @type {?} */ (this)).createdAt);
|
|
4729
4705
|
(/** @type {?} */ (this)).rjObject['XMLSchemaVersion'] = '2';
|
|
4730
|
-
(/** @type {?} */ (this)).rjObject['LastUpdated'] = (/** @type {?} */ (this)).
|
|
4706
|
+
(/** @type {?} */ (this)).rjObject['LastUpdated'] = (/** @type {?} */ (this)).updatedAt;
|
|
4731
4707
|
(/** @type {?} */ (this)).rjObject['MajorVersion'] = (/** @type {?} */ (this)).majorVersion;
|
|
4732
4708
|
(/** @type {?} */ (this)).rjObject['MinorVersion'] = (/** @type {?} */ (this)).minorVersion;
|
|
4733
4709
|
(/** @type {?} */ (this)).rjObject['ManifestVersion'] = (/** @type {?} */ (this)).manifestVersion;
|
|
@@ -4750,7 +4726,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4750
4726
|
function () {
|
|
4751
4727
|
(/** @type {?} */ (this)).rjObject['Header'] = {};
|
|
4752
4728
|
(/** @type {?} */ (this)).rjObject['Header'].TimeZoneOffset = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).generateTimezoneoffset((/** @type {?} */ (this)).transactionDocument.createdAt));
|
|
4753
|
-
(/** @type {?} */ (this)).rjObject['Header'].DateTimeCreated = (/** @type {?} */ (this)).
|
|
4729
|
+
(/** @type {?} */ (this)).rjObject['Header'].DateTimeCreated = (/** @type {?} */ (this)).createdAt;
|
|
4754
4730
|
(/** @type {?} */ (this)).rjObject['Header'].OriginatedBy = {};
|
|
4755
4731
|
(/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.DeviceID = (/** @type {?} */ (this)).deviceId;
|
|
4756
4732
|
(/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.CashierID = (/** @type {?} */ (this)).cashierId;
|
|
@@ -4952,7 +4928,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4952
4928
|
obj.Description = data.percentageDiscountReasonName ? data.percentageDiscountReasonName : data.priceOverrideReasonName;
|
|
4953
4929
|
obj.DeviceID = this.deviceId;
|
|
4954
4930
|
obj.UserID = this.userId;
|
|
4955
|
-
obj.DateTimeCreated = this.
|
|
4931
|
+
obj.DateTimeCreated = this.updatedAt;
|
|
4956
4932
|
obj.AuthorisingUserID = this.userId;
|
|
4957
4933
|
obj.ReasonCodeID = data.percentageDiscountReasonCode ? data.percentageDiscountReasonCode : data.priceOverrideReasonCode;
|
|
4958
4934
|
obj.ModifiedLineNumber = lineNo;
|
|
@@ -4973,7 +4949,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4973
4949
|
function () {
|
|
4974
4950
|
var _this = this;
|
|
4975
4951
|
(/** @type {?} */ (this)).rjObject['Trailer'] = {};
|
|
4976
|
-
(/** @type {?} */ (this)).rjObject.Trailer.DateTimeCompleted = (/** @type {?} */ (this)).
|
|
4952
|
+
(/** @type {?} */ (this)).rjObject.Trailer.DateTimeCompleted = (/** @type {?} */ (this)).updatedAt;
|
|
4977
4953
|
(/** @type {?} */ (this)).rjObject.Trailer.CompletedBy = {};
|
|
4978
4954
|
(/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.DeviceID = (/** @type {?} */ (this)).deviceId; //todo
|
|
4979
4955
|
(/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.CashierID = (/** @type {?} */ (this)).cashierId; //todo
|
|
@@ -5080,24 +5056,23 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5080
5056
|
* @param {?} x
|
|
5081
5057
|
* @return {?}
|
|
5082
5058
|
*/
|
|
5083
|
-
function (x) { return x.
|
|
5059
|
+
function (x) { return x.name.toUpperCase() === element.paymentType.toUpperCase(); }));
|
|
5084
5060
|
if (element.paymentType.toUpperCase() === 'GIFT CARD') {
|
|
5085
5061
|
/** @type {?} */
|
|
5086
5062
|
var obj = {
|
|
5087
5063
|
XMLSchemaVersion: (/** @type {?} */ (_this)).xmlSchemaVersion,
|
|
5088
5064
|
LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
|
|
5089
|
-
NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (
|
|
5090
|
-
EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (
|
|
5091
|
-
Description: (/** @type {?} */ (_this)).getDescription(value[0].
|
|
5092
|
-
//todo
|
|
5065
|
+
NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (Math.round(element.amount))),
|
|
5066
|
+
EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (Math.round(element.amount))),
|
|
5067
|
+
Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
|
|
5093
5068
|
DeviceID: (/** @type {?} */ (_this)).deviceId,
|
|
5094
5069
|
//todo
|
|
5095
5070
|
UserID: (/** @type {?} */ (_this)).userId,
|
|
5096
5071
|
//todo
|
|
5097
|
-
DateTimeCreated: (/** @type {?} */ (_this)).
|
|
5072
|
+
DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
|
|
5098
5073
|
TenderType: value[0].tenderType,
|
|
5099
5074
|
TenderSubType: value[0].tenderSubType,
|
|
5100
|
-
TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (
|
|
5075
|
+
TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (Math.round(element.amount))),
|
|
5101
5076
|
CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
|
|
5102
5077
|
CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
|
|
5103
5078
|
GiftVoucherSalesAllowed: '',
|
|
@@ -5116,13 +5091,12 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5116
5091
|
//todo
|
|
5117
5092
|
NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
5118
5093
|
EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
5119
|
-
Description: (/** @type {?} */ (_this)).getDescription(value[0].
|
|
5120
|
-
//todo
|
|
5094
|
+
Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
|
|
5121
5095
|
DeviceID: (/** @type {?} */ (_this)).deviceId,
|
|
5122
5096
|
//todo
|
|
5123
5097
|
UserID: (/** @type {?} */ (_this)).userId,
|
|
5124
5098
|
//todo
|
|
5125
|
-
DateTimeCreated: (/** @type {?} */ (_this)).
|
|
5099
|
+
DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
|
|
5126
5100
|
TenderType: value[0].tenderType,
|
|
5127
5101
|
TenderSubType: value[0].tenderSubType,
|
|
5128
5102
|
TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
@@ -5523,6 +5497,22 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5523
5497
|
(/** @type {?} */ (this)).branchId = value;
|
|
5524
5498
|
return (/** @type {?} */ (this));
|
|
5525
5499
|
};
|
|
5500
|
+
/**
|
|
5501
|
+
* @template THIS
|
|
5502
|
+
* @this {THIS}
|
|
5503
|
+
* @param {?} value
|
|
5504
|
+
* @return {THIS}
|
|
5505
|
+
*/
|
|
5506
|
+
RJMapperBuilderClass.prototype.setPaymentDetails = /**
|
|
5507
|
+
* @template THIS
|
|
5508
|
+
* @this {THIS}
|
|
5509
|
+
* @param {?} value
|
|
5510
|
+
* @return {THIS}
|
|
5511
|
+
*/
|
|
5512
|
+
function (value) {
|
|
5513
|
+
(/** @type {?} */ (this)).paymentTypes = value;
|
|
5514
|
+
return (/** @type {?} */ (this));
|
|
5515
|
+
};
|
|
5526
5516
|
/**
|
|
5527
5517
|
* @param {?} date
|
|
5528
5518
|
* @return {?}
|
|
@@ -5589,6 +5579,12 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5589
5579
|
function (element, lineDiscount) {
|
|
5590
5580
|
/** @type {?} */
|
|
5591
5581
|
var obj = {};
|
|
5582
|
+
/** @type {?} */
|
|
5583
|
+
var taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
5584
|
+
* @param {?} item
|
|
5585
|
+
* @return {?}
|
|
5586
|
+
*/
|
|
5587
|
+
function (item) { return item.itemLineId == element['itemLineId']; }));
|
|
5592
5588
|
obj['XMLSchemaVersion'] = this.xmlSchemaVersion;
|
|
5593
5589
|
obj['LineNumber'] = element['itemLineId'];
|
|
5594
5590
|
obj['NetValue'] = this.removeDecimal(element['refundedTotal']);
|
|
@@ -5596,7 +5592,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5596
5592
|
obj['Description'] = element['description'];
|
|
5597
5593
|
obj['DeviceID'] = this.transactionDocument['terminalId'];
|
|
5598
5594
|
obj['UserID'] = this.userId;
|
|
5599
|
-
obj['DateTimeCreated'] = this.
|
|
5595
|
+
obj['DateTimeCreated'] = this.createdAt;
|
|
5600
5596
|
obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
|
|
5601
5597
|
obj['UnitPrice'] = this.removeDecimal(element['price']);
|
|
5602
5598
|
obj['Quantity'] = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : -element['refundedQuantity'].toFixed(1);
|
|
@@ -5619,15 +5615,8 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5619
5615
|
obj['MMGroupID'] = this.getAttributes();
|
|
5620
5616
|
obj['CustomerDetails'] = ""; // todo - blank
|
|
5621
5617
|
obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
var taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
5625
|
-
* @param {?} item
|
|
5626
|
-
* @return {?}
|
|
5627
|
-
*/
|
|
5628
|
-
function (item) { return item.itemLineId == element['itemLineId']; }));
|
|
5629
|
-
obj['OriginalTaxAmount'] = taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal); //todo
|
|
5630
|
-
obj['taxAmount'] = taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal);
|
|
5618
|
+
obj['OriginalTaxAmount'] = this.convertToString(this.getoriginltax(element, taxTotal.VAT) * -1);
|
|
5619
|
+
obj['taxAmount'] = taxTotal.taxLineTotal < 0 ? (taxTotal.taxLineTotal) : (-taxTotal.taxLineTotal);
|
|
5631
5620
|
if (lineDiscount) {
|
|
5632
5621
|
if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {
|
|
5633
5622
|
// line discount
|
|
@@ -5692,7 +5681,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5692
5681
|
//to do
|
|
5693
5682
|
UserID: this.userId,
|
|
5694
5683
|
//to do,
|
|
5695
|
-
DateTimeCreated: this.
|
|
5684
|
+
DateTimeCreated: this.createdAt,
|
|
5696
5685
|
ExtendedValue: this.removeDecimal(element.price),
|
|
5697
5686
|
UnitPrice: this.removeDecimal(element.price),
|
|
5698
5687
|
MMGroupID: this.getAttributes(),
|
|
@@ -5707,8 +5696,8 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5707
5696
|
function (item) { return item.itemLineId == element['itemLineId']; })).VATCode,
|
|
5708
5697
|
TaxModifiable: 1,
|
|
5709
5698
|
//todo
|
|
5710
|
-
OriginalTaxAmount:
|
|
5711
|
-
TaxAmount:
|
|
5699
|
+
OriginalTaxAmount: this.convertToString(this.getoriginltax(element, taxTotal.VAT)),
|
|
5700
|
+
TaxAmount: this.convertToString(taxTotal.taxLineTotal),
|
|
5712
5701
|
OriginalTaxAmountSet: 1,
|
|
5713
5702
|
//todo
|
|
5714
5703
|
ProductID: element.SKU,
|
|
@@ -5753,6 +5742,23 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5753
5742
|
}
|
|
5754
5743
|
return obj;
|
|
5755
5744
|
};
|
|
5745
|
+
/**
|
|
5746
|
+
* @param {?} element
|
|
5747
|
+
* @param {?} VAT
|
|
5748
|
+
* @return {?}
|
|
5749
|
+
*/
|
|
5750
|
+
RJMapperBuilderClass.prototype.getoriginltax = /**
|
|
5751
|
+
* @param {?} element
|
|
5752
|
+
* @param {?} VAT
|
|
5753
|
+
* @return {?}
|
|
5754
|
+
*/
|
|
5755
|
+
function (element, VAT) {
|
|
5756
|
+
/** @type {?} */
|
|
5757
|
+
var pricebeforetax = (element.price * 100) / (100 + VAT);
|
|
5758
|
+
/** @type {?} */
|
|
5759
|
+
var originaltax = element.price - pricebeforetax;
|
|
5760
|
+
return originaltax;
|
|
5761
|
+
};
|
|
5756
5762
|
/**
|
|
5757
5763
|
* @param {?} value
|
|
5758
5764
|
* @return {?}
|
|
@@ -5819,6 +5825,32 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5819
5825
|
return "";
|
|
5820
5826
|
}
|
|
5821
5827
|
};
|
|
5828
|
+
/**
|
|
5829
|
+
* @param {?} date
|
|
5830
|
+
* @return {?}
|
|
5831
|
+
*/
|
|
5832
|
+
RJMapperBuilderClass.prototype.getdate = /**
|
|
5833
|
+
* @param {?} date
|
|
5834
|
+
* @return {?}
|
|
5835
|
+
*/
|
|
5836
|
+
function (date) {
|
|
5837
|
+
/** @type {?} */
|
|
5838
|
+
var offset = this.generateTimezoneoffset(date) * -1;
|
|
5839
|
+
/** @type {?} */
|
|
5840
|
+
var offsetHours = Math.abs(Math.floor(offset / 60));
|
|
5841
|
+
/** @type {?} */
|
|
5842
|
+
var offsetMinutes = Math.abs(offset) - offsetHours * 60;
|
|
5843
|
+
/** @type {?} */
|
|
5844
|
+
var offsetSign = '+';
|
|
5845
|
+
if (offset < 0) {
|
|
5846
|
+
offsetSign = '-';
|
|
5847
|
+
}
|
|
5848
|
+
/** @type {?} */
|
|
5849
|
+
var newdate = date.substring(0, 19);
|
|
5850
|
+
/** @type {?} */
|
|
5851
|
+
var x = (newdate + offsetSign + offsetHours + ':' + offsetMinutes).toString();
|
|
5852
|
+
return x;
|
|
5853
|
+
};
|
|
5822
5854
|
return RJMapperBuilderClass;
|
|
5823
5855
|
}());
|
|
5824
5856
|
if (false) {
|
|
@@ -5932,6 +5964,16 @@ if (false) {
|
|
|
5932
5964
|
* @private
|
|
5933
5965
|
*/
|
|
5934
5966
|
RJMapperBuilderClass.prototype.branchId;
|
|
5967
|
+
/**
|
|
5968
|
+
* @type {?}
|
|
5969
|
+
* @private
|
|
5970
|
+
*/
|
|
5971
|
+
RJMapperBuilderClass.prototype.createdAt;
|
|
5972
|
+
/**
|
|
5973
|
+
* @type {?}
|
|
5974
|
+
* @private
|
|
5975
|
+
*/
|
|
5976
|
+
RJMapperBuilderClass.prototype.updatedAt;
|
|
5935
5977
|
/**
|
|
5936
5978
|
* @type {?}
|
|
5937
5979
|
* @private
|