@pmcretail/mapper-library 0.0.15 → 0.0.17

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.
@@ -6552,9 +6552,314 @@
6552
6552
  RJMapperBuilderClass.prototype.rjObject;
6553
6553
  }
6554
6554
 
6555
+ /**
6556
+ * @fileoverview added by tsickle
6557
+ * Generated from: lib/WebReturn-mapper.class.ts
6558
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6559
+ */
6560
+ var WebReturnMapperBuilderClass = /** @class */ (function () {
6561
+ function WebReturnMapperBuilderClass(document) {
6562
+ this.webReturnObject = {
6563
+ id: '',
6564
+ orgCode: "",
6565
+ storeId: "",
6566
+ storeNodeId: "",
6567
+ storeNodeStructure: "",
6568
+ deviceId: "",
6569
+ terminalId: "",
6570
+ initiatingModule: "",
6571
+ export: false,
6572
+ basket: {},
6573
+ basketSummary: {},
6574
+ baseCurrency: "",
6575
+ customer: {
6576
+ firstName: '',
6577
+ lastName: '',
6578
+ email: '',
6579
+ postCode: '',
6580
+ id: '',
6581
+ billingAddress: {},
6582
+ shippingAddress: {},
6583
+ }
6584
+ };
6585
+ if (document) {
6586
+ this.document = document;
6587
+ }
6588
+ }
6589
+ /**
6590
+ * @template THIS
6591
+ * @this {THIS}
6592
+ * @return {THIS}
6593
+ */
6594
+ WebReturnMapperBuilderClass.prototype.WebReturnMapper = /**
6595
+ * @template THIS
6596
+ * @this {THIS}
6597
+ * @return {THIS}
6598
+ */
6599
+ function () {
6600
+ (/** @type {?} */ (this)).webReturnObject['type'] = 'WEB_RETURNS';
6601
+ (/** @type {?} */ (this)).webReturnObject['datetime'] = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
6602
+ (/** @type {?} */ (this)).webReturnObject.baseCurrency = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_currency_code);
6603
+ (/** @type {?} */ (this)).webReturnObject.storeId = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.store_id);
6604
+ (/** @type {?} */ (this)).webReturnObject.subsidiaryId = '1';
6605
+ (/** @type {?} */ (this)).webReturnObject.initiatingModule = 'MAGENTO';
6606
+ (/** @type {?} */ (this)).webReturnObject.createdAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.created_at));
6607
+ (/** @type {?} */ (this)).webReturnObject.updatedAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
6608
+ (/** @type {?} */ (this)).webReturnObject.export = true;
6609
+ (/** @type {?} */ (this)).webReturnObject.transCompletedAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
6610
+ (/** @type {?} */ (this)).webReturnObject['externalTransactionId'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.order_id);
6611
+ // customer
6612
+ (/** @type {?} */ (this)).webReturnObject['customer']['firstName'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.customer_firstname) || '';
6613
+ (/** @type {?} */ (this)).webReturnObject['customer']['lastName'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.customer_lastname) || '';
6614
+ (/** @type {?} */ (this)).webReturnObject['customer']['email'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.customer_email) || '';
6615
+ (/** @type {?} */ (this)).webReturnObject['customer']['postCode'] = '';
6616
+ // Billing address
6617
+ (/** @type {?} */ (this)).webReturnObject['customer']['billingAddress']['address1'] = ((/** @type {?} */ (this)).document.billing_address && (/** @type {?} */ (this)).document.billing_address.street) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.billing_address.street) : '';
6618
+ (/** @type {?} */ (this)).webReturnObject['customer']['billingAddress']['city'] = ((/** @type {?} */ (this)).document.billing_address && (/** @type {?} */ (this)).document.billing_address.city) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.billing_address.city) : '';
6619
+ (/** @type {?} */ (this)).webReturnObject['customer']['billingAddress']['county'] = ((/** @type {?} */ (this)).document.billing_address && (/** @type {?} */ (this)).document.billing_address.region) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.billing_address.region) : '';
6620
+ (/** @type {?} */ (this)).webReturnObject['customer']['billingAddress']['postCode'] = ((/** @type {?} */ (this)).document.billing_address && (/** @type {?} */ (this)).document.billing_address.postcode) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.billing_address.postcode) : '';
6621
+ (/** @type {?} */ (this)).webReturnObject['customer']['billingAddress']['country'] = ((/** @type {?} */ (this)).document.billing_address && (/** @type {?} */ (this)).document.billing_address.country) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.billing_address.country) : '';
6622
+ // Shipping address
6623
+ (/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['address1'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.street) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.street) : '';
6624
+ (/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['city'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.city) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.city) : '';
6625
+ (/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['county'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.region) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.region) : '';
6626
+ (/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['postCode'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.postcode) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.postcode) : '';
6627
+ (/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['country'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.country) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.country) : '';
6628
+ // basketSummary
6629
+ (/** @type {?} */ (this)).webReturnObject.basketSummary['discountTotal'] = Number((/** @type {?} */ (this)).document.discount_amount ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount) : 0);
6630
+ (/** @type {?} */ (this)).webReturnObject.basketSummary['VATTotal'] = Number((/** @type {?} */ (this)).document.base_total_paid ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid) : 0);
6631
+ (/** @type {?} */ (this)).webReturnObject.basketSummary['saleTotal'] = Number((/** @type {?} */ (this)).document.base_total_invoiced ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_invoiced) : 0);
6632
+ (/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = Number((/** @type {?} */ (this)).document.base_total_paid ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid) : 0);
6633
+ (/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = Number((/** @type {?} */ (this)).document.total_qty_ordered ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered) : 0);
6634
+ (/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = Number((/** @type {?} */ (this)).document.base_total_refunded ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded) : 0);
6635
+ // basket line discount
6636
+ (/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'] = [];
6637
+ /** @type {?} */
6638
+ var lineDiscount = {
6639
+ itemLineId: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.item_id) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.item_id) : 0,
6640
+ discountAmount: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.discount_amount) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.discount_amount)) : 0
6641
+ };
6642
+ (/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'].push(lineDiscount);
6643
+ // basket transaction discount
6644
+ (/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'] = [];
6645
+ /** @type {?} */
6646
+ var transactionDiscount = {
6647
+ discountAmount: ((/** @type {?} */ (this)).document && (/** @type {?} */ (this)).document.discount_amount) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount)) : 0
6648
+ };
6649
+ (/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'].push(transactionDiscount);
6650
+ // basket products
6651
+ (/** @type {?} */ (this)).webReturnObject.basket['products'] = [];
6652
+ /** @type {?} */
6653
+ var product = {
6654
+ description: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.name) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.name) : '',
6655
+ SKU: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.sku) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.sku) : '',
6656
+ quantity: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.qty_ordered) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.qty_ordered)) : 0,
6657
+ refundedQuantity: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.qty_refunded) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.qty_refunded)) : 0,
6658
+ price: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.original_price) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.original_price)) : 0,
6659
+ itemLineId: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.item_id) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.item_id)) : 0,
6660
+ totalLinePrice: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.row_invoiced) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.row_invoiced)) : 0,
6661
+ };
6662
+ (/** @type {?} */ (this)).webReturnObject.basket['products'].push(product);
6663
+ return (/** @type {?} */ (this));
6664
+ };
6665
+ /**
6666
+ * @template THIS
6667
+ * @this {THIS}
6668
+ * @param {?} deviceId
6669
+ * @return {THIS}
6670
+ */
6671
+ WebReturnMapperBuilderClass.prototype.deviceId = /**
6672
+ * @template THIS
6673
+ * @this {THIS}
6674
+ * @param {?} deviceId
6675
+ * @return {THIS}
6676
+ */
6677
+ function (deviceId) {
6678
+ (/** @type {?} */ (this)).webReturnObject.deviceId = deviceId;
6679
+ return (/** @type {?} */ (this));
6680
+ };
6681
+ /**
6682
+ * @template THIS
6683
+ * @this {THIS}
6684
+ * @param {?} terminalId
6685
+ * @return {THIS}
6686
+ */
6687
+ WebReturnMapperBuilderClass.prototype.terminalId = /**
6688
+ * @template THIS
6689
+ * @this {THIS}
6690
+ * @param {?} terminalId
6691
+ * @return {THIS}
6692
+ */
6693
+ function (terminalId) {
6694
+ (/** @type {?} */ (this)).webReturnObject.terminalId = terminalId;
6695
+ return (/** @type {?} */ (this));
6696
+ };
6697
+ /**
6698
+ * @template THIS
6699
+ * @this {THIS}
6700
+ * @param {?} orgCode
6701
+ * @return {THIS}
6702
+ */
6703
+ WebReturnMapperBuilderClass.prototype.orgCode = /**
6704
+ * @template THIS
6705
+ * @this {THIS}
6706
+ * @param {?} orgCode
6707
+ * @return {THIS}
6708
+ */
6709
+ function (orgCode) {
6710
+ (/** @type {?} */ (this)).webReturnObject.orgCode = orgCode;
6711
+ return (/** @type {?} */ (this));
6712
+ };
6713
+ /**
6714
+ * @template THIS
6715
+ * @this {THIS}
6716
+ * @param {?} storeId
6717
+ * @return {THIS}
6718
+ */
6719
+ WebReturnMapperBuilderClass.prototype.storeId = /**
6720
+ * @template THIS
6721
+ * @this {THIS}
6722
+ * @param {?} storeId
6723
+ * @return {THIS}
6724
+ */
6725
+ function (storeId) {
6726
+ (/** @type {?} */ (this)).webReturnObject.storeId = storeId;
6727
+ return (/** @type {?} */ (this));
6728
+ };
6729
+ /**
6730
+ * @template THIS
6731
+ * @this {THIS}
6732
+ * @param {?} storeNodeId
6733
+ * @return {THIS}
6734
+ */
6735
+ WebReturnMapperBuilderClass.prototype.storeNodeId = /**
6736
+ * @template THIS
6737
+ * @this {THIS}
6738
+ * @param {?} storeNodeId
6739
+ * @return {THIS}
6740
+ */
6741
+ function (storeNodeId) {
6742
+ (/** @type {?} */ (this)).webReturnObject.storeNodeId = storeNodeId;
6743
+ return (/** @type {?} */ (this));
6744
+ };
6745
+ /**
6746
+ * @template THIS
6747
+ * @this {THIS}
6748
+ * @param {?} storeNodeStructure
6749
+ * @return {THIS}
6750
+ */
6751
+ WebReturnMapperBuilderClass.prototype.storeNodeStructure = /**
6752
+ * @template THIS
6753
+ * @this {THIS}
6754
+ * @param {?} storeNodeStructure
6755
+ * @return {THIS}
6756
+ */
6757
+ function (storeNodeStructure) {
6758
+ (/** @type {?} */ (this)).webReturnObject.storeNodeStructure = storeNodeStructure;
6759
+ return (/** @type {?} */ (this));
6760
+ };
6761
+ /**
6762
+ * @template THIS
6763
+ * @this {THIS}
6764
+ * @param {?} docId
6765
+ * @return {THIS}
6766
+ */
6767
+ WebReturnMapperBuilderClass.prototype.docId = /**
6768
+ * @template THIS
6769
+ * @this {THIS}
6770
+ * @param {?} docId
6771
+ * @return {THIS}
6772
+ */
6773
+ function (docId) {
6774
+ (/** @type {?} */ (this)).webReturnObject.id = docId;
6775
+ return (/** @type {?} */ (this));
6776
+ };
6777
+ /**
6778
+ * @template THIS
6779
+ * @this {THIS}
6780
+ * @param {?} userID
6781
+ * @return {THIS}
6782
+ */
6783
+ WebReturnMapperBuilderClass.prototype.updateUserID = /**
6784
+ * @template THIS
6785
+ * @this {THIS}
6786
+ * @param {?} userID
6787
+ * @return {THIS}
6788
+ */
6789
+ function (userID) {
6790
+ (/** @type {?} */ (this)).webReturnObject.userId = userID;
6791
+ return (/** @type {?} */ (this));
6792
+ };
6793
+ /**
6794
+ * @template THIS
6795
+ * @this {THIS}
6796
+ * @param {?} name
6797
+ * @return {THIS}
6798
+ */
6799
+ WebReturnMapperBuilderClass.prototype.updateUserName = /**
6800
+ * @template THIS
6801
+ * @this {THIS}
6802
+ * @param {?} name
6803
+ * @return {THIS}
6804
+ */
6805
+ function (name) {
6806
+ (/** @type {?} */ (this)).webReturnObject.userName = name;
6807
+ return (/** @type {?} */ (this));
6808
+ };
6809
+ /**
6810
+ * @return {?}
6811
+ */
6812
+ WebReturnMapperBuilderClass.prototype.build = /**
6813
+ * @return {?}
6814
+ */
6815
+ function () {
6816
+ return this.webReturnObject;
6817
+ };
6818
+ /**
6819
+ * @param {?} obj
6820
+ * @return {?}
6821
+ */
6822
+ WebReturnMapperBuilderClass.prototype.getText = /**
6823
+ * @param {?} obj
6824
+ * @return {?}
6825
+ */
6826
+ function (obj) {
6827
+ if (obj) {
6828
+ return obj.text;
6829
+ }
6830
+ };
6831
+ /**
6832
+ * @param {?} date
6833
+ * @return {?}
6834
+ */
6835
+ WebReturnMapperBuilderClass.prototype.getUTCDateTime = /**
6836
+ * @param {?} date
6837
+ * @return {?}
6838
+ */
6839
+ function (date) {
6840
+ if (date) {
6841
+ return new Date(date).toISOString();
6842
+ }
6843
+ };
6844
+ return WebReturnMapperBuilderClass;
6845
+ }());
6846
+ if (false) {
6847
+ /**
6848
+ * @type {?}
6849
+ * @private
6850
+ */
6851
+ WebReturnMapperBuilderClass.prototype.document;
6852
+ /**
6853
+ * @type {?}
6854
+ * @private
6855
+ */
6856
+ WebReturnMapperBuilderClass.prototype.webReturnObject;
6857
+ }
6858
+
6555
6859
  exports.MapperLibraryComponent = MapperLibraryComponent;
6556
6860
  exports.MapperLibraryModule = MapperLibraryModule;
6557
6861
  exports.RJMapperBuilderClass = RJMapperBuilderClass;
6862
+ exports.WebReturnMapperBuilderClass = WebReturnMapperBuilderClass;
6558
6863
 
6559
6864
  Object.defineProperty(exports, '__esModule', { value: true });
6560
6865