@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 CHANGED
@@ -1,24 +1,24 @@
1
- # MapperLibrary
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.14.
4
-
5
- ## Code scaffolding
6
-
7
- Run `ng generate component component-name --project mapper-library` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project mapper-library`.
8
- > Note: Don't forget to add `--project mapper-library` or else it will be added to the default project in your `angular.json` file.
9
-
10
- ## Build
11
-
12
- Run `ng build mapper-library` to build the project. The build artifacts will be stored in the `dist/` directory.
13
-
14
- ## Publishing
15
-
16
- After building your library with `ng build mapper-library`, go to the dist folder `cd dist/mapper-library` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test mapper-library` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
1
+ # MapperLibrary
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.14.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project mapper-library` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project mapper-library`.
8
+ > Note: Don't forget to add `--project mapper-library` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build mapper-library` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build mapper-library`, go to the dist folder `cd dist/mapper-library` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test mapper-library` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
@@ -4871,7 +4871,6 @@
4871
4871
  */
4872
4872
  var RJMapperBuilderClass = /** @class */ (function () {
4873
4873
  function RJMapperBuilderClass(transactionDoc) {
4874
- this.productQuantity = 0;
4875
4874
  this.itemCount = 0;
4876
4875
  this.largestNumber = 0;
4877
4876
  this.rjObject = {};
@@ -5059,6 +5058,15 @@
5059
5058
  function (element) {
5060
5059
  /** @type {?} */
5061
5060
  var data = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
5061
+ /** @type {?} */
5062
+ var obj = {
5063
+ "OriginalReceiptSupplied": 0,
5064
+ "OriginalBranchID": 0,
5065
+ "OriginalTerminalNumber": 0,
5066
+ "OriginalTransactionNumber": 0,
5067
+ "OriginalCashierNumber": 0
5068
+ };
5069
+ data['Return'] = __assign({}, data['Return'], obj);
5062
5070
  (/** @type {?} */ (_this)).rjObject['ProductReturn'].push(data);
5063
5071
  (/** @type {?} */ (_this)).getModifierItem(element.lineDiscount, element.itemLineId);
5064
5072
  }));
@@ -5077,6 +5085,15 @@
5077
5085
  if (element.refundedQuantity > 0) {
5078
5086
  /** @type {?} */
5079
5087
  var returnProduct = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
5088
+ /** @type {?} */
5089
+ var obj = {
5090
+ "OriginalReceiptSupplied": 0,
5091
+ "OriginalBranchID": 0,
5092
+ "OriginalTerminalNumber": 0,
5093
+ "OriginalTransactionNumber": 0,
5094
+ "OriginalCashierNumber": 0
5095
+ };
5096
+ returnProduct['Return'] = __assign({}, returnProduct['Return'], obj);
5080
5097
  (/** @type {?} */ (_this)).rjObject['ProductReturn'].push(returnProduct);
5081
5098
  }
5082
5099
  else {
@@ -5204,7 +5221,7 @@
5204
5221
  obj['TaxTotal'] = (/** @type {?} */ (_this)).convertToString(element.taxLineTotal);
5205
5222
  obj['TaxDescription'] = (/** @type {?} */ (_this)).convertToString(element.VATCode);
5206
5223
  obj['TaxIncluded'] = '1';
5207
- obj['TaxPercentage'] = element.VAT; // todo
5224
+ obj['TaxPercentage'] = element.VAT.toFixed(2); // todo
5208
5225
  (/** @type {?} */ (_this)).rjObject['Trailer']['TaxItem'].push(obj);
5209
5226
  }));
5210
5227
  // TODO: make Trailer object from promotion
@@ -5776,6 +5793,7 @@
5776
5793
  function (element, lineDiscount) {
5777
5794
  /** @type {?} */
5778
5795
  var obj = {};
5796
+ obj['XMLSchemaVersion'] = this.xmlSchemaVersion;
5779
5797
  obj['LineNumber'] = element['itemLineId'];
5780
5798
  obj['NetValue'] = this.removeDecimal(element['refundedTotal']);
5781
5799
  obj['EffectiveNetValue'] = this.removeDecimal(element['refundedTotal']);
@@ -5783,7 +5801,7 @@
5783
5801
  obj['DeviceID'] = this.transactionDocument['terminalId'];
5784
5802
  obj['UserID'] = this.userId;
5785
5803
  obj['DateTimeCreated'] = this.transactionDocument['createdAt'];
5786
- obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice']);
5804
+ obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
5787
5805
  obj['UnitPrice'] = this.removeDecimal(element['price']);
5788
5806
  obj['Quantity'] = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : -element['refundedQuantity'].toFixed(1);
5789
5807
  obj['OriginalTaxAmountSet'] = 1;
@@ -5793,7 +5811,7 @@
5793
5811
  obj['Return'] = {};
5794
5812
  obj['Return']['ReturnReasonID'] = element['refundedReason'];
5795
5813
  obj['Return']['ReturnDescription'] = element['refundedReasonDescription'];
5796
- obj['Return']['ReturnToStock'] = element['refundedQuantity'] > 0 ? element['refundedQuantity'] : -1 * element['refundedQuantity'];
5814
+ obj['Return']['ReturnToStock'] = element['refundedQuantity'] > 0 ? element['refundedQuantity'].toFixed(1) : -1 * element['refundedQuantity'].toFixed(1);
5797
5815
  obj['TaxCode'] = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
5798
5816
  * @param {?} item
5799
5817
  * @return {?}
@@ -5861,6 +5879,12 @@
5861
5879
  * @return {?}
5862
5880
  */
5863
5881
  function (element, lineDiscount) {
5882
+ /** @type {?} */
5883
+ var taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
5884
+ * @param {?} item
5885
+ * @return {?}
5886
+ */
5887
+ function (item) { return item.itemLineId == element['itemLineId']; }));
5864
5888
  /** @type {?} */
5865
5889
  var obj = {
5866
5890
  XMLSchemaVersion: this.xmlSchemaVersion,
@@ -5880,14 +5904,15 @@
5880
5904
  Quantity: element.quantity.toFixed(1),
5881
5905
  SalespersonID: this.transactionDocument.userId,
5882
5906
  SalespersonName: this.transactionDocument.userName,
5883
- TaxCode: 0,
5884
- //todo
5907
+ TaxCode: this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
5908
+ * @param {?} item
5909
+ * @return {?}
5910
+ */
5911
+ function (item) { return item.itemLineId == element['itemLineId']; })).VATCode,
5885
5912
  TaxModifiable: 1,
5886
5913
  //todo
5887
- TaxAmount: 0,
5888
- //todo
5889
- OriginalTaxAmount: 0,
5890
- //todo
5914
+ OriginalTaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
5915
+ TaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
5891
5916
  OriginalTaxAmountSet: 1,
5892
5917
  //todo
5893
5918
  ProductID: element.SKU,
@@ -6006,11 +6031,6 @@
6006
6031
  * @private
6007
6032
  */
6008
6033
  RJMapperBuilderClass.prototype.transactionDocument;
6009
- /**
6010
- * @type {?}
6011
- * @private
6012
- */
6013
- RJMapperBuilderClass.prototype.productQuantity;
6014
6034
  /**
6015
6035
  * @type {?}
6016
6036
  * @private