@pmcretail/mapper-library 0.0.21 → 0.0.22
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 +2 -2
- package/bundles/pmcretail-mapper-library.umd.js.map +1 -1
- package/bundles/pmcretail-mapper-library.umd.min.js.map +1 -1
- package/esm2015/lib/WebReturn-mapper.class.js +3 -3
- package/esm5/lib/WebReturn-mapper.class.js +3 -3
- package/fesm2015/pmcretail-mapper-library.js +2 -2
- package/fesm2015/pmcretail-mapper-library.js.map +1 -1
- package/fesm5/pmcretail-mapper-library.js +2 -2
- package/fesm5/pmcretail-mapper-library.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pmcretail-mapper-library.js","sources":["ng://@pmcretail/mapper-library/lib/mapper-library.component.ts","ng://@pmcretail/mapper-library/lib/mapper-library.module.ts","ng://@pmcretail/mapper-library/lib/mapper-library.model.ts","ng://@pmcretail/mapper-library/lib/basket.service.ts","ng://@pmcretail/mapper-library/lib/number-util.service.ts","ng://@pmcretail/mapper-library/lib/TransactionDocumentBuilder.ts","ng://@pmcretail/mapper-library/lib/RJ-mapper.class.ts","ng://@pmcretail/mapper-library/lib/WebReturn-mapper.class.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'lib-mapper-library',\n template: `\n <p>\n mapper-library works!\n </p>\n `,\n styles: [\n ]\n})\nexport class MapperLibraryComponent implements OnInit {\n\n constructor() { }\n\n ngOnInit(): void {\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { MapperLibraryComponent } from './mapper-library.component';\n\n\n\n@NgModule({\n declarations: [\n MapperLibraryComponent\n ],\n imports: [\n ],\n exports: [\n MapperLibraryComponent\n ]\n})\nexport class MapperLibraryModule { }\n","\r\n\r\nexport enum TRANSACTION_TYPE {\r\n SALE = \"SALE\",\r\n REFUND = \"REFUND\",\r\n SALE_REFUND = \"SALE_REFUND\",\r\n SALE_EXCHANGE = \"SALE_EXCHANGE\",\r\n VOID = \"VOID\"\r\n}\r\n\r\nexport interface ItemDiscount {\r\n trnDiscountsPortion: number;\r\n trnPromotionsPortion: number;\r\n refundPortion: number;\r\n currentRefundPortion?: number;\r\n}\r\n\r\nexport enum DELIVERY_METHODS {\r\n DELIVERY = 1,\r\n DROP_SHIP = 2,\r\n COLLECT_FROM_STORE = 3,\r\n}\r\n\r\nexport interface ProductChange {\r\n itemLineId?: number;\r\n SKU: string;\r\n quantity: number;\r\n selectedPrice?: number;\r\n lineDiscount?: LineDiscount;\r\n linePromotions?: LinePromotions;\r\n exchange?: Exchange;\r\n refundedQuantity?: number; // contains quantity of both full priced and promotional quantities\r\n refundPromotionalQuantity?: number; // promotional quantity\r\n refunded?: boolean;\r\n refundedTotal?: number;\r\n refundedReason?: string;\r\n refundedReasonDescription?: string;\r\n isChecked?: boolean;\r\n sealed?: boolean;\r\n isLastExchanged?: boolean;\r\n}\r\n\r\n/**\r\n * Product\r\n */\r\nexport interface Product extends ProductChange {\r\n itemLineId?: number;\r\n status: number;\r\n subGroup: number;\r\n brand: string;\r\n currency: string;\r\n category: string;\r\n countryofOrigin: string;\r\n productId: string;\r\n productType: number;\r\n name?: string;\r\n imageUrls: [string];\r\n isImageFailToLoad?: boolean;\r\n size: string;\r\n type: string;\r\n season: number;\r\n productGroup: number;\r\n styleCode: string;\r\n nodeStructure: NodeStructure[];\r\n barcode: string;\r\n price: Price[];\r\n colour: string;\r\n description: string;\r\n totalLinePrice: number;\r\n total: number;\r\n addedInBasket?: boolean;\r\n selectedVAT?: number;\r\n selectedVATCode?: string;\r\n selectedRRPPrice?: number;\r\n lineDiscount?: LineDiscount;\r\n exchange?: Exchange;\r\n // refundedQuantity?: number;\r\n // refunded?: boolean;\r\n // refundedTotal?: number;\r\n // refundedReasonDescription?:string;\r\n // isChecked?:boolean;\r\n refundPromotionalQuantity?: number; // promotional quantity\r\n exchangeReason?: string;\r\n exchangeQuantity?: number;\r\n itemDiscounts: ItemDiscount;\r\n\r\n giftCardNumberIssued?: string;\r\n giftCardAmount?: number;\r\n giftCardRecipientEmail?: string;\r\n giftCardExpiryDate?: string;\r\n giftCardRecipientName?: string;\r\n giftCard?: boolean;\r\n\r\n discountable: boolean;\r\n // sealed?:boolean;\r\n excludePromotion: boolean;\r\n categories: Categories[];\r\n descriptions: Descriptions[];\r\n barcodes: string[];\r\n\r\n //New Feilds\r\n externalId: string;\r\n createdDate: string;\r\n updatedDate: string;\r\n createdBy: string;\r\n updatedBy: string;\r\n attributes: CoreAttribute[];\r\n id: string;\r\n long_description: string;\r\n\r\n // Mixed Sales fields\r\n isWebOrder?: boolean,\r\n fullfilmentId: string,\r\n fullfilmentLocationName?: string,\r\n deliveryMethod?: string,\r\n deliveryGroup?: string,\r\n selectedInventory?: InventoryInfo;\r\n leadTime?: leadTime\r\n}\r\nexport interface leadTime {\r\n type: string,\r\n value: string\r\n}\r\n\r\nexport interface Exchange {\r\n exchangeId: number,\r\n lineItemId: number,\r\n reason: string,\r\n quantity: number,\r\n newItems: Product[];\r\n}\r\n\r\nexport interface Categories {\r\n id: string;\r\n parentId: string;\r\n name: string;\r\n categoryId: string;\r\n status: boolean;\r\n}\r\n\r\nexport interface Descriptions {\r\n name: string;\r\n countryCode: string;\r\n value: string;\r\n}\r\n\r\nexport interface CoreAttribute {\r\n name: string;\r\n value: string;\r\n searchable: boolean;\r\n countryCode: string;\r\n}\r\n\r\n/**\r\n * Basket\r\n */\r\n\r\nexport interface Basket {\r\n subsidiaryId?: string;\r\n products: Product[];\r\n transactionDiscount: any[];\r\n quantity: number;\r\n total: number;\r\n saleTotal: number;\r\n discountTotal?: number;\r\n transactionId?: string;\r\n offlineTransactionId?: string;\r\n baseCurrency: string;\r\n basketTotal?: number;\r\n refundTotal?: number;\r\n transactionPromotion?: TransactionPromotion[];\r\n customer?: any;\r\n exchange?: Exchange[];\r\n inStoreFlag?: boolean\r\n}\r\n\r\n\r\n\r\n/**\r\n * Price\r\n */\r\nexport interface Price {\r\n VAT: number;\r\n VATCode: string;\r\n salesPrice: number;\r\n currencyCode: string;\r\n RRPPrice: number;\r\n}\r\n\r\n/**\r\n * Node structure\r\n */\r\ninterface NodeStructure {\r\n status: boolean;\r\n name: string;\r\n nodeType: string;\r\n isOverride: boolean;\r\n nodeId: string;\r\n parentId: string;\r\n}\r\n\r\n/**\r\n * Line Discount\r\n */\r\nexport interface LineDiscount {\r\n itemLineId: string,\r\n discountAmount: number,\r\n discountType: string,\r\n // reasonCode: string,\r\n name?: string,\r\n unitPrice: number,\r\n discountedLinePrice?: number,\r\n priceManagerOverride?: UserOverride,\r\n priceOverrideReasonCode?: string,\r\n priceOverrideReasonName?: string,\r\n priceOverrideAmount?: number,\r\n percentageDiscountManagerOverride?: UserOverride,\r\n percentageDiscountReasonCode?: string,\r\n percentageDiscountReasonName?: string,\r\n percentageDiscountValue?: number\r\n}\r\n\r\n/**\r\n * User Override\r\n */\r\nexport interface UserOverride {\r\n userId: string,\r\n automaticApprove: string,\r\n originalUserId: string\r\n}\r\n\r\n/**\r\n* line Promotions\r\n*/\r\nexport interface LinePromotions {\r\n\r\n trigger: Trigger[],\r\n itemLineId: number,\r\n promotionId: string,\r\n displayText: string,\r\n promotionType: string,\r\n promotionAmount: number,\r\n name: string,\r\n promotionInfo: string,\r\n promotionLinePrice: number\r\n refunded?: boolean;\r\n}\r\n\r\n/**\r\n* trigger\r\n*/\r\nexport interface Trigger {\r\n itemLineId: string;\r\n quantity?: number;\r\n totalQuantity?: number;\r\n}\r\n\r\n/**\r\n* Transaction Promotion\r\n*/\r\nexport interface TransactionPromotion {\r\n displayText: string;\r\n name: string;\r\n promotionAmount: number;\r\n promotionId: string;\r\n promotionInfo: string;\r\n promotionType: string;\r\n itemLineIds: number[];\r\n\r\n}\r\n\r\nexport interface RefundProductChange {\r\n itemLineId?: number;\r\n refundedQuantity?: number;\r\n refundedPromotionalQuantity?: number;\r\n refundTotal?: number;\r\n refundedReason?: string;\r\n refundedReasonDescription?: string;\r\n refundWithPromotion: boolean;\r\n isLastExchanged?: boolean;\r\n}\r\n\r\nexport interface InventoryInfo {\r\n storeName: string,\r\n storeId: string,\r\n quantityAvailable: number,\r\n quantityRequired: number\r\n}\r\n\r\nexport interface InventoryRequestInfo extends InventoryInfo {\r\n requestedQuantity: number,\r\n requestedAction: DELIVERY_METHODS\r\n}\r\n\r\nexport interface DeliveryInfo {\r\n groups: DeliveryGroupInfo[]\r\n}\r\n\r\nexport interface DeliveryGroupInfo {\r\n groupNumber: number;\r\n items: Product[];\r\n estimate?: Estimate;\r\n}\r\n\r\nexport interface Estimate {\r\n type: string,\r\n value: string\r\n}\r\n\r\nexport interface TransactionDocument {\r\n transactionId?: string;\r\n subsidiaryId?: string;\r\n offlineTransactionId?:string;\r\n transactionRef?: string;\r\n dateTime?: string;\r\n orgCode: string;\r\n storeId: string;\r\n storeNodeId:string;\r\n storeNodeStructure:string;\r\n deviceId: string;\r\n terminalId:string;\r\n initiatingModule :string;\r\n export:boolean;\r\n userId?: string;\r\n userName?:string;\r\n customer?: Customer;\r\n basket: any;\r\n basketSummary: any;\r\n // lineDiscount: LineDiscount[];\r\n baseCurrency: string;\r\n splitPayment?:boolean;\r\n isPaymentCompleted?:boolean;\r\n paymentDetails?: any;\r\n type?: string;\r\n operationStatus?: string;\r\n createdAt?: string;\r\n updatedAt?: string;\r\n transCompletedAt?: string;\r\n id?: string;\r\n saleTotal?: number;\r\n reasonCode?: string;\r\n reasonDescription?: string;\r\n override?: UserOverride;\r\n originalTransId?:string;\r\n originalExternalId?: string;\r\n apiResponse?: APIResponse; // TODO add handler as per export provider\r\n unreferencedRefund?:boolean;\r\n giftedReceipt?:boolean;\r\n currentTransactionDetails?:any;\r\n isChecked?:boolean;\r\n}\r\n\r\nexport interface APIResponse\r\n{\r\n internalId?:number;\r\n tranid?:string\r\n}\r\n\r\nexport interface CurrentTransactionDetails{\r\n products: Product[];\r\n lineDiscount?:LineDiscount[];\r\n linePromotion?:LinePromotions[];\r\n transactionPromotion?:TransactionPromotion[];\r\n transactionDiscount?:TransactionDiscount[];\r\n basketSummary?:BasketSummary; \r\n taxBreakdown?:TaxBreakdown; \r\n totalTaxSummary?:TotalTaxSummary[];\r\n}\r\nexport interface BasketSummary {\r\n totalItems: number;\r\n saleTotal: number;\r\n VATTotal: number;\r\n discountTotal: number;\r\n basketTotal: number;\r\n refundTotal?:number;\r\n}\r\n\r\nexport interface TransactionDiscount{\r\n discountAmount:number;\r\n discountType:String;\r\n reasonCode:string;\r\n override?: UserOverride;\r\n itemLineIds?:number[];\r\n}\r\n\r\nexport interface TBasket {\r\n products: TProduct[];\r\n lineDiscount:LineDiscount[];\r\n exchange:Exchange[];\r\n linePromotion:LinePromotions[];\r\n transactionPromotion?:TransactionPromotion[];\r\n transactionDiscount?:TransactionDiscount[];\r\n taxBreakdown?:TaxBreakdown;\r\n totalTaxSummary?:TotalTaxSummary[];\r\n\r\n \r\n}\r\n\r\nexport interface TExchange{\r\n exchangeId?:number,\r\n lineItemId?: number,\r\n reason?: string,\r\n quantity?: number,\r\n newItems?:TNewItems[];\r\n }\r\n \r\n export interface TNewItems{\r\n lineItemId:number,\r\n Quantity:number\r\n }\r\n\r\nexport interface TProduct {\r\n itemLineId: string;\r\n SKU: string;\r\n description: string;\r\n imageUrls: [string];\r\n price: number;\r\n taxCode?: string;\r\n taxPercent?: string;\r\n quantity: number;\r\n refundedQuantity?: number;\r\n refundedPromotionalQuantity?:number;\r\n refunded?: boolean;\r\n refundedTotal?: number;\r\n refundedReason?:string;\r\n refundedReasonDescription?:string;\r\n selectedRRPPrice?: number;\r\n totalLinePrice: number;\r\n barCode?: string;\r\n barcodes?: string[];\r\n flagged?: boolean;\r\n exchange?:Exchange;\r\n excludePromotion:boolean;\r\n discountable?:boolean;\r\n\r\n itemDiscounts?:ItemDiscounts;\r\n isLastExchanged?: boolean;\r\n\r\n // Mixed Sales fields\r\n fullfilmentId:string,\r\n fullfilmentLocationName:string,\r\n deliveryMethod?:string,\r\n deliveryGroup?:string,\r\n giftCardNumberIssued?: string,\r\n giftCardAmount?: number,\r\n giftCardRecipientEmail?: string,\r\n giftCardExpiryDate?: string ,\r\n giftCardRecipientName?: string,\r\n giftCard?:boolean,\r\n currency?:string,\r\n isWebOrder?:boolean,\r\n leadTime?: leadTime\r\n \r\n // currenttransaction doc changes\r\n lineDiscount?:any\r\n\r\n attributes?:CoreAttribute[];\r\n}\r\n\r\nexport interface ItemDiscounts{\r\n trnDiscountsPortion:number;\r\n trnPromotionsPortion:number;\r\n refundPortion:number;\r\n}\r\n\r\n\r\n\r\nexport interface Customer {\r\n id: string;\r\n title?: string;\r\n firstName: string;\r\n lastName: string;\r\n email: string;\r\n postCode: string;\r\n telephone?: string;\r\n billingAddress?: Address;\r\n shippingAddress?: Address;\r\n addressDetail?: string;\r\n noCustomerSelected?: boolean;\r\n externalId?: string; \r\n \r\n}\r\n\r\nexport interface Address \r\n{\r\n address1?: string;\r\n address2?: string;\r\n address3?: string;\r\n city?: string;\r\n county?: string;\r\n postCode?: string;\r\n country?: string;\r\n }\r\n\r\nexport interface PaymentDetails {\r\n cardNumber?: any;\r\n sqNo?:number;\r\n result?: string;\r\n currency: string;\r\n amount: string;\r\n authcode?: string;\r\n pan?: string;\r\n cardType?: string;\r\n transactionDate?: string;\r\n mid?: string;\r\n tid?: string;\r\n cvm?: string;\r\n hostReferenceId?: string;\r\n aid?: string;\r\n receiptNo?: string;\r\n expirydate?: string;\r\n transactionReference: string;\r\n applicationVersion?: string;\r\n entryMethod?:string;\r\n transactionType:string;\r\n totalamount:string;\r\n paymentType?:string;\r\n}\r\n\r\nexport interface TaxBreakdown\r\n{\r\n taxLines : TaxLine[],\r\n totalTaxableAmount: number;\r\n}\r\n\r\nexport interface TotalTaxSummary{\r\n VATCode:string,\r\n VAT : number;\r\n PreTaxSum: number\r\n TaxSum: number\r\n TXrateSum: number\r\n}\r\n\r\nexport interface TaxLine\r\n{\r\n itemLineId: number,\r\n taxableAmount: number,\r\n taxLineTotal: number,\r\n VAT: number,\r\n VATCode : string,\r\n PreTax: number\r\n}\r\n\r\nexport enum DISCOUNTTYPE {\r\n PERCENT = 'Percent',\r\n AMOUNT = 'AMOUNT'\r\n}","import { Injectable } from '@angular/core';\r\nimport { BehaviorSubject } from 'rxjs';\r\nimport { DELIVERY_METHODS } from './mapper-library.model';\r\nimport { Basket, DeliveryGroupInfo, DeliveryInfo, Product, TransactionPromotion } from './mapper-library.model';\r\nimport { TransactionDiscount } from './mapper-library.model';\r\nimport { NumberUtilService } from './number-util.service';\r\n\r\nexport class BasketService {\r\n currentBasket: Basket = {\r\n products: [],\r\n transactionDiscount: [],\r\n quantity: 0,\r\n total: 0,\r\n saleTotal: 0,\r\n baseCurrency: ''\r\n };\r\n\r\n private basketSource = new BehaviorSubject<any>(null);\r\n basket = this.basketSource.asObservable();\r\n\r\n private productSource = new BehaviorSubject<any>(null);\r\n product = this.productSource.asObservable();\r\n\r\n private peerSource = new BehaviorSubject<boolean>(false);\r\n peerSync = this.peerSource.asObservable();\r\n\r\n private scanSource = new BehaviorSubject<boolean>(false);\r\n scanner = this.scanSource.asObservable();\r\n\r\n private _isMixedBasketSales: boolean | undefined;\r\n public get isMixedBasketSales(): any {\r\n return this._isMixedBasketSales;\r\n }\r\n public set isMixedBasketSales(v: any) {\r\n this._isMixedBasketSales = v;\r\n }\r\n\r\n\r\n constructor(private numberUtilService: NumberUtilService) { }\r\n\r\n updateBasket(basket: Basket) {\r\n this.currentBasket = basket;\r\n this.isMixedBasketSales = this.filterProductListWithWebOrder(true).length > 0;\r\n this.basketSource.next(basket);\r\n }\r\n\r\n /**\r\n * calculates the total basket value and quantity\r\n * @param null\r\n * @returns void\r\n */\r\n updateBasketTotal(basketDetails: { quantity: number; total: number; products: any; transactionId: any; basketTotal: any; }, basketState: { updateBasket: (arg0: any) => void; }) {\r\n basketDetails.quantity = 0;\r\n basketDetails.total = 0;\r\n for (const p of basketDetails.products) {\r\n basketDetails.quantity = basketDetails.quantity + p.quantity;\r\n basketDetails.total =\r\n this.numberUtilService.trimTo2Decimal(basketDetails.total) +\r\n this.numberUtilService.trimTo2Decimal(p.total);\r\n }\r\n console.log(\r\n \"e:basket :basket service : basketDetails updated values for transaction id\",\r\n basketDetails.transactionId,\r\n JSON.stringify(basketDetails)\r\n );\r\n basketDetails.basketTotal = basketDetails.total;\r\n basketState.updateBasket(basketDetails);\r\n }\r\n\r\n /**\r\n * add Line promotion\r\n * @param null\r\n * @returns basketDetails\r\n */\r\n addlinePromotion(promotionList: { result: { linePromotions: string | any[]; }; }, basketDetails: { products: any; }) {\r\n console.log(\r\n \"e:basket :basket Service : promotionList and basketDetails for linePromotions\",\r\n JSON.stringify(promotionList),\r\n JSON.stringify(basketDetails)\r\n );\r\n if (\r\n promotionList &&\r\n promotionList.result &&\r\n promotionList.result.linePromotions &&\r\n promotionList.result.linePromotions.length > 0\r\n ) {\r\n for (var element of basketDetails.products) {\r\n for (var promotionelement of promotionList.result.linePromotions) {\r\n if (\r\n element.itemLineId.toString() ===\r\n promotionelement.itemLineId.toString()\r\n ) {\r\n element.linePromotions = promotionelement;\r\n }\r\n }\r\n }\r\n }\r\n return basketDetails;\r\n }\r\n\r\n /**\r\n * add Transaction promotion\r\n * @param null\r\n * @returns basketDetails\r\n */\r\n\r\n addTransactionPromotion(promotionList: { result: { transactionPromotion: any }; }, basketdetails: Basket) {\r\n console.log(\r\n \"e:basket :basket Service : promotionList and basketDetails for transactionPromotion\",\r\n JSON.stringify(promotionList),\r\n JSON.stringify(basketdetails),\r\n JSON.stringify(basketdetails.transactionPromotion)\r\n );\r\n if (\r\n promotionList &&\r\n promotionList.result &&\r\n promotionList.result.transactionPromotion &&\r\n promotionList.result.transactionPromotion.length > 0\r\n ) {\r\n promotionList.result.transactionPromotion.forEach((tPromotion: any) => {\r\n let transactionPromotionEntryUpdated: any = Object.assign(\r\n {},\r\n tPromotion\r\n );\r\n\r\n transactionPromotionEntryUpdated.itemLineIds = basketdetails.products.map(\r\n (product) => {\r\n return product.itemLineId;\r\n }\r\n );\r\n\r\n if (!basketdetails.transactionPromotion) {\r\n basketdetails.transactionPromotion = [];\r\n }\r\n basketdetails.transactionPromotion.push(\r\n transactionPromotionEntryUpdated\r\n );\r\n\r\n basketdetails = this.transactionPromotionProductPortionCalc(\r\n basketdetails,\r\n transactionPromotionEntryUpdated\r\n );\r\n });\r\n }\r\n console.log(\r\n \"basket details in refund calculation file\",\r\n JSON.stringify(basketdetails)\r\n );\r\n return basketdetails;\r\n }\r\n\r\n updateProductTotalForSummary(basketDetails: { total: string | number; quantity: string | number; products: any; }) {\r\n /*sale- product refundedQuantity = undefined\r\n partial refund - product refundedQuantity is > 0\r\n total refund - proudct refundedQuantity is > 0\r\n exchange - exchange product refundedQuantity is > 0 \r\n new product refundedQuantity = undefined \r\n old product without exchange refundedQuantity = 0\r\n unreference refund-product refundedQuantity is > 0 */\r\n\r\n basketDetails.total = 0;\r\n basketDetails.quantity = 0;\r\n for (var product of basketDetails.products) {\r\n if (product.linePromotions) {\r\n product.total = product.linePromotions.promotionLinePrice;\r\n } else if (product.lineDiscount && !product.linePromotions) {\r\n product.total = product.lineDiscount.discountedLinePrice;\r\n } else {\r\n product.total = product.totalLinePrice;\r\n }\r\n product.total =\r\n product.total -\r\n Math.abs(product.refundedTotal ? product.refundedTotal : 0);\r\n\r\n basketDetails.total += product.total;\r\n basketDetails.quantity =\r\n basketDetails.quantity +\r\n (product.quantity -\r\n (product.refundedQuantity ? product.refundedQuantity : 0));\r\n console.log(\r\n \"e-basket:ExchangeSummaryScreen:update basketdetails total :\" +\r\n basketDetails.total +\r\n \" Product line ID : \" +\r\n product.itemLineId +\r\n \" product total : \" +\r\n product.total,\r\n \"quantity : \" + basketDetails.quantity\r\n );\r\n }\r\n return this.updateBasketTotalForSummary(basketDetails);\r\n }\r\n\r\n updateBasketTotalForSummary(basketDetails: any) {\r\n basketDetails.basketTotal = basketDetails.total;\r\n console.info(\r\n \"ebasket : basket Service : update Basket Total for transaction transactionDiscount \",\r\n JSON.stringify(basketDetails.transactionDiscount)\r\n );\r\n\r\n console.info(\r\n \"ebasket : basket Service : update Basket Total for transaction transactionPromotion \",\r\n JSON.stringify(basketDetails.transactionPromotion)\r\n );\r\n\r\n basketDetails = this.updateTransactionPromotion(basketDetails);\r\n basketDetails = this.updateTransactionDiscount(basketDetails);\r\n basketDetails.basketTotal = Number(basketDetails.basketTotal.toFixed(2));\r\n\r\n console.info(\r\n \"ebasket : basket Service : update Basket Total: basketTotal after promotion applied for basketTotal\",\r\n basketDetails.basketTotal\r\n );\r\n return basketDetails;\r\n }\r\n\r\n updateTransactionDiscount(basketDetails: { transactionDiscount: any[]; basketTotal: number; }) {\r\n if (\r\n basketDetails.transactionDiscount &&\r\n basketDetails.transactionDiscount.length > 0\r\n ) {\r\n const discountTotal = basketDetails.transactionDiscount.reduce(\r\n (n: any, { discountAmount }: any) => n + discountAmount,\r\n 0\r\n );\r\n console.log(\"ebasket : basket Service : discountTotal \", discountTotal);\r\n basketDetails.basketTotal =\r\n basketDetails.basketTotal - Math.abs(discountTotal);\r\n }\r\n return basketDetails;\r\n }\r\n\r\n updateTransactionPromotion(basketDetails: { transactionPromotion: any[]; basketTotal: number; }) {\r\n if (\r\n basketDetails.transactionPromotion &&\r\n basketDetails.transactionPromotion.length > 0\r\n ) {\r\n const discountTotal = basketDetails.transactionPromotion.reduce(\r\n (n: any, { promotionAmount }: any) => n + promotionAmount,\r\n 0\r\n );\r\n basketDetails.basketTotal =\r\n basketDetails.basketTotal - Math.abs(discountTotal);\r\n }\r\n return basketDetails;\r\n }\r\n\r\n updateBasketTotalWithoutDiscount(basket: Basket): Basket {\r\n basket.total = 0;\r\n basket.quantity = 0;\r\n\r\n for (var product of basket.products) {\r\n if (product.linePromotions) {\r\n product.total = product.linePromotions.promotionLinePrice;\r\n } else if (product.lineDiscount && !product.linePromotions) {\r\n product.total = product.lineDiscount.discountedLinePrice || 0;\r\n } else {\r\n product.total = product.totalLinePrice;\r\n }\r\n\r\n product.total =\r\n product.total -\r\n Math.abs(product.refundedTotal ? product.refundedTotal : 0);\r\n basket.total += product.total;\r\n basket.quantity =\r\n basket.quantity +\r\n (product.quantity -\r\n (product.refundedQuantity ? product.refundedQuantity : 0));\r\n\r\n console.log(\r\n \"e-basket:basket service:update basketdetails total :\" +\r\n JSON.stringify(basket) +\r\n basket.total +\r\n \" Product line ID : \" +\r\n product.itemLineId +\r\n \" product total : \" +\r\n product.total\r\n );\r\n }\r\n\r\n basket.basketTotal = basket.total;\r\n return basket;\r\n }\r\n\r\n updateBasketTotalWithDiscounts(basket: any): Basket {\r\n console.log(\r\n \"e:basket :RefundBasketScreen : this.basketDetails new values\",\r\n basket,\r\n JSON.stringify(basket.basketTotal)\r\n );\r\n if (basket.transactionPromotion && basket.transactionPromotion.length > 0) {\r\n const discountTotal = basket.transactionPromotion.reduce(\r\n (n: any, { promotionAmount }: any) => n + promotionAmount,\r\n 0\r\n );\r\n basket.basketTotal = basket.basketTotal - discountTotal;\r\n }\r\n if (basket.transactionDiscount && basket.transactionDiscount.length > 0) {\r\n const discountTotal = basket.transactionDiscount.reduce(\r\n (n: any, { discountAmount }: any) => n + discountAmount,\r\n 0\r\n );\r\n\r\n basket.basketTotal = basket.basketTotal - discountTotal;\r\n }\r\n console.log(\r\n \"e:basket :RefundBasketScreen : basket new values\",\r\n JSON.stringify(basket)\r\n );\r\n\r\n return basket;\r\n }\r\n\r\n transactionDiscountAndPromotionProductortionCalculation(basket: Basket) {\r\n if (basket.transactionDiscount && basket.transactionDiscount.length > 0) {\r\n basket.transactionDiscount.forEach(\r\n (discount) =>\r\n (basket = this.transactionDiscountProductPortionCalc(\r\n basket,\r\n discount\r\n ))\r\n );\r\n }\r\n\r\n if (basket.transactionPromotion && basket.transactionPromotion.length > 0) {\r\n basket.transactionPromotion.forEach((promotion) => {\r\n basket = this.transactionPromotionProductPortionCalc(basket, promotion);\r\n });\r\n }\r\n console.log(\r\n \"ebasket: basket item discount protion calculation\",\r\n basket,\r\n basket.products\r\n );\r\n return basket;\r\n }\r\n\r\n transactionPromotionProductPortionCalc(\r\n basket: any,\r\n promotion: any\r\n ) {\r\n let total = 0;\r\n let percentage = 0;\r\n {\r\n basket.products.forEach((p:any) => {\r\n if (promotion.itemLineIds.includes(p.itemLineId)) {\r\n p = this.validateProductItemDiscount(p);\r\n const productContributionInTotal =\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnDiscountsPortion) +\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnPromotionsPortion) -\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.refundPortion);\r\n total += (p.total - this.numberUtilService.trimTo2Decimal2(productContributionInTotal));\r\n }\r\n });\r\n console.log(\r\n `ebasket: trnsactionPromotion: ${JSON.stringify(\r\n promotion\r\n )}, selected products total: ${total}`\r\n );\r\n basket.products.forEach((product: any) => {\r\n product = this.validateProductItemDiscount(product);\r\n\r\n const productContributionInTotal =\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnDiscountsPortion) +\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnPromotionsPortion) -\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.refundPortion);\r\n\r\n if (promotion.itemLineIds.includes(product.itemLineId)) {\r\n percentage = ((product.total - this.numberUtilService.trimTo2Decimal2(productContributionInTotal)) / total) * 100;\r\n product.itemDiscounts.trnPromotionsPortion +=\r\n (promotion.promotionAmount * percentage) / 100;\r\n product.itemDiscounts.trnPromotionsPortion = this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnPromotionsPortion);\r\n }\r\n });\r\n }\r\n return basket;\r\n }\r\n\r\n transactionDiscountProductPortionCalc(\r\n basket: any,\r\n discount: any\r\n ) {\r\n let total = 0;\r\n let percentage = 0;\r\n\r\n basket.products.forEach((p: any) => {\r\n if (discount.itemLineIds.includes(p.itemLineId)) {\r\n p = this.validateProductItemDiscount(p);\r\n const productContributionInTotal =\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnDiscountsPortion) +\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnPromotionsPortion) -\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.refundPortion);\r\n\r\n\r\n total += (p.total - this.numberUtilService.trimTo2Decimal2(productContributionInTotal));\r\n }\r\n });\r\n\r\n console.log(\r\n `ebasket: trnsactionDiscount: ${JSON.stringify(\r\n discount\r\n )}, selected products total: ${total}`\r\n );\r\n\r\n basket.products.forEach((product:any) => {\r\n product = this.validateProductItemDiscount(product);\r\n console.log(product.discountable, \"ebasket : basket service : discountable in basket service\");\r\n\r\n const productContributionInTotal =\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnDiscountsPortion) +\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnPromotionsPortion) -\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.refundPortion);\r\n\r\n if (discount.itemLineIds.includes(product.itemLineId) && product.discountable == true) {\r\n percentage = ((product.total - this.numberUtilService.trimTo2Decimal2(productContributionInTotal)) / total) * 100;\r\n product.itemDiscounts.trnDiscountsPortion +=\r\n (discount.discountAmount * percentage) / 100;\r\n product.itemDiscounts.trnDiscountsPortion = this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnDiscountsPortion)\r\n }\r\n });\r\n return basket;\r\n }\r\n\r\n public validateProductItemDiscount(product: Product) {\r\n if (!product.itemDiscounts) {\r\n product.itemDiscounts = {\r\n trnDiscountsPortion: 0,\r\n trnPromotionsPortion: 0,\r\n refundPortion: 0,\r\n };\r\n }\r\n return product;\r\n }\r\n\r\n markProduct(product: Product) {\r\n this.productSource.next(product);\r\n }\r\n stopPeerSyncProcess(peerSync: boolean) {\r\n this.peerSource.next(peerSync);\r\n }\r\n\r\n scanStart(isScanning: boolean) {\r\n this.scanSource.next(isScanning);\r\n }\r\n\r\n promotionRemainingCalculation(promotion: TransactionPromotion[]) {\r\n var promotionValue = 0;\r\n promotion.forEach((element) => {\r\n promotionValue += element.promotionAmount;\r\n });\r\n return promotionValue;\r\n }\r\n\r\n discountRemainingCalculation(discount: TransactionDiscount[]) {\r\n var discountValue = 0;\r\n discount.forEach((element) => {\r\n discountValue += element.discountAmount;\r\n });\r\n return discountValue;\r\n }\r\n\r\n discountRefundedCalculation(discount: TransactionDiscount[]) {\r\n var discountValue = 0;\r\n discount.forEach((element) => {\r\n if (element.discountAmount < 0) {\r\n discountValue += element.discountAmount;\r\n }\r\n });\r\n return discountValue;\r\n }\r\n\r\n generateNewItemLineId(products: Product[]) {\r\n let largestNumber: any = 0;\r\n\r\n if (products.length > 0) {\r\n let itemLineIdArray = products.map((product) => {\r\n return product.itemLineId;\r\n });\r\n\r\n largestNumber = itemLineIdArray.reduce((a :any, b:any) => Math.max(a, b));\r\n }\r\n\r\n return largestNumber + 1;\r\n }\r\n\r\n updateBasketProductDataAsPerQuantity(\r\n product: any,\r\n quantity: number\r\n ): Product {\r\n\r\n console.log(`ebasket: updateBasketProductDataAsPerQuantity : ${quantity} product: ${JSON.stringify(product)}`);\r\n product.quantity = quantity;\r\n if (product.hasOwnProperty(\"lineDiscount\")) {\r\n // && this.product.quantity !== this.productDetailForm.controls.quantity.value\r\n product.lineDiscount.discountedLinePrice = Number(\r\n this.numberUtilService.getFlooredFixed(\r\n product.lineDiscount.unitPrice * quantity,\r\n 2\r\n )\r\n );\r\n product.lineDiscount.discountAmount =\r\n product.totalLinePrice - product.lineDiscount.discountedLinePrice;\r\n } else {\r\n product.totalLinePrice =\r\n quantity * this.numberUtilService.trimTo2Decimal(product.selectedPrice);\r\n }\r\n if (product.lineDiscount) {\r\n product.total = product.lineDiscount.discountedLinePrice;\r\n } else {\r\n product.total = product.totalLinePrice;\r\n }\r\n console.log(`ebasket: updateBasketProductDataAsPerQuantity : ${quantity} product: ${JSON.stringify(product)}`);\r\n\r\n return product;\r\n }\r\n\r\n filterProductListWithWebOrder(isWebOrder: boolean): Product[] {\r\n console.log(\"ebasket: filterProductListWithWebOrder hit\", JSON.stringify(this.currentBasket.products));\r\n if (isWebOrder)\r\n return this.currentBasket.products.filter((x) => x.isWebOrder);\r\n else {\r\n return this.currentBasket.products.filter((x) => !x.isWebOrder);\r\n }\r\n }\r\n\r\n filterProductListWithDelivery(): Product[] {\r\n console.log(\"ebasket: filterProductListWithDelivery hit\", JSON.stringify(this.currentBasket.products));\r\n return this.currentBasket.products.filter((x) => x.deliveryMethod === DELIVERY_METHODS.DELIVERY.toString());\r\n }\r\n\r\n filterProductListWithDeliveryGroup(group: string, products: Product[]): Product[] {\r\n console.log(\"ebasket: filterProductListWithDeliveryGroup hit\", JSON.stringify(products));\r\n return products.filter((x) => x.deliveryGroup === group);\r\n }\r\n\r\n generateNewDeliveryGroupNumber(products: Product[]) {\r\n let largestNumber = 0;\r\n\r\n if (products.length > 0) {\r\n let deliveryGroupArr = products.map((product) => {\r\n if (product.deliveryGroup) {\r\n return parseInt(product.deliveryGroup);\r\n }\r\n return 0;\r\n });\r\n\r\n largestNumber = deliveryGroupArr.reduce((a, b) => Math.max(a, b));\r\n }\r\n\r\n return (largestNumber + 1).toString();\r\n }\r\n\r\n getDeliveryGroupNumbers(products: Product[]) {\r\n console.log(\"getDeliveryGroupNumbers initiating : \", JSON.stringify(products));\r\n\r\n let uniqueAndsortedResult: number[] = [];\r\n\r\n if (products.length > 0) {\r\n let deliveryGroupArr = products.map((product) => {\r\n if (product.deliveryGroup) {\r\n return parseInt(product.deliveryGroup);\r\n }\r\n else if (product.deliveryMethod === \"1\") {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n\r\n uniqueAndsortedResult = Array.from(new Set(deliveryGroupArr)).sort((a, b) => a - b);\r\n console.log(\"getDeliveryGroupNumbers : \", JSON.stringify(uniqueAndsortedResult));\r\n }\r\n return uniqueAndsortedResult;\r\n }\r\n\r\n updateProductsWithNewDeliveryGroupNumber(products: Product[]) {\r\n console.log(\"updateProductsWithNewDeliveryGroupNumber initiating : \", JSON.stringify(products));\r\n\r\n let newGroupNumber = this.generateNewDeliveryGroupNumber(this.currentBasket.products);\r\n if (products.length > 0) {\r\n this.currentBasket.products.forEach(cBProducts => {\r\n products.forEach(element => {\r\n if (cBProducts.itemLineId === element.itemLineId) {\r\n cBProducts.deliveryGroup = newGroupNumber;\r\n }\r\n\r\n });\r\n });\r\n\r\n }\r\n\r\n this.updateBasket(this.currentBasket);\r\n return;\r\n }\r\n\r\n calculateEstimatedTime(products: any[]) {\r\n try {\r\n let time;\r\n let estmatedTime: number = 0;\r\n let estimatedDays: string = \"Hours\";\r\n products.forEach((element: { leadTime: { type: string; value: any; }; }) => {\r\n\r\n if (element.leadTime.type.toLocaleLowerCase() === \"weeks\") {\r\n time = Number(element.leadTime.value) * 24 * 7;\r\n estmatedTime = Math.max(estmatedTime, time);\r\n estimatedDays = (estmatedTime === time) ? element.leadTime.type : estimatedDays\r\n console.log(\"week\", estmatedTime, estimatedDays);\r\n\r\n } else if (element.leadTime.type.toLocaleLowerCase() === \"days\") {\r\n time = Number(element.leadTime.value) * 24;\r\n estmatedTime = Math.max(estmatedTime, time);\r\n estimatedDays = (estmatedTime === time) ? element.leadTime.type : estimatedDays\r\n\r\n console.log(\"days\", estmatedTime, estimatedDays);\r\n\r\n }\r\n else if (element.leadTime.type.toLocaleLowerCase() === \"months\") {\r\n time = Number(element.leadTime.value) * 24 * 30;\r\n estmatedTime = Math.max(estmatedTime, time);\r\n estimatedDays = (estmatedTime === time) ? element.leadTime.type : estimatedDays\r\n\r\n console.log(\"months\", estmatedTime, estimatedDays);\r\n\r\n }\r\n else if (element.leadTime.type.toLocaleLowerCase() === \"years\") {\r\n time = Number(element.leadTime.value) * 24 * 365;\r\n estmatedTime = Math.max(estmatedTime, time);\r\n estimatedDays = (estmatedTime === time) ? element.leadTime.type : estimatedDays\r\n\r\n console.log(\"years\", estmatedTime, estimatedDays);\r\n\r\n } else {\r\n time = Number(element.leadTime.value);\r\n estmatedTime = Math.max(estmatedTime, time);\r\n estimatedDays = (estmatedTime === time) ? element.leadTime.type : estimatedDays;\r\n console.log(\"hours\", estmatedTime, estimatedDays);\r\n\r\n }\r\n });\r\n\r\n if (estimatedDays.toLocaleLowerCase() === \"days\") {\r\n estmatedTime = estmatedTime / 24;\r\n } else if (estimatedDays.toLocaleLowerCase() === \"weeks\") {\r\n estmatedTime = estmatedTime / (24 * 7);\r\n } else if (estimatedDays.toLocaleLowerCase() === \"months\") {\r\n estmatedTime = estmatedTime / (24 * 30);\r\n } else if (estimatedDays.toLocaleLowerCase() === \"years\") {\r\n estmatedTime = estmatedTime / (24 * 365);\r\n }\r\n\r\n let estimate = {\r\n value: estmatedTime.toString(),\r\n type: estimatedDays\r\n }\r\n return estimate;\r\n } catch (error) {\r\n console.log(\"error in calculateEstimatedTime\", error);\r\n }\r\n return 0;\r\n }\r\n\r\n updateProductsWithDeliveryGroupNumber(oldGroup: string, newGroup: string) {\r\n console.log(\"updateProductsWithDeliveryGroupNumber initiating\");\r\n\r\n this.currentBasket.products.forEach(cBProducts => {\r\n if (cBProducts.deliveryGroup === oldGroup) {\r\n cBProducts.deliveryGroup = newGroup;\r\n }\r\n\r\n });\r\n\r\n this.updateBasket(this.currentBasket);\r\n return;\r\n }\r\n\r\n getDeliveryInfo(): any {\r\n console.log(\"getDeliveryGroupInfor initiating\");\r\n try {\r\n let groupInfo: DeliveryInfo = {\r\n groups: []\r\n }\r\n\r\n this.getDeliveryGroupNumbers(this.currentBasket.products).forEach((groupNumber) => {\r\n let group: any = {\r\n groupNumber: groupNumber,\r\n items: [],\r\n estimate: {\r\n type: \"Hours\",\r\n value: \"0\"\r\n }\r\n }\r\n this.currentBasket.products.forEach(cBProducts => {\r\n if (cBProducts.deliveryGroup === groupNumber.toString()) {\r\n group.items.push(cBProducts);\r\n }\r\n });\r\n\r\n group.estimate = this.calculateEstimatedTime(group.items);\r\n\r\n groupInfo.groups.push(group);\r\n\r\n });\r\n\r\n return groupInfo;\r\n }\r\n catch (error) {\r\n console.log(\"error\", error);\r\n }\r\n }\r\n}\r\n","import { CurrencyPipe } from \"@angular/common\";\r\nimport { Injectable } from \"@angular/core\";\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class NumberUtilService {\r\n constructor( private cp: CurrencyPipe) {}\r\n\r\n trimTo2Decimal(no: any) {\r\n //return Math.floor(no * 100) / 100;\r\n return no;\r\n }\r\n\r\n trimTo2Decimal2(no: number) {\r\n return Number(this.getFlooredFixed(no,2));\r\n }\r\n\r\n getFlooredFixed(v:any, d:any) {\r\n return (Math.floor(v * Math.pow(10, d)) / Math.pow(10, d)).toFixed(d);\r\n }\r\n\r\n AppendWithCurrencySymbol(numValue: any, currencyCode: string): string {\r\n let returnValue: any = \"\";\r\n if (numValue) {\r\n const numb: number = parseFloat(numValue.toString().replace(',',''));\r\n returnValue = this.cp.transform(\r\n Number(numValue).toFixed(2),\r\n currencyCode.toLocaleUpperCase(),\r\n \"symbol\"\r\n );\r\n console.log(\"AppendWithCurrencySymbol :\" + returnValue);\r\n } else {\r\n returnValue = this.cp.transform(\r\n \"0.00\",\r\n currencyCode.toLocaleUpperCase(),\r\n \"symbol\"\r\n );\r\n }\r\n return returnValue;\r\n }\r\n}\r\n","import { CurrencyPipe } from \"@angular/common\";\r\nimport { BasketSummary, CurrentTransactionDetails, Customer, DELIVERY_METHODS, ItemDiscounts, TaxBreakdown, TaxLine, TBasket, TotalTaxSummary, TProduct, TransactionDocument } from \"./mapper-library.model\";\r\nimport { TRANSACTION_TYPE, Basket, LineDiscount, LinePromotions, Product, UserOverride } from \"./mapper-library.model\";\r\nimport { BasketService } from \"./basket.service\";\r\nimport { NumberUtilService } from \"./number-util.service\";\r\n\r\n/**\r\n * Transaction document builder\r\n */\r\nexport class TransactionDocumentBuilder {\r\n private transactionDocument: TransactionDocument;\r\n private numberUtilService: NumberUtilService;\r\n private storeInfo : any;\r\n \r\n constructor(\r\n transactionDoc?: TransactionDocument,\r\n private currencyPipe?: CurrencyPipe,\r\n private basketService?: BasketService | any,\r\n ) {\r\n this.numberUtilService = new NumberUtilService(currencyPipe);\r\n this.basketService = new BasketService(this.numberUtilService);\r\n this.storeInfo = JSON.parse(localStorage.getItem('storeInfo') || '{}');\r\n if (transactionDoc) {\r\n this.transactionDocument = transactionDoc;\r\n } else {\r\n this.transactionDocument = {\r\n transactionId: \"\",\r\n offlineTransactionId: \"\",\r\n transactionRef: \"\",\r\n dateTime: \"\",\r\n orgCode: \"\",\r\n storeId: \"\",\r\n storeNodeId: \"\",\r\n storeNodeStructure: \"\",\r\n deviceId: \"\",\r\n terminalId: \"\",\r\n userId: \"\",\r\n initiatingModule : \"eBasket\",\r\n export: false,\r\n basket: {} as TBasket,\r\n basketSummary: {} as BasketSummary,\r\n baseCurrency: \"\",\r\n type: \"\",\r\n operationStatus: \"\",\r\n createdAt: \"\",\r\n updatedAt: \"\",\r\n id: \"\",\r\n currentTransactionDetails: {} as CurrentTransactionDetails,\r\n saleTotal: 0,\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Transactions ref\r\n * @returns ref\r\n */\r\n transactionRef(): TransactionDocumentBuilder {\r\n const storeDetails = JSON.parse(localStorage.getItem('storeInfo') || '{}');\r\n const date = new Date();\r\n const random = (((1 + Math.random()) * 0x10000) | 0)\r\n .toString(16)\r\n .substring(1);\r\n this.transactionDocument.transactionRef =\r\n storeDetails.orgCode + storeDetails.storeId + date.toISOString() + random;\r\n console.log(\"ebasket: transaction ref created\", this.transactionDocument.transactionRef)\r\n return this;\r\n }\r\n\r\n /**\r\n * Transactions id\r\n * @param transactionID\r\n * @returns id\r\n */\r\n transactionId(transactionID: string, isOnline: boolean = true): TransactionDocumentBuilder {\r\n if (isOnline) {\r\n this.transactionDocument.transactionId = transactionID;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Transactions id\r\n * @param transactionID\r\n * @returns id\r\n */\r\n offlineTransactionId(transactionID: string, isOnline: any): TransactionDocumentBuilder {\r\n if (!isOnline) {\r\n this.transactionDocument.offlineTransactionId = transactionID;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * storeNode Id\r\n * @param storeNodeId\r\n * @returns id\r\n */\r\n storeNodeId(storeNodeId: string): TransactionDocumentBuilder {\r\n this.transactionDocument.storeNodeId = storeNodeId;\r\n return this;\r\n }\r\n\r\n /**\r\n* storeNode structure\r\n* @param storeNodeStructure\r\n* @returns id\r\n*/\r\n storeNodeStructure(storeNodeStructure: string): TransactionDocumentBuilder {\r\n this.transactionDocument.storeNodeStructure = storeNodeStructure;\r\n return this;\r\n }\r\n\r\n /**\r\n * Orgs code\r\n * @param orgCode\r\n * @returns code\r\n */\r\n orgCode(orgCode: any): TransactionDocumentBuilder {\r\n this.transactionDocument.orgCode = orgCode;\r\n return this;\r\n }\r\n /**\r\n * Stores id\r\n * @param storeId\r\n * @returns id\r\n */\r\n storeId(storeId: any): TransactionDocumentBuilder {\r\n this.transactionDocument.storeId = storeId;\r\n return this;\r\n }\r\n /**\r\n * Dates time\r\n * @returns time\r\n */\r\n dateTime(): TransactionDocumentBuilder {\r\n const date = new Date();\r\n this.transactionDocument.dateTime = date.toISOString();\r\n return this;\r\n }\r\n /**\r\n * Devices id\r\n * @param deviceId\r\n * @returns id\r\n */\r\n deviceId(deviceId: any): TransactionDocumentBuilder {\r\n this.transactionDocument.deviceId = deviceId;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * terminal id\r\n * @param terminalId\r\n * @returns id\r\n */\r\n terminalId(terminalId: any): TransactionDocumentBuilder {\r\n this.transactionDocument.terminalId = terminalId;\r\n return this;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n /**\r\n * saleExport\r\n * @param saleExport\r\n * @returns id\r\n */\r\n export(saleExport: any): TransactionDocumentBuilder {\r\n this.transactionDocument.export = saleExport;\r\n return this;\r\n }\r\n\r\n\r\n\r\n /* customer(): TransactionDocumentBuilder {\r\n const user = JSON.parse(localStorage.getItem('userDetails'));\r\n this.transactionDocument.customer = user;\r\n return this;\r\n } */\r\n /**\r\n * Baskets transaction document builder\r\n * @param basketDetails\r\n * @returns basket\r\n */\r\n basket(basketDetails: Basket): TransactionDocumentBuilder {\r\n console.log(\"ebasket: basket details update in transaction document\", JSON.stringify(basketDetails));\r\n\r\n this.transactionDocument.subsidiaryId = basketDetails.subsidiaryId || (localStorage.getItem('subsidiaryId') || '');\r\n this.transactionDocument.basket.products = [] as TProduct[];\r\n this.transactionDocument.basket.lineDiscount = [];\r\n this.transactionDocument.basket.linePromotion = [];\r\n this.transactionDocument.basket.transactionPromotion = [];\r\n basketDetails.products.forEach((product: any, index) => {\r\n const p = {} as TProduct;\r\n p.itemDiscounts = {} as ItemDiscounts;\r\n p.SKU = product.SKU;\r\n p.excludePromotion = product.excludePromotion;\r\n p.barCode = product.barcode;\r\n p.barcodes = product.barcodes;\r\n p.description = product.description;\r\n p.itemLineId = product.itemLineId ? product.itemLineId.toString() : \"\" + (index + 1);\r\n p.price = product.selectedPrice;\r\n p.quantity = product.quantity;\r\n p.totalLinePrice = product.quantity * product.selectedPrice;\r\n p.imageUrls = product.imageUrls;\r\n p.selectedRRPPrice = product.selectedRRPPrice;\r\n\r\n //inventory fields\r\n \r\n p.fullfilmentId = product.fullfilmentId? product.fullfilmentId: this.storeInfo.storeId;\r\n\r\n p.fullfilmentLocationName = product.fullfilmentLocationName;\r\n p.deliveryGroup = product.deliveryGroup;\r\n p.leadTime = product.leadTime;\r\n p.deliveryMethod = product.deliveryMethod;\r\n\r\n p.giftCard = product.giftCard;\r\n p.giftCardExpiryDate = product.giftCardExpiryDate;\r\n p.giftCardNumberIssued = product.giftCardNumberIssued;\r\n p.giftCardRecipientEmail = product.giftCardRecipientEmail;\r\n p.giftCardRecipientName = product.giftCardRecipientName;\r\n\r\n if (product.refundedQuantity > 0) {\r\n p.refundedQuantity = product.refundedQuantity;\r\n p.refundedPromotionalQuantity = product.refundPromotionalQuantity;\r\n p.refunded = product.refunded;\r\n p.refundedReasonDescription = product.refundedReasonDescription;\r\n p.refundedReason = product.refundedReason;\r\n if (!p.refundedReasonDescription) {\r\n p.refundedReasonDescription = p.refundedReason;\r\n }\r\n p.refundedTotal = product.refundedTotal;\r\n p.isLastExchanged = product.isLastExchanged;\r\n }\r\n\r\n if (product.exchange) {\r\n p.exchange = product.exchange;\r\n }\r\n if (product.lineDiscount) {\r\n p.lineDiscount = product.lineDiscount;\r\n }\r\n p.itemDiscounts = product.itemDiscounts as ItemDiscounts;\r\n this.transactionDocument.basket.products.push(p);\r\n this.lineDiscount(basketDetails);\r\n });\r\n console.info(\"ebasket: transactiondocument basket details updated\", JSON.stringify(this.transactionDocument.basket));\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * current transaction Details Total(New Products)\r\n * @returns currentTransactionDetails\r\n */\r\n\r\n currentTransactionDetails(basket: Basket): TransactionDocumentBuilder {\r\n console.log(\"ebasket: current transaction details for exchanges\", basket);\r\n this.transactionDocument.currentTransactionDetails.products = [] as Product[];\r\n this.transactionDocument.currentTransactionDetails.linePromotion = [] as LinePromotions[];\r\n this.transactionDocument.currentTransactionDetails.lineDiscount = [] as LineDiscount[];\r\n this.transactionDocument.currentTransactionDetails.transactionDiscount = [];\r\n this.transactionDocument.currentTransactionDetails.products = basket.products;\r\n this.transactionDocument.currentTransactionDetails.products = this.transactionDocument.currentTransactionDetails.products.filter(\r\n ( proj: { refundedQuantity: number; }) => proj.refundedQuantity != 0\r\n );\r\n\r\n this.transactionDocument.currentTransactionDetails.products.forEach((product: { refundedQuantity: any; quantity: any; totalLinePrice: number; refundedTotal: number; total: any; refunded: boolean; linePromotions: any; lineDiscount: any; }) => {\r\n if (product.refundedQuantity) {\r\n product.quantity = product.refundedQuantity;\r\n // updating total line price with actual price to be refunded including the refunding qty\r\n product.totalLinePrice = Math.abs(product.refundedTotal);\r\n product.total = product.totalLinePrice;\r\n if (product.quantity === product.refundedQuantity) {\r\n product.refunded = true;\r\n }\r\n }\r\n //Updating line promotions and line discounts \r\n if (product.linePromotions && !product.refundedQuantity) {\r\n this.transactionDocument.currentTransactionDetails.linePromotion.push(product.linePromotions)\r\n }\r\n if (product.lineDiscount && !product.refundedQuantity) {\r\n this.transactionDocument.currentTransactionDetails.lineDiscount.push(product.lineDiscount)\r\n }\r\n });\r\n\r\n console.log(\"ebasket: current transaction details after removing old products\", this.transactionDocument.currentTransactionDetails.products);\r\n\r\n if (basket.transactionDiscount && basket.transactionDiscount.length > 0) {\r\n this.transactionDocument.currentTransactionDetails.transactionDiscount.push(...basket.transactionDiscount);\r\n }\r\n this.transactionDocument.currentTransactionDetails.basketSummary = {} as BasketSummary;\r\n\r\n this.transactionDocument.currentTransactionDetails.basketSummary.saleTotal = this.numberUtilService.trimTo2Decimal2(this.updateSaleTotal(this.transactionDocument.currentTransactionDetails));\r\n this.transactionDocument.currentTransactionDetails.basketSummary.totalItems = basket.quantity;\r\n\r\n\r\n this.transactionDocument.currentTransactionDetails.basketSummary.basketTotal = basket.basketTotal;\r\n this.transactionDocument.currentTransactionDetails.basketSummary.refundTotal = this.updateCurrentTransactionDetailsRefundTotal();\r\n // For partial refund discount is updatied in total line price so discountTotal will always be zero & in case of exchange discount total is calculated\r\n\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.SALE_EXCHANGE) {\r\n this.transactionDocument.currentTransactionDetails.basketSummary.discountTotal = this.numberUtilService.trimTo2Decimal2(this.updateCurrentTransactionDetailsDiscountTotal());\r\n } else {\r\n if (this.transactionDocument.currentTransactionDetails.transactionDiscount && this.transactionDocument.currentTransactionDetails.transactionDiscount.length > 0) {\r\n let discountTotal = 0;\r\n this.transactionDocument.currentTransactionDetails.transactionDiscount.forEach((discount: { discountAmount: number; }) => {\r\n discountTotal += discount.discountAmount;\r\n });\r\n this.transactionDocument.currentTransactionDetails.basketSummary.discountTotal = Math.abs(discountTotal);\r\n } else {\r\n this.transactionDocument.currentTransactionDetails.basketSummary.discountTotal = 0;\r\n }\r\n }\r\n\r\n console.log(\"ebasket:this.transactionDocument.currentTransactionDetails\", JSON.stringify(this.transactionDocument.currentTransactionDetails));\r\n return this;\r\n }\r\n\r\n\r\n /**\r\n * current transaction Tax Total\r\n * @returns Tax Total\r\n */\r\n\r\n updateCurrentTransactionDetailsTaxBreakdown(basketDetails: Basket): TransactionDocumentBuilder {\r\n let transactionDiscountTotal = 0;\r\n let taxBreakdown: TaxBreakdown = {\r\n taxLines: [],\r\n totalTaxableAmount: 0,\r\n };\r\n\r\n if (this.transactionDocument.currentTransactionDetails.transactionDiscount && this.transactionDocument.currentTransactionDetails.transactionDiscount.length > 0) {\r\n this.transactionDocument.currentTransactionDetails.transactionDiscount.forEach((discount: { discountAmount: number; }) => {\r\n transactionDiscountTotal += discount.discountAmount;\r\n });\r\n }\r\n\r\n if (this.transactionDocument.currentTransactionDetails.products && this.transactionDocument.currentTransactionDetails.products.length > 0) {\r\n this.transactionDocument.currentTransactionDetails.products.forEach((product: { itemLineId: any; selectedVAT: any; selectedVATCode: any; total: any; refundedQuantity: number; itemDiscounts: { currentRefundPortion: number; trnDiscountsPortion: number; trnPromotionsPortion: number; }; }) => {\r\n let taxLine: TaxLine = {\r\n itemLineId: product.itemLineId,\r\n VAT: product.selectedVAT ? product.selectedVAT : 0,\r\n VATCode: product.selectedVATCode,\r\n taxLineTotal: 0,\r\n taxableAmount: product.total,\r\n PreTax: 0\r\n\r\n };\r\n console.info(\"Product contribution : item line ID :current transaction Details\",\r\n product.itemLineId, \"tax line :\", JSON.stringify(taxLine), JSON.stringify(basketDetails.basketTotal));\r\n\r\n //step 1\r\n // if Transaction Discount and/or promotion applied, find net selling price of each product as taxableamount\r\n\r\n //If transaction discount/promotion is applied taxable amount should be deducting transaction promotion and transaction disacount portion\r\n if (product.refundedQuantity && product.refundedQuantity > 0) {\r\n\r\n taxLine.taxableAmount = -Math.abs(taxLine.taxableAmount - product.itemDiscounts.currentRefundPortion);\r\n } else {\r\n taxLine.taxableAmount = taxLine.taxableAmount - product.itemDiscounts.trnDiscountsPortion - product.itemDiscounts.trnPromotionsPortion;\r\n }\r\n\r\n //step 2 - find pre tax\r\n taxLine.PreTax = this.numberUtilService.trimTo2Decimal2((taxLine.taxableAmount * 100) / (100 + taxLine.VAT));\r\n\r\n //step 3 - Update taxbreakdown\r\n taxBreakdown.totalTaxableAmount += taxLine.taxableAmount;\r\n taxLine.taxableAmount = this.numberUtilService.trimTo2Decimal2(taxLine.taxableAmount);\r\n \r\n // step 4 - update tax Line total\r\n taxLine.taxLineTotal = this.numberUtilService.trimTo2Decimal2(taxLine.taxableAmount - taxLine.PreTax);\r\n taxBreakdown.taxLines.push(taxLine);\r\n });\r\n }\r\n\r\n taxBreakdown.totalTaxableAmount = this.numberUtilService.trimTo2Decimal2(taxBreakdown.totalTaxableAmount);\r\n this.transactionDocument.currentTransactionDetails.taxBreakdown = taxBreakdown;\r\n if (this.transactionDocument.currentTransactionDetails.taxBreakdown && this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines && this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines.length > 0) {\r\n this.transactionDocument.currentTransactionDetails.basketSummary.VATTotal = this.numberUtilService.trimTo2Decimal2(this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines.reduce(\r\n (n: any, { taxLineTotal }: any) => n + taxLineTotal,\r\n 0\r\n ));\r\n }\r\n else {\r\n this.transactionDocument.currentTransactionDetails.basketSummary.VATTotal = 0.00;\r\n }\r\n\r\n console.log(\"eBasket:after calculating tax currenttransactionDetails\", this.transactionDocument.currentTransactionDetails)\r\n return this;\r\n }\r\n\r\n updateCurrentTransactionDetailsTotalTaxSummary(): TransactionDocumentBuilder {\r\n \r\n console.log(\"Total Tax Summery Request :\", JSON.stringify(this.transactionDocument.currentTransactionDetails.taxBreakdown));\r\n\r\n let totalTaxSummaryArray: TotalTaxSummary[] = []\r\n let totalTaxSummaryGroup = []\r\n\r\n console.log(\"Tax Lines for Total Tax Summery :\", JSON.stringify(this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines));\r\n\r\n this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines.forEach((element: { VATCode: any; VAT: any; PreTax: any; taxLineTotal: any; }) => {\r\n let TaxSummary: TotalTaxSummary = {\r\n VATCode:\"\",\r\n VAT: -12345,\r\n PreTaxSum: 0,\r\n TaxSum: 0,\r\n TXrateSum: 0\r\n };\r\n TaxSummary.VATCode=element.VATCode;\r\n TaxSummary.VAT = element.VAT; \r\n \r\n TaxSummary.PreTaxSum = this.numberUtilService.trimTo2Decimal2(element.PreTax); \r\n TaxSummary.TaxSum = this.numberUtilService.trimTo2Decimal2(element.taxLineTotal);\r\n TaxSummary.TXrateSum = this.numberUtilService.trimTo2Decimal2(TaxSummary.PreTaxSum + TaxSummary.TaxSum); \r\n totalTaxSummaryArray.push(TaxSummary);\r\n })\r\n\r\n console.log(\"Total Tax Summery Without Grouped : \", JSON.stringify(totalTaxSummaryArray));\r\n \r\n totalTaxSummaryGroup = totalTaxSummaryArray.reduce((preparedArray:any,currentObj:any) => {\r\n let ind = preparedArray.findIndex((x: { VAT: any; }) => x.VAT === currentObj.VAT);\r\n if(ind === -1){\r\n preparedArray.push(currentObj)\r\n }else {\r\n preparedArray[ind].VATCode = currentObj.VATCode;\r\n preparedArray[ind].VAT = currentObj.VAT;\r\n preparedArray[ind].PreTaxSum += currentObj.PreTaxSum;\r\n preparedArray[ind].TaxSum += currentObj.TaxSum;\r\n preparedArray[ind].TXrateSum += currentObj.TXrateSum;\r\n }\r\n return preparedArray;\r\n },[])\r\n // listOfTags.map(x => unique.filter(a => a.label == x.label && a.color == x.color).length > 0 ? null : unique.push(x));\r\n\r\n console.log(\"Total Tax Summer Group :\", JSON.stringify(totalTaxSummaryGroup));\r\n\r\n this.transactionDocument.currentTransactionDetails.totalTaxSummary = totalTaxSummaryGroup;\r\n return this;\r\n\r\n }\r\n\r\n /**\r\n * current transaction Disocunt Total\r\n * @returns Discount Total\r\n */\r\n updateCurrentTransactionDetailsDiscountTotal() {\r\n let refundTotal = this.transactionDocument.currentTransactionDetails.basketSummary.refundTotal ? this.transactionDocument.currentTransactionDetails.basketSummary.refundTotal : 0;\r\n\r\n console.log(\"e-basket: transaction builder updateCurrentTransactionDetailsDiscountTotal: discountTotal\", refundTotal, this.transactionDocument.currentTransactionDetails.basketSummary.basketTotal, this.transactionDocument.currentTransactionDetails.basketSummary.saleTotal);\r\n const discountTotal =\r\n Math.abs(\r\n Math.abs(this.transactionDocument.currentTransactionDetails.basketSummary.saleTotal) -\r\n (Math.abs(this.transactionDocument.currentTransactionDetails.basketSummary.basketTotal) + Math.abs(refundTotal))\r\n );\r\n console.log(\"e-basket: transaction builder updateCurrentTransactionDetailsDiscountTotal: discountTotal\", discountTotal)\r\n return Number(discountTotal.toFixed(2));\r\n }\r\n\r\n /**\r\n * current transaction Refund Total\r\n * @returns Refund Total\r\n */\r\n updateCurrentTransactionDetailsRefundTotal() {\r\n let totalRefund = 0;\r\n for (let index = 0; index < this.transactionDocument.currentTransactionDetails.products.length; index++) {\r\n const product: Product = this.transactionDocument.currentTransactionDetails.products[index];\r\n if (product.refundedTotal) {\r\n totalRefund = totalRefund + product.refundedTotal;\r\n }\r\n console.log(\"ebasket : transaction Service: totalRefund for Current TransactionDetails\" + totalRefund)\r\n }\r\n return totalRefund;\r\n }\r\n\r\n\r\n\r\n /**\r\n * Baskets summary\r\n * @param basketDetails\r\n * @returns summary\r\n */\r\n basketSummary(basketDetails: Basket): TransactionDocumentBuilder {\r\n this.transactionDocument.basketSummary.basketTotal = this.numberUtilService.trimTo2Decimal(basketDetails.basketTotal);\r\n\r\n this.transactionDocument.basketSummary.saleTotal = this.numberUtilService.trimTo2Decimal2(this.updateSaleTotal(\r\n basketDetails\r\n ));\r\n this.transactionDocument.basketSummary.refundTotal = this.getRefundTotal();\r\n if (\r\n this.transactionDocument.basket.lineDiscount ||\r\n this.transactionDocument.basket.linePromotion\r\n ) {\r\n this.transactionDocument.basketSummary.discountTotal = this.numberUtilService.trimTo2Decimal2(this.updateDiscountTotal());\r\n }\r\n this.transactionDocument.basketSummary.totalItems = basketDetails.quantity;\r\n\r\n\r\n if (this.transactionDocument.basket.taxBreakdown) {\r\n this.transactionDocument.basketSummary.VATTotal = this.numberUtilService.trimTo2Decimal2(this.transactionDocument.basket.taxBreakdown.taxLines.reduce(\r\n (n: any, { taxLineTotal }: any) => n + taxLineTotal,\r\n 0\r\n ));\r\n }\r\n else {\r\n this.transactionDocument.basketSummary.VATTotal = 0.00;\r\n }\r\n\r\n console.info(\"ebasket: basketsummary updated in transaction document: \", JSON.stringify(this.transactionDocument.basketSummary));\r\n return this;\r\n }\r\n\r\n /**\r\n * Line Discount\r\n * @param basketDetails\r\n * @returns line Discount\r\n */\r\n lineDiscount(basketDetails: Basket): TransactionDocumentBuilder {\r\n this.transactionDocument.basket.lineDiscount = [];\r\n for (let index = 0; index < basketDetails.products.length; index++) {\r\n const element = basketDetails.products[index];\r\n if (element.lineDiscount) {\r\n this.transactionDocument.basket.lineDiscount.push(element.lineDiscount);\r\n this.transactionDocument.basket.lineDiscount = this.transactionDocument.basket.lineDiscount.reduce(\r\n (acc: any[], val: { itemLineId: any; }) => {\r\n if (!acc.find((el: { itemLineId: any; }) => el.itemLineId === val.itemLineId)) {\r\n acc.push(val);\r\n }\r\n return acc;\r\n },\r\n []\r\n );\r\n }\r\n\r\n // console.info(\r\n // \"e-basket :line discount updated in transaction document\",\r\n // this.transactionDocument.basket.lineDiscount\r\n // );\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * exchange\r\n * @param basketDetails\r\n * @returns exchange \r\n */\r\n exchange(basketDetails: Basket): TransactionDocumentBuilder {\r\n this.transactionDocument.basket.exchange = basketDetails.exchange && basketDetails.exchange.length > 0 ? [...basketDetails.exchange] : [];\r\n for (let index = 0; index < basketDetails.products.length; index++) {\r\n\r\n const element: any = basketDetails.products[index];\r\n if (element.exchange != undefined) {\r\n const isPresent = this.transactionDocument.basket.exchange.some((el: { exchangeId: any; }) => el.exchangeId === element.exchange.exchangeId);\r\n if (!isPresent) {\r\n let exchangeItems = [];\r\n for (let j = 0; j < element.exchange.newItems.length; j++) {\r\n const item = element.exchange.newItems[j];\r\n let newItems: any = { lineItemId: item.itemLineId, Quantity: item.quantity }\r\n exchangeItems.push(newItems);\r\n }\r\n element.exchange.newItems = [...exchangeItems];\r\n this.transactionDocument.basket.exchange.push(element.exchange);\r\n }\r\n }\r\n console.log(\r\n \"e-basket :TransactionDocumentBuilder: this.transactionDocument.basket exchange\",\r\n JSON.stringify(this.transactionDocument.basket.exchange)\r\n );\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * add previous exchange data\r\n * @param originalTransactionDocument\r\n * @returns line Promotions\r\n */\r\n addExchangeData(originalTransactionDocument: TransactionDocument): TransactionDocumentBuilder {\r\n this.transactionDocument.basket.exchange = originalTransactionDocument.basket.exchange ? [...originalTransactionDocument.basket.exchange] : null;\r\n return this;\r\n }\r\n\r\n /**\r\n * line Promotions\r\n * @param basketDetails\r\n * @returns line Promotions\r\n */\r\n linePromotion(basketDetails: Basket): TransactionDocumentBuilder {\r\n this.transactionDocument.basket.linePromotion = [];\r\n for (let index = 0; index < basketDetails.products.length; index++) {\r\n const element = basketDetails.products[index];\r\n if (element.linePromotions) {\r\n this.transactionDocument.basket.linePromotion.push(\r\n element.linePromotions\r\n );\r\n this.transactionDocument.basket.linePromotion = this.transactionDocument.basket.linePromotion.reduce(\r\n (acc: any[], val: { itemLineId: any; }) => {\r\n if (!acc.find((el: { itemLineId: any; }) => el.itemLineId === val.itemLineId)) {\r\n acc.push(val);\r\n }\r\n return acc;\r\n },\r\n []\r\n );\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * transaction Promotion\r\n * @param basketDetails\r\n * @returns transaction Promotion\r\n */\r\n transactionPromotion(basketDetails: Basket): TransactionDocumentBuilder {\r\n if (basketDetails.transactionPromotion) {\r\n this.transactionDocument.basket.transactionPromotion =\r\n basketDetails.transactionPromotion;\r\n // for (let index = 0; index < basketDetails.TransactionDiscount.length; index++) {\r\n // this.transactionDocument.basket.transactionPromotion.push(element.linePromotions)\r\n // this.transactionDocument.basket.transactionPromotion = this.transactionDocument.basket.linePromotions.reduce((acc, val) => {\r\n // if (!acc.find(el => el.itemLineId === val.itemLineId)) {\r\n // acc.push(val);\r\n // }\r\n // return acc;\r\n // }, []);\r\n // }\r\n console.log(\r\n \"e-basket :TransactionDocumentBuilder: this.transactionDocument.basket.transactionPromotion\",\r\n JSON.stringify(this.transactionDocument.basket.transactionPromotion)\r\n );\r\n }\r\n return this;\r\n }\r\n\r\n transactionDiscount(basketDetails: Basket): TransactionDocumentBuilder {\r\n if (basketDetails.transactionDiscount) {\r\n this.transactionDocument.basket.transactionDiscount =\r\n basketDetails.transactionDiscount;\r\n\r\n console.log(\r\n \"e-basket :TransactionDocumentBuilder: transaction Discount\",\r\n JSON.stringify(this.transactionDocument.basket.transactionDiscount)\r\n );\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Payments details\r\n * @param paymentDetails\r\n * @returns\r\n */\r\n paymentDetails(paymentDetails: any) {\r\n console.info(\"ebasket : payment details after transaction completed\",JSON.stringify(paymentDetails));\r\n \r\n this.transactionDocument.paymentDetails = paymentDetails;\r\n return this;\r\n }\r\n\r\n\r\n /**\r\n * Payments details\r\n * @param paymentDetails\r\n * @returns\r\n */\r\n splitPayment(splitPayment: boolean) { \r\n this.transactionDocument.splitPayment = splitPayment;\r\n return this;\r\n } \r\n\r\n /**\r\n * Payments details\r\n * @param paymentDetails\r\n * @returns\r\n */\r\n isPaymentCompleted(isPaymentCompleted: boolean) {\r\n this.transactionDocument.isPaymentCompleted = isPaymentCompleted;\r\n return this;\r\n } \r\n \r\n\r\n\r\n\r\n /**\r\n * Bases currency\r\n * @param currency\r\n * @returns currency\r\n */\r\n baseCurrency(currency: any): TransactionDocumentBuilder {\r\n this.transactionDocument.baseCurrency = currency;\r\n return this;\r\n }\r\n\r\n /**\r\n * gift option at\r\n * @returns at\r\n */\r\n giftOption(gift: any): TransactionDocumentBuilder {\r\n console.log(\r\n \"e-basket :TransactionDocumentBuilder: this.transactionDocument.giftoption\",\r\n gift\r\n );\r\n if (gift) {\r\n this.transactionDocument.giftedReceipt = gift;\r\n }\r\n return this;\r\n }\r\n /**\r\n\r\n/**\r\n * manual Discount\r\n * @param discountData\r\n * @returns\r\n */\r\n\r\n // manualDiscount(discountData : basketDiscount):TransactionDocumentBuilder {\r\n // let saleTotal = this.transactionDocument.basketSummary.basketTotal;\r\n // if(discountData.discountType =='Percent'){\r\n // this.transactionDocument.basketSummary.basketTotal = saleTotal-(saleTotal*(discountData.discountAmount/100));\r\n // discountData.discountAmount = -1*(saleTotal-this.transactionDocument.basketSummary.basketTotal);\r\n // }else {\r\n // this.transactionDocument.basketSummary.basketTotal =saleTotal-discountData.discountAmount;\r\n // discountData.discountAmount = -1*discountData.discountAmount;\r\n // }\r\n // this.transactionDocument.transactionDiscount.push(discountData);\r\n // return this;\r\n\r\n // }\r\n\r\n /**\r\n * Types transaction document builder\r\n * @param t\r\n * @returns type\r\n */\r\n type(t: any): TransactionDocumentBuilder {\r\n this.transactionDocument.type = t;\r\n return this;\r\n }\r\n /**\r\n * Operations status\r\n * @param o\r\n * @returns status\r\n */\r\n operationStatus(o: any): TransactionDocumentBuilder {\r\n this.transactionDocument.operationStatus = o;\r\n return this;\r\n }\r\n /**\r\n * Created at\r\n * @returns at\r\n */\r\n createdAt(): TransactionDocumentBuilder {\r\n const date = new Date();\r\n this.transactionDocument.createdAt = date.toISOString();\r\n this.transactionDocument.updatedAt = date.toISOString();\r\n return this;\r\n }\r\n /**\r\n * Updated at\r\n * @returns at\r\n */\r\n updatedAt(): TransactionDocumentBuilder {\r\n const date = new Date();\r\n this.transactionDocument.updatedAt = date.toISOString();\r\n return this;\r\n }\r\n /**\r\n * transsaction completion at\r\n * @returns transaction completion date\r\n */\r\n transactionCompletedAt(): TransactionDocumentBuilder {\r\n const date = new Date();\r\n this.transactionDocument.transCompletedAt = date.toISOString();\r\n return this;\r\n }\r\n /**\r\n * Builds transaction document builder\r\n * @returns build\r\n */\r\n build(): TransactionDocument {\r\n return this.transactionDocument;\r\n }\r\n\r\n /**\r\n * Sales total in refund\r\n * @param saleTotal\r\n * @returns total in refund\r\n */\r\n saleTotalInRefund(saleTotal: number): TransactionDocumentBuilder {\r\n this.transactionDocument.saleTotal = saleTotal;\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets basket details\r\n * @returns basket details\r\n */\r\n getBasketDetails(): Basket {\r\n console.info(\"ebasket: Getting Basket for transactionDocument\", JSON.stringify(this.transactionDocument));\r\n\r\n let basket: Basket = {\r\n subsidiaryId : this.transactionDocument.subsidiaryId,\r\n transactionDiscount: this.transactionDocument.basket.transactionDiscount,\r\n transactionPromotion: this.transactionDocument.basket.transactionPromotion,\r\n transactionId: this.transactionDocument.transactionId,\r\n offlineTransactionId: this.transactionDocument.offlineTransactionId,\r\n total: this.transactionDocument.basketSummary.basketTotal,\r\n basketTotal: this.transactionDocument.basketSummary.basketTotal,\r\n discountTotal: this.transactionDocument.basketSummary.discountTotal,\r\n saleTotal: this.transactionDocument.basketSummary.saleTotal,\r\n refundTotal: this.transactionDocument.basketSummary.refundTotal,\r\n quantity: this.transactionDocument.basketSummary.totalItems,\r\n products: [],\r\n baseCurrency: this.transactionDocument.baseCurrency,\r\n customer: this.transactionDocument.customer,\r\n };\r\n\r\n basket.products = [] as Product[];\r\n this.transactionDocument.basket.products.forEach((product: { SKU: any; barCode: any; barcodes: any; description: any; imageUrls: any; totalLinePrice: any; itemLineId: any; excludePromotion: any; price: any; quantity: any; selectedRRPPrice: any; fullfilmentId: any; fullfilmentLocationName: any; deliveryGroup: string; leadTime: any; deliveryMethod: any; giftCard: any; giftCardExpiryDate: any; giftCardNumberIssued: any; giftCardRecipientEmail: any; giftCardRecipientName: any; refundedTotal: any; refundedQuantity: number; refundedReasonDescription: any; refundedReason: any; refundedPromotionalQuantity: any; isLastExchanged: any; }, index: any) => {\r\n console.log(JSON.stringify(product), \"ebasket: basket detail update in basket\");\r\n const p = {} as any;\r\n p.SKU = product.SKU;\r\n p.barcode = product.barCode;\r\n p.barcodes = product.barcodes;\r\n\r\n p.description = product.description;\r\n p.imageUrls = product.imageUrls;\r\n p.currency = this.transactionDocument.baseCurrency;\r\n p.totalLinePrice = product.totalLinePrice;\r\n p.itemLineId = Number(product.itemLineId);\r\n p.excludePromotion = product.excludePromotion;\r\n\r\n p.selectedPrice = product.price;\r\n p.quantity = product.quantity;\r\n p.total = product.totalLinePrice;\r\n p.selectedRRPPrice = product.selectedRRPPrice;\r\n\r\n p.fullfilmentId = product.fullfilmentId;\r\n p.fullfilmentLocationName = product.fullfilmentLocationName;\r\n p.deliveryGroup = product.deliveryGroup || \"1\";\r\n p.leadTime = product.leadTime;\r\n p.deliveryMethod = product.deliveryMethod || DELIVERY_METHODS.COLLECT_FROM_STORE.toString();\r\n\r\n if(p.fullfilmentId != this.transactionDocument.storeId)\r\n {\r\n p.isWebOrder = true;\r\n }\r\n \r\n p.giftCard = product.giftCard;\r\n p.giftCardExpiryDate = product.giftCardExpiryDate;\r\n p.giftCardNumberIssued = product.giftCardNumberIssued;\r\n p.giftCardRecipientEmail = product.giftCardRecipientEmail;\r\n p.giftCardRecipientName = product.giftCardRecipientName;\r\n \r\n if (\r\n this.transactionDocument.basket.lineDiscount &&\r\n this.transactionDocument.basket.lineDiscount.length > 0\r\n ) {\r\n this.transactionDocument.basket.lineDiscount.forEach((lineDiscount: { itemLineId: { toString: () => any; }; discountedLinePrice: any; }) => {\r\n if (product.itemLineId === lineDiscount.itemLineId.toString()) {\r\n p.lineDiscount = lineDiscount;\r\n p.total = lineDiscount.discountedLinePrice;\r\n }\r\n });\r\n }\r\n\r\n if (\r\n this.transactionDocument.basket.linePromotion &&\r\n this.transactionDocument.basket.linePromotion.length > 0\r\n ) {\r\n this.transactionDocument.basket.linePromotion.forEach((linePromotion: { itemLineId: { toString: () => any; }; promotionLinePrice: any; }) => {\r\n if (product.itemLineId === linePromotion.itemLineId.toString()) {\r\n p.linePromotions = linePromotion;\r\n p.total = linePromotion.promotionLinePrice;\r\n }\r\n });\r\n }\r\n\r\n if (\r\n this.transactionDocument.basket.taxBreakdown &&\r\n this.transactionDocument.basket.taxBreakdown.taxLines.length > 0\r\n ) {\r\n this.transactionDocument.basket.taxBreakdown.taxLines.forEach((taxLine: { itemLineId: { toString: () => any; }; VAT: any; VATCode: any; }) => {\r\n if (product.itemLineId && product.itemLineId === taxLine.itemLineId.toString()) {\r\n p.selectedVAT = taxLine.VAT;\r\n p.selectedVATCode = taxLine.VATCode;\r\n }\r\n });\r\n }\r\n\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.REFUND) {\r\n p.total = product.refundedTotal;\r\n } else if ((this.transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND || TRANSACTION_TYPE.SALE_EXCHANGE) && product.refundedQuantity > 0) {\r\n p.refundedReasonDescription = product.refundedReasonDescription;\r\n p.refundedReason = product.refundedReason;\r\n if (!p.refundedReasonDescription) {\r\n p.refundedReasonDescription = p.refundedReason;\r\n }\r\n p.refundedQuantity = product.refundedQuantity;\r\n p.refundPromotionalQuantity = product.refundedPromotionalQuantity;\r\n p.refundedTotal = product.refundedTotal;\r\n p.total -= Math.abs(p.refundedTotal);\r\n p.isLastExchanged = product.isLastExchanged;\r\n }\r\n\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.REFUND) {\r\n if (p.total > 0) {\r\n p.total *= -1;\r\n }\r\n }\r\n\r\n basket.products.push(p);\r\n\r\n });\r\n\r\n basket = this.getTransactionDiscountAndTransactionPromotionPortion(basket);\r\n basket.total = (basket.basketTotal || 0) + this.getTotalDiscountWithTransactionDiscountsAndPromotions(basket);\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND) {\r\n basket.quantity = this.getRefundedTotalWithQuantity(basket);\r\n }\r\n console.info(\"ebasket: Basket created successfully\", JSON.stringify(basket))\r\n return basket;\r\n }\r\n\r\n /**\r\n * Gets basket details\r\n * @returns refund basket details\r\n */\r\n // getRefundBasketDetails(): Basket {\r\n // let basket: Basket = {\r\n // subsidiaryId : this.transactionDocument.subsidiaryId,\r\n // transactionDiscount: this.transactionDocument.basket.transactionDiscount,\r\n // transactionPromotion: this.transactionDocument.basket.transactionPromotion,\r\n // transactionId: this.transactionDocument.transactionId,\r\n // total: this.transactionDocument.basketSummary.basketTotal,\r\n // basketTotal: this.transactionDocument.basketSummary.basketTotal,\r\n // discountTotal: this.transactionDocument.basketSummary.discountTotal,\r\n // saleTotal: this.transactionDocument.basketSummary.saleTotal,\r\n // quantity: this.transactionDocument.basketSummary.totalItems,\r\n // products: [],\r\n // baseCurrency: this.transactionDocument.baseCurrency,\r\n // customer: this.transactionDocument.customer,\r\n // };\r\n\r\n // basket.products = [] as Product[];\r\n // this.transactionDocument.basket.products.forEach((product: { SKU: any; barCode: any; barcodes: any; description: any; imageUrls: any; totalLinePrice: any; itemLineId: any; excludePromotion: any; price: number; quantity: any; selectedRRPPrice: any; fullfilmentId: any; fullfilmentLocationName: any; deliveryGroup: string; leadTime: any; deliveryMethod: any; giftCard: any; giftCardExpiryDate: any; giftCardNumberIssued: any; giftCardRecipientEmail: any; giftCardRecipientName: any; itemDiscounts: any; refundedPromotionalQuantity: any; refundedQuantity: number; refunded: any; isLastExchanged: any; exchange: any; refundedTotal: number; }, index: any) => {\r\n // const p = {} as Product;\r\n // p.SKU = product.SKU;\r\n // p.barcode = product.barCode;\r\n // p.barcodes = product.barcodes;\r\n\r\n // p.description = product.description;\r\n // p.imageUrls = product.imageUrls;\r\n // p.currency = this.transactionDocument.baseCurrency;\r\n // p.totalLinePrice = product.totalLinePrice;\r\n // p.itemLineId = Number(product.itemLineId);\r\n // p.excludePromotion = product.excludePromotion;\r\n\r\n // p.selectedPrice = product.price;\r\n // p.quantity = product.quantity;\r\n // p.total = product.totalLinePrice;\r\n // p.selectedRRPPrice = product.selectedRRPPrice;\r\n\r\n // p.fullfilmentId = product.fullfilmentId;\r\n // p.fullfilmentLocationName = product.fullfilmentLocationName;\r\n // p.deliveryGroup = product.deliveryGroup || \"1\";\r\n // p.leadTime = product.leadTime;\r\n // p.deliveryMethod = product.deliveryMethod || DELIVERY_METHODS.COLLECT_FROM_STORE.toString();\r\n\r\n // p.giftCard = product.giftCard;\r\n // p.giftCardExpiryDate = product.giftCardExpiryDate;\r\n // p.giftCardNumberIssued = product.giftCardNumberIssued;\r\n // p.giftCardRecipientEmail = product.giftCardRecipientEmail;\r\n // p.giftCardRecipientName = product.giftCardRecipientName;\r\n \r\n \r\n // if(p.fullfilmentId != this.transactionDocument.storeId)\r\n // {\r\n // p.isWebOrder = true;\r\n // }\r\n \r\n // if (product.itemDiscounts) {\r\n // p.itemDiscounts = product.itemDiscounts as ItemDiscount;\r\n // }\r\n\r\n // // if(!p.itemDiscounts){\r\n // // console.log(p.itemDiscounts);\r\n\r\n // // this.basketService.transactionDiscountAndPromotionProductortionCalculation(basket);\r\n // // }\r\n // p.refundPromotionalQuantity = product.refundedPromotionalQuantity ? product.refundedPromotionalQuantity : 0;\r\n\r\n // if (product.refundedQuantity) {\r\n // p.quantity = p.quantity - product.refundedQuantity;\r\n // p.totalLinePrice = (p.quantity * product.price);\r\n // p.total = p.totalLinePrice;\r\n // // p.refundPromotionalQuantity = product.refundedPromotionalQuantity;\r\n // p.refunded = product.refunded;\r\n // p.isLastExchanged = product.isLastExchanged;\r\n // }\r\n // if (product.exchange) {\r\n // p.exchange = product.exchange;\r\n // }\r\n\r\n // if (\r\n // this.transactionDocument.basket.lineDiscount &&\r\n // this.transactionDocument.basket.lineDiscount.length > 0\r\n // ) {\r\n\r\n // this.transactionDocument.basket.lineDiscount.forEach((lineDiscount: { itemLineId: { toString: () => any; }; discountedLinePrice: any; }) => {\r\n\r\n // if (product.itemLineId === lineDiscount.itemLineId.toString() && product.refundedQuantity > 0) {\r\n // p.lineDiscount = Object.assign({}, lineDiscount);\r\n // p.lineDiscount.discountedLinePrice = p.lineDiscount.unitPrice * p.quantity\r\n // p.lineDiscount.discountAmount = p.total - p.lineDiscount.discountedLinePrice\r\n // p.total = p.lineDiscount.discountedLinePrice;\r\n // } else if (product.itemLineId === lineDiscount.itemLineId.toString()) {\r\n // p.lineDiscount = lineDiscount;\r\n // p.total = lineDiscount.discountedLinePrice\r\n // }\r\n // });\r\n // }\r\n\r\n // if (\r\n // this.transactionDocument.basket.linePromotion &&\r\n // this.transactionDocument.basket.linePromotion.length > 0\r\n // ) {\r\n // this.transactionDocument.basket.linePromotion.forEach((linePromotion: { itemLineId: { toString: () => any; }; refunded: any; }) => {\r\n // if (product.itemLineId === linePromotion.itemLineId.toString() && !linePromotion.refunded) {\r\n // p.linePromotions = linePromotion;\r\n // p.total = p.linePromotions.promotionLinePrice;\r\n // p.total = p.total - (product.refundedTotal ? Math.abs(product.refundedTotal) : 0);\r\n // }\r\n // });\r\n // }\r\n\r\n // p.refundedQuantity = 0;\r\n // p.refundedTotal = 0;\r\n\r\n // if (\r\n // this.transactionDocument.basket.taxBreakdown &&\r\n // this.transactionDocument.basket.taxBreakdown.taxLines.length > 0\r\n // ) {\r\n // this.transactionDocument.basket.taxBreakdown.taxLines.forEach((taxLine: { itemLineId: { toString: () => any; }; VAT: any; VATCode: any; }) => {\r\n // if (product.itemLineId === taxLine.itemLineId.toString()) {\r\n // p.selectedVAT = taxLine.VAT;\r\n // p.selectedVATCode = taxLine.VATCode;\r\n // }\r\n // });\r\n // }\r\n\r\n // if (p.quantity > 0) {\r\n // basket.products.push(p);\r\n // }\r\n // });\r\n // // product.itemDiscounts\r\n // if (!basket.products[0].hasOwnProperty('itemDiscounts')) {\r\n // basket = this.getTransactionDiscountAndTransactionPromotionPortion(basket);\r\n\r\n // }\r\n\r\n // console.log(\"ebasket : TransactionDocumentBuilder :new created refunded basket\", JSON.stringify(basket))\r\n // basket.quantity = basket.products.reduce(\r\n // (n: any, { quantity }: any) => n + quantity,\r\n // 0\r\n // );\r\n // basket.total = this.getTotalWithLineDiscountAndLinePromotionApplied(basket);\r\n // basket.basketTotal = basket.total;\r\n // basket.basketTotal = basket.basketTotal - this.getTotalDiscountWithTransactionDiscountsAndPromotions(basket);\r\n // console.log(\r\n // \"ebasket : TransactionDocumentBuilder : update Basket Total: after promotion :basketTotal\",\r\n // basket.basketTotal\r\n // );\r\n\r\n // console.log(\r\n // \"e:basket :TransactionDocumentBuilder : basketDetails updated values\",\r\n // JSON.stringify(basket)\r\n // );\r\n // return basket;\r\n // }\r\n\r\n\r\n getTransactionDiscountAndTransactionPromotionPortion(basket:any) {\r\n if (\r\n basket.transactionDiscount &&\r\n basket.transactionDiscount.length > 0\r\n ) {\r\n basket.transactionDiscount.forEach((discount: { itemLineIds: any; }) => {\r\n if (!discount.itemLineIds) {\r\n discount.itemLineIds = basket.products.map((product: { itemLineId: any; }) => {\r\n return product.itemLineId\r\n });\r\n }\r\n basket = this.basketService.transactionDiscountProductPortionCalc(basket, discount);\r\n });\r\n }\r\n if (\r\n basket.transactionPromotion &&\r\n basket.transactionPromotion.length > 0\r\n ) {\r\n basket.transactionPromotion.forEach((tPromotion: { itemLineIds: any; }) => {\r\n if (!tPromotion.itemLineIds) {\r\n const filteredData = basket.products.filter(\r\n (item: { excludePromotion: boolean; }) => {\r\n return item.excludePromotion === false;\r\n });\r\n\r\n tPromotion.itemLineIds =\r\n filteredData.map((product: { itemLineId: any; }) => {\r\n return product.itemLineId\r\n });\r\n }\r\n basket = this.basketService.transactionPromotionProductPortionCalc(basket, tPromotion);\r\n });\r\n }\r\n\r\n return basket;\r\n }\r\n\r\n\r\n getTotalDiscountWithTransactionDiscountsAndPromotions(basketDetails: any) {\r\n\r\n let discountTotal = 0;\r\n if (\r\n basketDetails.transactionPromotion &&\r\n basketDetails.transactionPromotion.length > 0\r\n ) {\r\n discountTotal += basketDetails.transactionPromotion.reduce(\r\n (n: any, { promotionAmount }: any) => n + promotionAmount,\r\n 0\r\n );\r\n }\r\n if (\r\n basketDetails.transactionDiscount &&\r\n basketDetails.transactionDiscount.length > 0\r\n ) {\r\n\r\n discountTotal += basketDetails.transactionDiscount.reduce(\r\n (n: any, { discountAmount }: any) => n + discountAmount,\r\n 0\r\n );\r\n\r\n\r\n }\r\n console.log(\"ebasket : TransactionDocumentBuilder : Transaction discount Total:\", discountTotal);\r\n\r\n return discountTotal;\r\n }\r\n\r\n\r\n appendCurrencySymbol(currency: number, value: number) {\r\n // value=this.decimalpipe.transform(value,'1.2');\r\n if (value >= 0) {\r\n const returnval = currency + value;\r\n console.log(returnval, \"ebasket: add currency with value\");\r\n return returnval;\r\n } else {\r\n const returnval = \"-\" + (currency + value * -1);\r\n console.log(returnval, \"-(currency+(value*-1))\");\r\n return returnval;\r\n }\r\n }\r\n\r\n // /**\r\n // * Updates total refund\r\n // * @returns total refund\r\n // */\r\n // updateTotalRefund(): TransactionDocumentBuilder {\r\n // this.transactionDocument.basket.products.forEach((product) => {\r\n // product.refundedQuantity = product.quantity;\r\n // product.refundedTotal = product.totalLinePrice * -1;\r\n // console.log(\r\n // \"ebasket: Transaction price override :\",\r\n // this.transactionDocument.basket.lineDiscount\r\n // );\r\n\r\n // if (\r\n // this.transactionDocument.basket.linePromotion &&\r\n // this.transactionDocument.basket.linePromotion.length > 0\r\n // ) {\r\n // this.transactionDocument.basket.linePromotion.forEach((linePromotion) => {\r\n // console.log(\r\n // \"Promotion: basket linePromotion : \",\r\n // this.transactionDocument.basket.linePromotion\r\n // );\r\n // console.log(\r\n // \"linePromotion.itemLineId.toString() : \",\r\n // linePromotion.itemLineId.toString()\r\n // );\r\n // console.log(\r\n // \"condition : \" +\r\n // (product.itemLineId === linePromotion.itemLineId.toString())\r\n // );\r\n\r\n // if (product.itemLineId === linePromotion.itemLineId.toString()) {\r\n // product.refundedTotal =\r\n // linePromotion.promotionLinePrice * -1;\r\n // }\r\n // });\r\n // } else\r\n // if (\r\n // this.transactionDocument.basket.lineDiscount &&\r\n // this.transactionDocument.basket.lineDiscount.length > 0\r\n // ) {\r\n // this.transactionDocument.basket.lineDiscount.forEach((lineDiscount) => {\r\n // console.log(\r\n // \"product.itemLineId : \" +\r\n // this.transactionDocument.basket.lineDiscount\r\n // );\r\n // console.log(\r\n // \"lineDiscount.itemLineId.toString() : \" +\r\n // lineDiscount.itemLineId.toString()\r\n // );\r\n // console.log(\r\n // \"condition : \" +\r\n // (product.itemLineId === lineDiscount.itemLineId.toString())\r\n // );\r\n\r\n // if (product.itemLineId === lineDiscount.itemLineId.toString()) {\r\n // product.refundedTotal = lineDiscount.unitPrice * product.refundedQuantity * -1;\r\n // }\r\n // });\r\n // }\r\n\r\n // console.log(\"Product description :\" + product.description);\r\n // console.log(\"Product total :\" + product.refundedTotal);\r\n // // product.displayrefundedamount=this.appendCurrencySymbol(CURRENCY[this.transactionDocument.baseCurrency],product.refundedTotal);\r\n // // console.log(product.displayrefundedamount,\"displayrefundedamount\");\r\n // product.refunded = true;\r\n // });\r\n // const baskettotal = (this.transactionDocument.basketSummary.basketTotal *= -1);\r\n // // this.transactionDocument.basketSummary.displaybaskettotal=this.appendCurrencySymbol(CURRENCY[this.transactionDocument.baseCurrency], baskettotal);\r\n // const saletotal = (this.transactionDocument.basketSummary.saleTotal *= -1);\r\n // // this.transactionDocument.basketSummary.displaysaletotal = this.appendCurrencySymbol(CURRENCY[this.transactionDocument.baseCurrency], saletotal);\r\n // (this.transactionDocument.basketSummary.VATTotal *= -1);\r\n // return this;\r\n // }\r\n\r\n /**\r\n * Sale Total\r\n * @param basketDetails\r\n * @returns Sale Total\r\n */\r\n updateSaleTotal(basketDetails: { products: any[]; }) {\r\n const saleTotal = basketDetails.products.reduce(\r\n (n: any, { totalLinePrice }: any) => n + totalLinePrice,\r\n 0\r\n );\r\n return saleTotal\r\n }\r\n\r\n getTotalWithLineDiscountAndLinePromotionApplied(basketDetails: { products: any; }): number {\r\n let saletotal: number = 0.0;\r\n for (let product of basketDetails.products) {\r\n // if (product.linePromotions) {\r\n // saletotal += product.linePromotions.promotionLinePrice;\r\n // } else if (\r\n // product.lineDiscount &&\r\n // !product.linePromotions\r\n // ) {\r\n // saletotal +=\r\n // product.quantity * Number(product.lineDiscount.unitPrice.toFixed(2));\r\n // } else {\r\n // saletotal +=\r\n // product.quantity * Number(product.selectedPrice.toFixed(2));\r\n // }\r\n saletotal += product.total;\r\n console.log(\r\n \"e-basket:update product Total:\" + saletotal,\r\n JSON.stringify(product)\r\n );\r\n }\r\n return saletotal;\r\n }\r\n\r\n getRefundedTotalWithQuantity(basketDetails: { products: string | any[]; }): number {\r\n let quantity = 0;\r\n for (let index = 0; index < basketDetails.products.length; index++) {\r\n const product: any = basketDetails.products[index];\r\n\r\n if (!product.refundedReasonDescription) {\r\n\r\n quantity = quantity + product.quantity;\r\n\r\n } else {\r\n quantity = quantity + (product.quantity - product.refundedQuantity);\r\n\r\n // basketDetails.total = basketDetails.total + product.refundedTotal;\r\n\r\n }\r\n }\r\n return quantity;\r\n\r\n }\r\n\r\n /**\r\n * Discount Total\r\n * @returns Discount Total\r\n */\r\n updateDiscountTotal() {\r\n let refundTotal = this.transactionDocument.basketSummary.refundTotal ? this.transactionDocument.basketSummary.refundTotal : 0;\r\n console.info(\"e-basket: transaction builder: refundTotal\", JSON.stringify(refundTotal),\r\n JSON.stringify(this.transactionDocument.basketSummary));\r\n const discountTotal =\r\n Math.abs(\r\n Math.abs(this.transactionDocument.basketSummary.saleTotal) -\r\n (\r\n Math.abs(this.transactionDocument.basketSummary.basketTotal) + Math.abs(refundTotal)\r\n )\r\n );\r\n console.log(\"e-basket: transaction builder: discountTotal\", JSON.stringify(discountTotal))\r\n return Number(discountTotal.toFixed(2));\r\n }\r\n\r\n updateReasonCode(reasonCode: {\r\n code: string;\r\n name: string;\r\n }): TransactionDocumentBuilder {\r\n this.transactionDocument.reasonCode = reasonCode.code;\r\n this.transactionDocument.reasonDescription = reasonCode.name;\r\n return this;\r\n }\r\n\r\n updateManagerOverride(\r\n useroverride: UserOverride\r\n ): TransactionDocumentBuilder {\r\n this.transactionDocument.override = useroverride;\r\n return this;\r\n }\r\n\r\n updateUserID(\r\n userID: string\r\n ): TransactionDocumentBuilder {\r\n this.transactionDocument.userId = userID;\r\n return this;\r\n }\r\n\r\n updateUserName(name: any) : TransactionDocumentBuilder {\r\n this.transactionDocument.userName = name;\r\n return this;\r\n\r\n }\r\n \r\n addCustomerDetails(customerDetail: Customer): TransactionDocumentBuilder {\r\n this.transactionDocument.customer = customerDetail;\r\n return this;\r\n }\r\n\r\n updateTaxBreakdown(basketDetails: Basket): TransactionDocumentBuilder {\r\n // let transactionDiscountTotal = 0;\r\n let taxBreakdown: TaxBreakdown = {\r\n taxLines: [],\r\n totalTaxableAmount: 0,\r\n };\r\n\r\n\r\n\r\n // if (this.transactionDocument.basket.transactionDiscount && this.transactionDocument.basket.transactionDiscount.length > 0) {\r\n // this.transactionDocument.basket.transactionDiscount.forEach((discount) => {\r\n // transactionDiscountTotal += discount.discountAmount;\r\n // });\r\n // }\r\n\r\n // if (this.transactionDocument.basket.transactionPromotion && this.transactionDocument.basket.transactionPromotion.length > 0) {\r\n // this.transactionDocument.basket.transactionPromotion.forEach(\r\n // (promotion) => {\r\n // transactionDiscountTotal += promotion.promotionAmount;\r\n // }\r\n // );\r\n // }\r\n\r\n basketDetails.products.forEach((product: any) => {\r\n let taxLine: TaxLine = {\r\n itemLineId: product.itemLineId,\r\n VAT: product.selectedVAT ? product.selectedVAT : 0,\r\n VATCode: product.selectedVATCode,\r\n taxLineTotal: 0,\r\n taxableAmount: product.total,\r\n PreTax: 0\r\n };\r\n console.info(\"Product contribution : item line ID :\", product.itemLineId,\r\n \"tax line :\", JSON.stringify(taxLine));\r\n\r\n // step 1\r\n // if Transaction Discount and/or promotion applied, find net selling price of each product as taxableamount\r\n // if (transactionDiscountTotal > 0) {\r\n product = this.basketService.validateProductItemDiscount(product);\r\n\r\n const productContributionInTotal =\r\n product.itemDiscounts.trnDiscountsPortion +\r\n product.itemDiscounts.trnPromotionsPortion -\r\n product.itemDiscounts.refundPortion;\r\n // tp+td-rp;\r\n\r\n console.info(\"Product contribution : item line ID :\", product.itemLineId,\r\n \"contribution :\", JSON.stringify(productContributionInTotal));\r\n // calculate net selling price after applying transaction discount as per product contribution\r\n taxLine.taxableAmount -= productContributionInTotal;\r\n // }\r\n\r\n //step 2 - find pre tax\r\n taxLine.PreTax = this.numberUtilService.trimTo2Decimal2((taxLine.taxableAmount * 100) / (100 + taxLine.VAT));\r\n\r\n //step 3 - Update taxbreakdown\r\n taxBreakdown.totalTaxableAmount += taxLine.taxableAmount;\r\n taxLine.taxableAmount = this.numberUtilService.trimTo2Decimal2(taxLine.taxableAmount);\r\n \r\n // step 4 - update tax Line total\r\n taxLine.taxLineTotal = this.numberUtilService.trimTo2Decimal2(taxLine.taxableAmount - taxLine.PreTax);\r\n taxBreakdown.taxLines.push(taxLine);\r\n });\r\n\r\n taxBreakdown.totalTaxableAmount = this.numberUtilService.trimTo2Decimal2(taxBreakdown.totalTaxableAmount);\r\n this.transactionDocument.basket.taxBreakdown = taxBreakdown;\r\n return this;\r\n }\r\n\r\n updateTotalTaxSummary(): TransactionDocumentBuilder {\r\n\r\n console.log(\"Total Tax Summery Request :\", JSON.stringify(this.transactionDocument.basket.taxBreakdown));\r\n\r\n\r\n let totalTaxSummaryArray: TotalTaxSummary[] = []\r\n let totalTaxSummaryGroup = []\r\n\r\n console.log(\"Tax Lines for Total Tax Summery :\", JSON.stringify(this.transactionDocument.basket.taxBreakdown.taxLines));\r\n\r\n\r\n this.transactionDocument.basket.taxBreakdown.taxLines.forEach((element: { VATCode: any; VAT: any; PreTax: any; taxLineTotal: any; }) => {\r\n let TaxSummary: TotalTaxSummary = {\r\n VATCode: \"\",\r\n VAT: -12345,\r\n PreTaxSum: 0,\r\n TaxSum: 0,\r\n TXrateSum: 0\r\n \r\n };\r\n TaxSummary.VATCode = element.VATCode;\r\n TaxSummary.VAT = element.VAT; \r\n TaxSummary.PreTaxSum = this.numberUtilService.trimTo2Decimal2(element.PreTax);\r\n TaxSummary.TaxSum = this.numberUtilService.trimTo2Decimal2(element.taxLineTotal);\r\n TaxSummary.TXrateSum = this.numberUtilService.trimTo2Decimal2(TaxSummary.PreTaxSum + TaxSummary.TaxSum); \r\n totalTaxSummaryArray.push(TaxSummary);\r\n })\r\n\r\n console.log(\"Total Tax Summery Without Grouped : \", JSON.stringify(totalTaxSummaryArray));\r\n \r\n totalTaxSummaryGroup = totalTaxSummaryArray.reduce((preparedArray:any,currentObj) => {\r\n\r\n let ind = preparedArray.findIndex((x: { VAT: any; }) => x.VAT === currentObj.VAT);\r\n if(ind === -1){\r\n preparedArray.push(currentObj)\r\n }else {\r\n preparedArray[ind].VATCode = currentObj.VATCode;\r\n preparedArray[ind].VAT = currentObj.VAT;\r\n preparedArray[ind].PreTaxSum += currentObj.PreTaxSum;\r\n preparedArray[ind].TaxSum += currentObj.TaxSum;\r\n preparedArray[ind].TXrateSum += currentObj.TXrateSum;\r\n }\r\n return preparedArray;\r\n },[])\r\n \r\n console.log(\"Total Tax Summer Group :\",totalTaxSummaryGroup);\r\n\r\n\r\n this.transactionDocument.basket.totalTaxSummary = totalTaxSummaryGroup;\r\n\r\n return this;\r\n\r\n }\r\n\r\n\r\n /**\r\n * TransactionId\r\n * @returns OriginalTransactionId\r\n */\r\n addOriginalTransId(tranDoc:TransactionDocument): TransactionDocumentBuilder {\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.REFUND || this.transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND || this.transactionDocument.type === TRANSACTION_TYPE.SALE_EXCHANGE) {\r\n this.transactionDocument.originalTransId = tranDoc.transactionId;\r\n if(tranDoc.apiResponse && tranDoc.apiResponse.internalId)\r\n {\r\n this.transactionDocument.originalExternalId = tranDoc.apiResponse.internalId.toString();\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * unreferenced Refund\r\n * @returns boolean value\r\n */\r\n addUnreferencedRefund(): TransactionDocumentBuilder {\r\n this.transactionDocument.unreferencedRefund = true;\r\n return this;\r\n }\r\n\r\n getRefundTotal() {\r\n let totalRefund = 0;\r\n for (let index = 0; index < this.transactionDocument.basket.products.length; index++) {\r\n const product: TProduct = this.transactionDocument.basket.products[index];\r\n if (product.refundedTotal) {\r\n totalRefund = totalRefund + product.refundedTotal;\r\n }\r\n console.log(\"ebasket : transaction Service: totalRefund\" + totalRefund)\r\n }\r\n return totalRefund;\r\n }\r\n\r\n docId(docId: any): TransactionDocumentBuilder {\r\n this.transactionDocument.id = docId;\r\n return this;\r\n }\r\n}\r\n","import { DISCOUNTTYPE, LineDiscount, TProduct, TransactionDiscount, TransactionDocument, TRANSACTION_TYPE } from \"./mapper-library.model\"\r\nimport { TransactionDocumentBuilder } from \"./TransactionDocumentBuilder\";\r\nexport class RJMapperBuilderClass {\r\n\r\n private transactionDocument: TransactionDocument;\r\n private deviceId: any;\r\n private transactionNumber: any;\r\n private manifestVersion: any;\r\n private databaseSchemaVersion: any;\r\n private basketType: any;\r\n private xmlSchemaVersion: any;\r\n private majorVersion: any;\r\n private minorVersion: any;\r\n private externalState: any;\r\n private cashierId: any;\r\n private companyId: any;\r\n private terminalNumber: any;\r\n private taxMethodId: any;\r\n private tradingRegionId: any;\r\n private basketCurrencyId: any;\r\n private basketCountryId: any;\r\n private basketLanguageId: any;\r\n private itemCount = 0;\r\n private largestNumber = 0;\r\n private branchId: any;\r\n private createdAt: any;\r\n private updatedAt :any;\r\n private salesPersonName: any;\r\n private rjObject: any = {}\r\n\r\n constructor(transactionDoc?: TransactionDocument) {\r\n if (transactionDoc) {\r\n this.transactionDocument = transactionDoc;\r\n } else {\r\n this.transactionDocument = {\r\n transactionId: \"\",\r\n offlineTransactionId: \"\",\r\n transactionRef: \"\",\r\n dateTime: \"\",\r\n orgCode: \"\",\r\n storeId: \"\",\r\n storeNodeId: \"\",\r\n storeNodeStructure: \"\",\r\n deviceId: \"\",\r\n terminalId: \"\",\r\n userId: \"\",\r\n initiatingModule: \"eBasket\",\r\n export: false,\r\n basket: {} as any,\r\n basketSummary: {} as any,\r\n baseCurrency: \"\",\r\n type: \"\",\r\n operationStatus: \"\",\r\n createdAt: \"\",\r\n updatedAt: \"\",\r\n id: \"\",\r\n currentTransactionDetails: {} as any,\r\n saleTotal: 0,\r\n };\r\n }\r\n this.initilizeItemCount();\r\n this.setLineNumberForProducts();\r\n this.createdAt = this.getDate(this.transactionDocument.createdAt);\r\n this.updatedAt = this.getDate(this.transactionDocument.updatedAt);\r\n }\r\n\r\n getPosbasketInfo() {\r\n this.rjObject['Keyword'] = this.generateKeyword();\r\n this.rjObject['ID'] = this.generateId(this.createdAt);\r\n this.rjObject['XMLSchemaVersion'] = '2';\r\n this.rjObject['LastUpdated'] = this.updatedAt;\r\n this.rjObject['MajorVersion'] = this.majorVersion;\r\n this.rjObject['MinorVersion'] = this.minorVersion;\r\n this.rjObject['ManifestVersion'] = this.manifestVersion;\r\n this.rjObject['DatabaseSchemaVersion'] = this.databaseSchemaVersion;\r\n this.rjObject['BasketType'] = this.basketType;\r\n this.rjObject['State'] = this.getState();\r\n this.rjObject['ExternalState'] = this.externalState;\r\n\r\n return this;\r\n }\r\n\r\n\r\n getheaderInfo() {\r\n this.rjObject['Header'] = {};\r\n this.rjObject['Header'].TimeZoneOffset = this.convertToString(this.generateTimezoneoffset(this.transactionDocument.createdAt));\r\n this.rjObject['Header'].DateTimeCreated = this.createdAt;\r\n this.rjObject['Header'].OriginatedBy = {};\r\n this.rjObject['Header'].OriginatedBy.DeviceID = this.deviceId;\r\n this.rjObject['Header'].OriginatedBy.CashierID = this.cashierId;\r\n this.rjObject['Header'].OriginatedBy.CompanyID = this.companyId;\r\n this.rjObject['Header'].OriginatedBy.StoreID = this.transactionDocument.storeId;\r\n this.rjObject['Header'].OriginatedBy.BranchID = this.branchId;\r\n this.rjObject['Header'].OriginatedBy.TerminalNumber = this.terminalNumber;\r\n this.rjObject['Header'].OriginatedBy.TransactionNumber = this.transactionNumber;\r\n this.rjObject['Header'].TaxMethodID = this.taxMethodId;\r\n this.rjObject['Header'].DynamicStockLookup = this.generateDynamicStockLookUp();\r\n this.rjObject['Header'].BasketLanguageID = this.basketLanguageId; //todo\r\n this.rjObject['Header'].BasketCountryID = this.basketCountryId; //todo\r\n this.rjObject['Header'].BasketCurrencyID = this.transactionDocument.baseCurrency;\r\n this.rjObject['Header'].TradingRegionID = this.tradingRegionId;\r\n this.rjObject['Header'].Eurozone = \" \";//unknown\r\n this.rjObject['Header'].EuroBaseExchangeRate = \"\"; //unknown\r\n this.rjObject['Header'].PrintableName = this.transactionDocument.userName; //unknown\r\n\r\n return this;\r\n }\r\n\r\n rjMapper() {\r\n var transactionDiscount:any = [] ;\r\n if (this.transactionDocument.basket.transactionDiscount && this.transactionDocument.basket.transactionDiscount.length > 0) {\r\n transactionDiscount = this.transactionDocument.basket.transactionDiscount\r\n }\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.SALE) {\r\n this.rjObject['ProductSale'] = [];\r\n this.rjObject['ModifierItem'] = [];\r\n\r\n this.transactionDocument.basket.products.forEach((element: any) => {\r\n let lineDiscount = [];\r\n if (this.transactionDocument.basket.lineDiscount && this.transactionDocument.basket.lineDiscount.length > 0) {\r\n lineDiscount = this.transactionDocument.basket.lineDiscount.filter((x: any) => x.itemLineId === element.itemLineId);\r\n if (lineDiscount.length > 0) {\r\n const index = this.transactionDocument.basket.lineDiscount.indexOf(lineDiscount[0]);\r\n if (index > -1) {\r\n this.transactionDocument.basket.lineDiscount.splice(index, 1);\r\n }\r\n }\r\n }\r\n let data = this.addProduct(element, (lineDiscount.length > 0 ? lineDiscount[0] : null),(transactionDiscount.length > 0 ? transactionDiscount : null));\r\n this.rjObject['ProductSale'].push(data);\r\n this.getModifierItem(lineDiscount.length > 0 ? lineDiscount[0] : null, element.itemLineId);\r\n });\r\n let transactionPromotion = [];\r\n if (this.transactionDocument.basket.transactionPromotion && this.transactionDocument.basket.transactionPromotion.length > 0) {\r\n transactionPromotion = this.transactionDocument.basket.transactionPromotion;\r\n this.getTransactionPromotion(transactionPromotion);\r\n }\r\n } else if (this.transactionDocument.type === TRANSACTION_TYPE.REFUND) {\r\n this.rjObject['ProductReturn'] = [];\r\n this.rjObject['ModifierItem'] = []; \r\n this.transactionDocument.basket.products.forEach((element: any) => {\r\n let data = this.returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null),(transactionDiscount.length > 0 ? transactionDiscount : null));\r\n this.rjObject['ProductReturn'].push(data);\r\n this.getModifierItem(element.lineDiscount, element.itemLineId);\r\n });\r\n } else if (this.transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND) {\r\n this.rjObject['ProductReturn'] = [];\r\n this.rjObject['ModifierItem'] = [];\r\n \r\n let transactionDoc: any = new TransactionDocumentBuilder().basket(this.transactionDocument.currentTransactionDetails).build();\r\n transactionDoc.basket.products.forEach((element: any) => {\r\n let data = this.returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null),(transactionDiscount.length > 0 ? transactionDiscount : null));\r\n let obj = {\r\n \"OriginalReceiptSupplied\": 0,\r\n \"OriginalBranchID\": 0,\r\n \"OriginalTerminalNumber\": 0,\r\n \"OriginalTransactionNumber\": 0,\r\n \"OriginalCashierNumber\": 0\r\n };\r\n data['Return'] = {...data['Return'], ...obj};\r\n this.rjObject['ProductReturn'].push(data);\r\n this.getModifierItem(element.lineDiscount, element.itemLineId);\r\n })\r\n } else if (this.transactionDocument.type === TRANSACTION_TYPE.SALE_EXCHANGE) {\r\n this.rjObject['ProductReturn'] = [];\r\n this.rjObject['ProductSale'] = [];\r\n this.rjObject['ModifierItem'] = [];\r\n \r\n let transactionDoc: any = new TransactionDocumentBuilder().basket(this.transactionDocument.currentTransactionDetails).build();\r\n transactionDoc.basket.products.forEach((element: any) => {\r\n if (element.refundedQuantity > 0) {\r\n let returnProduct = this.returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null),(transactionDiscount.length > 0 ? transactionDiscount : null));\r\n let obj = {\r\n \"OriginalReceiptSupplied\": 0,\r\n \"OriginalBranchID\": 0,\r\n \"OriginalTerminalNumber\": 0,\r\n \"OriginalTransactionNumber\": 0,\r\n \"OriginalCashierNumber\": 0\r\n };\r\n returnProduct['Return'] = {...returnProduct['Return'], ...obj};\r\n this.rjObject['ProductReturn'].push(returnProduct);\r\n } else {\r\n let addProduct = this.addProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null) ,(transactionDiscount.length > 0 ? transactionDiscount : null));\r\n this.rjObject['ProductSale'].push(addProduct);\r\n }\r\n this.getModifierItem(element.lineDiscount, element.itemLineId);\r\n })\r\n\r\n }\r\n return this;\r\n }\r\n\r\n getBasketDiscount() {\r\n if (!this.transactionDocument.basket.transactionDiscount) return this;\r\n this.rjObject['BasketDiscount'] = [];\r\n this.transactionDocument.basket.transactionDiscount.forEach((element: any) => {\r\n let obj: any = {}\r\n obj['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['DeviceID']=this.deviceId;\r\n obj['DateTimeCreated']=this.updatedAt;\r\n obj['NetValue'] = this.convertToString(element.discountAmount * -1);\r\n obj['EffectiveNetValue'] =this.convertToString( element.discountAmount * -1);\r\n obj['Description'] = element.reasonDisplayText;\r\n obj['UserID'] = this.transactionDocument.userName;\r\n obj['ReasonCodeID'] = element.reasonCode;\r\n obj['DiscountType'] = this.convertToString(element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1); \r\n obj['RoundingRule'] = this.convertToString(2);\r\n obj['ModifiedLineNumber'] = element.itemLineIds; \r\n obj['LineNumber'] = this.convertToString(this.generateLineNumber()); \r\n obj['DiscountedValue'] = this.transactionDocument.basketSummary.basketTotal + this.transactionDocument.basketSummary.discountTotal;\r\n if(element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase()){\r\n obj['DiscountPercentage'] = this.convertToString((element.discountAmount / this.transactionDocument.basketSummary.basketTotal).toFixed(1))\r\n }\r\n if(this.transactionDocument.type === 'REFUND'){\r\n obj['NetValue'] = this.convertToString(element.discountAmount < 0 ? -element.discountAmount : element.discountAmount);\r\n obj['EffectiveNetValue'] =this.convertToString( element.discountAmount < 0 ? -element.discountAmount : element.discountAmount);\r\n }\r\n\r\n this.rjObject['BasketDiscount'].push(obj);\r\n });\r\n return this;\r\n }\r\n\r\n getModifierItem(data: any, lineNo: any) {\r\n if (data && lineNo) {\r\n let obj: any = {};\r\n obj.XMLSchemaVersion = 1;\r\n obj.LineNumber = this.generateLineNumber();\r\n obj.NetValue = 0;\r\n obj.EffectiveNetValue = 0;\r\n obj.Description = data.percentageDiscountReasonName ? data.percentageDiscountReasonName : data.priceOverrideReasonName;\r\n obj.DeviceID = this.deviceId;\r\n obj.UserID = this.transactionDocument.userName;\r\n obj.DateTimeCreated = this.updatedAt;\r\n obj.AuthorisingUserID = this.transactionDocument.userName;\r\n obj.ReasonCodeID = data.percentageDiscountReasonCode ? data.percentageDiscountReasonCode : data.priceOverrideReasonCode;\r\n obj.ModifiedLineNumber = lineNo;\r\n obj.ModifiedIndex = 1;\r\n\r\n this.rjObject['ModifierItem'].push(obj);\r\n }\r\n }\r\n\r\n getTrailerInfo() {\r\n this.rjObject['Trailer'] = {};\r\n this.rjObject.Trailer.DateTimeCompleted = this.updatedAt;\r\n this.rjObject.Trailer.CompletedBy = {};\r\n this.rjObject.Trailer.CompletedBy.DeviceID = this.deviceId;\r\n this.rjObject.Trailer.CompletedBy.CashierID = this.cashierId;\r\n this.rjObject.Trailer.CompletedBy.StoreID = this.transactionDocument.storeId;\r\n this.rjObject.Trailer.CompletedBy.BranchID = this.branchId;\r\n this.rjObject.Trailer.CompletedBy.TerminalNumber = this.terminalNumber;\r\n this.rjObject.Trailer.CompletedBy.TransactionNumber = this.transactionNumber;\r\n this.rjObject.Trailer.Total = this.convertToString(this.transactionDocument.basketSummary.basketTotal * 100);\r\n this.rjObject.Trailer.ItemCount = this.itemCount; //gives total count for product\r\n this.rjObject.Trailer.ItemQuantity = this.convertToString(this.transactionDocument.basketSummary.totalItems);\r\n this.rjObject.Trailer.NetItemQuantity = this.convertToString(this.transactionDocument.basketSummary.totalItems);\r\n this.rjObject.Trailer.TaxTotal = this.convertToString(this.removeDecimal(this.transactionDocument.basketSummary.VATTotal));\r\n this.rjObject.Trailer.SequenceDeviceID = this.deviceId;\r\n this.rjObject.Trailer.SequenceNumber = 'snsn' //static for now\r\n\r\n this.rjObject['Trailer']['TaxItem'] = [];\r\n this.transactionDocument.basket.taxBreakdown.taxLines.forEach((element: any) => {\r\n let obj: any = {};\r\n\r\n obj['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['TaxRate'] = this.convertToString(element.VATCode);\r\n obj['TaxableTotal'] = this.convertToString(this.removeDecimal(element.taxableAmount));\r\n obj['TaxTotal'] = this.convertToString(this.removeDecimal(this.removeDecimal(element.taxLineTotal)));\r\n obj['TaxDescription'] = this.convertToString(element.VATCode);\r\n obj['TaxIncluded'] = '1';\r\n obj['TaxPercentage'] = this.addDecimal(element.VAT.toFixed(2)).toFixed(2);\r\n\r\n this.rjObject['Trailer']['TaxItem'].push(obj)\r\n });\r\n if (this.transactionDocument.basket.linePromotion.length > 0 || this.transactionDocument.basket.linePromotion.length > 0) {\r\n this.rjObject['Trailer']['PromotionItem'] = [];\r\n if (this.transactionDocument.basket.linePromotion.length > 0) {\r\n this.transactionDocument.basket.linePromotion.forEach((element: any) => {\r\n let obj: any = {};\r\n\r\n obj['PromotionID'] = element.promotionId;\r\n obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;\r\n obj['PromotionQuantity'] = \"1\";\r\n obj['PromotionDescription'] = element.displayText;\r\n obj['PromotionHit'] = {}\r\n obj['PromotionHit']['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['PromotionHit']['HitNumber'] = \"1\";\r\n obj['PromotionHit']['HitQuantity'] = \"1\";\r\n obj['PromotionHit']['HitSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;\r\n obj['PromotionHit']['PromotionTrigger'] = {};\r\n let product = this.transactionDocument.basket.products.find((item: any) => item.itemLineId == element.itemLineId);\r\n obj['PromotionHit']['PromotionTrigger']['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['PromotionHit']['PromotionTrigger']['ProductID'] = product.SKU;\r\n obj['PromotionHit']['PromotionTrigger']['UnitValue'] = this.convertToString(element.promotionLinePrice / product.quantity);\r\n obj['PromotionHit']['PromotionTrigger']['LineNumber'] = this.getNumber(product.SKU);\r\n obj['PromotionHit']['PromotionTrigger']['Quantity'] = this.convertToString(product.quantity.toFixed(1));\r\n obj['PromotionHit']['PromotionTrigger']['TaxCode'] = this.transactionDocument.basket.taxBreakdown.taxLines.find((item: any) => item.itemLineId == element.itemLineId).VATCode;\r\n this.rjObject['Trailer']['PromotionItem'].push(obj);\r\n });\r\n }\r\n\r\n if (this.transactionDocument.basket.transactionPromotion.length > 0) {\r\n\r\n this.transactionDocument.basket.transactionPromotion.forEach((element: any) => {\r\n let obj: any = {};\r\n obj['PromotionID'] = element.promotionId;\r\n obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;\r\n obj['PromotionQuantity'] = \"1\";\r\n obj['PromotionDescription'] = element.displayText;\r\n obj['PromotionHit'] = {}\r\n obj['PromotionHit']['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['PromotionHit']['HitNumber'] = \"1\";\r\n obj['PromotionHit']['HitQuantity'] = \"1\";\r\n obj['PromotionHit']['HitSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;\r\n obj['PromotionHit']['PromotionTrigger'] = [];\r\n this.transactionDocument.basket.products.forEach((product: any) => {\r\n let promotionTrigger = {};\r\n element.itemLineIds.forEach((itemLineId: any) => {\r\n if (JSON.stringify(itemLineId) === product.itemLineId) {\r\n promotionTrigger['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n promotionTrigger['ProductID'] = product.SKU;\r\n promotionTrigger['UnitValue'] = this.convertToString(element.promotionLinePrice / product.quantity);\r\n promotionTrigger['LineNumber'] = this.getNumber(product.SKU);\r\n promotionTrigger['Quantity'] = this.convertToString(product.quantity);\r\n promotionTrigger['TaxCode'] = this.transactionDocument.basket.taxBreakdown.taxLines.find((item: any) => item.itemLineId == product.itemLineId).VATCode;\r\n obj['PromotionHit']['PromotionTrigger'].push(promotionTrigger);\r\n }\r\n });\r\n });\r\n this.rjObject['Trailer']['PromotionItem'].push(obj);\r\n });\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n getTenderInfo() {\r\n if (this.transactionDocument.paymentDetails && this.transactionDocument.paymentDetails.length > 0) {\r\n this.transactionDocument.paymentDetails.forEach((element: any) => {\r\n if(element.externalTenderKey){\r\n this.rjObject[element.externalTenderKey] = [];\r\n if (element.paymentType.toUpperCase() === 'GIFT CARD') {\r\n let obj = {\r\n XMLSchemaVersion: this.xmlSchemaVersion,\r\n LineNumber: this.generateLineNumber(),\r\n NetValue: this.convertToString(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n EffectiveNetValue: this.convertToString(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n Description: this.getDescription(element),\r\n DeviceID: this.deviceId,\r\n UserID: this.transactionDocument.userName,\r\n DateTimeCreated: this.updatedAt,\r\n TenderType: element.externalTenderType ? element.externalTenderType : '',\r\n TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',\r\n TenderAmount: this.convertToString(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n CurrencyID: this.transactionDocument.baseCurrency,\r\n CurrencyDescription: this.transactionDocument.baseCurrency,\r\n GiftVoucherSalesAllowed: '',//todo\r\n AllowRechargeableVoucherSales: '',//todo\r\n GiftVoucherID: ''\r\n }\r\n this.rjObject[element.externalTenderKey].push(obj)\r\n }\r\n else {\r\n let obj1 = {\r\n XMLSchemaVersion: \"1\",\r\n LineNumber: this.generateLineNumber(),//todo\r\n NetValue: this.convertToString(-1 * this.removeDecimal(Math.round(element.amount))),\r\n EffectiveNetValue: this.convertToString(-1 * this.removeDecimal(Math.round(element.amount))),\r\n Description: this.getDescription(element),\r\n DeviceID: this.deviceId,\r\n UserID: this.transactionDocument.userName,\r\n DateTimeCreated: this.updatedAt,\r\n TenderType: element.externalTenderType ? element.externalTenderType : '',\r\n TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',\r\n TenderAmount: this.convertToString(-1 * this.removeDecimal(Math.round(element.amount))),\r\n CurrencyID: this.transactionDocument.baseCurrency,\r\n CurrencyDescription: this.transactionDocument.baseCurrency,\r\n IncludeInTransactionTotalCheck: \"1\",\r\n AllowRechargeableVoucherSales: \"1\",\r\n OpenDrawerAtEnd: \"1\"\r\n }\r\n this.rjObject[element.externalTenderKey].push(obj1)\r\n }\r\n } else{\r\n this.rjObject['CashTender'] = [];\r\n if (element.paymentType.toUpperCase() === 'GIFT CARD') {\r\n let obj = {\r\n XMLSchemaVersion: this.xmlSchemaVersion,\r\n LineNumber: this.generateLineNumber(),\r\n NetValue: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n EffectiveNetValue: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n Description: this.getDescription(element),\r\n DeviceID: this.deviceId,\r\n UserID: this.transactionDocument.userName,\r\n DateTimeCreated: this.updatedAt,\r\n TenderType: element.externalTenderType ? element.externalTenderType : '',\r\n TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',\r\n TenderAmount: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n CurrencyID: this.transactionDocument.baseCurrency,\r\n CurrencyDescription: this.transactionDocument.baseCurrency,\r\n GiftVoucherSalesAllowed: '',//todo\r\n AllowRechargeableVoucherSales: '',//todo\r\n GiftVoucherID: ''\r\n }\r\n this.rjObject['CashTender'].push(obj)\r\n }\r\n else {\r\n let obj1 = {\r\n XMLSchemaVersion: \"1\",\r\n LineNumber: this.generateLineNumber(),\r\n NetValue: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n EffectiveNetValue: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n Description: this.getDescription(element),\r\n DeviceID: this.deviceId,\r\n UserID: this.transactionDocument.userName,\r\n DateTimeCreated: this.updatedAt,\r\n TenderType: element.externalTenderType ? element.externalTenderType : '',\r\n TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',\r\n TenderAmount: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n CurrencyID: this.transactionDocument.baseCurrency,\r\n CurrencyDescription: this.transactionDocument.baseCurrency,\r\n IncludeInTransactionTotalCheck: \"1\",\r\n AllowRechargeableVoucherSales: \"1\",\r\n OpenDrawerAtEnd: \"1\"\r\n }\r\n this.rjObject['CashTender'].push(obj1)\r\n }\r\n }\r\n });\r\n }\r\n return this;\r\n }\r\n\r\n getNumber(productId) {\r\n let lineNumber; \r\n for (let i = 0; i < this.rjObject['ProductSale'].length; i++) {\r\n const element = this.rjObject['ProductSale'][i];\r\n if(JSON.stringify(productId) === JSON.stringify(element.ProductID)){\r\n lineNumber = element.LineNumber;\r\n break;\r\n }\r\n }\r\n return lineNumber;\r\n }\r\n\r\n setLineNumberForProducts() {\r\n let itemLineIdArray = [];\r\n itemLineIdArray = this.transactionDocument.basket.products.map((product: any) => {\r\n return parseInt(product.itemLineId);\r\n })\r\n this.largestNumber = itemLineIdArray.reduce((a: any, b: any) => Math.max(a, b));\r\n }\r\n\r\n generateLineNumber() {\r\n this.largestNumber += 1;\r\n this.itemCount += 1;\r\n return this.largestNumber;\r\n }\r\n\r\n initilizeItemCount() {\r\n this.itemCount = this.transactionDocument.basket.products.length;\r\n }\r\n\r\n build() {\r\n return this.rjObject;\r\n }\r\n\r\n getDescription(element: any) {\r\n if (element.paymentType.toUpperCase() === 'CARD') {\r\n return element.cardType\r\n }\r\n else {\r\n return element.paymentType;\r\n }\r\n }\r\n\r\n getMMGROUPID(attributes) {\r\n if (attributes && attributes.length > 0) {\r\n let filterValue = attributes.filter((attribute) => attribute.name === \"MMGROUPID\");\r\n if(filterValue && filterValue.length > 0){\r\n return filterValue[0].value;\r\n }\r\n }\r\n }\r\n\r\n setDeviceInfo(id: any) {\r\n this.deviceId = id\r\n return this\r\n }\r\n\r\n removeDecimal(value: number) {\r\n return value * 100;\r\n }\r\n\r\n addDecimal(value: number) {\r\n return value /100;\r\n }\r\n\r\n setTransactionNumber(value: any) {\r\n this.transactionNumber = value;\r\n return this\r\n }\r\n\r\n setManifestVersion(value: any) {\r\n this.manifestVersion = value;\r\n return this\r\n }\r\n\r\n setDatabaseSchemaVersion(value: any) {\r\n this.databaseSchemaVersion = value;\r\n return this\r\n }\r\n\r\n setBasketType(value: any) {\r\n this.basketType = value;\r\n return this\r\n }\r\n\r\n setTradingRegionID(value: any) {\r\n this.tradingRegionId = value\r\n return this\r\n }\r\n\r\n setCompanyID(value: any) {\r\n this.companyId = value\r\n return this\r\n }\r\n\r\n setTaxMethodID(value: any) {\r\n this.taxMethodId = value\r\n return this\r\n }\r\n\r\n setMajorVersion(value: any) {\r\n this.majorVersion = value\r\n return this\r\n }\r\n\r\n setMinorVersion(value: any) {\r\n this.minorVersion = value\r\n return this\r\n }\r\n\r\n setXMLSchemaVersion(value: any) {\r\n this.xmlSchemaVersion = value\r\n return this\r\n }\r\n\r\n setExternalState(value: any) {\r\n this.externalState = value\r\n return this\r\n }\r\n\r\n setCashierID() {\r\n this.cashierId = (this.transactionDocument && this.transactionDocument.userName) ? this.transactionDocument.userName : '';\r\n return this\r\n }\r\n\r\n setTerminalNumber(value: any) {\r\n this.terminalNumber = value;\r\n return this;\r\n }\r\n\r\n setBasketLanguageID(value: any) {\r\n this.basketLanguageId = value;\r\n return this;\r\n }\r\n setBasketCountryID(value: any) {\r\n this.basketCountryId = value;\r\n return this;\r\n }\r\n\r\n setBasketCurrencyID(value: any) {\r\n this.basketCurrencyId = value;\r\n return this;\r\n }\r\n\r\n setBranchID(value: any) {\r\n this.branchId = value;\r\n return this;\r\n }\r\n\r\n setSalesPersonName(value: any) {\r\n this.salesPersonName = value;\r\n return this;\r\n }\r\n\r\n generateId(date: any) {\r\n let newDateTime = date.replace(/[^0-9]/g, '')\r\n let id = (this.deviceId + '|' + newDateTime + '|' + this.transactionNumber).toString();\r\n return id;\r\n } \r\n\r\n generateTimezoneoffset(date: any) {\r\n let x = date ? date : '';\r\n return new Date(x).getTimezoneOffset();\r\n }\r\n\r\n generateKeyword() {\r\n let x = (this.companyId + '|' + this.transactionDocument.storeId + '|' + this.terminalNumber + '|' + this.transactionNumber).toString();\r\n return x;\r\n }\r\n\r\n getState() {\r\n if (this.transactionDocument.operationStatus === 'PAY_SUCCESS') {\r\n return 'Completed';\r\n }\r\n else {\r\n return 'Cancelled';\r\n }\r\n }\r\n\r\n returnProduct(element: any, lineDiscount: LineDiscount , transactionDiscount: TransactionDiscount) {\r\n let obj: any = {};\r\n let taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((item: any) => item.itemLineId == element['itemLineId']);\r\n obj['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['LineNumber'] = element['itemLineId'];\r\n obj['NetValue'] = this.removeDecimal(element['refundedTotal']);\r\n obj['EffectiveNetValue'] = this.removeDecimal(element['refundedTotal']);\r\n obj['Description'] = element['description'];\r\n obj['DeviceID'] = this.transactionDocument['terminalId'];\r\n obj['UserID'] = this.transactionDocument.userName;\r\n obj['DateTimeCreated'] = this.createdAt;\r\n obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice']*-1);\r\n obj['UnitPrice'] = this.removeDecimal(element['price']);\r\n obj['Quantity'] = this.getQuantity(element);\r\n obj['OriginalTaxAmountSet'] = 1;\r\n obj['ProductID'] = element['SKU'];\r\n obj['HandKeyed'] = 1;\r\n obj['LongDescription'] = element['description'];\r\n obj['Return'] = {};\r\n obj['Return']['ReturnReasonID'] = element['refundedReason'];\r\n obj['Return']['ReturnDescription'] = element['refundedReasonDescription'];\r\n obj['Return']['ReturnToStock'] = this.getQuantity(element);\r\n obj['TaxCode'] = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((item: any) => item.itemLineId == element['itemLineId']).VATCode;\r\n\r\n obj['DisplayTaxCode'] = ''; // todo\r\n obj['ProductAttributes'] = ''; //todo - not required\r\n obj['Perishable'] = this.getMMGROUPID(element.attributes);\r\n //obj['MMGroupID'] = this.getCaregories(element);\r\n obj['MMGroupID'] = this.getMMGROUPID(element.attributes);\r\n obj['CustomerDetails'] = \"\"; // todo - blank\r\n obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO\r\n obj['OriginalTaxAmount'] = this.convertToString((this.removeDecimal(this.getOriginalTax(element,taxTotal.VAT) * -1)).toFixed(2));\r\n obj['taxAmount'] = this.removeDecimal(taxTotal.taxLineTotal < 0 ?(taxTotal.taxLineTotal) : (-taxTotal.taxLineTotal));\r\n\r\n if (lineDiscount) {\r\n if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {\r\n // line discount\r\n obj['Discount'] = {};\r\n obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;\r\n obj['Discount'].ModifierDateTime = obj.DateTimeCreated;\r\n obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;\r\n obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;\r\n obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;\r\n obj['Discount'].DiscountType = lineDiscount.discountType;\r\n obj['Discount'].XMLSchemaVersion = 1;\r\n obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));\r\n obj['Discount'].DiscountedValue = this.removeDecimal(lineDiscount.unitPrice);\r\n obj['Discount'].DiscountPercentage = lineDiscount.percentageDiscountValue;\r\n obj['Discount'].RoundingRule = 2;\r\n }\r\n\r\n if (lineDiscount.priceOverrideReasonCode && lineDiscount.priceOverrideReasonName) {\r\n //price override\r\n obj['PriceOverride'] = {};\r\n obj['PriceOverride'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;\r\n obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;\r\n obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;\r\n obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;\r\n obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;\r\n obj['PriceOverride'].XMLSchemaVersion = 1;\r\n obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);\r\n obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);\r\n }\r\n\r\n //update the product price\r\n obj.NetValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;\r\n obj.EffectiveNetValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;\r\n obj.ExtendedValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;\r\n obj.UnitPrice = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;\r\n }\r\n\r\n if(transactionDiscount) {\r\n obj['BasketDiscountModifier'] = [];\r\n this.transactionDocument.basket.transactionDiscount.forEach((e: any) => { \r\n let discountObj: any ={}\r\n e.itemLineIds.forEach((x: any) => {\r\n if (x == element.itemLineId) { \r\n var discountAmount = this.convertToString(e.discountAmount * -1); \r\n discountObj.BasketDiscountLineNumber = this.getLineNumber(e,discountAmount);\r\n discountObj.XMLSchemaVersion = this.xmlSchemaVersion;\r\n discountObj.DiscountedValue = this.getDiscountedValue(element.totalLinePrice, e.discountAmount);\r\n obj['BasketDiscountModifier'].push(discountObj);\r\n } \r\n }); \r\n });\r\n var totaltransactionDiscount = 0;\r\n obj['BasketDiscountModifier'].forEach((value:any)=>{\r\n totaltransactionDiscount = totaltransactionDiscount + value.DiscountedValue;\r\n });\r\n //update the product price\r\n obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount;\r\n }\r\n\r\n if (this.transactionDocument.basket.transactionPromotion.length > 0) {\r\n obj['PromotionSaving'] = [];\r\n this.transactionDocument.basket.transactionPromotion.forEach((transactionPromo: any) => {\r\n let promotionObj: any = {};\r\n transactionPromo.itemLineIds.forEach((itemLineId: any) => {\r\n if (itemLineId == element.itemLineId) {\r\n promotionObj.ModifierValue = transactionPromo.promotionAmount;\r\n promotionObj.ModifierDateTime = this.transactionDocument.createdAt;\r\n promotionObj.ModifierDescription = transactionPromo.displayText;\r\n promotionObj.XMLSchemaVersion = this.xmlSchemaVersion;\r\n promotionObj.PromotionID = transactionPromo.promotionId;\r\n promotionObj.PromotionDescription = transactionPromo.displayText;\r\n promotionObj.HitNumber = '1';\r\n promotionObj.PromotionHitProductQuantity = this.getQuantity(element);\r\n promotionObj.PromotionHitQuantity = this.getQuantity(element) * -1;\r\n obj['PromotionSaving'].push(promotionObj);\r\n }\r\n });\r\n });\r\n }\r\n\r\n return obj;\r\n }\r\n\r\n addProduct(element: TProduct, lineDiscount: LineDiscount, transactionDiscount: TransactionDiscount) {\r\n let taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((item: any) => item.itemLineId == element['itemLineId']);\r\n let obj: any = {\r\n XMLSchemaVersion: this.xmlSchemaVersion,\r\n LineNumber: element.itemLineId,\r\n NetValue: this.removeDecimal(element.totalLinePrice),\r\n EffectiveNetValue: this.removeDecimal(element.totalLinePrice),\r\n Description: element.description,\r\n DeviceID: this.deviceId,\r\n UserID: this.transactionDocument.userName,\r\n DateTimeCreated: this.createdAt,\r\n ExtendedValue: this.removeDecimal(element.price),\r\n UnitPrice: this.removeDecimal(element.price),\r\n //MMGroupID: this.getCaregories(element),\r\n Quantity: element.quantity,\r\n SalespersonID: this.transactionDocument.userName,\r\n SalespersonName: this.salesPersonName,\r\n TaxCode: this.transactionDocument.basket['taxBreakdown']['taxLines'].find((item: any) => item.itemLineId == element['itemLineId']).VATCode,\r\n TaxModifiable: \"1\", //todo\r\n OriginalTaxAmount : this.convertToString((this.removeDecimal(this.getOriginalTax(element,taxTotal.VAT)).toFixed(2))),\r\n TaxAmount : this.convertToString(this.removeDecimal(taxTotal.taxLineTotal)),\r\n OriginalTaxAmountSet: \"1\",//todo\r\n ProductID: element.SKU,\r\n HandKeyed: \"1\",//todo\r\n CustomerDetails: \"\",\r\n Perishable: this.getMMGROUPID(element.attributes),\r\n MMGroupID: this.getMMGROUPID(element.attributes)\r\n }\r\n if (lineDiscount) {\r\n if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {\r\n // line discount\r\n obj['Discount'] = {};\r\n obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;\r\n obj['Discount'].ModifierDateTime = obj.DateTimeCreated;\r\n obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;\r\n obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;\r\n obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;\r\n obj['Discount'].DiscountType = lineDiscount.discountType;\r\n obj['Discount'].XMLSchemaVersion = 1;\r\n obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));\r\n obj['Discount'].DiscountedValue = this.removeDecimal(lineDiscount.unitPrice);\r\n obj['Discount'].DiscountPercentage = lineDiscount.percentageDiscountValue;\r\n obj['Discount'].RoundingRule = 2;\r\n }\r\n\r\n if (lineDiscount.priceOverrideReasonCode && lineDiscount.priceOverrideReasonName) {\r\n //price override\r\n obj['PriceOverride'] = {};\r\n obj['PriceOverride'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;\r\n obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;\r\n obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;\r\n obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;\r\n obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;\r\n obj['PriceOverride'].XMLSchemaVersion = this.xmlSchemaVersion;\r\n obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);\r\n obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);\r\n }\r\n\r\n //update the product price\r\n obj['NetValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);\r\n obj['EffectiveNetValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);\r\n obj['ExtendedValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);\r\n obj['UnitPrice'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);\r\n }\r\n\r\n if(transactionDiscount) {\r\n obj['BasketDiscountModifier'] = [];\r\n this.transactionDocument.basket.transactionDiscount.forEach((e:any) => { \r\n let discountObj: any ={};\r\n e.itemLineIds.forEach((itemLineId: any) => {\r\n if (itemLineId == element.itemLineId) { \r\n let discountAmount = this.convertToString(e.discountAmount * -1); \r\n discountObj.XMLSchemaVersion = this.xmlSchemaVersion;\r\n discountObj.DiscountedValue = -(this.getDiscountedValue(element.totalLinePrice, e.discountAmount));\r\n discountObj.BasketDiscountLineNumber = this.getLineNumber(e,discountAmount) ;\r\n obj['BasketDiscountModifier'].push(discountObj); \r\n } \r\n }); \r\n });\r\n let totaltransactionDiscount = 0;\r\n obj['BasketDiscountModifier'].forEach((value:any)=>{\r\n totaltransactionDiscount = totaltransactionDiscount + value.DiscountedValue;\r\n });\r\n //update the product price\r\n obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount; \r\n }\r\n \r\n if (this.transactionDocument.basket.transactionPromotion.length > 0 || this.transactionDocument.basket.linePromotion.length > 0) {\r\n obj['DistributedPromotionSaving'] = [];\r\n if (this.transactionDocument.basket.transactionPromotion.length > 0) {\r\n this.transactionDocument.basket.transactionPromotion.forEach((e: any) => {\r\n let promotionObj: any = {};\r\n e.itemLineIds.forEach((itemLineId: any) => {\r\n if (itemLineId == element.itemLineId) {\r\n promotionObj.PromotionID = e.promotionId;\r\n promotionObj.Hit = '1';\r\n promotionObj.Saving = this.getSaving(element.totalLinePrice, e.promotionAmount);\r\n promotionObj.ISaving = this.getSaving(element.totalLinePrice, e.promotionAmount);\r\n obj['DistributedPromotionSaving'].push(promotionObj);\r\n }\r\n });\r\n });\r\n }\r\n\r\n if (this.transactionDocument.basket.linePromotion.length > 0) {\r\n this.transactionDocument.basket.linePromotion.forEach((linePromotion: any) => {\r\n let promotionObj: any = {};\r\n if (element.itemLineId == linePromotion.itemLineId) {\r\n promotionObj.PromotionID = linePromotion.promotionId;\r\n promotionObj.Hit = \"1\";\r\n promotionObj.Saving = linePromotion.promotionLinePrice;\r\n promotionObj.ISaving = linePromotion.promotionLinePrice;\r\n obj['DistributedPromotionSaving'].push(promotionObj);\r\n }\r\n });\r\n }\r\n let transactionPromotion = 0;\r\n obj['DistributedPromotionSaving'].forEach((value: any) => {\r\n transactionPromotion = transactionPromotion + value.Saving;\r\n });\r\n obj['EffectiveNetValue'] = obj.EffectiveNetValue + transactionPromotion;\r\n }\r\n return obj;\r\n }\r\n\r\n getSaving(price,promotionAmount): any {\r\n let Saving = (price*promotionAmount)/this.transactionDocument.basketSummary.saleTotal;\r\n return Saving;\r\n }\r\n\r\n getLineNumber(value: any,discountAmount:string ){\r\n let lineNumber;\r\n for (let i = 0; i < this.rjObject['BasketDiscount'].length; i++) {\r\n const element = this.rjObject['BasketDiscount'][i];\r\n if( value.reasonCode === element.ReasonCodeID && discountAmount === element.NetValue){\r\n lineNumber = element.LineNumber;\r\n break; \r\n } \r\n }\r\n return lineNumber; \r\n }\r\n\r\n\r\n getDiscountedValue(price:any ,discountAmount:any ) {\r\n let DiscountedValue =((price * discountAmount)/this.transactionDocument.basketSummary.saleTotal)*100 ;\r\n return DiscountedValue;\r\n }\r\n\r\n getOriginalTax(element: TProduct, VAT) {\r\n let pricebeforetax = (element.price * 100)/(100 + VAT )\r\n let originaltax= element.price - pricebeforetax\r\n return originaltax;\r\n }\r\n\r\n convertToString(value: any) {\r\n try {\r\n value = JSON.stringify(value);\r\n return value;\r\n }\r\n catch (e) {\r\n console.log(value, 'can not be converted in string', e);\r\n }\r\n }\r\n\r\n generateDynamicStockLookUp() {\r\n let x = '0';\r\n this.transactionDocument.basket.products.forEach((element: any) => {\r\n if (element.deliveryMethod === '1' || element.deliveryMethod === '2') {\r\n x = '1';\r\n }\r\n });\r\n return x;\r\n }\r\n\r\n // getAttributes(){\r\n // let name: string | any[] = []\r\n // this.transactionDocument.basket.products.forEach((element: any) => {\r\n // if (element && element.attributes && element.attributes.length > 0) {\r\n // name = element.attributes.filter((x: any) => x.name.toUpperCase() === element.name.toUpperCase());\r\n // }\r\n // });\r\n // if (name.length > 0) {\r\n // return name[0].value\r\n // }\r\n // else{\r\n // return \"\"\r\n // }\r\n // }\r\n\r\n // getCaregories(element) {\r\n // let MMGroupId = \" \";\r\n // if (element.categories && element.categories.length > 0) {\r\n // let categories = element.categories.filter((x) => x.parentId != '');\r\n // let value = categories.filter((x) => x.id != x.parentId);\r\n // MMGroupId = value[0].name;\r\n // }\r\n // return MMGroupId;\r\n // }\r\n\r\n getDate(date:string){\r\n let offset = this.generateTimezoneoffset(date) * -1;\r\n let offsetHours = Math.abs(Math.floor(offset / 60)); \r\n\t let offsetMinutes = Math.abs(offset) - offsetHours * 60;\r\n\r\n let offsetSign = '+';\r\n if (offset < 0) {\r\n offsetSign = '-';\r\n }\r\n\r\n let newdate = date.substring(0,19);\r\n const x = (newdate+ offsetSign +String(offsetHours).padStart(2, '0')+':'+String(offsetMinutes).padStart(2, '0')).toString();\r\n return x; \r\n }\r\n \r\n getTransactionPromotion(transactionPromotion){\r\n if(transactionPromotion && transactionPromotion.length > 0){\r\n this.rjObject['PromoVoucherItem'] = {};\r\n this.rjObject['PromoVoucherItem']['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n this.rjObject['PromoVoucherItem']['LineNumber'] = this.generateLineNumber();\r\n this.rjObject['PromoVoucherItem']['NetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;\r\n this.rjObject['PromoVoucherItem']['EffectiveNetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;\r\n this.rjObject['PromoVoucherItem']['Description'] = transactionPromotion[0].promotionInfo;\r\n this.rjObject['PromoVoucherItem']['DeviceID'] = this.deviceId;\r\n this.rjObject['PromoVoucherItem']['UserID'] = this.transactionDocument.userName;\r\n this.rjObject['PromoVoucherItem']['DateTimeCreated'] = this.createdAt;\r\n this.rjObject['PromoVoucherItem']['ProductId'] = \"\"; //todo\r\n this.rjObject['PromoVoucherItem']['SerialNumber'] = \"\" ; //todo\r\n this.rjObject['PromoVoucherItem']['MMGroupId'] = \"\";\r\n }\r\n }\r\n \r\n getQuantity(element: any) {\r\n let quantity\r\n if(this.transactionDocument.unreferencedRefund){\r\n quantity = element['quantity'] < 0 ? element['quantity'] : (-element['quantity']);\r\n }\r\n else{\r\n quantity = element['refundedQuantity'] < 0 ? element['refundedQuantity'] : (-element['refundedQuantity']);\r\n }\r\n return quantity;\r\n }\r\n}\r\n","import { TransactionDocument } from \"./mapper-library.model\";\r\n\r\nexport class WebReturnMapperBuilderClass {\r\n\r\n private document: any;\r\n private webReturnObject: TransactionDocument = {\r\n id: '',\r\n orgCode: \"\",\r\n storeId: \"\",\r\n storeNodeId: \"\",\r\n storeNodeStructure: \"\",\r\n deviceId: \"\",\r\n terminalId: \"\",\r\n initiatingModule: \"\",\r\n export: false,\r\n basket: {},\r\n basketSummary: {},\r\n baseCurrency: \"\",\r\n customer: {\r\n firstName: '',\r\n lastName: '',\r\n email: '',\r\n postCode: '',\r\n id: '',\r\n billingAddress: {},\r\n shippingAddress: {},\r\n\r\n }\r\n }\r\n\r\n constructor(document) {\r\n if (document) {\r\n this.document = document;\r\n }\r\n }\r\n\r\n WebReturnMapper() {\r\n this.webReturnObject['type'] = 'WEB_RETURNS';\r\n this.webReturnObject['datetime'] = this.getUTCDateTime(this.getText(this.document.updated_at));\r\n this.webReturnObject.baseCurrency = this.getText(this.document.base_currency_code);\r\n this.webReturnObject.storeId = this.getText(this.document.store_id);\r\n this.webReturnObject.subsidiaryId = '1';\r\n this.webReturnObject.initiatingModule = 'MAGENTO';\r\n this.webReturnObject.createdAt = this.getUTCDateTime(this.getText(this.document.created_at));\r\n this.webReturnObject.updatedAt = this.getUTCDateTime(this.getText(this.document.updated_at));\r\n this.webReturnObject.export = true;\r\n this.webReturnObject.transCompletedAt = this.getUTCDateTime(this.getText(this.document.updated_at));\r\n this.webReturnObject['externalTransactionId'] = this.getText(this.document.order_id);\r\n\r\n // customer\r\n this.webReturnObject['customer']['firstName'] = this.getText(this.document.customer_firstname) || '';\r\n this.webReturnObject['customer']['lastName'] = this.getText(this.document.customer_lastname) || '';\r\n this.webReturnObject['customer']['email'] = this.getText(this.document.customer_email) || '';\r\n this.webReturnObject['customer']['postCode'] = '';\r\n\r\n // Billing address\r\n this.webReturnObject['customer']['billingAddress']['address1'] = (this.document.billing_address && this.document.billing_address.street) ? this.getText(this.document.billing_address.street) : '';\r\n this.webReturnObject['customer']['billingAddress']['city'] = (this.document.billing_address && this.document.billing_address.city) ? this.getText(this.document.billing_address.city) : '';\r\n this.webReturnObject['customer']['billingAddress']['county'] = (this.document.billing_address && this.document.billing_address.region) ? this.getText(this.document.billing_address.region) : '';\r\n this.webReturnObject['customer']['billingAddress']['postCode'] = (this.document.billing_address && this.document.billing_address.postcode) ? this.getText(this.document.billing_address.postcode) : '';\r\n this.webReturnObject['customer']['billingAddress']['country'] = (this.document.billing_address && this.document.billing_address.country) ? this.getText(this.document.billing_address.country) : '';\r\n\r\n // Shipping address\r\n this.webReturnObject['customer']['shippingAddress']['address1'] = (this.document.shipping_address && this.document.shipping_address.street) ? this.getText(this.document.shipping_address.street) : '';\r\n this.webReturnObject['customer']['shippingAddress']['city'] = (this.document.shipping_address && this.document.shipping_address.city) ? this.getText(this.document.shipping_address.city) : '';\r\n this.webReturnObject['customer']['shippingAddress']['county'] = (this.document.shipping_address && this.document.shipping_address.region) ? this.getText(this.document.shipping_address.region) : '';\r\n this.webReturnObject['customer']['shippingAddress']['postCode'] = (this.document.shipping_address && this.document.shipping_address.postcode) ? this.getText(this.document.shipping_address.postcode) : '';\r\n this.webReturnObject['customer']['shippingAddress']['country'] = (this.document.shipping_address && this.document.shipping_address.country) ? this.getText(this.document.shipping_address.country) : '';\r\n\r\n // basketSummary \r\n this.webReturnObject.basketSummary['discountTotal'] = Number(this.document.discount_amount ? this.getText(this.document.discount_amount) : 0);\r\n this.webReturnObject.basketSummary['VATTotal'] = Number(this.document.base_total_paid ? this.getText(this.document.base_total_paid) : 0);\r\n this.webReturnObject.basketSummary['saleTotal'] = Number(this.document.base_total_invoiced ? this.getText(this.document.base_total_invoiced) : 0);\r\n this.webReturnObject.basketSummary['basketTotal'] = Number(this.document.base_total_paid ? this.getText(this.document.base_total_paid) : 0);\r\n this.webReturnObject.basketSummary['totalItems'] = Number(this.document.total_qty_ordered ? this.getText(this.document.total_qty_ordered) : 0);\r\n this.webReturnObject.basketSummary['refundTotal'] = Number(this.document.base_total_refunded ? this.getText(this.document.base_total_refunded) : 0);\r\n\r\n // basket line discount\r\n this.webReturnObject.basket['lineDiscount'] = [];\r\n\r\n let lineDiscount = {\r\n itemLineId: (this.document.items && this.document.items.item && this.document.items.item.item_id) ? this.getText(this.document.items.item.item_id) : 0,\r\n discountAmount: (this.document.items && this.document.items.item && this.document.items.item.discount_amount) ? Number(this.getText(this.document.items.item.discount_amount)) : 0\r\n }\r\n this.webReturnObject.basket['lineDiscount'].push(lineDiscount);\r\n\r\n // basket transaction discount\r\n this.webReturnObject.basket['transactionDiscount'] = [];\r\n\r\n let transactionDiscount = {\r\n discountAmount: (this.document && this.document.discount_amount) ? Number(this.getText(this.document.discount_amount)) : 0\r\n }\r\n this.webReturnObject.basket['transactionDiscount'].push(transactionDiscount);\r\n\r\n // basket products \r\n this.webReturnObject.basket['products'] = [];\r\n let product : any= {};\r\n if (this.document.items && this.document.items.item && this.document.items.item) {\r\n if (this.document.items.item instanceof Array) {\r\n this.document.items.item.forEach(element => {\r\n product = {\r\n description: (element.name) ? this.getText(element.name) : '',\r\n SKU: (element.sku) ? this.getText(element.sku) : '',\r\n quantity: (element.qty_ordered) ? Number(this.getText(element.qty_ordered)) : 0,\r\n refundedQuantity: (element.qty_refunded) ? Number(this.getText(this.document.items.item.qty_refunded)) : 0,\r\n price: (element.original_price) ? Number(this.getText(element.original_price)) : 0,\r\n itemLineId: (element.item_id) ? Number(this.getText(element.item_id)) : 0,\r\n // totalLinePrice: (element.row_invoiced) ? Number(this.getText(element.row_invoiced)) : 0,\r\n totalLinePrice: (element.qty_ordered - element.qty_refunded) * element.base_original_price || 0,\r\n }\r\n if (product && product.price != 0) {\r\n this.webReturnObject.basket['products'].push(product);\r\n }\r\n });\r\n } else {\r\n product = {\r\n description: (this.document.items && this.document.items.item && this.document.items.item.name) ? this.getText(this.document.items.item.name) : '',\r\n SKU: (this.document.items && this.document.items.item && this.document.items.item.sku) ? this.getText(this.document.items.item.sku) : '',\r\n quantity: (this.document.items && this.document.items.item && this.document.items.item.qty_ordered) ? Number(this.getText(this.document.items.item.qty_ordered)) : 0,\r\n refundedQuantity: (this.document.items && this.document.items.item && this.document.items.item.qty_refunded) ? Number(this.getText(this.document.items.item.qty_refunded)) : 0,\r\n price: (this.document.items && this.document.items.item && this.document.items.item.original_price) ? Number(this.getText(this.document.items.item.original_price)) : 0,\r\n itemLineId: (this.document.items && this.document.items.item && this.document.items.item.item_id) ? Number(this.getText(this.document.items.item.item_id)) : 0,\r\n // totalLinePrice: (this.document.items && this.document.items.item && this.document.items.item.row_invoiced) ? Number(this.getText(this.document.items.item.row_invoiced)) : 0,\r\n totalLinePrice: (this.document.items.item.qty_ordered - this.document.items.item.qty_refunded) * this.document.items.item.base_original_price || 0,\r\n }\r\n if (product && product.price != 0) {\r\n this.webReturnObject.basket['products'].push(product);\r\n }\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n deviceId(deviceId) {\r\n this.webReturnObject.deviceId = deviceId;\r\n return this;\r\n }\r\n\r\n terminalId(terminalId) {\r\n this.webReturnObject.terminalId = terminalId;\r\n return this;\r\n }\r\n\r\n orgCode(orgCode) {\r\n this.webReturnObject.orgCode = orgCode;\r\n return this;\r\n }\r\n\r\n storeId(storeId) {\r\n this.webReturnObject.storeId = storeId;\r\n return this;\r\n }\r\n\r\n storeNodeId(storeNodeId: string) {\r\n this.webReturnObject.storeNodeId = storeNodeId;\r\n return this;\r\n }\r\n\r\n storeNodeStructure(storeNodeStructure: string) {\r\n this.webReturnObject.storeNodeStructure = storeNodeStructure;\r\n return this;\r\n }\r\n\r\n docId(docId) {\r\n this.webReturnObject.id = docId;\r\n return this;\r\n }\r\n\r\n updateUserID(userID: string) {\r\n this.webReturnObject.userId = userID;\r\n return this;\r\n }\r\n\r\n updateUserName(name) {\r\n this.webReturnObject.userName = name;\r\n return this;\r\n }\r\n\r\n build() {\r\n return this.webReturnObject;\r\n }\r\n\r\n getText(obj) {\r\n if (obj && obj.text) {\r\n return obj.text;\r\n } else {\r\n return obj;\r\n }\r\n }\r\n\r\n getUTCDateTime(date) {\r\n if (date) {\r\n return new Date(date).toISOString();\r\n }\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;AAAA,MAYa,sBAAsB;IAEjC,iBAAiB;;;;IAEjB,QAAQ;KACP;;;YAfF,SAAS,SAAC;gBACT,QAAQ,EAAE,oBAAoB;gBAC9B,QAAQ,EAAE;;;;GAIT;aAGF;;;;;;;;;;ACXD,MAea,mBAAmB;;;YAV/B,QAAQ,SAAC;gBACR,YAAY,EAAE;oBACZ,sBAAsB;iBACvB;gBACD,OAAO,EAAE,EACR;gBACD,OAAO,EAAE;oBACP,sBAAsB;iBACvB;aACF;;;;;;;;;ACZD,MAAY,gBAAgB;IAC1B,IAAI,QAAS;IACb,MAAM,UAAW;IACjB,WAAW,eAAgB;IAC3B,aAAa,iBAAkB;IAC/B,IAAI,QAAS;EACd;;;;AAED,2BAKC;;;IAJC,2CAA4B;;IAC5B,4CAA6B;;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;;;IAED,kBAAkB,CAAC,kBAA0B;QACzC,mBAAA,IAAI,GAAC,eAAe,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7D,0BAAO,IAAI,GAAC;KACf;;;;;;;IAED,KAAK,CAAC,KAAK;QACP,mBAAA,IAAI,GAAC,eAAe,CAAC,EAAE,GAAG,KAAK,CAAC;QAChC,0BAAO,IAAI,GAAC;KACf;;;;;;;IAED,YAAY,CAAC,MAAc;QACvB,mBAAA,IAAI,GAAC,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC;QACrC,0BAAO,IAAI,GAAC;KACf;;;;;;;IAED,cAAc,CAAC,IAAI;QACf,mBAAA,IAAI,GAAC,eAAe,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrC,0BAAO,IAAI,GAAC;KACf;;;;IAED,KAAK;QACD,OAAO,IAAI,CAAC,eAAe,CAAC;KAC/B;;;;;IAED,OAAO,CAAC,GAAG;QACP,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE;YACjB,OAAO,GAAG,CAAC,IAAI,CAAC;SACnB;aAAM;YACH,OAAO,GAAG,CAAC;SACd;KACJ;;;;;IAED,cAAc,CAAC,IAAI;QACf,IAAI,IAAI,EAAE;YACN,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;SACvC;KACJ;CACJ;;;;;;IA/LG,+CAAsB;;;;;IACtB,sDAuBC;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"pmcretail-mapper-library.js","sources":["ng://@pmcretail/mapper-library/lib/mapper-library.component.ts","ng://@pmcretail/mapper-library/lib/mapper-library.module.ts","ng://@pmcretail/mapper-library/lib/mapper-library.model.ts","ng://@pmcretail/mapper-library/lib/basket.service.ts","ng://@pmcretail/mapper-library/lib/number-util.service.ts","ng://@pmcretail/mapper-library/lib/TransactionDocumentBuilder.ts","ng://@pmcretail/mapper-library/lib/RJ-mapper.class.ts","ng://@pmcretail/mapper-library/lib/WebReturn-mapper.class.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'lib-mapper-library',\n template: `\n <p>\n mapper-library works!\n </p>\n `,\n styles: [\n ]\n})\nexport class MapperLibraryComponent implements OnInit {\n\n constructor() { }\n\n ngOnInit(): void {\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { MapperLibraryComponent } from './mapper-library.component';\n\n\n\n@NgModule({\n declarations: [\n MapperLibraryComponent\n ],\n imports: [\n ],\n exports: [\n MapperLibraryComponent\n ]\n})\nexport class MapperLibraryModule { }\n","\r\n\r\nexport enum TRANSACTION_TYPE {\r\n SALE = \"SALE\",\r\n REFUND = \"REFUND\",\r\n SALE_REFUND = \"SALE_REFUND\",\r\n SALE_EXCHANGE = \"SALE_EXCHANGE\",\r\n VOID = \"VOID\"\r\n}\r\n\r\nexport interface ItemDiscount {\r\n trnDiscountsPortion: number;\r\n trnPromotionsPortion: number;\r\n refundPortion: number;\r\n currentRefundPortion?: number;\r\n}\r\n\r\nexport enum DELIVERY_METHODS {\r\n DELIVERY = 1,\r\n DROP_SHIP = 2,\r\n COLLECT_FROM_STORE = 3,\r\n}\r\n\r\nexport interface ProductChange {\r\n itemLineId?: number;\r\n SKU: string;\r\n quantity: number;\r\n selectedPrice?: number;\r\n lineDiscount?: LineDiscount;\r\n linePromotions?: LinePromotions;\r\n exchange?: Exchange;\r\n refundedQuantity?: number; // contains quantity of both full priced and promotional quantities\r\n refundPromotionalQuantity?: number; // promotional quantity\r\n refunded?: boolean;\r\n refundedTotal?: number;\r\n refundedReason?: string;\r\n refundedReasonDescription?: string;\r\n isChecked?: boolean;\r\n sealed?: boolean;\r\n isLastExchanged?: boolean;\r\n}\r\n\r\n/**\r\n * Product\r\n */\r\nexport interface Product extends ProductChange {\r\n itemLineId?: number;\r\n status: number;\r\n subGroup: number;\r\n brand: string;\r\n currency: string;\r\n category: string;\r\n countryofOrigin: string;\r\n productId: string;\r\n productType: number;\r\n name?: string;\r\n imageUrls: [string];\r\n isImageFailToLoad?: boolean;\r\n size: string;\r\n type: string;\r\n season: number;\r\n productGroup: number;\r\n styleCode: string;\r\n nodeStructure: NodeStructure[];\r\n barcode: string;\r\n price: Price[];\r\n colour: string;\r\n description: string;\r\n totalLinePrice: number;\r\n total: number;\r\n addedInBasket?: boolean;\r\n selectedVAT?: number;\r\n selectedVATCode?: string;\r\n selectedRRPPrice?: number;\r\n lineDiscount?: LineDiscount;\r\n exchange?: Exchange;\r\n // refundedQuantity?: number;\r\n // refunded?: boolean;\r\n // refundedTotal?: number;\r\n // refundedReasonDescription?:string;\r\n // isChecked?:boolean;\r\n refundPromotionalQuantity?: number; // promotional quantity\r\n exchangeReason?: string;\r\n exchangeQuantity?: number;\r\n itemDiscounts: ItemDiscount;\r\n\r\n giftCardNumberIssued?: string;\r\n giftCardAmount?: number;\r\n giftCardRecipientEmail?: string;\r\n giftCardExpiryDate?: string;\r\n giftCardRecipientName?: string;\r\n giftCard?: boolean;\r\n\r\n discountable: boolean;\r\n // sealed?:boolean;\r\n excludePromotion: boolean;\r\n categories: Categories[];\r\n descriptions: Descriptions[];\r\n barcodes: string[];\r\n\r\n //New Feilds\r\n externalId: string;\r\n createdDate: string;\r\n updatedDate: string;\r\n createdBy: string;\r\n updatedBy: string;\r\n attributes: CoreAttribute[];\r\n id: string;\r\n long_description: string;\r\n\r\n // Mixed Sales fields\r\n isWebOrder?: boolean,\r\n fullfilmentId: string,\r\n fullfilmentLocationName?: string,\r\n deliveryMethod?: string,\r\n deliveryGroup?: string,\r\n selectedInventory?: InventoryInfo;\r\n leadTime?: leadTime\r\n}\r\nexport interface leadTime {\r\n type: string,\r\n value: string\r\n}\r\n\r\nexport interface Exchange {\r\n exchangeId: number,\r\n lineItemId: number,\r\n reason: string,\r\n quantity: number,\r\n newItems: Product[];\r\n}\r\n\r\nexport interface Categories {\r\n id: string;\r\n parentId: string;\r\n name: string;\r\n categoryId: string;\r\n status: boolean;\r\n}\r\n\r\nexport interface Descriptions {\r\n name: string;\r\n countryCode: string;\r\n value: string;\r\n}\r\n\r\nexport interface CoreAttribute {\r\n name: string;\r\n value: string;\r\n searchable: boolean;\r\n countryCode: string;\r\n}\r\n\r\n/**\r\n * Basket\r\n */\r\n\r\nexport interface Basket {\r\n subsidiaryId?: string;\r\n products: Product[];\r\n transactionDiscount: any[];\r\n quantity: number;\r\n total: number;\r\n saleTotal: number;\r\n discountTotal?: number;\r\n transactionId?: string;\r\n offlineTransactionId?: string;\r\n baseCurrency: string;\r\n basketTotal?: number;\r\n refundTotal?: number;\r\n transactionPromotion?: TransactionPromotion[];\r\n customer?: any;\r\n exchange?: Exchange[];\r\n inStoreFlag?: boolean\r\n}\r\n\r\n\r\n\r\n/**\r\n * Price\r\n */\r\nexport interface Price {\r\n VAT: number;\r\n VATCode: string;\r\n salesPrice: number;\r\n currencyCode: string;\r\n RRPPrice: number;\r\n}\r\n\r\n/**\r\n * Node structure\r\n */\r\ninterface NodeStructure {\r\n status: boolean;\r\n name: string;\r\n nodeType: string;\r\n isOverride: boolean;\r\n nodeId: string;\r\n parentId: string;\r\n}\r\n\r\n/**\r\n * Line Discount\r\n */\r\nexport interface LineDiscount {\r\n itemLineId: string,\r\n discountAmount: number,\r\n discountType: string,\r\n // reasonCode: string,\r\n name?: string,\r\n unitPrice: number,\r\n discountedLinePrice?: number,\r\n priceManagerOverride?: UserOverride,\r\n priceOverrideReasonCode?: string,\r\n priceOverrideReasonName?: string,\r\n priceOverrideAmount?: number,\r\n percentageDiscountManagerOverride?: UserOverride,\r\n percentageDiscountReasonCode?: string,\r\n percentageDiscountReasonName?: string,\r\n percentageDiscountValue?: number\r\n}\r\n\r\n/**\r\n * User Override\r\n */\r\nexport interface UserOverride {\r\n userId: string,\r\n automaticApprove: string,\r\n originalUserId: string\r\n}\r\n\r\n/**\r\n* line Promotions\r\n*/\r\nexport interface LinePromotions {\r\n\r\n trigger: Trigger[],\r\n itemLineId: number,\r\n promotionId: string,\r\n displayText: string,\r\n promotionType: string,\r\n promotionAmount: number,\r\n name: string,\r\n promotionInfo: string,\r\n promotionLinePrice: number\r\n refunded?: boolean;\r\n}\r\n\r\n/**\r\n* trigger\r\n*/\r\nexport interface Trigger {\r\n itemLineId: string;\r\n quantity?: number;\r\n totalQuantity?: number;\r\n}\r\n\r\n/**\r\n* Transaction Promotion\r\n*/\r\nexport interface TransactionPromotion {\r\n displayText: string;\r\n name: string;\r\n promotionAmount: number;\r\n promotionId: string;\r\n promotionInfo: string;\r\n promotionType: string;\r\n itemLineIds: number[];\r\n\r\n}\r\n\r\nexport interface RefundProductChange {\r\n itemLineId?: number;\r\n refundedQuantity?: number;\r\n refundedPromotionalQuantity?: number;\r\n refundTotal?: number;\r\n refundedReason?: string;\r\n refundedReasonDescription?: string;\r\n refundWithPromotion: boolean;\r\n isLastExchanged?: boolean;\r\n}\r\n\r\nexport interface InventoryInfo {\r\n storeName: string,\r\n storeId: string,\r\n quantityAvailable: number,\r\n quantityRequired: number\r\n}\r\n\r\nexport interface InventoryRequestInfo extends InventoryInfo {\r\n requestedQuantity: number,\r\n requestedAction: DELIVERY_METHODS\r\n}\r\n\r\nexport interface DeliveryInfo {\r\n groups: DeliveryGroupInfo[]\r\n}\r\n\r\nexport interface DeliveryGroupInfo {\r\n groupNumber: number;\r\n items: Product[];\r\n estimate?: Estimate;\r\n}\r\n\r\nexport interface Estimate {\r\n type: string,\r\n value: string\r\n}\r\n\r\nexport interface TransactionDocument {\r\n transactionId?: string;\r\n subsidiaryId?: string;\r\n offlineTransactionId?:string;\r\n transactionRef?: string;\r\n dateTime?: string;\r\n orgCode: string;\r\n storeId: string;\r\n storeNodeId:string;\r\n storeNodeStructure:string;\r\n deviceId: string;\r\n terminalId:string;\r\n initiatingModule :string;\r\n export:boolean;\r\n userId?: string;\r\n userName?:string;\r\n customer?: Customer;\r\n basket: any;\r\n basketSummary: any;\r\n // lineDiscount: LineDiscount[];\r\n baseCurrency: string;\r\n splitPayment?:boolean;\r\n isPaymentCompleted?:boolean;\r\n paymentDetails?: any;\r\n type?: string;\r\n operationStatus?: string;\r\n createdAt?: string;\r\n updatedAt?: string;\r\n transCompletedAt?: string;\r\n id?: string;\r\n saleTotal?: number;\r\n reasonCode?: string;\r\n reasonDescription?: string;\r\n override?: UserOverride;\r\n originalTransId?:string;\r\n originalExternalId?: string;\r\n apiResponse?: APIResponse; // TODO add handler as per export provider\r\n unreferencedRefund?:boolean;\r\n giftedReceipt?:boolean;\r\n currentTransactionDetails?:any;\r\n isChecked?:boolean;\r\n}\r\n\r\nexport interface APIResponse\r\n{\r\n internalId?:number;\r\n tranid?:string\r\n}\r\n\r\nexport interface CurrentTransactionDetails{\r\n products: Product[];\r\n lineDiscount?:LineDiscount[];\r\n linePromotion?:LinePromotions[];\r\n transactionPromotion?:TransactionPromotion[];\r\n transactionDiscount?:TransactionDiscount[];\r\n basketSummary?:BasketSummary; \r\n taxBreakdown?:TaxBreakdown; \r\n totalTaxSummary?:TotalTaxSummary[];\r\n}\r\nexport interface BasketSummary {\r\n totalItems: number;\r\n saleTotal: number;\r\n VATTotal: number;\r\n discountTotal: number;\r\n basketTotal: number;\r\n refundTotal?:number;\r\n}\r\n\r\nexport interface TransactionDiscount{\r\n discountAmount:number;\r\n discountType:String;\r\n reasonCode:string;\r\n override?: UserOverride;\r\n itemLineIds?:number[];\r\n}\r\n\r\nexport interface TBasket {\r\n products: TProduct[];\r\n lineDiscount:LineDiscount[];\r\n exchange:Exchange[];\r\n linePromotion:LinePromotions[];\r\n transactionPromotion?:TransactionPromotion[];\r\n transactionDiscount?:TransactionDiscount[];\r\n taxBreakdown?:TaxBreakdown;\r\n totalTaxSummary?:TotalTaxSummary[];\r\n\r\n \r\n}\r\n\r\nexport interface TExchange{\r\n exchangeId?:number,\r\n lineItemId?: number,\r\n reason?: string,\r\n quantity?: number,\r\n newItems?:TNewItems[];\r\n }\r\n \r\n export interface TNewItems{\r\n lineItemId:number,\r\n Quantity:number\r\n }\r\n\r\nexport interface TProduct {\r\n itemLineId: string;\r\n SKU: string;\r\n description: string;\r\n imageUrls: [string];\r\n price: number;\r\n taxCode?: string;\r\n taxPercent?: string;\r\n quantity: number;\r\n refundedQuantity?: number;\r\n refundedPromotionalQuantity?:number;\r\n refunded?: boolean;\r\n refundedTotal?: number;\r\n refundedReason?:string;\r\n refundedReasonDescription?:string;\r\n selectedRRPPrice?: number;\r\n totalLinePrice: number;\r\n barCode?: string;\r\n barcodes?: string[];\r\n flagged?: boolean;\r\n exchange?:Exchange;\r\n excludePromotion:boolean;\r\n discountable?:boolean;\r\n\r\n itemDiscounts?:ItemDiscounts;\r\n isLastExchanged?: boolean;\r\n\r\n // Mixed Sales fields\r\n fullfilmentId:string,\r\n fullfilmentLocationName:string,\r\n deliveryMethod?:string,\r\n deliveryGroup?:string,\r\n giftCardNumberIssued?: string,\r\n giftCardAmount?: number,\r\n giftCardRecipientEmail?: string,\r\n giftCardExpiryDate?: string ,\r\n giftCardRecipientName?: string,\r\n giftCard?:boolean,\r\n currency?:string,\r\n isWebOrder?:boolean,\r\n leadTime?: leadTime\r\n \r\n // currenttransaction doc changes\r\n lineDiscount?:any\r\n\r\n attributes?:CoreAttribute[];\r\n}\r\n\r\nexport interface ItemDiscounts{\r\n trnDiscountsPortion:number;\r\n trnPromotionsPortion:number;\r\n refundPortion:number;\r\n}\r\n\r\n\r\n\r\nexport interface Customer {\r\n id: string;\r\n title?: string;\r\n firstName: string;\r\n lastName: string;\r\n email: string;\r\n postCode: string;\r\n telephone?: string;\r\n billingAddress?: Address;\r\n shippingAddress?: Address;\r\n addressDetail?: string;\r\n noCustomerSelected?: boolean;\r\n externalId?: string; \r\n \r\n}\r\n\r\nexport interface Address \r\n{\r\n address1?: string;\r\n address2?: string;\r\n address3?: string;\r\n city?: string;\r\n county?: string;\r\n postCode?: string;\r\n country?: string;\r\n }\r\n\r\nexport interface PaymentDetails {\r\n cardNumber?: any;\r\n sqNo?:number;\r\n result?: string;\r\n currency: string;\r\n amount: string;\r\n authcode?: string;\r\n pan?: string;\r\n cardType?: string;\r\n transactionDate?: string;\r\n mid?: string;\r\n tid?: string;\r\n cvm?: string;\r\n hostReferenceId?: string;\r\n aid?: string;\r\n receiptNo?: string;\r\n expirydate?: string;\r\n transactionReference: string;\r\n applicationVersion?: string;\r\n entryMethod?:string;\r\n transactionType:string;\r\n totalamount:string;\r\n paymentType?:string;\r\n}\r\n\r\nexport interface TaxBreakdown\r\n{\r\n taxLines : TaxLine[],\r\n totalTaxableAmount: number;\r\n}\r\n\r\nexport interface TotalTaxSummary{\r\n VATCode:string,\r\n VAT : number;\r\n PreTaxSum: number\r\n TaxSum: number\r\n TXrateSum: number\r\n}\r\n\r\nexport interface TaxLine\r\n{\r\n itemLineId: number,\r\n taxableAmount: number,\r\n taxLineTotal: number,\r\n VAT: number,\r\n VATCode : string,\r\n PreTax: number\r\n}\r\n\r\nexport enum DISCOUNTTYPE {\r\n PERCENT = 'Percent',\r\n AMOUNT = 'AMOUNT'\r\n}","import { Injectable } from '@angular/core';\r\nimport { BehaviorSubject } from 'rxjs';\r\nimport { DELIVERY_METHODS } from './mapper-library.model';\r\nimport { Basket, DeliveryGroupInfo, DeliveryInfo, Product, TransactionPromotion } from './mapper-library.model';\r\nimport { TransactionDiscount } from './mapper-library.model';\r\nimport { NumberUtilService } from './number-util.service';\r\n\r\nexport class BasketService {\r\n currentBasket: Basket = {\r\n products: [],\r\n transactionDiscount: [],\r\n quantity: 0,\r\n total: 0,\r\n saleTotal: 0,\r\n baseCurrency: ''\r\n };\r\n\r\n private basketSource = new BehaviorSubject<any>(null);\r\n basket = this.basketSource.asObservable();\r\n\r\n private productSource = new BehaviorSubject<any>(null);\r\n product = this.productSource.asObservable();\r\n\r\n private peerSource = new BehaviorSubject<boolean>(false);\r\n peerSync = this.peerSource.asObservable();\r\n\r\n private scanSource = new BehaviorSubject<boolean>(false);\r\n scanner = this.scanSource.asObservable();\r\n\r\n private _isMixedBasketSales: boolean | undefined;\r\n public get isMixedBasketSales(): any {\r\n return this._isMixedBasketSales;\r\n }\r\n public set isMixedBasketSales(v: any) {\r\n this._isMixedBasketSales = v;\r\n }\r\n\r\n\r\n constructor(private numberUtilService: NumberUtilService) { }\r\n\r\n updateBasket(basket: Basket) {\r\n this.currentBasket = basket;\r\n this.isMixedBasketSales = this.filterProductListWithWebOrder(true).length > 0;\r\n this.basketSource.next(basket);\r\n }\r\n\r\n /**\r\n * calculates the total basket value and quantity\r\n * @param null\r\n * @returns void\r\n */\r\n updateBasketTotal(basketDetails: { quantity: number; total: number; products: any; transactionId: any; basketTotal: any; }, basketState: { updateBasket: (arg0: any) => void; }) {\r\n basketDetails.quantity = 0;\r\n basketDetails.total = 0;\r\n for (const p of basketDetails.products) {\r\n basketDetails.quantity = basketDetails.quantity + p.quantity;\r\n basketDetails.total =\r\n this.numberUtilService.trimTo2Decimal(basketDetails.total) +\r\n this.numberUtilService.trimTo2Decimal(p.total);\r\n }\r\n console.log(\r\n \"e:basket :basket service : basketDetails updated values for transaction id\",\r\n basketDetails.transactionId,\r\n JSON.stringify(basketDetails)\r\n );\r\n basketDetails.basketTotal = basketDetails.total;\r\n basketState.updateBasket(basketDetails);\r\n }\r\n\r\n /**\r\n * add Line promotion\r\n * @param null\r\n * @returns basketDetails\r\n */\r\n addlinePromotion(promotionList: { result: { linePromotions: string | any[]; }; }, basketDetails: { products: any; }) {\r\n console.log(\r\n \"e:basket :basket Service : promotionList and basketDetails for linePromotions\",\r\n JSON.stringify(promotionList),\r\n JSON.stringify(basketDetails)\r\n );\r\n if (\r\n promotionList &&\r\n promotionList.result &&\r\n promotionList.result.linePromotions &&\r\n promotionList.result.linePromotions.length > 0\r\n ) {\r\n for (var element of basketDetails.products) {\r\n for (var promotionelement of promotionList.result.linePromotions) {\r\n if (\r\n element.itemLineId.toString() ===\r\n promotionelement.itemLineId.toString()\r\n ) {\r\n element.linePromotions = promotionelement;\r\n }\r\n }\r\n }\r\n }\r\n return basketDetails;\r\n }\r\n\r\n /**\r\n * add Transaction promotion\r\n * @param null\r\n * @returns basketDetails\r\n */\r\n\r\n addTransactionPromotion(promotionList: { result: { transactionPromotion: any }; }, basketdetails: Basket) {\r\n console.log(\r\n \"e:basket :basket Service : promotionList and basketDetails for transactionPromotion\",\r\n JSON.stringify(promotionList),\r\n JSON.stringify(basketdetails),\r\n JSON.stringify(basketdetails.transactionPromotion)\r\n );\r\n if (\r\n promotionList &&\r\n promotionList.result &&\r\n promotionList.result.transactionPromotion &&\r\n promotionList.result.transactionPromotion.length > 0\r\n ) {\r\n promotionList.result.transactionPromotion.forEach((tPromotion: any) => {\r\n let transactionPromotionEntryUpdated: any = Object.assign(\r\n {},\r\n tPromotion\r\n );\r\n\r\n transactionPromotionEntryUpdated.itemLineIds = basketdetails.products.map(\r\n (product) => {\r\n return product.itemLineId;\r\n }\r\n );\r\n\r\n if (!basketdetails.transactionPromotion) {\r\n basketdetails.transactionPromotion = [];\r\n }\r\n basketdetails.transactionPromotion.push(\r\n transactionPromotionEntryUpdated\r\n );\r\n\r\n basketdetails = this.transactionPromotionProductPortionCalc(\r\n basketdetails,\r\n transactionPromotionEntryUpdated\r\n );\r\n });\r\n }\r\n console.log(\r\n \"basket details in refund calculation file\",\r\n JSON.stringify(basketdetails)\r\n );\r\n return basketdetails;\r\n }\r\n\r\n updateProductTotalForSummary(basketDetails: { total: string | number; quantity: string | number; products: any; }) {\r\n /*sale- product refundedQuantity = undefined\r\n partial refund - product refundedQuantity is > 0\r\n total refund - proudct refundedQuantity is > 0\r\n exchange - exchange product refundedQuantity is > 0 \r\n new product refundedQuantity = undefined \r\n old product without exchange refundedQuantity = 0\r\n unreference refund-product refundedQuantity is > 0 */\r\n\r\n basketDetails.total = 0;\r\n basketDetails.quantity = 0;\r\n for (var product of basketDetails.products) {\r\n if (product.linePromotions) {\r\n product.total = product.linePromotions.promotionLinePrice;\r\n } else if (product.lineDiscount && !product.linePromotions) {\r\n product.total = product.lineDiscount.discountedLinePrice;\r\n } else {\r\n product.total = product.totalLinePrice;\r\n }\r\n product.total =\r\n product.total -\r\n Math.abs(product.refundedTotal ? product.refundedTotal : 0);\r\n\r\n basketDetails.total += product.total;\r\n basketDetails.quantity =\r\n basketDetails.quantity +\r\n (product.quantity -\r\n (product.refundedQuantity ? product.refundedQuantity : 0));\r\n console.log(\r\n \"e-basket:ExchangeSummaryScreen:update basketdetails total :\" +\r\n basketDetails.total +\r\n \" Product line ID : \" +\r\n product.itemLineId +\r\n \" product total : \" +\r\n product.total,\r\n \"quantity : \" + basketDetails.quantity\r\n );\r\n }\r\n return this.updateBasketTotalForSummary(basketDetails);\r\n }\r\n\r\n updateBasketTotalForSummary(basketDetails: any) {\r\n basketDetails.basketTotal = basketDetails.total;\r\n console.info(\r\n \"ebasket : basket Service : update Basket Total for transaction transactionDiscount \",\r\n JSON.stringify(basketDetails.transactionDiscount)\r\n );\r\n\r\n console.info(\r\n \"ebasket : basket Service : update Basket Total for transaction transactionPromotion \",\r\n JSON.stringify(basketDetails.transactionPromotion)\r\n );\r\n\r\n basketDetails = this.updateTransactionPromotion(basketDetails);\r\n basketDetails = this.updateTransactionDiscount(basketDetails);\r\n basketDetails.basketTotal = Number(basketDetails.basketTotal.toFixed(2));\r\n\r\n console.info(\r\n \"ebasket : basket Service : update Basket Total: basketTotal after promotion applied for basketTotal\",\r\n basketDetails.basketTotal\r\n );\r\n return basketDetails;\r\n }\r\n\r\n updateTransactionDiscount(basketDetails: { transactionDiscount: any[]; basketTotal: number; }) {\r\n if (\r\n basketDetails.transactionDiscount &&\r\n basketDetails.transactionDiscount.length > 0\r\n ) {\r\n const discountTotal = basketDetails.transactionDiscount.reduce(\r\n (n: any, { discountAmount }: any) => n + discountAmount,\r\n 0\r\n );\r\n console.log(\"ebasket : basket Service : discountTotal \", discountTotal);\r\n basketDetails.basketTotal =\r\n basketDetails.basketTotal - Math.abs(discountTotal);\r\n }\r\n return basketDetails;\r\n }\r\n\r\n updateTransactionPromotion(basketDetails: { transactionPromotion: any[]; basketTotal: number; }) {\r\n if (\r\n basketDetails.transactionPromotion &&\r\n basketDetails.transactionPromotion.length > 0\r\n ) {\r\n const discountTotal = basketDetails.transactionPromotion.reduce(\r\n (n: any, { promotionAmount }: any) => n + promotionAmount,\r\n 0\r\n );\r\n basketDetails.basketTotal =\r\n basketDetails.basketTotal - Math.abs(discountTotal);\r\n }\r\n return basketDetails;\r\n }\r\n\r\n updateBasketTotalWithoutDiscount(basket: Basket): Basket {\r\n basket.total = 0;\r\n basket.quantity = 0;\r\n\r\n for (var product of basket.products) {\r\n if (product.linePromotions) {\r\n product.total = product.linePromotions.promotionLinePrice;\r\n } else if (product.lineDiscount && !product.linePromotions) {\r\n product.total = product.lineDiscount.discountedLinePrice || 0;\r\n } else {\r\n product.total = product.totalLinePrice;\r\n }\r\n\r\n product.total =\r\n product.total -\r\n Math.abs(product.refundedTotal ? product.refundedTotal : 0);\r\n basket.total += product.total;\r\n basket.quantity =\r\n basket.quantity +\r\n (product.quantity -\r\n (product.refundedQuantity ? product.refundedQuantity : 0));\r\n\r\n console.log(\r\n \"e-basket:basket service:update basketdetails total :\" +\r\n JSON.stringify(basket) +\r\n basket.total +\r\n \" Product line ID : \" +\r\n product.itemLineId +\r\n \" product total : \" +\r\n product.total\r\n );\r\n }\r\n\r\n basket.basketTotal = basket.total;\r\n return basket;\r\n }\r\n\r\n updateBasketTotalWithDiscounts(basket: any): Basket {\r\n console.log(\r\n \"e:basket :RefundBasketScreen : this.basketDetails new values\",\r\n basket,\r\n JSON.stringify(basket.basketTotal)\r\n );\r\n if (basket.transactionPromotion && basket.transactionPromotion.length > 0) {\r\n const discountTotal = basket.transactionPromotion.reduce(\r\n (n: any, { promotionAmount }: any) => n + promotionAmount,\r\n 0\r\n );\r\n basket.basketTotal = basket.basketTotal - discountTotal;\r\n }\r\n if (basket.transactionDiscount && basket.transactionDiscount.length > 0) {\r\n const discountTotal = basket.transactionDiscount.reduce(\r\n (n: any, { discountAmount }: any) => n + discountAmount,\r\n 0\r\n );\r\n\r\n basket.basketTotal = basket.basketTotal - discountTotal;\r\n }\r\n console.log(\r\n \"e:basket :RefundBasketScreen : basket new values\",\r\n JSON.stringify(basket)\r\n );\r\n\r\n return basket;\r\n }\r\n\r\n transactionDiscountAndPromotionProductortionCalculation(basket: Basket) {\r\n if (basket.transactionDiscount && basket.transactionDiscount.length > 0) {\r\n basket.transactionDiscount.forEach(\r\n (discount) =>\r\n (basket = this.transactionDiscountProductPortionCalc(\r\n basket,\r\n discount\r\n ))\r\n );\r\n }\r\n\r\n if (basket.transactionPromotion && basket.transactionPromotion.length > 0) {\r\n basket.transactionPromotion.forEach((promotion) => {\r\n basket = this.transactionPromotionProductPortionCalc(basket, promotion);\r\n });\r\n }\r\n console.log(\r\n \"ebasket: basket item discount protion calculation\",\r\n basket,\r\n basket.products\r\n );\r\n return basket;\r\n }\r\n\r\n transactionPromotionProductPortionCalc(\r\n basket: any,\r\n promotion: any\r\n ) {\r\n let total = 0;\r\n let percentage = 0;\r\n {\r\n basket.products.forEach((p:any) => {\r\n if (promotion.itemLineIds.includes(p.itemLineId)) {\r\n p = this.validateProductItemDiscount(p);\r\n const productContributionInTotal =\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnDiscountsPortion) +\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnPromotionsPortion) -\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.refundPortion);\r\n total += (p.total - this.numberUtilService.trimTo2Decimal2(productContributionInTotal));\r\n }\r\n });\r\n console.log(\r\n `ebasket: trnsactionPromotion: ${JSON.stringify(\r\n promotion\r\n )}, selected products total: ${total}`\r\n );\r\n basket.products.forEach((product: any) => {\r\n product = this.validateProductItemDiscount(product);\r\n\r\n const productContributionInTotal =\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnDiscountsPortion) +\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnPromotionsPortion) -\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.refundPortion);\r\n\r\n if (promotion.itemLineIds.includes(product.itemLineId)) {\r\n percentage = ((product.total - this.numberUtilService.trimTo2Decimal2(productContributionInTotal)) / total) * 100;\r\n product.itemDiscounts.trnPromotionsPortion +=\r\n (promotion.promotionAmount * percentage) / 100;\r\n product.itemDiscounts.trnPromotionsPortion = this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnPromotionsPortion);\r\n }\r\n });\r\n }\r\n return basket;\r\n }\r\n\r\n transactionDiscountProductPortionCalc(\r\n basket: any,\r\n discount: any\r\n ) {\r\n let total = 0;\r\n let percentage = 0;\r\n\r\n basket.products.forEach((p: any) => {\r\n if (discount.itemLineIds.includes(p.itemLineId)) {\r\n p = this.validateProductItemDiscount(p);\r\n const productContributionInTotal =\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnDiscountsPortion) +\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnPromotionsPortion) -\r\n this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.refundPortion);\r\n\r\n\r\n total += (p.total - this.numberUtilService.trimTo2Decimal2(productContributionInTotal));\r\n }\r\n });\r\n\r\n console.log(\r\n `ebasket: trnsactionDiscount: ${JSON.stringify(\r\n discount\r\n )}, selected products total: ${total}`\r\n );\r\n\r\n basket.products.forEach((product:any) => {\r\n product = this.validateProductItemDiscount(product);\r\n console.log(product.discountable, \"ebasket : basket service : discountable in basket service\");\r\n\r\n const productContributionInTotal =\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnDiscountsPortion) +\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnPromotionsPortion) -\r\n this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.refundPortion);\r\n\r\n if (discount.itemLineIds.includes(product.itemLineId) && product.discountable == true) {\r\n percentage = ((product.total - this.numberUtilService.trimTo2Decimal2(productContributionInTotal)) / total) * 100;\r\n product.itemDiscounts.trnDiscountsPortion +=\r\n (discount.discountAmount * percentage) / 100;\r\n product.itemDiscounts.trnDiscountsPortion = this.numberUtilService.trimTo2Decimal2(product.itemDiscounts.trnDiscountsPortion)\r\n }\r\n });\r\n return basket;\r\n }\r\n\r\n public validateProductItemDiscount(product: Product) {\r\n if (!product.itemDiscounts) {\r\n product.itemDiscounts = {\r\n trnDiscountsPortion: 0,\r\n trnPromotionsPortion: 0,\r\n refundPortion: 0,\r\n };\r\n }\r\n return product;\r\n }\r\n\r\n markProduct(product: Product) {\r\n this.productSource.next(product);\r\n }\r\n stopPeerSyncProcess(peerSync: boolean) {\r\n this.peerSource.next(peerSync);\r\n }\r\n\r\n scanStart(isScanning: boolean) {\r\n this.scanSource.next(isScanning);\r\n }\r\n\r\n promotionRemainingCalculation(promotion: TransactionPromotion[]) {\r\n var promotionValue = 0;\r\n promotion.forEach((element) => {\r\n promotionValue += element.promotionAmount;\r\n });\r\n return promotionValue;\r\n }\r\n\r\n discountRemainingCalculation(discount: TransactionDiscount[]) {\r\n var discountValue = 0;\r\n discount.forEach((element) => {\r\n discountValue += element.discountAmount;\r\n });\r\n return discountValue;\r\n }\r\n\r\n discountRefundedCalculation(discount: TransactionDiscount[]) {\r\n var discountValue = 0;\r\n discount.forEach((element) => {\r\n if (element.discountAmount < 0) {\r\n discountValue += element.discountAmount;\r\n }\r\n });\r\n return discountValue;\r\n }\r\n\r\n generateNewItemLineId(products: Product[]) {\r\n let largestNumber: any = 0;\r\n\r\n if (products.length > 0) {\r\n let itemLineIdArray = products.map((product) => {\r\n return product.itemLineId;\r\n });\r\n\r\n largestNumber = itemLineIdArray.reduce((a :any, b:any) => Math.max(a, b));\r\n }\r\n\r\n return largestNumber + 1;\r\n }\r\n\r\n updateBasketProductDataAsPerQuantity(\r\n product: any,\r\n quantity: number\r\n ): Product {\r\n\r\n console.log(`ebasket: updateBasketProductDataAsPerQuantity : ${quantity} product: ${JSON.stringify(product)}`);\r\n product.quantity = quantity;\r\n if (product.hasOwnProperty(\"lineDiscount\")) {\r\n // && this.product.quantity !== this.productDetailForm.controls.quantity.value\r\n product.lineDiscount.discountedLinePrice = Number(\r\n this.numberUtilService.getFlooredFixed(\r\n product.lineDiscount.unitPrice * quantity,\r\n 2\r\n )\r\n );\r\n product.lineDiscount.discountAmount =\r\n product.totalLinePrice - product.lineDiscount.discountedLinePrice;\r\n } else {\r\n product.totalLinePrice =\r\n quantity * this.numberUtilService.trimTo2Decimal(product.selectedPrice);\r\n }\r\n if (product.lineDiscount) {\r\n product.total = product.lineDiscount.discountedLinePrice;\r\n } else {\r\n product.total = product.totalLinePrice;\r\n }\r\n console.log(`ebasket: updateBasketProductDataAsPerQuantity : ${quantity} product: ${JSON.stringify(product)}`);\r\n\r\n return product;\r\n }\r\n\r\n filterProductListWithWebOrder(isWebOrder: boolean): Product[] {\r\n console.log(\"ebasket: filterProductListWithWebOrder hit\", JSON.stringify(this.currentBasket.products));\r\n if (isWebOrder)\r\n return this.currentBasket.products.filter((x) => x.isWebOrder);\r\n else {\r\n return this.currentBasket.products.filter((x) => !x.isWebOrder);\r\n }\r\n }\r\n\r\n filterProductListWithDelivery(): Product[] {\r\n console.log(\"ebasket: filterProductListWithDelivery hit\", JSON.stringify(this.currentBasket.products));\r\n return this.currentBasket.products.filter((x) => x.deliveryMethod === DELIVERY_METHODS.DELIVERY.toString());\r\n }\r\n\r\n filterProductListWithDeliveryGroup(group: string, products: Product[]): Product[] {\r\n console.log(\"ebasket: filterProductListWithDeliveryGroup hit\", JSON.stringify(products));\r\n return products.filter((x) => x.deliveryGroup === group);\r\n }\r\n\r\n generateNewDeliveryGroupNumber(products: Product[]) {\r\n let largestNumber = 0;\r\n\r\n if (products.length > 0) {\r\n let deliveryGroupArr = products.map((product) => {\r\n if (product.deliveryGroup) {\r\n return parseInt(product.deliveryGroup);\r\n }\r\n return 0;\r\n });\r\n\r\n largestNumber = deliveryGroupArr.reduce((a, b) => Math.max(a, b));\r\n }\r\n\r\n return (largestNumber + 1).toString();\r\n }\r\n\r\n getDeliveryGroupNumbers(products: Product[]) {\r\n console.log(\"getDeliveryGroupNumbers initiating : \", JSON.stringify(products));\r\n\r\n let uniqueAndsortedResult: number[] = [];\r\n\r\n if (products.length > 0) {\r\n let deliveryGroupArr = products.map((product) => {\r\n if (product.deliveryGroup) {\r\n return parseInt(product.deliveryGroup);\r\n }\r\n else if (product.deliveryMethod === \"1\") {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n\r\n uniqueAndsortedResult = Array.from(new Set(deliveryGroupArr)).sort((a, b) => a - b);\r\n console.log(\"getDeliveryGroupNumbers : \", JSON.stringify(uniqueAndsortedResult));\r\n }\r\n return uniqueAndsortedResult;\r\n }\r\n\r\n updateProductsWithNewDeliveryGroupNumber(products: Product[]) {\r\n console.log(\"updateProductsWithNewDeliveryGroupNumber initiating : \", JSON.stringify(products));\r\n\r\n let newGroupNumber = this.generateNewDeliveryGroupNumber(this.currentBasket.products);\r\n if (products.length > 0) {\r\n this.currentBasket.products.forEach(cBProducts => {\r\n products.forEach(element => {\r\n if (cBProducts.itemLineId === element.itemLineId) {\r\n cBProducts.deliveryGroup = newGroupNumber;\r\n }\r\n\r\n });\r\n });\r\n\r\n }\r\n\r\n this.updateBasket(this.currentBasket);\r\n return;\r\n }\r\n\r\n calculateEstimatedTime(products: any[]) {\r\n try {\r\n let time;\r\n let estmatedTime: number = 0;\r\n let estimatedDays: string = \"Hours\";\r\n products.forEach((element: { leadTime: { type: string; value: any; }; }) => {\r\n\r\n if (element.leadTime.type.toLocaleLowerCase() === \"weeks\") {\r\n time = Number(element.leadTime.value) * 24 * 7;\r\n estmatedTime = Math.max(estmatedTime, time);\r\n estimatedDays = (estmatedTime === time) ? element.leadTime.type : estimatedDays\r\n console.log(\"week\", estmatedTime, estimatedDays);\r\n\r\n } else if (element.leadTime.type.toLocaleLowerCase() === \"days\") {\r\n time = Number(element.leadTime.value) * 24;\r\n estmatedTime = Math.max(estmatedTime, time);\r\n estimatedDays = (estmatedTime === time) ? element.leadTime.type : estimatedDays\r\n\r\n console.log(\"days\", estmatedTime, estimatedDays);\r\n\r\n }\r\n else if (element.leadTime.type.toLocaleLowerCase() === \"months\") {\r\n time = Number(element.leadTime.value) * 24 * 30;\r\n estmatedTime = Math.max(estmatedTime, time);\r\n estimatedDays = (estmatedTime === time) ? element.leadTime.type : estimatedDays\r\n\r\n console.log(\"months\", estmatedTime, estimatedDays);\r\n\r\n }\r\n else if (element.leadTime.type.toLocaleLowerCase() === \"years\") {\r\n time = Number(element.leadTime.value) * 24 * 365;\r\n estmatedTime = Math.max(estmatedTime, time);\r\n estimatedDays = (estmatedTime === time) ? element.leadTime.type : estimatedDays\r\n\r\n console.log(\"years\", estmatedTime, estimatedDays);\r\n\r\n } else {\r\n time = Number(element.leadTime.value);\r\n estmatedTime = Math.max(estmatedTime, time);\r\n estimatedDays = (estmatedTime === time) ? element.leadTime.type : estimatedDays;\r\n console.log(\"hours\", estmatedTime, estimatedDays);\r\n\r\n }\r\n });\r\n\r\n if (estimatedDays.toLocaleLowerCase() === \"days\") {\r\n estmatedTime = estmatedTime / 24;\r\n } else if (estimatedDays.toLocaleLowerCase() === \"weeks\") {\r\n estmatedTime = estmatedTime / (24 * 7);\r\n } else if (estimatedDays.toLocaleLowerCase() === \"months\") {\r\n estmatedTime = estmatedTime / (24 * 30);\r\n } else if (estimatedDays.toLocaleLowerCase() === \"years\") {\r\n estmatedTime = estmatedTime / (24 * 365);\r\n }\r\n\r\n let estimate = {\r\n value: estmatedTime.toString(),\r\n type: estimatedDays\r\n }\r\n return estimate;\r\n } catch (error) {\r\n console.log(\"error in calculateEstimatedTime\", error);\r\n }\r\n return 0;\r\n }\r\n\r\n updateProductsWithDeliveryGroupNumber(oldGroup: string, newGroup: string) {\r\n console.log(\"updateProductsWithDeliveryGroupNumber initiating\");\r\n\r\n this.currentBasket.products.forEach(cBProducts => {\r\n if (cBProducts.deliveryGroup === oldGroup) {\r\n cBProducts.deliveryGroup = newGroup;\r\n }\r\n\r\n });\r\n\r\n this.updateBasket(this.currentBasket);\r\n return;\r\n }\r\n\r\n getDeliveryInfo(): any {\r\n console.log(\"getDeliveryGroupInfor initiating\");\r\n try {\r\n let groupInfo: DeliveryInfo = {\r\n groups: []\r\n }\r\n\r\n this.getDeliveryGroupNumbers(this.currentBasket.products).forEach((groupNumber) => {\r\n let group: any = {\r\n groupNumber: groupNumber,\r\n items: [],\r\n estimate: {\r\n type: \"Hours\",\r\n value: \"0\"\r\n }\r\n }\r\n this.currentBasket.products.forEach(cBProducts => {\r\n if (cBProducts.deliveryGroup === groupNumber.toString()) {\r\n group.items.push(cBProducts);\r\n }\r\n });\r\n\r\n group.estimate = this.calculateEstimatedTime(group.items);\r\n\r\n groupInfo.groups.push(group);\r\n\r\n });\r\n\r\n return groupInfo;\r\n }\r\n catch (error) {\r\n console.log(\"error\", error);\r\n }\r\n }\r\n}\r\n","import { CurrencyPipe } from \"@angular/common\";\r\nimport { Injectable } from \"@angular/core\";\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class NumberUtilService {\r\n constructor( private cp: CurrencyPipe) {}\r\n\r\n trimTo2Decimal(no: any) {\r\n //return Math.floor(no * 100) / 100;\r\n return no;\r\n }\r\n\r\n trimTo2Decimal2(no: number) {\r\n return Number(this.getFlooredFixed(no,2));\r\n }\r\n\r\n getFlooredFixed(v:any, d:any) {\r\n return (Math.floor(v * Math.pow(10, d)) / Math.pow(10, d)).toFixed(d);\r\n }\r\n\r\n AppendWithCurrencySymbol(numValue: any, currencyCode: string): string {\r\n let returnValue: any = \"\";\r\n if (numValue) {\r\n const numb: number = parseFloat(numValue.toString().replace(',',''));\r\n returnValue = this.cp.transform(\r\n Number(numValue).toFixed(2),\r\n currencyCode.toLocaleUpperCase(),\r\n \"symbol\"\r\n );\r\n console.log(\"AppendWithCurrencySymbol :\" + returnValue);\r\n } else {\r\n returnValue = this.cp.transform(\r\n \"0.00\",\r\n currencyCode.toLocaleUpperCase(),\r\n \"symbol\"\r\n );\r\n }\r\n return returnValue;\r\n }\r\n}\r\n","import { CurrencyPipe } from \"@angular/common\";\r\nimport { BasketSummary, CurrentTransactionDetails, Customer, DELIVERY_METHODS, ItemDiscounts, TaxBreakdown, TaxLine, TBasket, TotalTaxSummary, TProduct, TransactionDocument } from \"./mapper-library.model\";\r\nimport { TRANSACTION_TYPE, Basket, LineDiscount, LinePromotions, Product, UserOverride } from \"./mapper-library.model\";\r\nimport { BasketService } from \"./basket.service\";\r\nimport { NumberUtilService } from \"./number-util.service\";\r\n\r\n/**\r\n * Transaction document builder\r\n */\r\nexport class TransactionDocumentBuilder {\r\n private transactionDocument: TransactionDocument;\r\n private numberUtilService: NumberUtilService;\r\n private storeInfo : any;\r\n \r\n constructor(\r\n transactionDoc?: TransactionDocument,\r\n private currencyPipe?: CurrencyPipe,\r\n private basketService?: BasketService | any,\r\n ) {\r\n this.numberUtilService = new NumberUtilService(currencyPipe);\r\n this.basketService = new BasketService(this.numberUtilService);\r\n this.storeInfo = JSON.parse(localStorage.getItem('storeInfo') || '{}');\r\n if (transactionDoc) {\r\n this.transactionDocument = transactionDoc;\r\n } else {\r\n this.transactionDocument = {\r\n transactionId: \"\",\r\n offlineTransactionId: \"\",\r\n transactionRef: \"\",\r\n dateTime: \"\",\r\n orgCode: \"\",\r\n storeId: \"\",\r\n storeNodeId: \"\",\r\n storeNodeStructure: \"\",\r\n deviceId: \"\",\r\n terminalId: \"\",\r\n userId: \"\",\r\n initiatingModule : \"eBasket\",\r\n export: false,\r\n basket: {} as TBasket,\r\n basketSummary: {} as BasketSummary,\r\n baseCurrency: \"\",\r\n type: \"\",\r\n operationStatus: \"\",\r\n createdAt: \"\",\r\n updatedAt: \"\",\r\n id: \"\",\r\n currentTransactionDetails: {} as CurrentTransactionDetails,\r\n saleTotal: 0,\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Transactions ref\r\n * @returns ref\r\n */\r\n transactionRef(): TransactionDocumentBuilder {\r\n const storeDetails = JSON.parse(localStorage.getItem('storeInfo') || '{}');\r\n const date = new Date();\r\n const random = (((1 + Math.random()) * 0x10000) | 0)\r\n .toString(16)\r\n .substring(1);\r\n this.transactionDocument.transactionRef =\r\n storeDetails.orgCode + storeDetails.storeId + date.toISOString() + random;\r\n console.log(\"ebasket: transaction ref created\", this.transactionDocument.transactionRef)\r\n return this;\r\n }\r\n\r\n /**\r\n * Transactions id\r\n * @param transactionID\r\n * @returns id\r\n */\r\n transactionId(transactionID: string, isOnline: boolean = true): TransactionDocumentBuilder {\r\n if (isOnline) {\r\n this.transactionDocument.transactionId = transactionID;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Transactions id\r\n * @param transactionID\r\n * @returns id\r\n */\r\n offlineTransactionId(transactionID: string, isOnline: any): TransactionDocumentBuilder {\r\n if (!isOnline) {\r\n this.transactionDocument.offlineTransactionId = transactionID;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * storeNode Id\r\n * @param storeNodeId\r\n * @returns id\r\n */\r\n storeNodeId(storeNodeId: string): TransactionDocumentBuilder {\r\n this.transactionDocument.storeNodeId = storeNodeId;\r\n return this;\r\n }\r\n\r\n /**\r\n* storeNode structure\r\n* @param storeNodeStructure\r\n* @returns id\r\n*/\r\n storeNodeStructure(storeNodeStructure: string): TransactionDocumentBuilder {\r\n this.transactionDocument.storeNodeStructure = storeNodeStructure;\r\n return this;\r\n }\r\n\r\n /**\r\n * Orgs code\r\n * @param orgCode\r\n * @returns code\r\n */\r\n orgCode(orgCode: any): TransactionDocumentBuilder {\r\n this.transactionDocument.orgCode = orgCode;\r\n return this;\r\n }\r\n /**\r\n * Stores id\r\n * @param storeId\r\n * @returns id\r\n */\r\n storeId(storeId: any): TransactionDocumentBuilder {\r\n this.transactionDocument.storeId = storeId;\r\n return this;\r\n }\r\n /**\r\n * Dates time\r\n * @returns time\r\n */\r\n dateTime(): TransactionDocumentBuilder {\r\n const date = new Date();\r\n this.transactionDocument.dateTime = date.toISOString();\r\n return this;\r\n }\r\n /**\r\n * Devices id\r\n * @param deviceId\r\n * @returns id\r\n */\r\n deviceId(deviceId: any): TransactionDocumentBuilder {\r\n this.transactionDocument.deviceId = deviceId;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * terminal id\r\n * @param terminalId\r\n * @returns id\r\n */\r\n terminalId(terminalId: any): TransactionDocumentBuilder {\r\n this.transactionDocument.terminalId = terminalId;\r\n return this;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n /**\r\n * saleExport\r\n * @param saleExport\r\n * @returns id\r\n */\r\n export(saleExport: any): TransactionDocumentBuilder {\r\n this.transactionDocument.export = saleExport;\r\n return this;\r\n }\r\n\r\n\r\n\r\n /* customer(): TransactionDocumentBuilder {\r\n const user = JSON.parse(localStorage.getItem('userDetails'));\r\n this.transactionDocument.customer = user;\r\n return this;\r\n } */\r\n /**\r\n * Baskets transaction document builder\r\n * @param basketDetails\r\n * @returns basket\r\n */\r\n basket(basketDetails: Basket): TransactionDocumentBuilder {\r\n console.log(\"ebasket: basket details update in transaction document\", JSON.stringify(basketDetails));\r\n\r\n this.transactionDocument.subsidiaryId = basketDetails.subsidiaryId || (localStorage.getItem('subsidiaryId') || '');\r\n this.transactionDocument.basket.products = [] as TProduct[];\r\n this.transactionDocument.basket.lineDiscount = [];\r\n this.transactionDocument.basket.linePromotion = [];\r\n this.transactionDocument.basket.transactionPromotion = [];\r\n basketDetails.products.forEach((product: any, index) => {\r\n const p = {} as TProduct;\r\n p.itemDiscounts = {} as ItemDiscounts;\r\n p.SKU = product.SKU;\r\n p.excludePromotion = product.excludePromotion;\r\n p.barCode = product.barcode;\r\n p.barcodes = product.barcodes;\r\n p.description = product.description;\r\n p.itemLineId = product.itemLineId ? product.itemLineId.toString() : \"\" + (index + 1);\r\n p.price = product.selectedPrice;\r\n p.quantity = product.quantity;\r\n p.totalLinePrice = product.quantity * product.selectedPrice;\r\n p.imageUrls = product.imageUrls;\r\n p.selectedRRPPrice = product.selectedRRPPrice;\r\n\r\n //inventory fields\r\n \r\n p.fullfilmentId = product.fullfilmentId? product.fullfilmentId: this.storeInfo.storeId;\r\n\r\n p.fullfilmentLocationName = product.fullfilmentLocationName;\r\n p.deliveryGroup = product.deliveryGroup;\r\n p.leadTime = product.leadTime;\r\n p.deliveryMethod = product.deliveryMethod;\r\n\r\n p.giftCard = product.giftCard;\r\n p.giftCardExpiryDate = product.giftCardExpiryDate;\r\n p.giftCardNumberIssued = product.giftCardNumberIssued;\r\n p.giftCardRecipientEmail = product.giftCardRecipientEmail;\r\n p.giftCardRecipientName = product.giftCardRecipientName;\r\n\r\n if (product.refundedQuantity > 0) {\r\n p.refundedQuantity = product.refundedQuantity;\r\n p.refundedPromotionalQuantity = product.refundPromotionalQuantity;\r\n p.refunded = product.refunded;\r\n p.refundedReasonDescription = product.refundedReasonDescription;\r\n p.refundedReason = product.refundedReason;\r\n if (!p.refundedReasonDescription) {\r\n p.refundedReasonDescription = p.refundedReason;\r\n }\r\n p.refundedTotal = product.refundedTotal;\r\n p.isLastExchanged = product.isLastExchanged;\r\n }\r\n\r\n if (product.exchange) {\r\n p.exchange = product.exchange;\r\n }\r\n if (product.lineDiscount) {\r\n p.lineDiscount = product.lineDiscount;\r\n }\r\n p.itemDiscounts = product.itemDiscounts as ItemDiscounts;\r\n this.transactionDocument.basket.products.push(p);\r\n this.lineDiscount(basketDetails);\r\n });\r\n console.info(\"ebasket: transactiondocument basket details updated\", JSON.stringify(this.transactionDocument.basket));\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * current transaction Details Total(New Products)\r\n * @returns currentTransactionDetails\r\n */\r\n\r\n currentTransactionDetails(basket: Basket): TransactionDocumentBuilder {\r\n console.log(\"ebasket: current transaction details for exchanges\", basket);\r\n this.transactionDocument.currentTransactionDetails.products = [] as Product[];\r\n this.transactionDocument.currentTransactionDetails.linePromotion = [] as LinePromotions[];\r\n this.transactionDocument.currentTransactionDetails.lineDiscount = [] as LineDiscount[];\r\n this.transactionDocument.currentTransactionDetails.transactionDiscount = [];\r\n this.transactionDocument.currentTransactionDetails.products = basket.products;\r\n this.transactionDocument.currentTransactionDetails.products = this.transactionDocument.currentTransactionDetails.products.filter(\r\n ( proj: { refundedQuantity: number; }) => proj.refundedQuantity != 0\r\n );\r\n\r\n this.transactionDocument.currentTransactionDetails.products.forEach((product: { refundedQuantity: any; quantity: any; totalLinePrice: number; refundedTotal: number; total: any; refunded: boolean; linePromotions: any; lineDiscount: any; }) => {\r\n if (product.refundedQuantity) {\r\n product.quantity = product.refundedQuantity;\r\n // updating total line price with actual price to be refunded including the refunding qty\r\n product.totalLinePrice = Math.abs(product.refundedTotal);\r\n product.total = product.totalLinePrice;\r\n if (product.quantity === product.refundedQuantity) {\r\n product.refunded = true;\r\n }\r\n }\r\n //Updating line promotions and line discounts \r\n if (product.linePromotions && !product.refundedQuantity) {\r\n this.transactionDocument.currentTransactionDetails.linePromotion.push(product.linePromotions)\r\n }\r\n if (product.lineDiscount && !product.refundedQuantity) {\r\n this.transactionDocument.currentTransactionDetails.lineDiscount.push(product.lineDiscount)\r\n }\r\n });\r\n\r\n console.log(\"ebasket: current transaction details after removing old products\", this.transactionDocument.currentTransactionDetails.products);\r\n\r\n if (basket.transactionDiscount && basket.transactionDiscount.length > 0) {\r\n this.transactionDocument.currentTransactionDetails.transactionDiscount.push(...basket.transactionDiscount);\r\n }\r\n this.transactionDocument.currentTransactionDetails.basketSummary = {} as BasketSummary;\r\n\r\n this.transactionDocument.currentTransactionDetails.basketSummary.saleTotal = this.numberUtilService.trimTo2Decimal2(this.updateSaleTotal(this.transactionDocument.currentTransactionDetails));\r\n this.transactionDocument.currentTransactionDetails.basketSummary.totalItems = basket.quantity;\r\n\r\n\r\n this.transactionDocument.currentTransactionDetails.basketSummary.basketTotal = basket.basketTotal;\r\n this.transactionDocument.currentTransactionDetails.basketSummary.refundTotal = this.updateCurrentTransactionDetailsRefundTotal();\r\n // For partial refund discount is updatied in total line price so discountTotal will always be zero & in case of exchange discount total is calculated\r\n\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.SALE_EXCHANGE) {\r\n this.transactionDocument.currentTransactionDetails.basketSummary.discountTotal = this.numberUtilService.trimTo2Decimal2(this.updateCurrentTransactionDetailsDiscountTotal());\r\n } else {\r\n if (this.transactionDocument.currentTransactionDetails.transactionDiscount && this.transactionDocument.currentTransactionDetails.transactionDiscount.length > 0) {\r\n let discountTotal = 0;\r\n this.transactionDocument.currentTransactionDetails.transactionDiscount.forEach((discount: { discountAmount: number; }) => {\r\n discountTotal += discount.discountAmount;\r\n });\r\n this.transactionDocument.currentTransactionDetails.basketSummary.discountTotal = Math.abs(discountTotal);\r\n } else {\r\n this.transactionDocument.currentTransactionDetails.basketSummary.discountTotal = 0;\r\n }\r\n }\r\n\r\n console.log(\"ebasket:this.transactionDocument.currentTransactionDetails\", JSON.stringify(this.transactionDocument.currentTransactionDetails));\r\n return this;\r\n }\r\n\r\n\r\n /**\r\n * current transaction Tax Total\r\n * @returns Tax Total\r\n */\r\n\r\n updateCurrentTransactionDetailsTaxBreakdown(basketDetails: Basket): TransactionDocumentBuilder {\r\n let transactionDiscountTotal = 0;\r\n let taxBreakdown: TaxBreakdown = {\r\n taxLines: [],\r\n totalTaxableAmount: 0,\r\n };\r\n\r\n if (this.transactionDocument.currentTransactionDetails.transactionDiscount && this.transactionDocument.currentTransactionDetails.transactionDiscount.length > 0) {\r\n this.transactionDocument.currentTransactionDetails.transactionDiscount.forEach((discount: { discountAmount: number; }) => {\r\n transactionDiscountTotal += discount.discountAmount;\r\n });\r\n }\r\n\r\n if (this.transactionDocument.currentTransactionDetails.products && this.transactionDocument.currentTransactionDetails.products.length > 0) {\r\n this.transactionDocument.currentTransactionDetails.products.forEach((product: { itemLineId: any; selectedVAT: any; selectedVATCode: any; total: any; refundedQuantity: number; itemDiscounts: { currentRefundPortion: number; trnDiscountsPortion: number; trnPromotionsPortion: number; }; }) => {\r\n let taxLine: TaxLine = {\r\n itemLineId: product.itemLineId,\r\n VAT: product.selectedVAT ? product.selectedVAT : 0,\r\n VATCode: product.selectedVATCode,\r\n taxLineTotal: 0,\r\n taxableAmount: product.total,\r\n PreTax: 0\r\n\r\n };\r\n console.info(\"Product contribution : item line ID :current transaction Details\",\r\n product.itemLineId, \"tax line :\", JSON.stringify(taxLine), JSON.stringify(basketDetails.basketTotal));\r\n\r\n //step 1\r\n // if Transaction Discount and/or promotion applied, find net selling price of each product as taxableamount\r\n\r\n //If transaction discount/promotion is applied taxable amount should be deducting transaction promotion and transaction disacount portion\r\n if (product.refundedQuantity && product.refundedQuantity > 0) {\r\n\r\n taxLine.taxableAmount = -Math.abs(taxLine.taxableAmount - product.itemDiscounts.currentRefundPortion);\r\n } else {\r\n taxLine.taxableAmount = taxLine.taxableAmount - product.itemDiscounts.trnDiscountsPortion - product.itemDiscounts.trnPromotionsPortion;\r\n }\r\n\r\n //step 2 - find pre tax\r\n taxLine.PreTax = this.numberUtilService.trimTo2Decimal2((taxLine.taxableAmount * 100) / (100 + taxLine.VAT));\r\n\r\n //step 3 - Update taxbreakdown\r\n taxBreakdown.totalTaxableAmount += taxLine.taxableAmount;\r\n taxLine.taxableAmount = this.numberUtilService.trimTo2Decimal2(taxLine.taxableAmount);\r\n \r\n // step 4 - update tax Line total\r\n taxLine.taxLineTotal = this.numberUtilService.trimTo2Decimal2(taxLine.taxableAmount - taxLine.PreTax);\r\n taxBreakdown.taxLines.push(taxLine);\r\n });\r\n }\r\n\r\n taxBreakdown.totalTaxableAmount = this.numberUtilService.trimTo2Decimal2(taxBreakdown.totalTaxableAmount);\r\n this.transactionDocument.currentTransactionDetails.taxBreakdown = taxBreakdown;\r\n if (this.transactionDocument.currentTransactionDetails.taxBreakdown && this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines && this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines.length > 0) {\r\n this.transactionDocument.currentTransactionDetails.basketSummary.VATTotal = this.numberUtilService.trimTo2Decimal2(this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines.reduce(\r\n (n: any, { taxLineTotal }: any) => n + taxLineTotal,\r\n 0\r\n ));\r\n }\r\n else {\r\n this.transactionDocument.currentTransactionDetails.basketSummary.VATTotal = 0.00;\r\n }\r\n\r\n console.log(\"eBasket:after calculating tax currenttransactionDetails\", this.transactionDocument.currentTransactionDetails)\r\n return this;\r\n }\r\n\r\n updateCurrentTransactionDetailsTotalTaxSummary(): TransactionDocumentBuilder {\r\n \r\n console.log(\"Total Tax Summery Request :\", JSON.stringify(this.transactionDocument.currentTransactionDetails.taxBreakdown));\r\n\r\n let totalTaxSummaryArray: TotalTaxSummary[] = []\r\n let totalTaxSummaryGroup = []\r\n\r\n console.log(\"Tax Lines for Total Tax Summery :\", JSON.stringify(this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines));\r\n\r\n this.transactionDocument.currentTransactionDetails.taxBreakdown.taxLines.forEach((element: { VATCode: any; VAT: any; PreTax: any; taxLineTotal: any; }) => {\r\n let TaxSummary: TotalTaxSummary = {\r\n VATCode:\"\",\r\n VAT: -12345,\r\n PreTaxSum: 0,\r\n TaxSum: 0,\r\n TXrateSum: 0\r\n };\r\n TaxSummary.VATCode=element.VATCode;\r\n TaxSummary.VAT = element.VAT; \r\n \r\n TaxSummary.PreTaxSum = this.numberUtilService.trimTo2Decimal2(element.PreTax); \r\n TaxSummary.TaxSum = this.numberUtilService.trimTo2Decimal2(element.taxLineTotal);\r\n TaxSummary.TXrateSum = this.numberUtilService.trimTo2Decimal2(TaxSummary.PreTaxSum + TaxSummary.TaxSum); \r\n totalTaxSummaryArray.push(TaxSummary);\r\n })\r\n\r\n console.log(\"Total Tax Summery Without Grouped : \", JSON.stringify(totalTaxSummaryArray));\r\n \r\n totalTaxSummaryGroup = totalTaxSummaryArray.reduce((preparedArray:any,currentObj:any) => {\r\n let ind = preparedArray.findIndex((x: { VAT: any; }) => x.VAT === currentObj.VAT);\r\n if(ind === -1){\r\n preparedArray.push(currentObj)\r\n }else {\r\n preparedArray[ind].VATCode = currentObj.VATCode;\r\n preparedArray[ind].VAT = currentObj.VAT;\r\n preparedArray[ind].PreTaxSum += currentObj.PreTaxSum;\r\n preparedArray[ind].TaxSum += currentObj.TaxSum;\r\n preparedArray[ind].TXrateSum += currentObj.TXrateSum;\r\n }\r\n return preparedArray;\r\n },[])\r\n // listOfTags.map(x => unique.filter(a => a.label == x.label && a.color == x.color).length > 0 ? null : unique.push(x));\r\n\r\n console.log(\"Total Tax Summer Group :\", JSON.stringify(totalTaxSummaryGroup));\r\n\r\n this.transactionDocument.currentTransactionDetails.totalTaxSummary = totalTaxSummaryGroup;\r\n return this;\r\n\r\n }\r\n\r\n /**\r\n * current transaction Disocunt Total\r\n * @returns Discount Total\r\n */\r\n updateCurrentTransactionDetailsDiscountTotal() {\r\n let refundTotal = this.transactionDocument.currentTransactionDetails.basketSummary.refundTotal ? this.transactionDocument.currentTransactionDetails.basketSummary.refundTotal : 0;\r\n\r\n console.log(\"e-basket: transaction builder updateCurrentTransactionDetailsDiscountTotal: discountTotal\", refundTotal, this.transactionDocument.currentTransactionDetails.basketSummary.basketTotal, this.transactionDocument.currentTransactionDetails.basketSummary.saleTotal);\r\n const discountTotal =\r\n Math.abs(\r\n Math.abs(this.transactionDocument.currentTransactionDetails.basketSummary.saleTotal) -\r\n (Math.abs(this.transactionDocument.currentTransactionDetails.basketSummary.basketTotal) + Math.abs(refundTotal))\r\n );\r\n console.log(\"e-basket: transaction builder updateCurrentTransactionDetailsDiscountTotal: discountTotal\", discountTotal)\r\n return Number(discountTotal.toFixed(2));\r\n }\r\n\r\n /**\r\n * current transaction Refund Total\r\n * @returns Refund Total\r\n */\r\n updateCurrentTransactionDetailsRefundTotal() {\r\n let totalRefund = 0;\r\n for (let index = 0; index < this.transactionDocument.currentTransactionDetails.products.length; index++) {\r\n const product: Product = this.transactionDocument.currentTransactionDetails.products[index];\r\n if (product.refundedTotal) {\r\n totalRefund = totalRefund + product.refundedTotal;\r\n }\r\n console.log(\"ebasket : transaction Service: totalRefund for Current TransactionDetails\" + totalRefund)\r\n }\r\n return totalRefund;\r\n }\r\n\r\n\r\n\r\n /**\r\n * Baskets summary\r\n * @param basketDetails\r\n * @returns summary\r\n */\r\n basketSummary(basketDetails: Basket): TransactionDocumentBuilder {\r\n this.transactionDocument.basketSummary.basketTotal = this.numberUtilService.trimTo2Decimal(basketDetails.basketTotal);\r\n\r\n this.transactionDocument.basketSummary.saleTotal = this.numberUtilService.trimTo2Decimal2(this.updateSaleTotal(\r\n basketDetails\r\n ));\r\n this.transactionDocument.basketSummary.refundTotal = this.getRefundTotal();\r\n if (\r\n this.transactionDocument.basket.lineDiscount ||\r\n this.transactionDocument.basket.linePromotion\r\n ) {\r\n this.transactionDocument.basketSummary.discountTotal = this.numberUtilService.trimTo2Decimal2(this.updateDiscountTotal());\r\n }\r\n this.transactionDocument.basketSummary.totalItems = basketDetails.quantity;\r\n\r\n\r\n if (this.transactionDocument.basket.taxBreakdown) {\r\n this.transactionDocument.basketSummary.VATTotal = this.numberUtilService.trimTo2Decimal2(this.transactionDocument.basket.taxBreakdown.taxLines.reduce(\r\n (n: any, { taxLineTotal }: any) => n + taxLineTotal,\r\n 0\r\n ));\r\n }\r\n else {\r\n this.transactionDocument.basketSummary.VATTotal = 0.00;\r\n }\r\n\r\n console.info(\"ebasket: basketsummary updated in transaction document: \", JSON.stringify(this.transactionDocument.basketSummary));\r\n return this;\r\n }\r\n\r\n /**\r\n * Line Discount\r\n * @param basketDetails\r\n * @returns line Discount\r\n */\r\n lineDiscount(basketDetails: Basket): TransactionDocumentBuilder {\r\n this.transactionDocument.basket.lineDiscount = [];\r\n for (let index = 0; index < basketDetails.products.length; index++) {\r\n const element = basketDetails.products[index];\r\n if (element.lineDiscount) {\r\n this.transactionDocument.basket.lineDiscount.push(element.lineDiscount);\r\n this.transactionDocument.basket.lineDiscount = this.transactionDocument.basket.lineDiscount.reduce(\r\n (acc: any[], val: { itemLineId: any; }) => {\r\n if (!acc.find((el: { itemLineId: any; }) => el.itemLineId === val.itemLineId)) {\r\n acc.push(val);\r\n }\r\n return acc;\r\n },\r\n []\r\n );\r\n }\r\n\r\n // console.info(\r\n // \"e-basket :line discount updated in transaction document\",\r\n // this.transactionDocument.basket.lineDiscount\r\n // );\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * exchange\r\n * @param basketDetails\r\n * @returns exchange \r\n */\r\n exchange(basketDetails: Basket): TransactionDocumentBuilder {\r\n this.transactionDocument.basket.exchange = basketDetails.exchange && basketDetails.exchange.length > 0 ? [...basketDetails.exchange] : [];\r\n for (let index = 0; index < basketDetails.products.length; index++) {\r\n\r\n const element: any = basketDetails.products[index];\r\n if (element.exchange != undefined) {\r\n const isPresent = this.transactionDocument.basket.exchange.some((el: { exchangeId: any; }) => el.exchangeId === element.exchange.exchangeId);\r\n if (!isPresent) {\r\n let exchangeItems = [];\r\n for (let j = 0; j < element.exchange.newItems.length; j++) {\r\n const item = element.exchange.newItems[j];\r\n let newItems: any = { lineItemId: item.itemLineId, Quantity: item.quantity }\r\n exchangeItems.push(newItems);\r\n }\r\n element.exchange.newItems = [...exchangeItems];\r\n this.transactionDocument.basket.exchange.push(element.exchange);\r\n }\r\n }\r\n console.log(\r\n \"e-basket :TransactionDocumentBuilder: this.transactionDocument.basket exchange\",\r\n JSON.stringify(this.transactionDocument.basket.exchange)\r\n );\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * add previous exchange data\r\n * @param originalTransactionDocument\r\n * @returns line Promotions\r\n */\r\n addExchangeData(originalTransactionDocument: TransactionDocument): TransactionDocumentBuilder {\r\n this.transactionDocument.basket.exchange = originalTransactionDocument.basket.exchange ? [...originalTransactionDocument.basket.exchange] : null;\r\n return this;\r\n }\r\n\r\n /**\r\n * line Promotions\r\n * @param basketDetails\r\n * @returns line Promotions\r\n */\r\n linePromotion(basketDetails: Basket): TransactionDocumentBuilder {\r\n this.transactionDocument.basket.linePromotion = [];\r\n for (let index = 0; index < basketDetails.products.length; index++) {\r\n const element = basketDetails.products[index];\r\n if (element.linePromotions) {\r\n this.transactionDocument.basket.linePromotion.push(\r\n element.linePromotions\r\n );\r\n this.transactionDocument.basket.linePromotion = this.transactionDocument.basket.linePromotion.reduce(\r\n (acc: any[], val: { itemLineId: any; }) => {\r\n if (!acc.find((el: { itemLineId: any; }) => el.itemLineId === val.itemLineId)) {\r\n acc.push(val);\r\n }\r\n return acc;\r\n },\r\n []\r\n );\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * transaction Promotion\r\n * @param basketDetails\r\n * @returns transaction Promotion\r\n */\r\n transactionPromotion(basketDetails: Basket): TransactionDocumentBuilder {\r\n if (basketDetails.transactionPromotion) {\r\n this.transactionDocument.basket.transactionPromotion =\r\n basketDetails.transactionPromotion;\r\n // for (let index = 0; index < basketDetails.TransactionDiscount.length; index++) {\r\n // this.transactionDocument.basket.transactionPromotion.push(element.linePromotions)\r\n // this.transactionDocument.basket.transactionPromotion = this.transactionDocument.basket.linePromotions.reduce((acc, val) => {\r\n // if (!acc.find(el => el.itemLineId === val.itemLineId)) {\r\n // acc.push(val);\r\n // }\r\n // return acc;\r\n // }, []);\r\n // }\r\n console.log(\r\n \"e-basket :TransactionDocumentBuilder: this.transactionDocument.basket.transactionPromotion\",\r\n JSON.stringify(this.transactionDocument.basket.transactionPromotion)\r\n );\r\n }\r\n return this;\r\n }\r\n\r\n transactionDiscount(basketDetails: Basket): TransactionDocumentBuilder {\r\n if (basketDetails.transactionDiscount) {\r\n this.transactionDocument.basket.transactionDiscount =\r\n basketDetails.transactionDiscount;\r\n\r\n console.log(\r\n \"e-basket :TransactionDocumentBuilder: transaction Discount\",\r\n JSON.stringify(this.transactionDocument.basket.transactionDiscount)\r\n );\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Payments details\r\n * @param paymentDetails\r\n * @returns\r\n */\r\n paymentDetails(paymentDetails: any) {\r\n console.info(\"ebasket : payment details after transaction completed\",JSON.stringify(paymentDetails));\r\n \r\n this.transactionDocument.paymentDetails = paymentDetails;\r\n return this;\r\n }\r\n\r\n\r\n /**\r\n * Payments details\r\n * @param paymentDetails\r\n * @returns\r\n */\r\n splitPayment(splitPayment: boolean) { \r\n this.transactionDocument.splitPayment = splitPayment;\r\n return this;\r\n } \r\n\r\n /**\r\n * Payments details\r\n * @param paymentDetails\r\n * @returns\r\n */\r\n isPaymentCompleted(isPaymentCompleted: boolean) {\r\n this.transactionDocument.isPaymentCompleted = isPaymentCompleted;\r\n return this;\r\n } \r\n \r\n\r\n\r\n\r\n /**\r\n * Bases currency\r\n * @param currency\r\n * @returns currency\r\n */\r\n baseCurrency(currency: any): TransactionDocumentBuilder {\r\n this.transactionDocument.baseCurrency = currency;\r\n return this;\r\n }\r\n\r\n /**\r\n * gift option at\r\n * @returns at\r\n */\r\n giftOption(gift: any): TransactionDocumentBuilder {\r\n console.log(\r\n \"e-basket :TransactionDocumentBuilder: this.transactionDocument.giftoption\",\r\n gift\r\n );\r\n if (gift) {\r\n this.transactionDocument.giftedReceipt = gift;\r\n }\r\n return this;\r\n }\r\n /**\r\n\r\n/**\r\n * manual Discount\r\n * @param discountData\r\n * @returns\r\n */\r\n\r\n // manualDiscount(discountData : basketDiscount):TransactionDocumentBuilder {\r\n // let saleTotal = this.transactionDocument.basketSummary.basketTotal;\r\n // if(discountData.discountType =='Percent'){\r\n // this.transactionDocument.basketSummary.basketTotal = saleTotal-(saleTotal*(discountData.discountAmount/100));\r\n // discountData.discountAmount = -1*(saleTotal-this.transactionDocument.basketSummary.basketTotal);\r\n // }else {\r\n // this.transactionDocument.basketSummary.basketTotal =saleTotal-discountData.discountAmount;\r\n // discountData.discountAmount = -1*discountData.discountAmount;\r\n // }\r\n // this.transactionDocument.transactionDiscount.push(discountData);\r\n // return this;\r\n\r\n // }\r\n\r\n /**\r\n * Types transaction document builder\r\n * @param t\r\n * @returns type\r\n */\r\n type(t: any): TransactionDocumentBuilder {\r\n this.transactionDocument.type = t;\r\n return this;\r\n }\r\n /**\r\n * Operations status\r\n * @param o\r\n * @returns status\r\n */\r\n operationStatus(o: any): TransactionDocumentBuilder {\r\n this.transactionDocument.operationStatus = o;\r\n return this;\r\n }\r\n /**\r\n * Created at\r\n * @returns at\r\n */\r\n createdAt(): TransactionDocumentBuilder {\r\n const date = new Date();\r\n this.transactionDocument.createdAt = date.toISOString();\r\n this.transactionDocument.updatedAt = date.toISOString();\r\n return this;\r\n }\r\n /**\r\n * Updated at\r\n * @returns at\r\n */\r\n updatedAt(): TransactionDocumentBuilder {\r\n const date = new Date();\r\n this.transactionDocument.updatedAt = date.toISOString();\r\n return this;\r\n }\r\n /**\r\n * transsaction completion at\r\n * @returns transaction completion date\r\n */\r\n transactionCompletedAt(): TransactionDocumentBuilder {\r\n const date = new Date();\r\n this.transactionDocument.transCompletedAt = date.toISOString();\r\n return this;\r\n }\r\n /**\r\n * Builds transaction document builder\r\n * @returns build\r\n */\r\n build(): TransactionDocument {\r\n return this.transactionDocument;\r\n }\r\n\r\n /**\r\n * Sales total in refund\r\n * @param saleTotal\r\n * @returns total in refund\r\n */\r\n saleTotalInRefund(saleTotal: number): TransactionDocumentBuilder {\r\n this.transactionDocument.saleTotal = saleTotal;\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets basket details\r\n * @returns basket details\r\n */\r\n getBasketDetails(): Basket {\r\n console.info(\"ebasket: Getting Basket for transactionDocument\", JSON.stringify(this.transactionDocument));\r\n\r\n let basket: Basket = {\r\n subsidiaryId : this.transactionDocument.subsidiaryId,\r\n transactionDiscount: this.transactionDocument.basket.transactionDiscount,\r\n transactionPromotion: this.transactionDocument.basket.transactionPromotion,\r\n transactionId: this.transactionDocument.transactionId,\r\n offlineTransactionId: this.transactionDocument.offlineTransactionId,\r\n total: this.transactionDocument.basketSummary.basketTotal,\r\n basketTotal: this.transactionDocument.basketSummary.basketTotal,\r\n discountTotal: this.transactionDocument.basketSummary.discountTotal,\r\n saleTotal: this.transactionDocument.basketSummary.saleTotal,\r\n refundTotal: this.transactionDocument.basketSummary.refundTotal,\r\n quantity: this.transactionDocument.basketSummary.totalItems,\r\n products: [],\r\n baseCurrency: this.transactionDocument.baseCurrency,\r\n customer: this.transactionDocument.customer,\r\n };\r\n\r\n basket.products = [] as Product[];\r\n this.transactionDocument.basket.products.forEach((product: { SKU: any; barCode: any; barcodes: any; description: any; imageUrls: any; totalLinePrice: any; itemLineId: any; excludePromotion: any; price: any; quantity: any; selectedRRPPrice: any; fullfilmentId: any; fullfilmentLocationName: any; deliveryGroup: string; leadTime: any; deliveryMethod: any; giftCard: any; giftCardExpiryDate: any; giftCardNumberIssued: any; giftCardRecipientEmail: any; giftCardRecipientName: any; refundedTotal: any; refundedQuantity: number; refundedReasonDescription: any; refundedReason: any; refundedPromotionalQuantity: any; isLastExchanged: any; }, index: any) => {\r\n console.log(JSON.stringify(product), \"ebasket: basket detail update in basket\");\r\n const p = {} as any;\r\n p.SKU = product.SKU;\r\n p.barcode = product.barCode;\r\n p.barcodes = product.barcodes;\r\n\r\n p.description = product.description;\r\n p.imageUrls = product.imageUrls;\r\n p.currency = this.transactionDocument.baseCurrency;\r\n p.totalLinePrice = product.totalLinePrice;\r\n p.itemLineId = Number(product.itemLineId);\r\n p.excludePromotion = product.excludePromotion;\r\n\r\n p.selectedPrice = product.price;\r\n p.quantity = product.quantity;\r\n p.total = product.totalLinePrice;\r\n p.selectedRRPPrice = product.selectedRRPPrice;\r\n\r\n p.fullfilmentId = product.fullfilmentId;\r\n p.fullfilmentLocationName = product.fullfilmentLocationName;\r\n p.deliveryGroup = product.deliveryGroup || \"1\";\r\n p.leadTime = product.leadTime;\r\n p.deliveryMethod = product.deliveryMethod || DELIVERY_METHODS.COLLECT_FROM_STORE.toString();\r\n\r\n if(p.fullfilmentId != this.transactionDocument.storeId)\r\n {\r\n p.isWebOrder = true;\r\n }\r\n \r\n p.giftCard = product.giftCard;\r\n p.giftCardExpiryDate = product.giftCardExpiryDate;\r\n p.giftCardNumberIssued = product.giftCardNumberIssued;\r\n p.giftCardRecipientEmail = product.giftCardRecipientEmail;\r\n p.giftCardRecipientName = product.giftCardRecipientName;\r\n \r\n if (\r\n this.transactionDocument.basket.lineDiscount &&\r\n this.transactionDocument.basket.lineDiscount.length > 0\r\n ) {\r\n this.transactionDocument.basket.lineDiscount.forEach((lineDiscount: { itemLineId: { toString: () => any; }; discountedLinePrice: any; }) => {\r\n if (product.itemLineId === lineDiscount.itemLineId.toString()) {\r\n p.lineDiscount = lineDiscount;\r\n p.total = lineDiscount.discountedLinePrice;\r\n }\r\n });\r\n }\r\n\r\n if (\r\n this.transactionDocument.basket.linePromotion &&\r\n this.transactionDocument.basket.linePromotion.length > 0\r\n ) {\r\n this.transactionDocument.basket.linePromotion.forEach((linePromotion: { itemLineId: { toString: () => any; }; promotionLinePrice: any; }) => {\r\n if (product.itemLineId === linePromotion.itemLineId.toString()) {\r\n p.linePromotions = linePromotion;\r\n p.total = linePromotion.promotionLinePrice;\r\n }\r\n });\r\n }\r\n\r\n if (\r\n this.transactionDocument.basket.taxBreakdown &&\r\n this.transactionDocument.basket.taxBreakdown.taxLines.length > 0\r\n ) {\r\n this.transactionDocument.basket.taxBreakdown.taxLines.forEach((taxLine: { itemLineId: { toString: () => any; }; VAT: any; VATCode: any; }) => {\r\n if (product.itemLineId && product.itemLineId === taxLine.itemLineId.toString()) {\r\n p.selectedVAT = taxLine.VAT;\r\n p.selectedVATCode = taxLine.VATCode;\r\n }\r\n });\r\n }\r\n\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.REFUND) {\r\n p.total = product.refundedTotal;\r\n } else if ((this.transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND || TRANSACTION_TYPE.SALE_EXCHANGE) && product.refundedQuantity > 0) {\r\n p.refundedReasonDescription = product.refundedReasonDescription;\r\n p.refundedReason = product.refundedReason;\r\n if (!p.refundedReasonDescription) {\r\n p.refundedReasonDescription = p.refundedReason;\r\n }\r\n p.refundedQuantity = product.refundedQuantity;\r\n p.refundPromotionalQuantity = product.refundedPromotionalQuantity;\r\n p.refundedTotal = product.refundedTotal;\r\n p.total -= Math.abs(p.refundedTotal);\r\n p.isLastExchanged = product.isLastExchanged;\r\n }\r\n\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.REFUND) {\r\n if (p.total > 0) {\r\n p.total *= -1;\r\n }\r\n }\r\n\r\n basket.products.push(p);\r\n\r\n });\r\n\r\n basket = this.getTransactionDiscountAndTransactionPromotionPortion(basket);\r\n basket.total = (basket.basketTotal || 0) + this.getTotalDiscountWithTransactionDiscountsAndPromotions(basket);\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND) {\r\n basket.quantity = this.getRefundedTotalWithQuantity(basket);\r\n }\r\n console.info(\"ebasket: Basket created successfully\", JSON.stringify(basket))\r\n return basket;\r\n }\r\n\r\n /**\r\n * Gets basket details\r\n * @returns refund basket details\r\n */\r\n // getRefundBasketDetails(): Basket {\r\n // let basket: Basket = {\r\n // subsidiaryId : this.transactionDocument.subsidiaryId,\r\n // transactionDiscount: this.transactionDocument.basket.transactionDiscount,\r\n // transactionPromotion: this.transactionDocument.basket.transactionPromotion,\r\n // transactionId: this.transactionDocument.transactionId,\r\n // total: this.transactionDocument.basketSummary.basketTotal,\r\n // basketTotal: this.transactionDocument.basketSummary.basketTotal,\r\n // discountTotal: this.transactionDocument.basketSummary.discountTotal,\r\n // saleTotal: this.transactionDocument.basketSummary.saleTotal,\r\n // quantity: this.transactionDocument.basketSummary.totalItems,\r\n // products: [],\r\n // baseCurrency: this.transactionDocument.baseCurrency,\r\n // customer: this.transactionDocument.customer,\r\n // };\r\n\r\n // basket.products = [] as Product[];\r\n // this.transactionDocument.basket.products.forEach((product: { SKU: any; barCode: any; barcodes: any; description: any; imageUrls: any; totalLinePrice: any; itemLineId: any; excludePromotion: any; price: number; quantity: any; selectedRRPPrice: any; fullfilmentId: any; fullfilmentLocationName: any; deliveryGroup: string; leadTime: any; deliveryMethod: any; giftCard: any; giftCardExpiryDate: any; giftCardNumberIssued: any; giftCardRecipientEmail: any; giftCardRecipientName: any; itemDiscounts: any; refundedPromotionalQuantity: any; refundedQuantity: number; refunded: any; isLastExchanged: any; exchange: any; refundedTotal: number; }, index: any) => {\r\n // const p = {} as Product;\r\n // p.SKU = product.SKU;\r\n // p.barcode = product.barCode;\r\n // p.barcodes = product.barcodes;\r\n\r\n // p.description = product.description;\r\n // p.imageUrls = product.imageUrls;\r\n // p.currency = this.transactionDocument.baseCurrency;\r\n // p.totalLinePrice = product.totalLinePrice;\r\n // p.itemLineId = Number(product.itemLineId);\r\n // p.excludePromotion = product.excludePromotion;\r\n\r\n // p.selectedPrice = product.price;\r\n // p.quantity = product.quantity;\r\n // p.total = product.totalLinePrice;\r\n // p.selectedRRPPrice = product.selectedRRPPrice;\r\n\r\n // p.fullfilmentId = product.fullfilmentId;\r\n // p.fullfilmentLocationName = product.fullfilmentLocationName;\r\n // p.deliveryGroup = product.deliveryGroup || \"1\";\r\n // p.leadTime = product.leadTime;\r\n // p.deliveryMethod = product.deliveryMethod || DELIVERY_METHODS.COLLECT_FROM_STORE.toString();\r\n\r\n // p.giftCard = product.giftCard;\r\n // p.giftCardExpiryDate = product.giftCardExpiryDate;\r\n // p.giftCardNumberIssued = product.giftCardNumberIssued;\r\n // p.giftCardRecipientEmail = product.giftCardRecipientEmail;\r\n // p.giftCardRecipientName = product.giftCardRecipientName;\r\n \r\n \r\n // if(p.fullfilmentId != this.transactionDocument.storeId)\r\n // {\r\n // p.isWebOrder = true;\r\n // }\r\n \r\n // if (product.itemDiscounts) {\r\n // p.itemDiscounts = product.itemDiscounts as ItemDiscount;\r\n // }\r\n\r\n // // if(!p.itemDiscounts){\r\n // // console.log(p.itemDiscounts);\r\n\r\n // // this.basketService.transactionDiscountAndPromotionProductortionCalculation(basket);\r\n // // }\r\n // p.refundPromotionalQuantity = product.refundedPromotionalQuantity ? product.refundedPromotionalQuantity : 0;\r\n\r\n // if (product.refundedQuantity) {\r\n // p.quantity = p.quantity - product.refundedQuantity;\r\n // p.totalLinePrice = (p.quantity * product.price);\r\n // p.total = p.totalLinePrice;\r\n // // p.refundPromotionalQuantity = product.refundedPromotionalQuantity;\r\n // p.refunded = product.refunded;\r\n // p.isLastExchanged = product.isLastExchanged;\r\n // }\r\n // if (product.exchange) {\r\n // p.exchange = product.exchange;\r\n // }\r\n\r\n // if (\r\n // this.transactionDocument.basket.lineDiscount &&\r\n // this.transactionDocument.basket.lineDiscount.length > 0\r\n // ) {\r\n\r\n // this.transactionDocument.basket.lineDiscount.forEach((lineDiscount: { itemLineId: { toString: () => any; }; discountedLinePrice: any; }) => {\r\n\r\n // if (product.itemLineId === lineDiscount.itemLineId.toString() && product.refundedQuantity > 0) {\r\n // p.lineDiscount = Object.assign({}, lineDiscount);\r\n // p.lineDiscount.discountedLinePrice = p.lineDiscount.unitPrice * p.quantity\r\n // p.lineDiscount.discountAmount = p.total - p.lineDiscount.discountedLinePrice\r\n // p.total = p.lineDiscount.discountedLinePrice;\r\n // } else if (product.itemLineId === lineDiscount.itemLineId.toString()) {\r\n // p.lineDiscount = lineDiscount;\r\n // p.total = lineDiscount.discountedLinePrice\r\n // }\r\n // });\r\n // }\r\n\r\n // if (\r\n // this.transactionDocument.basket.linePromotion &&\r\n // this.transactionDocument.basket.linePromotion.length > 0\r\n // ) {\r\n // this.transactionDocument.basket.linePromotion.forEach((linePromotion: { itemLineId: { toString: () => any; }; refunded: any; }) => {\r\n // if (product.itemLineId === linePromotion.itemLineId.toString() && !linePromotion.refunded) {\r\n // p.linePromotions = linePromotion;\r\n // p.total = p.linePromotions.promotionLinePrice;\r\n // p.total = p.total - (product.refundedTotal ? Math.abs(product.refundedTotal) : 0);\r\n // }\r\n // });\r\n // }\r\n\r\n // p.refundedQuantity = 0;\r\n // p.refundedTotal = 0;\r\n\r\n // if (\r\n // this.transactionDocument.basket.taxBreakdown &&\r\n // this.transactionDocument.basket.taxBreakdown.taxLines.length > 0\r\n // ) {\r\n // this.transactionDocument.basket.taxBreakdown.taxLines.forEach((taxLine: { itemLineId: { toString: () => any; }; VAT: any; VATCode: any; }) => {\r\n // if (product.itemLineId === taxLine.itemLineId.toString()) {\r\n // p.selectedVAT = taxLine.VAT;\r\n // p.selectedVATCode = taxLine.VATCode;\r\n // }\r\n // });\r\n // }\r\n\r\n // if (p.quantity > 0) {\r\n // basket.products.push(p);\r\n // }\r\n // });\r\n // // product.itemDiscounts\r\n // if (!basket.products[0].hasOwnProperty('itemDiscounts')) {\r\n // basket = this.getTransactionDiscountAndTransactionPromotionPortion(basket);\r\n\r\n // }\r\n\r\n // console.log(\"ebasket : TransactionDocumentBuilder :new created refunded basket\", JSON.stringify(basket))\r\n // basket.quantity = basket.products.reduce(\r\n // (n: any, { quantity }: any) => n + quantity,\r\n // 0\r\n // );\r\n // basket.total = this.getTotalWithLineDiscountAndLinePromotionApplied(basket);\r\n // basket.basketTotal = basket.total;\r\n // basket.basketTotal = basket.basketTotal - this.getTotalDiscountWithTransactionDiscountsAndPromotions(basket);\r\n // console.log(\r\n // \"ebasket : TransactionDocumentBuilder : update Basket Total: after promotion :basketTotal\",\r\n // basket.basketTotal\r\n // );\r\n\r\n // console.log(\r\n // \"e:basket :TransactionDocumentBuilder : basketDetails updated values\",\r\n // JSON.stringify(basket)\r\n // );\r\n // return basket;\r\n // }\r\n\r\n\r\n getTransactionDiscountAndTransactionPromotionPortion(basket:any) {\r\n if (\r\n basket.transactionDiscount &&\r\n basket.transactionDiscount.length > 0\r\n ) {\r\n basket.transactionDiscount.forEach((discount: { itemLineIds: any; }) => {\r\n if (!discount.itemLineIds) {\r\n discount.itemLineIds = basket.products.map((product: { itemLineId: any; }) => {\r\n return product.itemLineId\r\n });\r\n }\r\n basket = this.basketService.transactionDiscountProductPortionCalc(basket, discount);\r\n });\r\n }\r\n if (\r\n basket.transactionPromotion &&\r\n basket.transactionPromotion.length > 0\r\n ) {\r\n basket.transactionPromotion.forEach((tPromotion: { itemLineIds: any; }) => {\r\n if (!tPromotion.itemLineIds) {\r\n const filteredData = basket.products.filter(\r\n (item: { excludePromotion: boolean; }) => {\r\n return item.excludePromotion === false;\r\n });\r\n\r\n tPromotion.itemLineIds =\r\n filteredData.map((product: { itemLineId: any; }) => {\r\n return product.itemLineId\r\n });\r\n }\r\n basket = this.basketService.transactionPromotionProductPortionCalc(basket, tPromotion);\r\n });\r\n }\r\n\r\n return basket;\r\n }\r\n\r\n\r\n getTotalDiscountWithTransactionDiscountsAndPromotions(basketDetails: any) {\r\n\r\n let discountTotal = 0;\r\n if (\r\n basketDetails.transactionPromotion &&\r\n basketDetails.transactionPromotion.length > 0\r\n ) {\r\n discountTotal += basketDetails.transactionPromotion.reduce(\r\n (n: any, { promotionAmount }: any) => n + promotionAmount,\r\n 0\r\n );\r\n }\r\n if (\r\n basketDetails.transactionDiscount &&\r\n basketDetails.transactionDiscount.length > 0\r\n ) {\r\n\r\n discountTotal += basketDetails.transactionDiscount.reduce(\r\n (n: any, { discountAmount }: any) => n + discountAmount,\r\n 0\r\n );\r\n\r\n\r\n }\r\n console.log(\"ebasket : TransactionDocumentBuilder : Transaction discount Total:\", discountTotal);\r\n\r\n return discountTotal;\r\n }\r\n\r\n\r\n appendCurrencySymbol(currency: number, value: number) {\r\n // value=this.decimalpipe.transform(value,'1.2');\r\n if (value >= 0) {\r\n const returnval = currency + value;\r\n console.log(returnval, \"ebasket: add currency with value\");\r\n return returnval;\r\n } else {\r\n const returnval = \"-\" + (currency + value * -1);\r\n console.log(returnval, \"-(currency+(value*-1))\");\r\n return returnval;\r\n }\r\n }\r\n\r\n // /**\r\n // * Updates total refund\r\n // * @returns total refund\r\n // */\r\n // updateTotalRefund(): TransactionDocumentBuilder {\r\n // this.transactionDocument.basket.products.forEach((product) => {\r\n // product.refundedQuantity = product.quantity;\r\n // product.refundedTotal = product.totalLinePrice * -1;\r\n // console.log(\r\n // \"ebasket: Transaction price override :\",\r\n // this.transactionDocument.basket.lineDiscount\r\n // );\r\n\r\n // if (\r\n // this.transactionDocument.basket.linePromotion &&\r\n // this.transactionDocument.basket.linePromotion.length > 0\r\n // ) {\r\n // this.transactionDocument.basket.linePromotion.forEach((linePromotion) => {\r\n // console.log(\r\n // \"Promotion: basket linePromotion : \",\r\n // this.transactionDocument.basket.linePromotion\r\n // );\r\n // console.log(\r\n // \"linePromotion.itemLineId.toString() : \",\r\n // linePromotion.itemLineId.toString()\r\n // );\r\n // console.log(\r\n // \"condition : \" +\r\n // (product.itemLineId === linePromotion.itemLineId.toString())\r\n // );\r\n\r\n // if (product.itemLineId === linePromotion.itemLineId.toString()) {\r\n // product.refundedTotal =\r\n // linePromotion.promotionLinePrice * -1;\r\n // }\r\n // });\r\n // } else\r\n // if (\r\n // this.transactionDocument.basket.lineDiscount &&\r\n // this.transactionDocument.basket.lineDiscount.length > 0\r\n // ) {\r\n // this.transactionDocument.basket.lineDiscount.forEach((lineDiscount) => {\r\n // console.log(\r\n // \"product.itemLineId : \" +\r\n // this.transactionDocument.basket.lineDiscount\r\n // );\r\n // console.log(\r\n // \"lineDiscount.itemLineId.toString() : \" +\r\n // lineDiscount.itemLineId.toString()\r\n // );\r\n // console.log(\r\n // \"condition : \" +\r\n // (product.itemLineId === lineDiscount.itemLineId.toString())\r\n // );\r\n\r\n // if (product.itemLineId === lineDiscount.itemLineId.toString()) {\r\n // product.refundedTotal = lineDiscount.unitPrice * product.refundedQuantity * -1;\r\n // }\r\n // });\r\n // }\r\n\r\n // console.log(\"Product description :\" + product.description);\r\n // console.log(\"Product total :\" + product.refundedTotal);\r\n // // product.displayrefundedamount=this.appendCurrencySymbol(CURRENCY[this.transactionDocument.baseCurrency],product.refundedTotal);\r\n // // console.log(product.displayrefundedamount,\"displayrefundedamount\");\r\n // product.refunded = true;\r\n // });\r\n // const baskettotal = (this.transactionDocument.basketSummary.basketTotal *= -1);\r\n // // this.transactionDocument.basketSummary.displaybaskettotal=this.appendCurrencySymbol(CURRENCY[this.transactionDocument.baseCurrency], baskettotal);\r\n // const saletotal = (this.transactionDocument.basketSummary.saleTotal *= -1);\r\n // // this.transactionDocument.basketSummary.displaysaletotal = this.appendCurrencySymbol(CURRENCY[this.transactionDocument.baseCurrency], saletotal);\r\n // (this.transactionDocument.basketSummary.VATTotal *= -1);\r\n // return this;\r\n // }\r\n\r\n /**\r\n * Sale Total\r\n * @param basketDetails\r\n * @returns Sale Total\r\n */\r\n updateSaleTotal(basketDetails: { products: any[]; }) {\r\n const saleTotal = basketDetails.products.reduce(\r\n (n: any, { totalLinePrice }: any) => n + totalLinePrice,\r\n 0\r\n );\r\n return saleTotal\r\n }\r\n\r\n getTotalWithLineDiscountAndLinePromotionApplied(basketDetails: { products: any; }): number {\r\n let saletotal: number = 0.0;\r\n for (let product of basketDetails.products) {\r\n // if (product.linePromotions) {\r\n // saletotal += product.linePromotions.promotionLinePrice;\r\n // } else if (\r\n // product.lineDiscount &&\r\n // !product.linePromotions\r\n // ) {\r\n // saletotal +=\r\n // product.quantity * Number(product.lineDiscount.unitPrice.toFixed(2));\r\n // } else {\r\n // saletotal +=\r\n // product.quantity * Number(product.selectedPrice.toFixed(2));\r\n // }\r\n saletotal += product.total;\r\n console.log(\r\n \"e-basket:update product Total:\" + saletotal,\r\n JSON.stringify(product)\r\n );\r\n }\r\n return saletotal;\r\n }\r\n\r\n getRefundedTotalWithQuantity(basketDetails: { products: string | any[]; }): number {\r\n let quantity = 0;\r\n for (let index = 0; index < basketDetails.products.length; index++) {\r\n const product: any = basketDetails.products[index];\r\n\r\n if (!product.refundedReasonDescription) {\r\n\r\n quantity = quantity + product.quantity;\r\n\r\n } else {\r\n quantity = quantity + (product.quantity - product.refundedQuantity);\r\n\r\n // basketDetails.total = basketDetails.total + product.refundedTotal;\r\n\r\n }\r\n }\r\n return quantity;\r\n\r\n }\r\n\r\n /**\r\n * Discount Total\r\n * @returns Discount Total\r\n */\r\n updateDiscountTotal() {\r\n let refundTotal = this.transactionDocument.basketSummary.refundTotal ? this.transactionDocument.basketSummary.refundTotal : 0;\r\n console.info(\"e-basket: transaction builder: refundTotal\", JSON.stringify(refundTotal),\r\n JSON.stringify(this.transactionDocument.basketSummary));\r\n const discountTotal =\r\n Math.abs(\r\n Math.abs(this.transactionDocument.basketSummary.saleTotal) -\r\n (\r\n Math.abs(this.transactionDocument.basketSummary.basketTotal) + Math.abs(refundTotal)\r\n )\r\n );\r\n console.log(\"e-basket: transaction builder: discountTotal\", JSON.stringify(discountTotal))\r\n return Number(discountTotal.toFixed(2));\r\n }\r\n\r\n updateReasonCode(reasonCode: {\r\n code: string;\r\n name: string;\r\n }): TransactionDocumentBuilder {\r\n this.transactionDocument.reasonCode = reasonCode.code;\r\n this.transactionDocument.reasonDescription = reasonCode.name;\r\n return this;\r\n }\r\n\r\n updateManagerOverride(\r\n useroverride: UserOverride\r\n ): TransactionDocumentBuilder {\r\n this.transactionDocument.override = useroverride;\r\n return this;\r\n }\r\n\r\n updateUserID(\r\n userID: string\r\n ): TransactionDocumentBuilder {\r\n this.transactionDocument.userId = userID;\r\n return this;\r\n }\r\n\r\n updateUserName(name: any) : TransactionDocumentBuilder {\r\n this.transactionDocument.userName = name;\r\n return this;\r\n\r\n }\r\n \r\n addCustomerDetails(customerDetail: Customer): TransactionDocumentBuilder {\r\n this.transactionDocument.customer = customerDetail;\r\n return this;\r\n }\r\n\r\n updateTaxBreakdown(basketDetails: Basket): TransactionDocumentBuilder {\r\n // let transactionDiscountTotal = 0;\r\n let taxBreakdown: TaxBreakdown = {\r\n taxLines: [],\r\n totalTaxableAmount: 0,\r\n };\r\n\r\n\r\n\r\n // if (this.transactionDocument.basket.transactionDiscount && this.transactionDocument.basket.transactionDiscount.length > 0) {\r\n // this.transactionDocument.basket.transactionDiscount.forEach((discount) => {\r\n // transactionDiscountTotal += discount.discountAmount;\r\n // });\r\n // }\r\n\r\n // if (this.transactionDocument.basket.transactionPromotion && this.transactionDocument.basket.transactionPromotion.length > 0) {\r\n // this.transactionDocument.basket.transactionPromotion.forEach(\r\n // (promotion) => {\r\n // transactionDiscountTotal += promotion.promotionAmount;\r\n // }\r\n // );\r\n // }\r\n\r\n basketDetails.products.forEach((product: any) => {\r\n let taxLine: TaxLine = {\r\n itemLineId: product.itemLineId,\r\n VAT: product.selectedVAT ? product.selectedVAT : 0,\r\n VATCode: product.selectedVATCode,\r\n taxLineTotal: 0,\r\n taxableAmount: product.total,\r\n PreTax: 0\r\n };\r\n console.info(\"Product contribution : item line ID :\", product.itemLineId,\r\n \"tax line :\", JSON.stringify(taxLine));\r\n\r\n // step 1\r\n // if Transaction Discount and/or promotion applied, find net selling price of each product as taxableamount\r\n // if (transactionDiscountTotal > 0) {\r\n product = this.basketService.validateProductItemDiscount(product);\r\n\r\n const productContributionInTotal =\r\n product.itemDiscounts.trnDiscountsPortion +\r\n product.itemDiscounts.trnPromotionsPortion -\r\n product.itemDiscounts.refundPortion;\r\n // tp+td-rp;\r\n\r\n console.info(\"Product contribution : item line ID :\", product.itemLineId,\r\n \"contribution :\", JSON.stringify(productContributionInTotal));\r\n // calculate net selling price after applying transaction discount as per product contribution\r\n taxLine.taxableAmount -= productContributionInTotal;\r\n // }\r\n\r\n //step 2 - find pre tax\r\n taxLine.PreTax = this.numberUtilService.trimTo2Decimal2((taxLine.taxableAmount * 100) / (100 + taxLine.VAT));\r\n\r\n //step 3 - Update taxbreakdown\r\n taxBreakdown.totalTaxableAmount += taxLine.taxableAmount;\r\n taxLine.taxableAmount = this.numberUtilService.trimTo2Decimal2(taxLine.taxableAmount);\r\n \r\n // step 4 - update tax Line total\r\n taxLine.taxLineTotal = this.numberUtilService.trimTo2Decimal2(taxLine.taxableAmount - taxLine.PreTax);\r\n taxBreakdown.taxLines.push(taxLine);\r\n });\r\n\r\n taxBreakdown.totalTaxableAmount = this.numberUtilService.trimTo2Decimal2(taxBreakdown.totalTaxableAmount);\r\n this.transactionDocument.basket.taxBreakdown = taxBreakdown;\r\n return this;\r\n }\r\n\r\n updateTotalTaxSummary(): TransactionDocumentBuilder {\r\n\r\n console.log(\"Total Tax Summery Request :\", JSON.stringify(this.transactionDocument.basket.taxBreakdown));\r\n\r\n\r\n let totalTaxSummaryArray: TotalTaxSummary[] = []\r\n let totalTaxSummaryGroup = []\r\n\r\n console.log(\"Tax Lines for Total Tax Summery :\", JSON.stringify(this.transactionDocument.basket.taxBreakdown.taxLines));\r\n\r\n\r\n this.transactionDocument.basket.taxBreakdown.taxLines.forEach((element: { VATCode: any; VAT: any; PreTax: any; taxLineTotal: any; }) => {\r\n let TaxSummary: TotalTaxSummary = {\r\n VATCode: \"\",\r\n VAT: -12345,\r\n PreTaxSum: 0,\r\n TaxSum: 0,\r\n TXrateSum: 0\r\n \r\n };\r\n TaxSummary.VATCode = element.VATCode;\r\n TaxSummary.VAT = element.VAT; \r\n TaxSummary.PreTaxSum = this.numberUtilService.trimTo2Decimal2(element.PreTax);\r\n TaxSummary.TaxSum = this.numberUtilService.trimTo2Decimal2(element.taxLineTotal);\r\n TaxSummary.TXrateSum = this.numberUtilService.trimTo2Decimal2(TaxSummary.PreTaxSum + TaxSummary.TaxSum); \r\n totalTaxSummaryArray.push(TaxSummary);\r\n })\r\n\r\n console.log(\"Total Tax Summery Without Grouped : \", JSON.stringify(totalTaxSummaryArray));\r\n \r\n totalTaxSummaryGroup = totalTaxSummaryArray.reduce((preparedArray:any,currentObj) => {\r\n\r\n let ind = preparedArray.findIndex((x: { VAT: any; }) => x.VAT === currentObj.VAT);\r\n if(ind === -1){\r\n preparedArray.push(currentObj)\r\n }else {\r\n preparedArray[ind].VATCode = currentObj.VATCode;\r\n preparedArray[ind].VAT = currentObj.VAT;\r\n preparedArray[ind].PreTaxSum += currentObj.PreTaxSum;\r\n preparedArray[ind].TaxSum += currentObj.TaxSum;\r\n preparedArray[ind].TXrateSum += currentObj.TXrateSum;\r\n }\r\n return preparedArray;\r\n },[])\r\n \r\n console.log(\"Total Tax Summer Group :\",totalTaxSummaryGroup);\r\n\r\n\r\n this.transactionDocument.basket.totalTaxSummary = totalTaxSummaryGroup;\r\n\r\n return this;\r\n\r\n }\r\n\r\n\r\n /**\r\n * TransactionId\r\n * @returns OriginalTransactionId\r\n */\r\n addOriginalTransId(tranDoc:TransactionDocument): TransactionDocumentBuilder {\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.REFUND || this.transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND || this.transactionDocument.type === TRANSACTION_TYPE.SALE_EXCHANGE) {\r\n this.transactionDocument.originalTransId = tranDoc.transactionId;\r\n if(tranDoc.apiResponse && tranDoc.apiResponse.internalId)\r\n {\r\n this.transactionDocument.originalExternalId = tranDoc.apiResponse.internalId.toString();\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * unreferenced Refund\r\n * @returns boolean value\r\n */\r\n addUnreferencedRefund(): TransactionDocumentBuilder {\r\n this.transactionDocument.unreferencedRefund = true;\r\n return this;\r\n }\r\n\r\n getRefundTotal() {\r\n let totalRefund = 0;\r\n for (let index = 0; index < this.transactionDocument.basket.products.length; index++) {\r\n const product: TProduct = this.transactionDocument.basket.products[index];\r\n if (product.refundedTotal) {\r\n totalRefund = totalRefund + product.refundedTotal;\r\n }\r\n console.log(\"ebasket : transaction Service: totalRefund\" + totalRefund)\r\n }\r\n return totalRefund;\r\n }\r\n\r\n docId(docId: any): TransactionDocumentBuilder {\r\n this.transactionDocument.id = docId;\r\n return this;\r\n }\r\n}\r\n","import { DISCOUNTTYPE, LineDiscount, TProduct, TransactionDiscount, TransactionDocument, TRANSACTION_TYPE } from \"./mapper-library.model\"\r\nimport { TransactionDocumentBuilder } from \"./TransactionDocumentBuilder\";\r\nexport class RJMapperBuilderClass {\r\n\r\n private transactionDocument: TransactionDocument;\r\n private deviceId: any;\r\n private transactionNumber: any;\r\n private manifestVersion: any;\r\n private databaseSchemaVersion: any;\r\n private basketType: any;\r\n private xmlSchemaVersion: any;\r\n private majorVersion: any;\r\n private minorVersion: any;\r\n private externalState: any;\r\n private cashierId: any;\r\n private companyId: any;\r\n private terminalNumber: any;\r\n private taxMethodId: any;\r\n private tradingRegionId: any;\r\n private basketCurrencyId: any;\r\n private basketCountryId: any;\r\n private basketLanguageId: any;\r\n private itemCount = 0;\r\n private largestNumber = 0;\r\n private branchId: any;\r\n private createdAt: any;\r\n private updatedAt :any;\r\n private salesPersonName: any;\r\n private rjObject: any = {}\r\n\r\n constructor(transactionDoc?: TransactionDocument) {\r\n if (transactionDoc) {\r\n this.transactionDocument = transactionDoc;\r\n } else {\r\n this.transactionDocument = {\r\n transactionId: \"\",\r\n offlineTransactionId: \"\",\r\n transactionRef: \"\",\r\n dateTime: \"\",\r\n orgCode: \"\",\r\n storeId: \"\",\r\n storeNodeId: \"\",\r\n storeNodeStructure: \"\",\r\n deviceId: \"\",\r\n terminalId: \"\",\r\n userId: \"\",\r\n initiatingModule: \"eBasket\",\r\n export: false,\r\n basket: {} as any,\r\n basketSummary: {} as any,\r\n baseCurrency: \"\",\r\n type: \"\",\r\n operationStatus: \"\",\r\n createdAt: \"\",\r\n updatedAt: \"\",\r\n id: \"\",\r\n currentTransactionDetails: {} as any,\r\n saleTotal: 0,\r\n };\r\n }\r\n this.initilizeItemCount();\r\n this.setLineNumberForProducts();\r\n this.createdAt = this.getDate(this.transactionDocument.createdAt);\r\n this.updatedAt = this.getDate(this.transactionDocument.updatedAt);\r\n }\r\n\r\n getPosbasketInfo() {\r\n this.rjObject['Keyword'] = this.generateKeyword();\r\n this.rjObject['ID'] = this.generateId(this.createdAt);\r\n this.rjObject['XMLSchemaVersion'] = '2';\r\n this.rjObject['LastUpdated'] = this.updatedAt;\r\n this.rjObject['MajorVersion'] = this.majorVersion;\r\n this.rjObject['MinorVersion'] = this.minorVersion;\r\n this.rjObject['ManifestVersion'] = this.manifestVersion;\r\n this.rjObject['DatabaseSchemaVersion'] = this.databaseSchemaVersion;\r\n this.rjObject['BasketType'] = this.basketType;\r\n this.rjObject['State'] = this.getState();\r\n this.rjObject['ExternalState'] = this.externalState;\r\n\r\n return this;\r\n }\r\n\r\n\r\n getheaderInfo() {\r\n this.rjObject['Header'] = {};\r\n this.rjObject['Header'].TimeZoneOffset = this.convertToString(this.generateTimezoneoffset(this.transactionDocument.createdAt));\r\n this.rjObject['Header'].DateTimeCreated = this.createdAt;\r\n this.rjObject['Header'].OriginatedBy = {};\r\n this.rjObject['Header'].OriginatedBy.DeviceID = this.deviceId;\r\n this.rjObject['Header'].OriginatedBy.CashierID = this.cashierId;\r\n this.rjObject['Header'].OriginatedBy.CompanyID = this.companyId;\r\n this.rjObject['Header'].OriginatedBy.StoreID = this.transactionDocument.storeId;\r\n this.rjObject['Header'].OriginatedBy.BranchID = this.branchId;\r\n this.rjObject['Header'].OriginatedBy.TerminalNumber = this.terminalNumber;\r\n this.rjObject['Header'].OriginatedBy.TransactionNumber = this.transactionNumber;\r\n this.rjObject['Header'].TaxMethodID = this.taxMethodId;\r\n this.rjObject['Header'].DynamicStockLookup = this.generateDynamicStockLookUp();\r\n this.rjObject['Header'].BasketLanguageID = this.basketLanguageId; //todo\r\n this.rjObject['Header'].BasketCountryID = this.basketCountryId; //todo\r\n this.rjObject['Header'].BasketCurrencyID = this.transactionDocument.baseCurrency;\r\n this.rjObject['Header'].TradingRegionID = this.tradingRegionId;\r\n this.rjObject['Header'].Eurozone = \" \";//unknown\r\n this.rjObject['Header'].EuroBaseExchangeRate = \"\"; //unknown\r\n this.rjObject['Header'].PrintableName = this.transactionDocument.userName; //unknown\r\n\r\n return this;\r\n }\r\n\r\n rjMapper() {\r\n var transactionDiscount:any = [] ;\r\n if (this.transactionDocument.basket.transactionDiscount && this.transactionDocument.basket.transactionDiscount.length > 0) {\r\n transactionDiscount = this.transactionDocument.basket.transactionDiscount\r\n }\r\n if (this.transactionDocument.type === TRANSACTION_TYPE.SALE) {\r\n this.rjObject['ProductSale'] = [];\r\n this.rjObject['ModifierItem'] = [];\r\n\r\n this.transactionDocument.basket.products.forEach((element: any) => {\r\n let lineDiscount = [];\r\n if (this.transactionDocument.basket.lineDiscount && this.transactionDocument.basket.lineDiscount.length > 0) {\r\n lineDiscount = this.transactionDocument.basket.lineDiscount.filter((x: any) => x.itemLineId === element.itemLineId);\r\n if (lineDiscount.length > 0) {\r\n const index = this.transactionDocument.basket.lineDiscount.indexOf(lineDiscount[0]);\r\n if (index > -1) {\r\n this.transactionDocument.basket.lineDiscount.splice(index, 1);\r\n }\r\n }\r\n }\r\n let data = this.addProduct(element, (lineDiscount.length > 0 ? lineDiscount[0] : null),(transactionDiscount.length > 0 ? transactionDiscount : null));\r\n this.rjObject['ProductSale'].push(data);\r\n this.getModifierItem(lineDiscount.length > 0 ? lineDiscount[0] : null, element.itemLineId);\r\n });\r\n let transactionPromotion = [];\r\n if (this.transactionDocument.basket.transactionPromotion && this.transactionDocument.basket.transactionPromotion.length > 0) {\r\n transactionPromotion = this.transactionDocument.basket.transactionPromotion;\r\n this.getTransactionPromotion(transactionPromotion);\r\n }\r\n } else if (this.transactionDocument.type === TRANSACTION_TYPE.REFUND) {\r\n this.rjObject['ProductReturn'] = [];\r\n this.rjObject['ModifierItem'] = []; \r\n this.transactionDocument.basket.products.forEach((element: any) => {\r\n let data = this.returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null),(transactionDiscount.length > 0 ? transactionDiscount : null));\r\n this.rjObject['ProductReturn'].push(data);\r\n this.getModifierItem(element.lineDiscount, element.itemLineId);\r\n });\r\n } else if (this.transactionDocument.type === TRANSACTION_TYPE.SALE_REFUND) {\r\n this.rjObject['ProductReturn'] = [];\r\n this.rjObject['ModifierItem'] = [];\r\n \r\n let transactionDoc: any = new TransactionDocumentBuilder().basket(this.transactionDocument.currentTransactionDetails).build();\r\n transactionDoc.basket.products.forEach((element: any) => {\r\n let data = this.returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null),(transactionDiscount.length > 0 ? transactionDiscount : null));\r\n let obj = {\r\n \"OriginalReceiptSupplied\": 0,\r\n \"OriginalBranchID\": 0,\r\n \"OriginalTerminalNumber\": 0,\r\n \"OriginalTransactionNumber\": 0,\r\n \"OriginalCashierNumber\": 0\r\n };\r\n data['Return'] = {...data['Return'], ...obj};\r\n this.rjObject['ProductReturn'].push(data);\r\n this.getModifierItem(element.lineDiscount, element.itemLineId);\r\n })\r\n } else if (this.transactionDocument.type === TRANSACTION_TYPE.SALE_EXCHANGE) {\r\n this.rjObject['ProductReturn'] = [];\r\n this.rjObject['ProductSale'] = [];\r\n this.rjObject['ModifierItem'] = [];\r\n \r\n let transactionDoc: any = new TransactionDocumentBuilder().basket(this.transactionDocument.currentTransactionDetails).build();\r\n transactionDoc.basket.products.forEach((element: any) => {\r\n if (element.refundedQuantity > 0) {\r\n let returnProduct = this.returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null),(transactionDiscount.length > 0 ? transactionDiscount : null));\r\n let obj = {\r\n \"OriginalReceiptSupplied\": 0,\r\n \"OriginalBranchID\": 0,\r\n \"OriginalTerminalNumber\": 0,\r\n \"OriginalTransactionNumber\": 0,\r\n \"OriginalCashierNumber\": 0\r\n };\r\n returnProduct['Return'] = {...returnProduct['Return'], ...obj};\r\n this.rjObject['ProductReturn'].push(returnProduct);\r\n } else {\r\n let addProduct = this.addProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null) ,(transactionDiscount.length > 0 ? transactionDiscount : null));\r\n this.rjObject['ProductSale'].push(addProduct);\r\n }\r\n this.getModifierItem(element.lineDiscount, element.itemLineId);\r\n })\r\n\r\n }\r\n return this;\r\n }\r\n\r\n getBasketDiscount() {\r\n if (!this.transactionDocument.basket.transactionDiscount) return this;\r\n this.rjObject['BasketDiscount'] = [];\r\n this.transactionDocument.basket.transactionDiscount.forEach((element: any) => {\r\n let obj: any = {}\r\n obj['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['DeviceID']=this.deviceId;\r\n obj['DateTimeCreated']=this.updatedAt;\r\n obj['NetValue'] = this.convertToString(element.discountAmount * -1);\r\n obj['EffectiveNetValue'] =this.convertToString( element.discountAmount * -1);\r\n obj['Description'] = element.reasonDisplayText;\r\n obj['UserID'] = this.transactionDocument.userName;\r\n obj['ReasonCodeID'] = element.reasonCode;\r\n obj['DiscountType'] = this.convertToString(element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1); \r\n obj['RoundingRule'] = this.convertToString(2);\r\n obj['ModifiedLineNumber'] = element.itemLineIds; \r\n obj['LineNumber'] = this.convertToString(this.generateLineNumber()); \r\n obj['DiscountedValue'] = this.transactionDocument.basketSummary.basketTotal + this.transactionDocument.basketSummary.discountTotal;\r\n if(element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase()){\r\n obj['DiscountPercentage'] = this.convertToString((element.discountAmount / this.transactionDocument.basketSummary.basketTotal).toFixed(1))\r\n }\r\n if(this.transactionDocument.type === 'REFUND'){\r\n obj['NetValue'] = this.convertToString(element.discountAmount < 0 ? -element.discountAmount : element.discountAmount);\r\n obj['EffectiveNetValue'] =this.convertToString( element.discountAmount < 0 ? -element.discountAmount : element.discountAmount);\r\n }\r\n\r\n this.rjObject['BasketDiscount'].push(obj);\r\n });\r\n return this;\r\n }\r\n\r\n getModifierItem(data: any, lineNo: any) {\r\n if (data && lineNo) {\r\n let obj: any = {};\r\n obj.XMLSchemaVersion = 1;\r\n obj.LineNumber = this.generateLineNumber();\r\n obj.NetValue = 0;\r\n obj.EffectiveNetValue = 0;\r\n obj.Description = data.percentageDiscountReasonName ? data.percentageDiscountReasonName : data.priceOverrideReasonName;\r\n obj.DeviceID = this.deviceId;\r\n obj.UserID = this.transactionDocument.userName;\r\n obj.DateTimeCreated = this.updatedAt;\r\n obj.AuthorisingUserID = this.transactionDocument.userName;\r\n obj.ReasonCodeID = data.percentageDiscountReasonCode ? data.percentageDiscountReasonCode : data.priceOverrideReasonCode;\r\n obj.ModifiedLineNumber = lineNo;\r\n obj.ModifiedIndex = 1;\r\n\r\n this.rjObject['ModifierItem'].push(obj);\r\n }\r\n }\r\n\r\n getTrailerInfo() {\r\n this.rjObject['Trailer'] = {};\r\n this.rjObject.Trailer.DateTimeCompleted = this.updatedAt;\r\n this.rjObject.Trailer.CompletedBy = {};\r\n this.rjObject.Trailer.CompletedBy.DeviceID = this.deviceId;\r\n this.rjObject.Trailer.CompletedBy.CashierID = this.cashierId;\r\n this.rjObject.Trailer.CompletedBy.StoreID = this.transactionDocument.storeId;\r\n this.rjObject.Trailer.CompletedBy.BranchID = this.branchId;\r\n this.rjObject.Trailer.CompletedBy.TerminalNumber = this.terminalNumber;\r\n this.rjObject.Trailer.CompletedBy.TransactionNumber = this.transactionNumber;\r\n this.rjObject.Trailer.Total = this.convertToString(this.transactionDocument.basketSummary.basketTotal * 100);\r\n this.rjObject.Trailer.ItemCount = this.itemCount; //gives total count for product\r\n this.rjObject.Trailer.ItemQuantity = this.convertToString(this.transactionDocument.basketSummary.totalItems);\r\n this.rjObject.Trailer.NetItemQuantity = this.convertToString(this.transactionDocument.basketSummary.totalItems);\r\n this.rjObject.Trailer.TaxTotal = this.convertToString(this.removeDecimal(this.transactionDocument.basketSummary.VATTotal));\r\n this.rjObject.Trailer.SequenceDeviceID = this.deviceId;\r\n this.rjObject.Trailer.SequenceNumber = 'snsn' //static for now\r\n\r\n this.rjObject['Trailer']['TaxItem'] = [];\r\n this.transactionDocument.basket.taxBreakdown.taxLines.forEach((element: any) => {\r\n let obj: any = {};\r\n\r\n obj['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['TaxRate'] = this.convertToString(element.VATCode);\r\n obj['TaxableTotal'] = this.convertToString(this.removeDecimal(element.taxableAmount));\r\n obj['TaxTotal'] = this.convertToString(this.removeDecimal(this.removeDecimal(element.taxLineTotal)));\r\n obj['TaxDescription'] = this.convertToString(element.VATCode);\r\n obj['TaxIncluded'] = '1';\r\n obj['TaxPercentage'] = this.addDecimal(element.VAT.toFixed(2)).toFixed(2);\r\n\r\n this.rjObject['Trailer']['TaxItem'].push(obj)\r\n });\r\n if (this.transactionDocument.basket.linePromotion.length > 0 || this.transactionDocument.basket.linePromotion.length > 0) {\r\n this.rjObject['Trailer']['PromotionItem'] = [];\r\n if (this.transactionDocument.basket.linePromotion.length > 0) {\r\n this.transactionDocument.basket.linePromotion.forEach((element: any) => {\r\n let obj: any = {};\r\n\r\n obj['PromotionID'] = element.promotionId;\r\n obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;\r\n obj['PromotionQuantity'] = \"1\";\r\n obj['PromotionDescription'] = element.displayText;\r\n obj['PromotionHit'] = {}\r\n obj['PromotionHit']['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['PromotionHit']['HitNumber'] = \"1\";\r\n obj['PromotionHit']['HitQuantity'] = \"1\";\r\n obj['PromotionHit']['HitSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;\r\n obj['PromotionHit']['PromotionTrigger'] = {};\r\n let product = this.transactionDocument.basket.products.find((item: any) => item.itemLineId == element.itemLineId);\r\n obj['PromotionHit']['PromotionTrigger']['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['PromotionHit']['PromotionTrigger']['ProductID'] = product.SKU;\r\n obj['PromotionHit']['PromotionTrigger']['UnitValue'] = this.convertToString(element.promotionLinePrice / product.quantity);\r\n obj['PromotionHit']['PromotionTrigger']['LineNumber'] = this.getNumber(product.SKU);\r\n obj['PromotionHit']['PromotionTrigger']['Quantity'] = this.convertToString(product.quantity.toFixed(1));\r\n obj['PromotionHit']['PromotionTrigger']['TaxCode'] = this.transactionDocument.basket.taxBreakdown.taxLines.find((item: any) => item.itemLineId == element.itemLineId).VATCode;\r\n this.rjObject['Trailer']['PromotionItem'].push(obj);\r\n });\r\n }\r\n\r\n if (this.transactionDocument.basket.transactionPromotion.length > 0) {\r\n\r\n this.transactionDocument.basket.transactionPromotion.forEach((element: any) => {\r\n let obj: any = {};\r\n obj['PromotionID'] = element.promotionId;\r\n obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;\r\n obj['PromotionQuantity'] = \"1\";\r\n obj['PromotionDescription'] = element.displayText;\r\n obj['PromotionHit'] = {}\r\n obj['PromotionHit']['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['PromotionHit']['HitNumber'] = \"1\";\r\n obj['PromotionHit']['HitQuantity'] = \"1\";\r\n obj['PromotionHit']['HitSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;\r\n obj['PromotionHit']['PromotionTrigger'] = [];\r\n this.transactionDocument.basket.products.forEach((product: any) => {\r\n let promotionTrigger = {};\r\n element.itemLineIds.forEach((itemLineId: any) => {\r\n if (JSON.stringify(itemLineId) === product.itemLineId) {\r\n promotionTrigger['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n promotionTrigger['ProductID'] = product.SKU;\r\n promotionTrigger['UnitValue'] = this.convertToString(element.promotionLinePrice / product.quantity);\r\n promotionTrigger['LineNumber'] = this.getNumber(product.SKU);\r\n promotionTrigger['Quantity'] = this.convertToString(product.quantity);\r\n promotionTrigger['TaxCode'] = this.transactionDocument.basket.taxBreakdown.taxLines.find((item: any) => item.itemLineId == product.itemLineId).VATCode;\r\n obj['PromotionHit']['PromotionTrigger'].push(promotionTrigger);\r\n }\r\n });\r\n });\r\n this.rjObject['Trailer']['PromotionItem'].push(obj);\r\n });\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n getTenderInfo() {\r\n if (this.transactionDocument.paymentDetails && this.transactionDocument.paymentDetails.length > 0) {\r\n this.transactionDocument.paymentDetails.forEach((element: any) => {\r\n if(element.externalTenderKey){\r\n this.rjObject[element.externalTenderKey] = [];\r\n if (element.paymentType.toUpperCase() === 'GIFT CARD') {\r\n let obj = {\r\n XMLSchemaVersion: this.xmlSchemaVersion,\r\n LineNumber: this.generateLineNumber(),\r\n NetValue: this.convertToString(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n EffectiveNetValue: this.convertToString(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n Description: this.getDescription(element),\r\n DeviceID: this.deviceId,\r\n UserID: this.transactionDocument.userName,\r\n DateTimeCreated: this.updatedAt,\r\n TenderType: element.externalTenderType ? element.externalTenderType : '',\r\n TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',\r\n TenderAmount: this.convertToString(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n CurrencyID: this.transactionDocument.baseCurrency,\r\n CurrencyDescription: this.transactionDocument.baseCurrency,\r\n GiftVoucherSalesAllowed: '',//todo\r\n AllowRechargeableVoucherSales: '',//todo\r\n GiftVoucherID: ''\r\n }\r\n this.rjObject[element.externalTenderKey].push(obj)\r\n }\r\n else {\r\n let obj1 = {\r\n XMLSchemaVersion: \"1\",\r\n LineNumber: this.generateLineNumber(),//todo\r\n NetValue: this.convertToString(-1 * this.removeDecimal(Math.round(element.amount))),\r\n EffectiveNetValue: this.convertToString(-1 * this.removeDecimal(Math.round(element.amount))),\r\n Description: this.getDescription(element),\r\n DeviceID: this.deviceId,\r\n UserID: this.transactionDocument.userName,\r\n DateTimeCreated: this.updatedAt,\r\n TenderType: element.externalTenderType ? element.externalTenderType : '',\r\n TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',\r\n TenderAmount: this.convertToString(-1 * this.removeDecimal(Math.round(element.amount))),\r\n CurrencyID: this.transactionDocument.baseCurrency,\r\n CurrencyDescription: this.transactionDocument.baseCurrency,\r\n IncludeInTransactionTotalCheck: \"1\",\r\n AllowRechargeableVoucherSales: \"1\",\r\n OpenDrawerAtEnd: \"1\"\r\n }\r\n this.rjObject[element.externalTenderKey].push(obj1)\r\n }\r\n } else{\r\n this.rjObject['CashTender'] = [];\r\n if (element.paymentType.toUpperCase() === 'GIFT CARD') {\r\n let obj = {\r\n XMLSchemaVersion: this.xmlSchemaVersion,\r\n LineNumber: this.generateLineNumber(),\r\n NetValue: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n EffectiveNetValue: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n Description: this.getDescription(element),\r\n DeviceID: this.deviceId,\r\n UserID: this.transactionDocument.userName,\r\n DateTimeCreated: this.updatedAt,\r\n TenderType: element.externalTenderType ? element.externalTenderType : '',\r\n TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',\r\n TenderAmount: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n CurrencyID: this.transactionDocument.baseCurrency,\r\n CurrencyDescription: this.transactionDocument.baseCurrency,\r\n GiftVoucherSalesAllowed: '',//todo\r\n AllowRechargeableVoucherSales: '',//todo\r\n GiftVoucherID: ''\r\n }\r\n this.rjObject['CashTender'].push(obj)\r\n }\r\n else {\r\n let obj1 = {\r\n XMLSchemaVersion: \"1\",\r\n LineNumber: this.generateLineNumber(),\r\n NetValue: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n EffectiveNetValue: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n Description: this.getDescription(element),\r\n DeviceID: this.deviceId,\r\n UserID: this.transactionDocument.userName,\r\n DateTimeCreated: this.updatedAt,\r\n TenderType: element.externalTenderType ? element.externalTenderType : '',\r\n TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',\r\n TenderAmount: JSON.stringify(-1 * this.removeDecimal((Math.round(element.amount)))),\r\n CurrencyID: this.transactionDocument.baseCurrency,\r\n CurrencyDescription: this.transactionDocument.baseCurrency,\r\n IncludeInTransactionTotalCheck: \"1\",\r\n AllowRechargeableVoucherSales: \"1\",\r\n OpenDrawerAtEnd: \"1\"\r\n }\r\n this.rjObject['CashTender'].push(obj1)\r\n }\r\n }\r\n });\r\n }\r\n return this;\r\n }\r\n\r\n getNumber(productId) {\r\n let lineNumber; \r\n for (let i = 0; i < this.rjObject['ProductSale'].length; i++) {\r\n const element = this.rjObject['ProductSale'][i];\r\n if(JSON.stringify(productId) === JSON.stringify(element.ProductID)){\r\n lineNumber = element.LineNumber;\r\n break;\r\n }\r\n }\r\n return lineNumber;\r\n }\r\n\r\n setLineNumberForProducts() {\r\n let itemLineIdArray = [];\r\n itemLineIdArray = this.transactionDocument.basket.products.map((product: any) => {\r\n return parseInt(product.itemLineId);\r\n })\r\n this.largestNumber = itemLineIdArray.reduce((a: any, b: any) => Math.max(a, b));\r\n }\r\n\r\n generateLineNumber() {\r\n this.largestNumber += 1;\r\n this.itemCount += 1;\r\n return this.largestNumber;\r\n }\r\n\r\n initilizeItemCount() {\r\n this.itemCount = this.transactionDocument.basket.products.length;\r\n }\r\n\r\n build() {\r\n return this.rjObject;\r\n }\r\n\r\n getDescription(element: any) {\r\n if (element.paymentType.toUpperCase() === 'CARD') {\r\n return element.cardType\r\n }\r\n else {\r\n return element.paymentType;\r\n }\r\n }\r\n\r\n getMMGROUPID(attributes) {\r\n if (attributes && attributes.length > 0) {\r\n let filterValue = attributes.filter((attribute) => attribute.name === \"MMGROUPID\");\r\n if(filterValue && filterValue.length > 0){\r\n return filterValue[0].value;\r\n }\r\n }\r\n }\r\n\r\n setDeviceInfo(id: any) {\r\n this.deviceId = id\r\n return this\r\n }\r\n\r\n removeDecimal(value: number) {\r\n return value * 100;\r\n }\r\n\r\n addDecimal(value: number) {\r\n return value /100;\r\n }\r\n\r\n setTransactionNumber(value: any) {\r\n this.transactionNumber = value;\r\n return this\r\n }\r\n\r\n setManifestVersion(value: any) {\r\n this.manifestVersion = value;\r\n return this\r\n }\r\n\r\n setDatabaseSchemaVersion(value: any) {\r\n this.databaseSchemaVersion = value;\r\n return this\r\n }\r\n\r\n setBasketType(value: any) {\r\n this.basketType = value;\r\n return this\r\n }\r\n\r\n setTradingRegionID(value: any) {\r\n this.tradingRegionId = value\r\n return this\r\n }\r\n\r\n setCompanyID(value: any) {\r\n this.companyId = value\r\n return this\r\n }\r\n\r\n setTaxMethodID(value: any) {\r\n this.taxMethodId = value\r\n return this\r\n }\r\n\r\n setMajorVersion(value: any) {\r\n this.majorVersion = value\r\n return this\r\n }\r\n\r\n setMinorVersion(value: any) {\r\n this.minorVersion = value\r\n return this\r\n }\r\n\r\n setXMLSchemaVersion(value: any) {\r\n this.xmlSchemaVersion = value\r\n return this\r\n }\r\n\r\n setExternalState(value: any) {\r\n this.externalState = value\r\n return this\r\n }\r\n\r\n setCashierID() {\r\n this.cashierId = (this.transactionDocument && this.transactionDocument.userName) ? this.transactionDocument.userName : '';\r\n return this\r\n }\r\n\r\n setTerminalNumber(value: any) {\r\n this.terminalNumber = value;\r\n return this;\r\n }\r\n\r\n setBasketLanguageID(value: any) {\r\n this.basketLanguageId = value;\r\n return this;\r\n }\r\n setBasketCountryID(value: any) {\r\n this.basketCountryId = value;\r\n return this;\r\n }\r\n\r\n setBasketCurrencyID(value: any) {\r\n this.basketCurrencyId = value;\r\n return this;\r\n }\r\n\r\n setBranchID(value: any) {\r\n this.branchId = value;\r\n return this;\r\n }\r\n\r\n setSalesPersonName(value: any) {\r\n this.salesPersonName = value;\r\n return this;\r\n }\r\n\r\n generateId(date: any) {\r\n let newDateTime = date.replace(/[^0-9]/g, '')\r\n let id = (this.deviceId + '|' + newDateTime + '|' + this.transactionNumber).toString();\r\n return id;\r\n } \r\n\r\n generateTimezoneoffset(date: any) {\r\n let x = date ? date : '';\r\n return new Date(x).getTimezoneOffset();\r\n }\r\n\r\n generateKeyword() {\r\n let x = (this.companyId + '|' + this.transactionDocument.storeId + '|' + this.terminalNumber + '|' + this.transactionNumber).toString();\r\n return x;\r\n }\r\n\r\n getState() {\r\n if (this.transactionDocument.operationStatus === 'PAY_SUCCESS') {\r\n return 'Completed';\r\n }\r\n else {\r\n return 'Cancelled';\r\n }\r\n }\r\n\r\n returnProduct(element: any, lineDiscount: LineDiscount , transactionDiscount: TransactionDiscount) {\r\n let obj: any = {};\r\n let taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((item: any) => item.itemLineId == element['itemLineId']);\r\n obj['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n obj['LineNumber'] = element['itemLineId'];\r\n obj['NetValue'] = this.removeDecimal(element['refundedTotal']);\r\n obj['EffectiveNetValue'] = this.removeDecimal(element['refundedTotal']);\r\n obj['Description'] = element['description'];\r\n obj['DeviceID'] = this.transactionDocument['terminalId'];\r\n obj['UserID'] = this.transactionDocument.userName;\r\n obj['DateTimeCreated'] = this.createdAt;\r\n obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice']*-1);\r\n obj['UnitPrice'] = this.removeDecimal(element['price']);\r\n obj['Quantity'] = this.getQuantity(element);\r\n obj['OriginalTaxAmountSet'] = 1;\r\n obj['ProductID'] = element['SKU'];\r\n obj['HandKeyed'] = 1;\r\n obj['LongDescription'] = element['description'];\r\n obj['Return'] = {};\r\n obj['Return']['ReturnReasonID'] = element['refundedReason'];\r\n obj['Return']['ReturnDescription'] = element['refundedReasonDescription'];\r\n obj['Return']['ReturnToStock'] = this.getQuantity(element);\r\n obj['TaxCode'] = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((item: any) => item.itemLineId == element['itemLineId']).VATCode;\r\n\r\n obj['DisplayTaxCode'] = ''; // todo\r\n obj['ProductAttributes'] = ''; //todo - not required\r\n obj['Perishable'] = this.getMMGROUPID(element.attributes);\r\n //obj['MMGroupID'] = this.getCaregories(element);\r\n obj['MMGroupID'] = this.getMMGROUPID(element.attributes);\r\n obj['CustomerDetails'] = \"\"; // todo - blank\r\n obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO\r\n obj['OriginalTaxAmount'] = this.convertToString((this.removeDecimal(this.getOriginalTax(element,taxTotal.VAT) * -1)).toFixed(2));\r\n obj['taxAmount'] = this.removeDecimal(taxTotal.taxLineTotal < 0 ?(taxTotal.taxLineTotal) : (-taxTotal.taxLineTotal));\r\n\r\n if (lineDiscount) {\r\n if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {\r\n // line discount\r\n obj['Discount'] = {};\r\n obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;\r\n obj['Discount'].ModifierDateTime = obj.DateTimeCreated;\r\n obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;\r\n obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;\r\n obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;\r\n obj['Discount'].DiscountType = lineDiscount.discountType;\r\n obj['Discount'].XMLSchemaVersion = 1;\r\n obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));\r\n obj['Discount'].DiscountedValue = this.removeDecimal(lineDiscount.unitPrice);\r\n obj['Discount'].DiscountPercentage = lineDiscount.percentageDiscountValue;\r\n obj['Discount'].RoundingRule = 2;\r\n }\r\n\r\n if (lineDiscount.priceOverrideReasonCode && lineDiscount.priceOverrideReasonName) {\r\n //price override\r\n obj['PriceOverride'] = {};\r\n obj['PriceOverride'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;\r\n obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;\r\n obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;\r\n obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;\r\n obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;\r\n obj['PriceOverride'].XMLSchemaVersion = 1;\r\n obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);\r\n obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);\r\n }\r\n\r\n //update the product price\r\n obj.NetValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;\r\n obj.EffectiveNetValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;\r\n obj.ExtendedValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;\r\n obj.UnitPrice = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;\r\n }\r\n\r\n if(transactionDiscount) {\r\n obj['BasketDiscountModifier'] = [];\r\n this.transactionDocument.basket.transactionDiscount.forEach((e: any) => { \r\n let discountObj: any ={}\r\n e.itemLineIds.forEach((x: any) => {\r\n if (x == element.itemLineId) { \r\n var discountAmount = this.convertToString(e.discountAmount * -1); \r\n discountObj.BasketDiscountLineNumber = this.getLineNumber(e,discountAmount);\r\n discountObj.XMLSchemaVersion = this.xmlSchemaVersion;\r\n discountObj.DiscountedValue = this.getDiscountedValue(element.totalLinePrice, e.discountAmount);\r\n obj['BasketDiscountModifier'].push(discountObj);\r\n } \r\n }); \r\n });\r\n var totaltransactionDiscount = 0;\r\n obj['BasketDiscountModifier'].forEach((value:any)=>{\r\n totaltransactionDiscount = totaltransactionDiscount + value.DiscountedValue;\r\n });\r\n //update the product price\r\n obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount;\r\n }\r\n\r\n if (this.transactionDocument.basket.transactionPromotion.length > 0) {\r\n obj['PromotionSaving'] = [];\r\n this.transactionDocument.basket.transactionPromotion.forEach((transactionPromo: any) => {\r\n let promotionObj: any = {};\r\n transactionPromo.itemLineIds.forEach((itemLineId: any) => {\r\n if (itemLineId == element.itemLineId) {\r\n promotionObj.ModifierValue = transactionPromo.promotionAmount;\r\n promotionObj.ModifierDateTime = this.transactionDocument.createdAt;\r\n promotionObj.ModifierDescription = transactionPromo.displayText;\r\n promotionObj.XMLSchemaVersion = this.xmlSchemaVersion;\r\n promotionObj.PromotionID = transactionPromo.promotionId;\r\n promotionObj.PromotionDescription = transactionPromo.displayText;\r\n promotionObj.HitNumber = '1';\r\n promotionObj.PromotionHitProductQuantity = this.getQuantity(element);\r\n promotionObj.PromotionHitQuantity = this.getQuantity(element) * -1;\r\n obj['PromotionSaving'].push(promotionObj);\r\n }\r\n });\r\n });\r\n }\r\n\r\n return obj;\r\n }\r\n\r\n addProduct(element: TProduct, lineDiscount: LineDiscount, transactionDiscount: TransactionDiscount) {\r\n let taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((item: any) => item.itemLineId == element['itemLineId']);\r\n let obj: any = {\r\n XMLSchemaVersion: this.xmlSchemaVersion,\r\n LineNumber: element.itemLineId,\r\n NetValue: this.removeDecimal(element.totalLinePrice),\r\n EffectiveNetValue: this.removeDecimal(element.totalLinePrice),\r\n Description: element.description,\r\n DeviceID: this.deviceId,\r\n UserID: this.transactionDocument.userName,\r\n DateTimeCreated: this.createdAt,\r\n ExtendedValue: this.removeDecimal(element.price),\r\n UnitPrice: this.removeDecimal(element.price),\r\n //MMGroupID: this.getCaregories(element),\r\n Quantity: element.quantity,\r\n SalespersonID: this.transactionDocument.userName,\r\n SalespersonName: this.salesPersonName,\r\n TaxCode: this.transactionDocument.basket['taxBreakdown']['taxLines'].find((item: any) => item.itemLineId == element['itemLineId']).VATCode,\r\n TaxModifiable: \"1\", //todo\r\n OriginalTaxAmount : this.convertToString((this.removeDecimal(this.getOriginalTax(element,taxTotal.VAT)).toFixed(2))),\r\n TaxAmount : this.convertToString(this.removeDecimal(taxTotal.taxLineTotal)),\r\n OriginalTaxAmountSet: \"1\",//todo\r\n ProductID: element.SKU,\r\n HandKeyed: \"1\",//todo\r\n CustomerDetails: \"\",\r\n Perishable: this.getMMGROUPID(element.attributes),\r\n MMGroupID: this.getMMGROUPID(element.attributes)\r\n }\r\n if (lineDiscount) {\r\n if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {\r\n // line discount\r\n obj['Discount'] = {};\r\n obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;\r\n obj['Discount'].ModifierDateTime = obj.DateTimeCreated;\r\n obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;\r\n obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;\r\n obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;\r\n obj['Discount'].DiscountType = lineDiscount.discountType;\r\n obj['Discount'].XMLSchemaVersion = 1;\r\n obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));\r\n obj['Discount'].DiscountedValue = this.removeDecimal(lineDiscount.unitPrice);\r\n obj['Discount'].DiscountPercentage = lineDiscount.percentageDiscountValue;\r\n obj['Discount'].RoundingRule = 2;\r\n }\r\n\r\n if (lineDiscount.priceOverrideReasonCode && lineDiscount.priceOverrideReasonName) {\r\n //price override\r\n obj['PriceOverride'] = {};\r\n obj['PriceOverride'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;\r\n obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;\r\n obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;\r\n obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;\r\n obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;\r\n obj['PriceOverride'].XMLSchemaVersion = this.xmlSchemaVersion;\r\n obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);\r\n obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);\r\n }\r\n\r\n //update the product price\r\n obj['NetValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);\r\n obj['EffectiveNetValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);\r\n obj['ExtendedValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);\r\n obj['UnitPrice'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);\r\n }\r\n\r\n if(transactionDiscount) {\r\n obj['BasketDiscountModifier'] = [];\r\n this.transactionDocument.basket.transactionDiscount.forEach((e:any) => { \r\n let discountObj: any ={};\r\n e.itemLineIds.forEach((itemLineId: any) => {\r\n if (itemLineId == element.itemLineId) { \r\n let discountAmount = this.convertToString(e.discountAmount * -1); \r\n discountObj.XMLSchemaVersion = this.xmlSchemaVersion;\r\n discountObj.DiscountedValue = -(this.getDiscountedValue(element.totalLinePrice, e.discountAmount));\r\n discountObj.BasketDiscountLineNumber = this.getLineNumber(e,discountAmount) ;\r\n obj['BasketDiscountModifier'].push(discountObj); \r\n } \r\n }); \r\n });\r\n let totaltransactionDiscount = 0;\r\n obj['BasketDiscountModifier'].forEach((value:any)=>{\r\n totaltransactionDiscount = totaltransactionDiscount + value.DiscountedValue;\r\n });\r\n //update the product price\r\n obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount; \r\n }\r\n \r\n if (this.transactionDocument.basket.transactionPromotion.length > 0 || this.transactionDocument.basket.linePromotion.length > 0) {\r\n obj['DistributedPromotionSaving'] = [];\r\n if (this.transactionDocument.basket.transactionPromotion.length > 0) {\r\n this.transactionDocument.basket.transactionPromotion.forEach((e: any) => {\r\n let promotionObj: any = {};\r\n e.itemLineIds.forEach((itemLineId: any) => {\r\n if (itemLineId == element.itemLineId) {\r\n promotionObj.PromotionID = e.promotionId;\r\n promotionObj.Hit = '1';\r\n promotionObj.Saving = this.getSaving(element.totalLinePrice, e.promotionAmount);\r\n promotionObj.ISaving = this.getSaving(element.totalLinePrice, e.promotionAmount);\r\n obj['DistributedPromotionSaving'].push(promotionObj);\r\n }\r\n });\r\n });\r\n }\r\n\r\n if (this.transactionDocument.basket.linePromotion.length > 0) {\r\n this.transactionDocument.basket.linePromotion.forEach((linePromotion: any) => {\r\n let promotionObj: any = {};\r\n if (element.itemLineId == linePromotion.itemLineId) {\r\n promotionObj.PromotionID = linePromotion.promotionId;\r\n promotionObj.Hit = \"1\";\r\n promotionObj.Saving = linePromotion.promotionLinePrice;\r\n promotionObj.ISaving = linePromotion.promotionLinePrice;\r\n obj['DistributedPromotionSaving'].push(promotionObj);\r\n }\r\n });\r\n }\r\n let transactionPromotion = 0;\r\n obj['DistributedPromotionSaving'].forEach((value: any) => {\r\n transactionPromotion = transactionPromotion + value.Saving;\r\n });\r\n obj['EffectiveNetValue'] = obj.EffectiveNetValue + transactionPromotion;\r\n }\r\n return obj;\r\n }\r\n\r\n getSaving(price,promotionAmount): any {\r\n let Saving = (price*promotionAmount)/this.transactionDocument.basketSummary.saleTotal;\r\n return Saving;\r\n }\r\n\r\n getLineNumber(value: any,discountAmount:string ){\r\n let lineNumber;\r\n for (let i = 0; i < this.rjObject['BasketDiscount'].length; i++) {\r\n const element = this.rjObject['BasketDiscount'][i];\r\n if( value.reasonCode === element.ReasonCodeID && discountAmount === element.NetValue){\r\n lineNumber = element.LineNumber;\r\n break; \r\n } \r\n }\r\n return lineNumber; \r\n }\r\n\r\n\r\n getDiscountedValue(price:any ,discountAmount:any ) {\r\n let DiscountedValue =((price * discountAmount)/this.transactionDocument.basketSummary.saleTotal)*100 ;\r\n return DiscountedValue;\r\n }\r\n\r\n getOriginalTax(element: TProduct, VAT) {\r\n let pricebeforetax = (element.price * 100)/(100 + VAT )\r\n let originaltax= element.price - pricebeforetax\r\n return originaltax;\r\n }\r\n\r\n convertToString(value: any) {\r\n try {\r\n value = JSON.stringify(value);\r\n return value;\r\n }\r\n catch (e) {\r\n console.log(value, 'can not be converted in string', e);\r\n }\r\n }\r\n\r\n generateDynamicStockLookUp() {\r\n let x = '0';\r\n this.transactionDocument.basket.products.forEach((element: any) => {\r\n if (element.deliveryMethod === '1' || element.deliveryMethod === '2') {\r\n x = '1';\r\n }\r\n });\r\n return x;\r\n }\r\n\r\n // getAttributes(){\r\n // let name: string | any[] = []\r\n // this.transactionDocument.basket.products.forEach((element: any) => {\r\n // if (element && element.attributes && element.attributes.length > 0) {\r\n // name = element.attributes.filter((x: any) => x.name.toUpperCase() === element.name.toUpperCase());\r\n // }\r\n // });\r\n // if (name.length > 0) {\r\n // return name[0].value\r\n // }\r\n // else{\r\n // return \"\"\r\n // }\r\n // }\r\n\r\n // getCaregories(element) {\r\n // let MMGroupId = \" \";\r\n // if (element.categories && element.categories.length > 0) {\r\n // let categories = element.categories.filter((x) => x.parentId != '');\r\n // let value = categories.filter((x) => x.id != x.parentId);\r\n // MMGroupId = value[0].name;\r\n // }\r\n // return MMGroupId;\r\n // }\r\n\r\n getDate(date:string){\r\n let offset = this.generateTimezoneoffset(date) * -1;\r\n let offsetHours = Math.abs(Math.floor(offset / 60)); \r\n\t let offsetMinutes = Math.abs(offset) - offsetHours * 60;\r\n\r\n let offsetSign = '+';\r\n if (offset < 0) {\r\n offsetSign = '-';\r\n }\r\n\r\n let newdate = date.substring(0,19);\r\n const x = (newdate+ offsetSign +String(offsetHours).padStart(2, '0')+':'+String(offsetMinutes).padStart(2, '0')).toString();\r\n return x; \r\n }\r\n \r\n getTransactionPromotion(transactionPromotion){\r\n if(transactionPromotion && transactionPromotion.length > 0){\r\n this.rjObject['PromoVoucherItem'] = {};\r\n this.rjObject['PromoVoucherItem']['XMLSchemaVersion'] = this.xmlSchemaVersion;\r\n this.rjObject['PromoVoucherItem']['LineNumber'] = this.generateLineNumber();\r\n this.rjObject['PromoVoucherItem']['NetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;\r\n this.rjObject['PromoVoucherItem']['EffectiveNetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;\r\n this.rjObject['PromoVoucherItem']['Description'] = transactionPromotion[0].promotionInfo;\r\n this.rjObject['PromoVoucherItem']['DeviceID'] = this.deviceId;\r\n this.rjObject['PromoVoucherItem']['UserID'] = this.transactionDocument.userName;\r\n this.rjObject['PromoVoucherItem']['DateTimeCreated'] = this.createdAt;\r\n this.rjObject['PromoVoucherItem']['ProductId'] = \"\"; //todo\r\n this.rjObject['PromoVoucherItem']['SerialNumber'] = \"\" ; //todo\r\n this.rjObject['PromoVoucherItem']['MMGroupId'] = \"\";\r\n }\r\n }\r\n \r\n getQuantity(element: any) {\r\n let quantity\r\n if(this.transactionDocument.unreferencedRefund){\r\n quantity = element['quantity'] < 0 ? element['quantity'] : (-element['quantity']);\r\n }\r\n else{\r\n quantity = element['refundedQuantity'] < 0 ? element['refundedQuantity'] : (-element['refundedQuantity']);\r\n }\r\n return quantity;\r\n }\r\n}\r\n","import { TransactionDocument } from \"./mapper-library.model\";\r\n\r\nexport class WebReturnMapperBuilderClass {\r\n\r\n private document: any;\r\n private webReturnObject: TransactionDocument = {\r\n id: '',\r\n orgCode: \"\",\r\n storeId: \"\",\r\n storeNodeId: \"\",\r\n storeNodeStructure: \"\",\r\n deviceId: \"\",\r\n terminalId: \"\",\r\n initiatingModule: \"\",\r\n export: false,\r\n basket: {},\r\n basketSummary: {},\r\n baseCurrency: \"\",\r\n customer: {\r\n firstName: '',\r\n lastName: '',\r\n email: '',\r\n postCode: '',\r\n id: '',\r\n billingAddress: {},\r\n shippingAddress: {},\r\n\r\n }\r\n }\r\n\r\n constructor(document) {\r\n if (document) {\r\n this.document = document;\r\n }\r\n }\r\n\r\n WebReturnMapper() {\r\n this.webReturnObject['type'] = 'WEB_RETURNS';\r\n this.webReturnObject['datetime'] = this.getUTCDateTime(this.getText(this.document.updated_at));\r\n this.webReturnObject.baseCurrency = this.getText(this.document.base_currency_code);\r\n this.webReturnObject.storeId = this.getText(this.document.store_id);\r\n this.webReturnObject.subsidiaryId = '1';\r\n this.webReturnObject.initiatingModule = 'MAGENTO';\r\n this.webReturnObject.createdAt = this.getUTCDateTime(this.getText(this.document.created_at));\r\n this.webReturnObject.updatedAt = this.getUTCDateTime(this.getText(this.document.updated_at));\r\n this.webReturnObject.export = true;\r\n this.webReturnObject.transCompletedAt = this.getUTCDateTime(this.getText(this.document.updated_at));\r\n this.webReturnObject['externalTransactionId'] = this.getText(this.document.order_id);\r\n\r\n // customer\r\n this.webReturnObject['customer']['firstName'] = this.getText(this.document.customer_firstname) || '';\r\n this.webReturnObject['customer']['lastName'] = this.getText(this.document.customer_lastname) || '';\r\n this.webReturnObject['customer']['email'] = this.getText(this.document.customer_email) || '';\r\n this.webReturnObject['customer']['postCode'] = '';\r\n\r\n // Billing address\r\n this.webReturnObject['customer']['billingAddress']['address1'] = (this.document.billing_address && this.document.billing_address.street) ? this.getText(this.document.billing_address.street) : '';\r\n this.webReturnObject['customer']['billingAddress']['city'] = (this.document.billing_address && this.document.billing_address.city) ? this.getText(this.document.billing_address.city) : '';\r\n this.webReturnObject['customer']['billingAddress']['county'] = (this.document.billing_address && this.document.billing_address.region) ? this.getText(this.document.billing_address.region) : '';\r\n this.webReturnObject['customer']['billingAddress']['postCode'] = (this.document.billing_address && this.document.billing_address.postcode) ? this.getText(this.document.billing_address.postcode) : '';\r\n this.webReturnObject['customer']['billingAddress']['country'] = (this.document.billing_address && this.document.billing_address.country) ? this.getText(this.document.billing_address.country) : '';\r\n\r\n // Shipping address\r\n this.webReturnObject['customer']['shippingAddress']['address1'] = (this.document.shipping_address && this.document.shipping_address.street) ? this.getText(this.document.shipping_address.street) : '';\r\n this.webReturnObject['customer']['shippingAddress']['city'] = (this.document.shipping_address && this.document.shipping_address.city) ? this.getText(this.document.shipping_address.city) : '';\r\n this.webReturnObject['customer']['shippingAddress']['county'] = (this.document.shipping_address && this.document.shipping_address.region) ? this.getText(this.document.shipping_address.region) : '';\r\n this.webReturnObject['customer']['shippingAddress']['postCode'] = (this.document.shipping_address && this.document.shipping_address.postcode) ? this.getText(this.document.shipping_address.postcode) : '';\r\n this.webReturnObject['customer']['shippingAddress']['country'] = (this.document.shipping_address && this.document.shipping_address.country) ? this.getText(this.document.shipping_address.country) : '';\r\n\r\n // basketSummary \r\n this.webReturnObject.basketSummary['discountTotal'] = Number(this.document.discount_amount ? this.getText(this.document.discount_amount) : 0);\r\n this.webReturnObject.basketSummary['VATTotal'] = Number(this.document.base_total_paid ? this.getText(this.document.base_total_paid) : 0);\r\n this.webReturnObject.basketSummary['saleTotal'] = Number(this.document.base_total_invoiced ? this.getText(this.document.base_total_invoiced) : 0);\r\n this.webReturnObject.basketSummary['basketTotal'] = Number(this.document.base_total_paid ? this.getText(this.document.base_total_paid) : 0);\r\n this.webReturnObject.basketSummary['totalItems'] = Number(this.document.total_qty_ordered ? this.getText(this.document.total_qty_ordered) : 0);\r\n this.webReturnObject.basketSummary['refundTotal'] = Number(this.document.base_total_refunded ? this.getText(this.document.base_total_refunded) : 0);\r\n\r\n // basket line discount\r\n this.webReturnObject.basket['lineDiscount'] = [];\r\n\r\n let lineDiscount = {\r\n itemLineId: (this.document.items && this.document.items.item && this.document.items.item.item_id) ? this.getText(this.document.items.item.item_id) : 0,\r\n discountAmount: (this.document.items && this.document.items.item && this.document.items.item.discount_amount) ? Number(this.getText(this.document.items.item.discount_amount)) : 0\r\n }\r\n this.webReturnObject.basket['lineDiscount'].push(lineDiscount);\r\n\r\n // basket transaction discount\r\n this.webReturnObject.basket['transactionDiscount'] = [];\r\n\r\n let transactionDiscount = {\r\n discountAmount: (this.document && this.document.discount_amount) ? Number(this.getText(this.document.discount_amount)) : 0\r\n }\r\n this.webReturnObject.basket['transactionDiscount'].push(transactionDiscount);\r\n\r\n // basket products \r\n this.webReturnObject.basket['products'] = [];\r\n let product : any= {};\r\n if (this.document.items && this.document.items.item && this.document.items.item) {\r\n if (this.document.items.item instanceof Array) {\r\n this.document.items.item.forEach(element => {\r\n product = {\r\n description: (element.name) ? this.getText(element.name) : '',\r\n SKU: (element.sku) ? this.getText(element.sku) : '',\r\n quantity: (element.qty_ordered) ? Number(this.getText(element.qty_ordered)) : 0,\r\n refundedQuantity: (element.qty_refunded) ? Number(this.getText(this.document.items.item.qty_refunded)) : 0,\r\n price: (element.original_price) ? Number(this.getText(element.original_price)) : 0,\r\n itemLineId: (element.item_id) ? Number(this.getText(element.item_id)) : 0,\r\n // totalLinePrice: (element.row_invoiced) ? Number(this.getText(element.row_invoiced)) : 0,\r\n totalLinePrice: ((element.qty_ordered - element.qty_refunded) * element.base_original_price) || 0,\r\n }\r\n if (product && product.price != 0) {\r\n this.webReturnObject.basket['products'].push(product);\r\n }\r\n });\r\n } else {\r\n product = {\r\n description: (this.document.items && this.document.items.item && this.document.items.item.name) ? this.getText(this.document.items.item.name) : '',\r\n SKU: (this.document.items && this.document.items.item && this.document.items.item.sku) ? this.getText(this.document.items.item.sku) : '',\r\n quantity: (this.document.items && this.document.items.item && this.document.items.item.qty_ordered) ? Number(this.getText(this.document.items.item.qty_ordered)) : 0,\r\n refundedQuantity: (this.document.items && this.document.items.item && this.document.items.item.qty_refunded) ? Number(this.getText(this.document.items.item.qty_refunded)) : 0,\r\n price: (this.document.items && this.document.items.item && this.document.items.item.original_price) ? Number(this.getText(this.document.items.item.original_price)) : 0,\r\n itemLineId: (this.document.items && this.document.items.item && this.document.items.item.item_id) ? Number(this.getText(this.document.items.item.item_id)) : 0,\r\n // totalLinePrice: (this.document.items && this.document.items.item && this.document.items.item.row_invoiced) ? Number(this.getText(this.document.items.item.row_invoiced)) : 0,\r\n totalLinePrice: ((this.document.items.item.qty_ordered - this.document.items.item.qty_refunded) * this.document.items.item.base_original_price) || 0,\r\n }\r\n if (product && product.price != 0) {\r\n this.webReturnObject.basket['products'].push(product);\r\n }\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n deviceId(deviceId) {\r\n this.webReturnObject.deviceId = deviceId;\r\n return this;\r\n }\r\n\r\n terminalId(terminalId) {\r\n this.webReturnObject.terminalId = terminalId;\r\n return this;\r\n }\r\n\r\n orgCode(orgCode) {\r\n this.webReturnObject.orgCode = orgCode;\r\n return this;\r\n }\r\n\r\n storeId(storeId) {\r\n this.webReturnObject.storeId = storeId;\r\n return this;\r\n }\r\n\r\n storeNodeId(storeNodeId: string) {\r\n this.webReturnObject.storeNodeId = storeNodeId;\r\n return this;\r\n }\r\n\r\n storeNodeStructure(storeNodeStructure: string) {\r\n this.webReturnObject.storeNodeStructure = storeNodeStructure;\r\n return this;\r\n }\r\n\r\n docId(docId) {\r\n this.webReturnObject.id = docId;\r\n return this;\r\n }\r\n\r\n updateUserID(userID: string) {\r\n this.webReturnObject.userId = userID;\r\n return this;\r\n }\r\n\r\n updateUserName(name) {\r\n this.webReturnObject.userName = name;\r\n return this;\r\n }\r\n\r\n build() {\r\n return this.webReturnObject;\r\n }\r\n\r\n getText(obj) {\r\n if (obj && obj.text) {\r\n return obj.text;\r\n } else {\r\n return obj;\r\n }\r\n }\r\n\r\n getUTCDateTime(date) {\r\n if (date) {\r\n return new Date(date).toISOString();\r\n }\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;AAAA,MAYa,sBAAsB;IAEjC,iBAAiB;;;;IAEjB,QA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