@pmcretail/mapper-library 0.0.2 → 0.0.4
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/README.md +24 -24
- package/bundles/pmcretail-mapper-library.umd.js +35 -15
- 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 +36 -16
- package/esm2015/public-api.js +1 -1
- package/esm5/lib/RJ-mapper.class.js +37 -16
- package/esm5/public-api.js +1 -1
- package/fesm2015/pmcretail-mapper-library.js +35 -15
- package/fesm2015/pmcretail-mapper-library.js.map +1 -1
- package/fesm5/pmcretail-mapper-library.js +36 -16
- package/fesm5/pmcretail-mapper-library.js.map +1 -1
- package/lib/RJ-mapper.class.d.ts +0 -1
- package/package.json +1 -1
|
@@ -3481,7 +3481,6 @@ class RJMapperBuilderClass {
|
|
|
3481
3481
|
* @param {?=} transactionDoc
|
|
3482
3482
|
*/
|
|
3483
3483
|
constructor(transactionDoc) {
|
|
3484
|
-
this.productQuantity = 0;
|
|
3485
3484
|
this.itemCount = 0;
|
|
3486
3485
|
this.largestNumber = 0;
|
|
3487
3486
|
this.rjObject = {};
|
|
@@ -3653,6 +3652,15 @@ class RJMapperBuilderClass {
|
|
|
3653
3652
|
(element) => {
|
|
3654
3653
|
/** @type {?} */
|
|
3655
3654
|
let data = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
3655
|
+
/** @type {?} */
|
|
3656
|
+
let obj = {
|
|
3657
|
+
"OriginalReceiptSupplied": 0,
|
|
3658
|
+
"OriginalBranchID": 0,
|
|
3659
|
+
"OriginalTerminalNumber": 0,
|
|
3660
|
+
"OriginalTransactionNumber": 0,
|
|
3661
|
+
"OriginalCashierNumber": 0
|
|
3662
|
+
};
|
|
3663
|
+
data['Return'] = Object.assign({}, data['Return'], obj);
|
|
3656
3664
|
(/** @type {?} */ (this)).rjObject['ProductReturn'].push(data);
|
|
3657
3665
|
(/** @type {?} */ (this)).getModifierItem(element.lineDiscount, element.itemLineId);
|
|
3658
3666
|
}));
|
|
@@ -3671,6 +3679,15 @@ class RJMapperBuilderClass {
|
|
|
3671
3679
|
if (element.refundedQuantity > 0) {
|
|
3672
3680
|
/** @type {?} */
|
|
3673
3681
|
let returnProduct = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
3682
|
+
/** @type {?} */
|
|
3683
|
+
let obj = {
|
|
3684
|
+
"OriginalReceiptSupplied": 0,
|
|
3685
|
+
"OriginalBranchID": 0,
|
|
3686
|
+
"OriginalTerminalNumber": 0,
|
|
3687
|
+
"OriginalTransactionNumber": 0,
|
|
3688
|
+
"OriginalCashierNumber": 0
|
|
3689
|
+
};
|
|
3690
|
+
returnProduct['Return'] = Object.assign({}, returnProduct['Return'], obj);
|
|
3674
3691
|
(/** @type {?} */ (this)).rjObject['ProductReturn'].push(returnProduct);
|
|
3675
3692
|
}
|
|
3676
3693
|
else {
|
|
@@ -3781,7 +3798,7 @@ class RJMapperBuilderClass {
|
|
|
3781
3798
|
obj['TaxTotal'] = (/** @type {?} */ (this)).convertToString(element.taxLineTotal);
|
|
3782
3799
|
obj['TaxDescription'] = (/** @type {?} */ (this)).convertToString(element.VATCode);
|
|
3783
3800
|
obj['TaxIncluded'] = '1';
|
|
3784
|
-
obj['TaxPercentage'] = element.VAT; // todo
|
|
3801
|
+
obj['TaxPercentage'] = element.VAT.toFixed(2); // todo
|
|
3785
3802
|
(/** @type {?} */ (this)).rjObject['Trailer']['TaxItem'].push(obj);
|
|
3786
3803
|
}));
|
|
3787
3804
|
// TODO: make Trailer object from promotion
|
|
@@ -4199,6 +4216,7 @@ class RJMapperBuilderClass {
|
|
|
4199
4216
|
returnProduct(element, lineDiscount) {
|
|
4200
4217
|
/** @type {?} */
|
|
4201
4218
|
let obj = {};
|
|
4219
|
+
obj['XMLSchemaVersion'] = this.xmlSchemaVersion;
|
|
4202
4220
|
obj['LineNumber'] = element['itemLineId'];
|
|
4203
4221
|
obj['NetValue'] = this.removeDecimal(element['refundedTotal']);
|
|
4204
4222
|
obj['EffectiveNetValue'] = this.removeDecimal(element['refundedTotal']);
|
|
@@ -4206,7 +4224,7 @@ class RJMapperBuilderClass {
|
|
|
4206
4224
|
obj['DeviceID'] = this.transactionDocument['terminalId'];
|
|
4207
4225
|
obj['UserID'] = this.userId;
|
|
4208
4226
|
obj['DateTimeCreated'] = this.transactionDocument['createdAt'];
|
|
4209
|
-
obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice']);
|
|
4227
|
+
obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
|
|
4210
4228
|
obj['UnitPrice'] = this.removeDecimal(element['price']);
|
|
4211
4229
|
obj['Quantity'] = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : -element['refundedQuantity'].toFixed(1);
|
|
4212
4230
|
obj['OriginalTaxAmountSet'] = 1;
|
|
@@ -4216,7 +4234,7 @@ class RJMapperBuilderClass {
|
|
|
4216
4234
|
obj['Return'] = {};
|
|
4217
4235
|
obj['Return']['ReturnReasonID'] = element['refundedReason'];
|
|
4218
4236
|
obj['Return']['ReturnDescription'] = element['refundedReasonDescription'];
|
|
4219
|
-
obj['Return']['ReturnToStock'] = element['refundedQuantity'] > 0 ? element['refundedQuantity'] : -1 * element['refundedQuantity'];
|
|
4237
|
+
obj['Return']['ReturnToStock'] = element['refundedQuantity'] > 0 ? element['refundedQuantity'].toFixed(1) : -1 * element['refundedQuantity'].toFixed(1);
|
|
4220
4238
|
obj['TaxCode'] = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
4221
4239
|
* @param {?} item
|
|
4222
4240
|
* @return {?}
|
|
@@ -4279,6 +4297,12 @@ class RJMapperBuilderClass {
|
|
|
4279
4297
|
* @return {?}
|
|
4280
4298
|
*/
|
|
4281
4299
|
addProduct(element, lineDiscount) {
|
|
4300
|
+
/** @type {?} */
|
|
4301
|
+
let taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
4302
|
+
* @param {?} item
|
|
4303
|
+
* @return {?}
|
|
4304
|
+
*/
|
|
4305
|
+
(item) => item.itemLineId == element['itemLineId']));
|
|
4282
4306
|
/** @type {?} */
|
|
4283
4307
|
let obj = {
|
|
4284
4308
|
XMLSchemaVersion: this.xmlSchemaVersion,
|
|
@@ -4298,14 +4322,15 @@ class RJMapperBuilderClass {
|
|
|
4298
4322
|
Quantity: element.quantity.toFixed(1),
|
|
4299
4323
|
SalespersonID: this.transactionDocument.userId,
|
|
4300
4324
|
SalespersonName: this.transactionDocument.userName,
|
|
4301
|
-
TaxCode:
|
|
4302
|
-
|
|
4325
|
+
TaxCode: this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
4326
|
+
* @param {?} item
|
|
4327
|
+
* @return {?}
|
|
4328
|
+
*/
|
|
4329
|
+
(item) => item.itemLineId == element['itemLineId'])).VATCode,
|
|
4303
4330
|
TaxModifiable: 1,
|
|
4304
4331
|
//todo
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
OriginalTaxAmount: 0,
|
|
4308
|
-
//todo
|
|
4332
|
+
OriginalTaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
|
|
4333
|
+
TaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
|
|
4309
4334
|
OriginalTaxAmountSet: 1,
|
|
4310
4335
|
//todo
|
|
4311
4336
|
ProductID: element.SKU,
|
|
@@ -4413,11 +4438,6 @@ if (false) {
|
|
|
4413
4438
|
* @private
|
|
4414
4439
|
*/
|
|
4415
4440
|
RJMapperBuilderClass.prototype.transactionDocument;
|
|
4416
|
-
/**
|
|
4417
|
-
* @type {?}
|
|
4418
|
-
* @private
|
|
4419
|
-
*/
|
|
4420
|
-
RJMapperBuilderClass.prototype.productQuantity;
|
|
4421
4441
|
/**
|
|
4422
4442
|
* @type {?}
|
|
4423
4443
|
* @private
|