@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, NgModule, Injectable, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
|
|
2
|
-
import { __values, __spread } from 'tslib';
|
|
2
|
+
import { __values, __spread, __assign } from 'tslib';
|
|
3
3
|
import { BehaviorSubject } from 'rxjs';
|
|
4
4
|
import { CurrencyPipe } from '@angular/common';
|
|
5
5
|
|
|
@@ -4651,7 +4651,6 @@ if (false) {
|
|
|
4651
4651
|
*/
|
|
4652
4652
|
var RJMapperBuilderClass = /** @class */ (function () {
|
|
4653
4653
|
function RJMapperBuilderClass(transactionDoc) {
|
|
4654
|
-
this.productQuantity = 0;
|
|
4655
4654
|
this.itemCount = 0;
|
|
4656
4655
|
this.largestNumber = 0;
|
|
4657
4656
|
this.rjObject = {};
|
|
@@ -4839,6 +4838,15 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4839
4838
|
function (element) {
|
|
4840
4839
|
/** @type {?} */
|
|
4841
4840
|
var data = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
4841
|
+
/** @type {?} */
|
|
4842
|
+
var obj = {
|
|
4843
|
+
"OriginalReceiptSupplied": 0,
|
|
4844
|
+
"OriginalBranchID": 0,
|
|
4845
|
+
"OriginalTerminalNumber": 0,
|
|
4846
|
+
"OriginalTransactionNumber": 0,
|
|
4847
|
+
"OriginalCashierNumber": 0
|
|
4848
|
+
};
|
|
4849
|
+
data['Return'] = __assign({}, data['Return'], obj);
|
|
4842
4850
|
(/** @type {?} */ (_this)).rjObject['ProductReturn'].push(data);
|
|
4843
4851
|
(/** @type {?} */ (_this)).getModifierItem(element.lineDiscount, element.itemLineId);
|
|
4844
4852
|
}));
|
|
@@ -4857,6 +4865,15 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4857
4865
|
if (element.refundedQuantity > 0) {
|
|
4858
4866
|
/** @type {?} */
|
|
4859
4867
|
var returnProduct = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
4868
|
+
/** @type {?} */
|
|
4869
|
+
var obj = {
|
|
4870
|
+
"OriginalReceiptSupplied": 0,
|
|
4871
|
+
"OriginalBranchID": 0,
|
|
4872
|
+
"OriginalTerminalNumber": 0,
|
|
4873
|
+
"OriginalTransactionNumber": 0,
|
|
4874
|
+
"OriginalCashierNumber": 0
|
|
4875
|
+
};
|
|
4876
|
+
returnProduct['Return'] = __assign({}, returnProduct['Return'], obj);
|
|
4860
4877
|
(/** @type {?} */ (_this)).rjObject['ProductReturn'].push(returnProduct);
|
|
4861
4878
|
}
|
|
4862
4879
|
else {
|
|
@@ -4984,7 +5001,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4984
5001
|
obj['TaxTotal'] = (/** @type {?} */ (_this)).convertToString(element.taxLineTotal);
|
|
4985
5002
|
obj['TaxDescription'] = (/** @type {?} */ (_this)).convertToString(element.VATCode);
|
|
4986
5003
|
obj['TaxIncluded'] = '1';
|
|
4987
|
-
obj['TaxPercentage'] = element.VAT; // todo
|
|
5004
|
+
obj['TaxPercentage'] = element.VAT.toFixed(2); // todo
|
|
4988
5005
|
(/** @type {?} */ (_this)).rjObject['Trailer']['TaxItem'].push(obj);
|
|
4989
5006
|
}));
|
|
4990
5007
|
// TODO: make Trailer object from promotion
|
|
@@ -5556,6 +5573,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5556
5573
|
function (element, lineDiscount) {
|
|
5557
5574
|
/** @type {?} */
|
|
5558
5575
|
var obj = {};
|
|
5576
|
+
obj['XMLSchemaVersion'] = this.xmlSchemaVersion;
|
|
5559
5577
|
obj['LineNumber'] = element['itemLineId'];
|
|
5560
5578
|
obj['NetValue'] = this.removeDecimal(element['refundedTotal']);
|
|
5561
5579
|
obj['EffectiveNetValue'] = this.removeDecimal(element['refundedTotal']);
|
|
@@ -5563,7 +5581,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5563
5581
|
obj['DeviceID'] = this.transactionDocument['terminalId'];
|
|
5564
5582
|
obj['UserID'] = this.userId;
|
|
5565
5583
|
obj['DateTimeCreated'] = this.transactionDocument['createdAt'];
|
|
5566
|
-
obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice']);
|
|
5584
|
+
obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
|
|
5567
5585
|
obj['UnitPrice'] = this.removeDecimal(element['price']);
|
|
5568
5586
|
obj['Quantity'] = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : -element['refundedQuantity'].toFixed(1);
|
|
5569
5587
|
obj['OriginalTaxAmountSet'] = 1;
|
|
@@ -5573,7 +5591,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5573
5591
|
obj['Return'] = {};
|
|
5574
5592
|
obj['Return']['ReturnReasonID'] = element['refundedReason'];
|
|
5575
5593
|
obj['Return']['ReturnDescription'] = element['refundedReasonDescription'];
|
|
5576
|
-
obj['Return']['ReturnToStock'] = element['refundedQuantity'] > 0 ? element['refundedQuantity'] : -1 * element['refundedQuantity'];
|
|
5594
|
+
obj['Return']['ReturnToStock'] = element['refundedQuantity'] > 0 ? element['refundedQuantity'].toFixed(1) : -1 * element['refundedQuantity'].toFixed(1);
|
|
5577
5595
|
obj['TaxCode'] = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
5578
5596
|
* @param {?} item
|
|
5579
5597
|
* @return {?}
|
|
@@ -5641,6 +5659,12 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5641
5659
|
* @return {?}
|
|
5642
5660
|
*/
|
|
5643
5661
|
function (element, lineDiscount) {
|
|
5662
|
+
/** @type {?} */
|
|
5663
|
+
var taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
5664
|
+
* @param {?} item
|
|
5665
|
+
* @return {?}
|
|
5666
|
+
*/
|
|
5667
|
+
function (item) { return item.itemLineId == element['itemLineId']; }));
|
|
5644
5668
|
/** @type {?} */
|
|
5645
5669
|
var obj = {
|
|
5646
5670
|
XMLSchemaVersion: this.xmlSchemaVersion,
|
|
@@ -5660,14 +5684,15 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5660
5684
|
Quantity: element.quantity.toFixed(1),
|
|
5661
5685
|
SalespersonID: this.transactionDocument.userId,
|
|
5662
5686
|
SalespersonName: this.transactionDocument.userName,
|
|
5663
|
-
TaxCode:
|
|
5664
|
-
|
|
5687
|
+
TaxCode: this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
5688
|
+
* @param {?} item
|
|
5689
|
+
* @return {?}
|
|
5690
|
+
*/
|
|
5691
|
+
function (item) { return item.itemLineId == element['itemLineId']; })).VATCode,
|
|
5665
5692
|
TaxModifiable: 1,
|
|
5666
5693
|
//todo
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
OriginalTaxAmount: 0,
|
|
5670
|
-
//todo
|
|
5694
|
+
OriginalTaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
|
|
5695
|
+
TaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
|
|
5671
5696
|
OriginalTaxAmountSet: 1,
|
|
5672
5697
|
//todo
|
|
5673
5698
|
ProductID: element.SKU,
|
|
@@ -5786,11 +5811,6 @@ if (false) {
|
|
|
5786
5811
|
* @private
|
|
5787
5812
|
*/
|
|
5788
5813
|
RJMapperBuilderClass.prototype.transactionDocument;
|
|
5789
|
-
/**
|
|
5790
|
-
* @type {?}
|
|
5791
|
-
* @private
|
|
5792
|
-
*/
|
|
5793
|
-
RJMapperBuilderClass.prototype.productQuantity;
|
|
5794
5814
|
/**
|
|
5795
5815
|
* @type {?}
|
|
5796
5816
|
* @private
|