@pmcretail/mapper-library 0.0.47 → 0.0.49

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.
@@ -1 +1 @@
1
- {"version":3,"file":"pmcretail-mapper-library.js","sources":["../../../projects/mapper-library/src/lib/mapper-library.component.ts","../../../projects/mapper-library/src/lib/mapper-library.module.ts","../../../projects/mapper-library/src/lib/mapper-library.model.ts","../../../projects/mapper-library/src/lib/basket.service.ts","../../../projects/mapper-library/src/lib/number-util.service.ts","../../../projects/mapper-library/src/lib/TransactionDocumentBuilder.ts","../../../projects/mapper-library/src/lib/RJ-mapper.class.ts","../../../projects/mapper-library/src/lib/WebReturn-mapper.class.ts","../../../projects/mapper-library/src/lib/WebReturnSalesforceMapper.class.ts","../../../projects/mapper-library/src/lib/WebReturnMagento2RestV1.class.ts","../../../projects/mapper-library/src/public-api.ts","../../../projects/mapper-library/src/pmcretail-mapper-library.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'lib-mapper-library',\r\n template: `\r\n <p>\r\n mapper-library works!\r\n </p>\r\n `,\r\n styles: [\r\n ]\r\n})\r\nexport class MapperLibraryComponent implements OnInit {\r\n\r\n constructor() { }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { MapperLibraryComponent } from './mapper-library.component';\r\n\r\n\r\n\r\n@NgModule({\r\n declarations: [\r\n MapperLibraryComponent\r\n ],\r\n imports: [\r\n ],\r\n exports: [\r\n MapperLibraryComponent\r\n ]\r\n})\r\nexport class MapperLibraryModule { }\r\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 WEB_RETURNS = \"WEB_RETURNS\"\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 SHIP_TO_STORE = 4\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 linePromotionAmount?:number; // promotion amount applied accross the line\r\n promotionAmount?:number; // promotion amount applied on 1 unit\r\n refundedReason?: string;\r\n refundedReasonDescription?:string;\r\n promotionId?:string;\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 type?:string;\r\n subLevelType?:PROMOTION_LEVEL\r\n trigger?:Trigger[];\r\n couponCode?:string;\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: BasketSummary;\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 externalTransactionDetails?: externalTransactionDetails[];\r\n refundRequest?: any[];\r\n isInStoreOrder?: 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 shippingTotal?: number;\r\n basketTotalWithShippingTotal?: number;\r\n inStore?: BasketSummaryDetails;\r\n webOrder?: BasketSummaryDetails;\r\n cnc?: BasketSummaryDetails;\r\n}\r\n\r\nexport interface BasketSummaryDetails {\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 shippingTotal?: number;\r\n basketTotalWithShippingTotal?: 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 | Address[] | any;\r\n shippingAddress?: Address | Address[] | any;\r\n shipmentDetails?: ShipmentDetails[];\r\n addressDetail?: string;\r\n noCustomerSelected?: boolean;\r\n externalId?: string; \r\n}\r\n\r\nexport interface Address \r\n{\r\n id?: string;\r\n countryCode?: string;\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\n export interface ShipmentDetails {\r\n id?: string,\r\n deliveryGroup?: 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}\r\n\r\nexport interface TransactionInfo {\r\n shippingId?: string,\r\n externalShippingId?: string,\r\n invoiceId?: string\r\n}\r\n\r\nexport interface Coupons {\r\n name?: string;\r\n id?: string;\r\n}\r\n\r\nexport interface externalTransactionDetails {\r\n uniqueId?: string,\r\n providerType?: string,\r\n details?: TransactionInfo,\r\n coupons?: Coupons[]\r\n}\r\n\r\nexport enum INITIATING_MODULE {\r\n EBASKET = \"eBasket\"\r\n}\r\n\r\nexport interface pendingMethod {\r\n _type?: string;\r\n type?: string;\r\n message?: string;\r\n path?: string;\r\n details?: ShipmentId;\r\n}\r\n\r\nexport interface ShipmentId {\r\n shipmentId?: string;\r\n}\r\n\r\nexport interface CustomerAddress {\r\n _type?: string;\r\n email?: string;\r\n address1?: string;\r\n city?: string;\r\n country_code?: string;\r\n first_name?: string;\r\n full_name?: string;\r\n id?: string;\r\n last_name?: string;\r\n phone?: string;\r\n salutation?: string;\r\n c_area?: string;\r\n c_email?: string;\r\n c_phoneWhatsApp?: string;\r\n c_strValue?: string;\r\n postal_code?: string;\r\n}\r\n\r\nexport interface CustomerInfo {\r\n _type?: string;\r\n customer_id?: string;\r\n email?: string;\r\n}\r\n\r\nexport interface GroupedTaxItem {\r\n _type?: string;\r\n tax_rate?: number;\r\n tax_value?: number;\r\n}\r\n\r\nexport interface additionalNotes {\r\n _type?: string;\r\n link?: string;\r\n}\r\n\r\nexport interface ProductItem {\r\n _type?: string;\r\n adjusted_tax?: number;\r\n base_price?: number;\r\n bonus_product_line_item?: boolean;\r\n gift?: boolean;\r\n item_id?: string;\r\n item_text?: string;\r\n price?: number;\r\n price_adjustments?: PriceAdjustment[];\r\n price_after_item_discount?: number;\r\n price_after_order_discount?: number;\r\n product_id?: string;\r\n product_name?: string;\r\n quantity?: number;\r\n shipment_id?: string;\r\n tax?: number;\r\n tax_basis?: number;\r\n tax_class_id?: string;\r\n tax_rate?: number;\r\n c_osuObjectData?:string;\r\n}\r\n\r\nexport interface ShippingMethod {\r\n _type?: string;\r\n description?: string;\r\n id?: string;\r\n name?: string;\r\n price?: number;\r\n c_approachingThresholdMessage?: string;\r\n c_estimatedArrivalTime?: string;\r\n c_isEmail?: boolean;\r\n c_storePickupEnabled?: boolean;\r\n c_thresholdValue?: number;\r\n} \r\n\r\nexport interface shipment {\r\n _type?: string;\r\n adjusted_merchandize_total_tax?: number;\r\n adjusted_shipping_total_tax?: number;\r\n gift?: boolean;\r\n merchandize_total_tax?: number;\r\n product_sub_total?: number;\r\n product_total?: number;\r\n shipment_id?: string;\r\n shipment_total?: number;\r\n shipping_address?: CustomerAddress;\r\n shipping_method?: ShippingMethod;\r\n shipping_status?: string;\r\n shipping_total?: number;\r\n shipping_total_tax?: number;\r\n tax_total?: number;\r\n c_fromStoreId?: string;\r\n}\r\n\r\nexport interface ShippingItem {\r\n _type?: string;\r\n adjusted_tax?: number;\r\n base_price?: number;\r\n item_id?: string;\r\n item_text?: string;\r\n price?: number;\r\n price_after_item_discount?: number;\r\n shipment_id?: string;\r\n tax?: number;\r\n tax_basis?: number;\r\n tax_class_id?: string;\r\n tax_rate?: number;\r\n}\r\n\r\nexport interface AppliedDiscount {\r\n _type?: string,\r\n amount?: number,\r\n percentage?: number,\r\n type?: string\r\n}\r\n\r\nexport interface PriceAdjustment {\r\n _type?: string,\r\n applied_discount?: AppliedDiscount,\r\n coupon_code?: string,\r\n creation_date?: string,\r\n custom?: boolean,\r\n item_text?: string,\r\n last_modified?: string,\r\n manual?: boolean,\r\n price?: number\r\n price_adjustment_id?: string,\r\n promotion_id?: string,\r\n promotion_link?: string\r\n}\r\n\r\nexport interface OrderDetails {\r\n _v?: string;\r\n _type?: string;\r\n _resource_state?: string;\r\n _flash?: pendingMethod[];\r\n adjusted_merchandize_total_tax?: number;\r\n adjusted_shipping_total_tax?: number;\r\n agent_basket?: boolean;\r\n basket_id?: string;\r\n billing_address?: CustomerAddress;\r\n channel_type?: string;\r\n creation_date?: string;\r\n currency?: string;\r\n customer_info?: CustomerInfo;\r\n grouped_tax_items?: GroupedTaxItem[];\r\n last_modified?: string;\r\n merchandize_total_tax?: number;\r\n notes?: additionalNotes;\r\n order_price_adjustments?: PriceAdjustment[],\r\n order_no?: string;\r\n order_total?: number;\r\n product_items?: ProductItem[];\r\n product_sub_total?: number;\r\n product_total?: number;\r\n shipments?: shipment[];\r\n shipping_items?: ShippingItem[];\r\n shipping_total?: number;\r\n shipping_total_tax?: number;\r\n taxation?: string;\r\n tax_rounded_at_group?: boolean;\r\n tax_total?: number;\r\n c_isInStoreOrder?: boolean;\r\n}\r\n\r\nexport enum PROVIDERS {\r\n SALESFORCE = \"Salesforce\",\r\n MAGENTO = \"Magento\",\r\n MAGENTO2 = \"Magento2\" , // Its magento 2 , 2 is the root version (means second version of magento)\r\n}\r\n\r\nexport enum PROMOTION_LEVEL\r\n{\r\n LINE=\"LINE\",\r\n TRANSACTION=\"TRANSACTION\"\r\n}\r\n\r\nexport enum PROMOTION_TYPE\r\n{\r\n COUPON=\"COUPON\"\r\n}\r\n\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\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.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 className = \"BasketService\";\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 AppLoggerService.logDebug(this.className, \"updateBasketTotal\",\r\n `basketDetails updated values for transaction id\r\n ${basketDetails.transactionId}, basketDetails\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 AppLoggerService.logDebug(this.className, \"addlinePromotion\",\r\n `promotionList ${JSON.stringify(promotionList)} and \r\n basketDetails\r\n ${JSON.stringify(basketDetails)} for linePromotions`\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 AppLoggerService.logDebug(this.className, \"addTransactionPromotion\",\r\n `promotionList ${JSON.stringify(promotionList)} and \r\n basketDetails\r\n ${JSON.stringify(basketdetails)} for transactionPromotions ${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 AppLoggerService.logDebug(this.className, \"addTransactionPromotion\",\r\n \"basket details in refund calculation file\",\r\n 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 AppLoggerService.logDebug(this.className, \"updateProductTotalForSummary\",\r\n \"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 AppLoggerService.logInfo(this.className, \"updateBasketTotalForSummary\",\r\n \"update Basket Total for transaction transactionDiscount \",\r\n basketDetails.transactionDiscount\r\n );\r\n\r\n AppLoggerService.logInfo(this.className, \"updateBasketTotalForSummary\",\r\n \"update Basket Total for transaction transactionPromotion \",\r\n 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 AppLoggerService.logInfo(this.className, \"updateBasketTotalForSummary\",\r\n \"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 AppLoggerService.logDebug(this.className, \"updateTransactionDiscount\", \"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 AppLoggerService.logDebug(this.className, \"updateBasketTotalWithoutDiscount\",\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 AppLoggerService.logDebug(this.className, \"updateBasketTotalWithDiscounts\",\r\n `this.basketDetails new values ${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 AppLoggerService.logDebug(this.className, \"updateBasketTotalWithDiscounts\",\r\n \"basket new values\",\r\n 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 AppLoggerService.logDebug(this.className, \"transactionDiscountAndPromotionProductortionCalculation\",\r\n `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 AppLoggerService.logDebug(this.className, \"transactionPromotionProductPortionCalc\",\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 AppLoggerService.logDebug(this.className, \"transactionDiscountProductPortionCalc\",\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 AppLoggerService.logDebug(this.className, \"transactionDiscountProductPortionCalc\", \"discountable in basket service\", product.discountable);\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 AppLoggerService.logDebug(this.className, \"updateBasketProductDataAsPerQuantity\", `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 AppLoggerService.logDebug(this.className, \"updateBasketProductDataAsPerQuantity\", `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 AppLoggerService.logDebug(this.className, \"filterProductListWithWebOrder\", \"filterProductListWithWebOrder hit\", 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 AppLoggerService.logDebug(this.className, \"filterProductListWithDelivery\", \"filterProductListWithDelivery hit\", 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 AppLoggerService.logDebug(this.className, \"filterProductListWithDeliveryGroup\", \"filterProductListWithDeliveryGroup hit\", 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 AppLoggerService.logDebug(this.className, \"getDeliveryGroupNumbers\", \"getDeliveryGroupNumbers initiating : \",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 AppLoggerService.logDebug(this.className, \"getDeliveryGroupNumbers\", \"getDeliveryGroupNumbers : uniqueAndsortedResult\", uniqueAndsortedResult);\r\n }\r\n return uniqueAndsortedResult;\r\n }\r\n\r\n updateProductsWithNewDeliveryGroupNumber(products: Product[]) {\r\n AppLoggerService.logDebug(this.className, \"updateProductsWithNewDeliveryGroupNumber\", \"initiating : \", 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 AppLoggerService.logDebug(this.className, \"calculateEstimatedTime\", `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 AppLoggerService.logDebug(this.className, \"calculateEstimatedTime\", `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 AppLoggerService.logDebug(this.className, \"calculateEstimatedTime\", `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 AppLoggerService.logDebug(this.className, \"calculateEstimatedTime\", `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 AppLoggerService.logDebug(this.className, \"calculateEstimatedTime\", `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 AppLoggerService.logError(this.className, \"calculateEstimatedTime\", \"error in calculateEstimatedTime\", error);\r\n }\r\n return 0;\r\n }\r\n\r\n updateProductsWithDeliveryGroupNumber(oldGroup: string, newGroup: string) {\r\n AppLoggerService.logDebug(this.className, \"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 AppLoggerService.logDebug(this.className, \"getDeliveryInfo\", \"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 AppLoggerService.logError(this.className, \"getDeliveryInfo\", \"error while getting delivery info\", error);\r\n }\r\n }\r\n}\r\n","import { CurrencyPipe } from \"@angular/common\";\r\nimport { Injectable } from \"@angular/core\";\r\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.service';\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class NumberUtilService {\r\n className = \"NumberUtilService\";\r\n constructor( private cp: CurrencyPipe) {}\r\n\r\n trimTo2Decimal(no: number) {\r\n //return Math.floor(no * 100) / 100;\r\n return no;\r\n }\r\n\r\n trimTo2Decimal2(no: number) {\r\n // SEAM-11411 - Had to change 2nd param to 3 to fix rounding issue (FIXME - Needs a new story for refactoring)\r\n return Number(this.getFlooredFixed(no, 3));\r\n }\r\n\r\n getFlooredFixed(v, d) {\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 AppLoggerService.logDebug(this.className, \"AppendWithCurrencySymbol\", \"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\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.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 className = \"TransactionDocumentBuilder\";\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 AppLoggerService.logDebug(this.className, \"transactionRef\", \"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 AppLoggerService.logDebug(this.className, \"basket\", \"basket details update in transaction document\", 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 AppLoggerService.logInfo(this.className, \"basket\", \"transactiondocument basket details updated\", 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 AppLoggerService.logDebug(this.className, \"currentTransactionDetails\", \"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 AppLoggerService.logDebug(this.className, \"currentTransactionDetails\", \"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 AppLoggerService.logInfo(this.className, \"currentTransactionDetails\", \"currentTransactionDetails\", 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 AppLoggerService.logInfo(this.className, \"updateCurrentTransactionDetailsTaxBreakdown\", `item line ID :current transaction Details\",\r\n ${product.itemLineId}, tax line : ${taxLine}, basketDetails.basketTotal ${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 AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsTaxBreakdown\", \"eBasket:after calculating tax currenttransactionDetails\", this.transactionDocument.currentTransactionDetails)\r\n return this;\r\n }\r\n\r\n updateCurrentTransactionDetailsTotalTaxSummary(): TransactionDocumentBuilder {\r\n \r\n AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsTotalTaxSummary\", \"Total Tax Summery Request :\", this.transactionDocument.currentTransactionDetails.taxBreakdown);\r\n\r\n let totalTaxSummaryArray: TotalTaxSummary[] = []\r\n let totalTaxSummaryGroup = []\r\n\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 AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsTotalTaxSummary\", \"Total Tax Summery Without Grouped : \", 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 AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsTotalTaxSummary\", \"Total Tax Summer Group :\", 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 AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsDiscountTotal\", `refundTotal ${refundTotal}, basketTotal ${this.transactionDocument.currentTransactionDetails.basketSummary.basketTotal},saleTotal ${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 AppLoggerService.logDebug(this.className, \"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 AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsRefundTotal\", \"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 AppLoggerService.logInfo(this.className, \"basketSummary\", \"basketsummary updated in transaction document: \", 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 // AppLoggerService.logInfo(this.className, \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 AppLoggerService.logDebug(this.className, \"exchange\",\r\n \"this.transactionDocument.basket exchange\",\r\n 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 AppLoggerService.logDebug(this.className, \"transactionPromotion\",\r\n \"this.transactionDocument.basket.transactionPromotion\",\r\n 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 AppLoggerService.logDebug(this.className, \"transactionDiscount\",\r\n \"transaction Discount\",\r\n 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 AppLoggerService.logInfo(this.className, \"paymentDetails\", \"payment details after transaction completed\",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 AppLoggerService.logDebug(this.className, \"giftOption\",\r\n \"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 AppLoggerService.logInfo(this.className, \"getBasketDetails\", \"Getting Basket for transactionDocument\", 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 AppLoggerService.logDebug(this.className, 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 AppLoggerService.logInfo(this.className, \"getBasketDetails\", \"Basket created successfully\", 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 // // AppLoggerService.logDebug(this.className, 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 // AppLoggerService.logDebug(this.className, \"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 // AppLoggerService.logDebug(this.className, \r\n // \"ebasket : TransactionDocumentBuilder : update Basket Total: after promotion :basketTotal\",\r\n // basket.basketTotal\r\n // );\r\n\r\n // AppLoggerService.logDebug(this.className, \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 AppLoggerService.logDebug(this.className, \"getTotalDiscountWithTransactionDiscountsAndPromotions\", \"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 AppLoggerService.logDebug(this.className, \"appendCurrencySymbol\", \"add currency with value\", returnval);\r\n return returnval;\r\n } else {\r\n const returnval = \"-\" + (currency + value * -1);\r\n AppLoggerService.logDebug(this.className, \"appendCurrencySymbol\", \"returnVal\", returnval);\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 // AppLoggerService.logDebug(this.className, \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 // AppLoggerService.logDebug(this.className, \r\n // \"Promotion: basket linePromotion : \",\r\n // this.transactionDocument.basket.linePromotion\r\n // );\r\n // AppLoggerService.logDebug(this.className, \r\n // \"linePromotion.itemLineId.toString() : \",\r\n // linePromotion.itemLineId.toString()\r\n // );\r\n // AppLoggerService.logDebug(this.className, \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 // AppLoggerService.logDebug(this.className, \r\n // \"product.itemLineId : \" +\r\n // this.transactionDocument.basket.lineDiscount\r\n // );\r\n // AppLoggerService.logDebug(this.className, \r\n // \"lineDiscount.itemLineId.toString() : \" +\r\n // lineDiscount.itemLineId.toString()\r\n // );\r\n // AppLoggerService.logDebug(this.className, \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 // AppLoggerService.logDebug(this.className, \"Product description :\" + product.description);\r\n // AppLoggerService.logDebug(this.className, \"Product total :\" + product.refundedTotal);\r\n // // product.displayrefundedamount=this.appendCurrencySymbol(CURRENCY[this.transactionDocument.baseCurrency],product.refundedTotal);\r\n // // AppLoggerService.logDebug(this.className, 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 AppLoggerService.logDebug(this.className, \"getTotalWithLineDiscountAndLinePromotionApplied\",\r\n \"e-basket:update product Total:\" + saletotal,\r\n 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 AppLoggerService.logInfo(this.className, \"updateDiscountTotal\", `refundTotal: ${refundTotal} this.transactionDocument.basketSummary: ${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 AppLoggerService.logDebug(this.className, \"updateDiscountTotal\", \"discountTotal\", 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 AppLoggerService.logInfo(this.className, \"updateTaxBreakdown\", `item line ID :, ${product.itemLineId},\r\n \"tax line :\", ${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 AppLoggerService.logInfo(this.className, \"updateTaxBreakdown\", `item line ID , ${product.itemLineId},\r\n \"contribution :\", ${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 AppLoggerService.logDebug(this.className, \"updateTotalTaxSummary\", \"Total Tax Summery Request :\", this.transactionDocument.basket.taxBreakdown);\r\n\r\n\r\n let totalTaxSummaryArray: TotalTaxSummary[] = []\r\n let totalTaxSummaryGroup = []\r\n\r\n AppLoggerService.logDebug(this.className, \"updateTotalTaxSummary\", \"Tax Lines for Total Tax Summery :\", 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 AppLoggerService.logDebug(this.className, \"updateTotalTaxSummary\", \"Total Tax Summery Without Grouped : \", 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 AppLoggerService.logDebug(this.className, \"updateTotalTaxSummary\", \"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 AppLoggerService.logDebug(this.className, \"getRefundTotal\", \"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\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.service';\r\nexport class RJMapperBuilderClass {\r\n\r\n className = \"RJMapperBuilderClass\";\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 AppLoggerService.logError(this.className, \"convertToString\", '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 { CurrencyPipe } from \"@angular/common\";\r\nimport { CurrentTransactionDetails, TransactionDocument, Trigger, PROMOTION_LEVEL, PROMOTION_TYPE, TProduct, TransactionPromotion } from \"./mapper-library.model\";\r\nimport { NumberUtilService } from \"./number-util.service\";\r\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.service';\r\n\r\nexport class WebReturnMapperBuilderClass {\r\n className = \"WebReturnMapperBuilderClass\";\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 isInStoreOrder: 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 currentTransactionDetails: {} as CurrentTransactionDetails\r\n }\r\n numberUtilService: any;\r\n\r\n constructor(document, private currencyPipe?: CurrencyPipe) {\r\n if (document) {\r\n this.document = document;\r\n }\r\n this.numberUtilService = new NumberUtilService(currencyPipe);\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'] = Math.abs(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 \r\n\r\n // basket products \r\n this.webReturnObject.basket['products'] = [];\r\n this.webReturnObject.basket['linePromotion']=[];\r\n this.webReturnObject.basket['transactionDiscount'] = [];\r\n this.webReturnObject.basket['transactionPromotion'] = [];\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\r\n let product : any= {};\r\n if (this.document.items && this.document.items.item) {\r\n if (this.document.items.item instanceof Array) {\r\n this.document.items.item.forEach((element, index) => {\r\n let qty = this.getText(element.qty_ordered) ? Number(this.getText(element.qty_ordered)) : 0;\r\n let refundQty = this.getText(element.qty_refunded) ? Number(this.getText(element.qty_refunded)) : 0;\r\n let price = this.getText(element.price_incl_tax) ? Number(this.getText(element.price_incl_tax)) : 0;\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(element.qty_refunded)) : 0,\r\n //price: (element.original_price) ? Number(this.getText(element.original_price)) : 0,\r\n price: price,\r\n \r\n itemLineId: (index + 1).toString(),\r\n // totalLinePrice: (element.row_invoiced) ? Number(this.getText(element.row_invoiced)) : 0,\r\n totalLinePrice: ((qty - refundQty) * price),\r\n }\r\n\r\n let promotionAmount = this.getText(element.discount_amount) ? Number(this.getText(element.discount_amount)) : 0;\r\n let appliedIDs = this.getText(element.applied_rule_ids) ? this.getText(element.applied_rule_ids):'';\r\n\r\n if (product && product.price != 0) {\r\n if(promotionAmount)\r\n {\r\n let trigger = {} as Trigger;\r\n trigger.itemLineId = product.itemLineId;\r\n trigger.quantity = product.quantity ? product.quantity : 0;\r\n \r\n let promotion = {\r\n promotionAmount:promotionAmount,\r\n promotionId:appliedIDs,\r\n itemLineId:product.itemLineId,\r\n promotionLinePrice: product.totalLinePrice - promotionAmount,\r\n trigger:trigger\r\n }\r\n\r\n this.webReturnObject.basket['linePromotion'].push(promotion);\r\n }\r\n\r\n this.webReturnObject.basket['products'].push(product);\r\n }\r\n\r\n });\r\n } else {\r\n let qty = (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 let refundQty = (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 let price = (this.document.items && this.document.items.item && this.document.items.item.price_incl_tax) ? Number(this.getText(this.document.items.item.price_incl_tax)) : 0;\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 price: price,\r\n\r\n itemLineId: \"1\",\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: ((qty - refundQty) * price),\r\n }\r\n let promotionAmount = this.getText(this.document.items.item.discount_amount) ? Number(this.getText(this.document.items.item.discount_amount)) : 0;\r\n let appliedIDs = this.getText(this.document.items.item.applied_rule_ids) ? this.getText(this.document.items.item.applied_rule_ids):'';\r\n\r\n if (product && product.price != 0) {\r\n if(promotionAmount)\r\n {\r\n let trigger = {} as Trigger;\r\n trigger.itemLineId = product.itemLineId;\r\n trigger.quantity = product.quantity ? product.quantity : 0;\r\n \r\n let promotion = {\r\n promotionAmount:promotionAmount,\r\n promotionId:appliedIDs,\r\n itemLineId:product.itemLineId,\r\n promotionLinePrice: product.totalLinePrice - promotionAmount,\r\n trigger:trigger\r\n }\r\n\r\n this.webReturnObject.basket['linePromotion'].push(promotion);\r\n }\r\n\r\n this.webReturnObject.basket['products'].push(product);\r\n }\r\n }\r\n\r\n let couponCode = this.getText(this.document.coupon_code) ? this.getText(this.document.coupon_code) : 0;\r\n let appliedIDs = this.getText(this.document.applied_rule_ids) ? this.getText(this.document.applied_rule_ids):'';\r\n let discountDescription = this.getText(this.document.discount_description) ? this.getText(this.document.discount_description):'';\r\n\r\n let couponTriggerPromotions = [] as Trigger[];\r\n if(couponCode && appliedIDs)\r\n {\r\n let transactionPromotion = {} as TransactionPromotion;\r\n\r\n if(this.webReturnObject.basket['linePromotion'] && this.webReturnObject.basket['linePromotion'].length > 0)\r\n {\r\n this.webReturnObject.basket['linePromotion'].forEach(\r\n (promotion)=>{\r\n if(promotion.promotionId === appliedIDs)\r\n {\r\n let trigger = {} as Trigger;\r\n trigger.itemLineId = promotion.itemLineId;\r\n trigger.quantity = promotion.trigger.quantity;\r\n trigger.totalQuantity = promotion.trigger.quantity;\r\n trigger.promotionAmount = promotion.promotionAmount;\r\n trigger.refundedReason = couponCode;\r\n trigger.refundedReasonDescription = discountDescription;\r\n trigger.promotionId = promotion.promotionId;\r\n couponTriggerPromotions.push(trigger);\r\n this.webReturnObject.basket['linePromotion'] = this.webReturnObject.basket['linePromotion'].filter((x)=>x.itemLineId !== promotion.itemLineId);\r\n }\r\n }\r\n );\r\n }\r\n\r\n if (couponTriggerPromotions.length > 0) {\r\n transactionPromotion.displayText = couponTriggerPromotions[0].refundedReasonDescription;\r\n transactionPromotion.name = couponTriggerPromotions[0].refundedReason;\r\n transactionPromotion.promotionAmount = -(couponTriggerPromotions.reduce((n, { promotionAmount }) => n + promotionAmount, 0));\r\n transactionPromotion.promotionId = couponTriggerPromotions[0].promotionId;\r\n transactionPromotion.promotionInfo = couponTriggerPromotions[0].refundedReasonDescription;\r\n transactionPromotion.couponCode = couponCode;\r\n transactionPromotion.itemLineIds = [];\r\n transactionPromotion.type = PROMOTION_TYPE.COUPON;\r\n transactionPromotion.subLevelType = PROMOTION_LEVEL.LINE;\r\n transactionPromotion.trigger = couponTriggerPromotions;\r\n }\r\n \r\n AppLoggerService.logDebug(this.className, \"WebReturnMapper\", \"update LinePromotion With Coupon\",transactionPromotion);\r\n \r\n if (!this.webReturnObject.basket.transactionPromotion ) {\r\n this.webReturnObject.basket.transactionPromotion = [];\r\n }\r\n \r\n if (transactionPromotion && transactionPromotion.promotionId ) {\r\n this.webReturnObject.basket.transactionPromotion.push(transactionPromotion);\r\n }\r\n }\r\n\r\n this.updateTransactionPromotionPrtionCalc();\r\n }\r\n return this;\r\n }\r\n\r\n public validateProductItemDiscount(product: TProduct) {\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 transactionPromotionProductPortionCalc(\r\n txDoc: TransactionDocument,\r\n promotion: TransactionPromotion\r\n ) {\r\n AppLoggerService.logDebug(this.className, \"transactionPromotionProductPortionCalc\",\r\n `trnsactionPromotion: ${JSON.stringify(\r\n promotion\r\n )}`\r\n );\r\n if (promotion.type === PROMOTION_TYPE.COUPON && promotion.subLevelType === PROMOTION_LEVEL.LINE) {\r\n txDoc.basket.products.forEach((product) => {\r\n product = this.validateProductItemDiscount(product);\r\n\r\n if (promotion.trigger && promotion.trigger.length > 0) {\r\n promotion.trigger.forEach((t) => {\r\n if (t.itemLineId === product.itemLineId.toString()) {\r\n product.itemDiscounts.trnPromotionsPortion += t.promotionAmount;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n else {\r\n txDoc.basket.products.forEach((product) => {\r\n product = this.validateProductItemDiscount(product);\r\n if (promotion.itemLineIds.includes(+product.itemLineId)) {\r\n let discountAmount = 0;\r\n if (this.document.items.item instanceof Array) {\r\n const productItem = this.document.items.item.find(productItem => productItem.sku === product.SKU);\r\n discountAmount = productItem.discount_amount ? +productItem.discount_amount : 0;\r\n } else {\r\n discountAmount = this.document.items.item.sku === product.SKU && this.document.items.item.discount_amount ?\r\n +this.document.items.item.discount_amount : 0;\r\n }\r\n const transactionPromotionPortion = discountAmount;\r\n product.itemDiscounts.trnPromotionsPortion += this.numberUtilService.trimTo2Decimal2(transactionPromotionPortion);\r\n }\r\n });\r\n }\r\n return txDoc;\r\n }\r\n\r\n updateTransactionPromotionPrtionCalc() {\r\n try {\r\n if (this.webReturnObject.basket.transactionPromotion && this.webReturnObject.basket.transactionPromotion.length > 0) {\r\n this.webReturnObject.basket.transactionPromotion.forEach(tr => {\r\n this.transactionPromotionProductPortionCalc(this.webReturnObject, tr)\r\n })\r\n }\r\n } catch(error) {\r\n AppLoggerService.logError(this.className, \"updateTransactionPromotionPrtionCalc\", \"updateTransactionPromotionPrtionCalc => failed:\", error);\r\n }\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 isInStoreOrder() {\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"isInStoreOrder mapping started...\"); \r\n if(this.document.payment && this.document.payment.method && this.document.payment.method === 'pos_order'){\r\n this.webReturnObject.isInStoreOrder = true;\r\n }\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"isInStoreOrder mapping ended...\");\r\n return this;\r\n }\r\n}\r\n","import { CurrencyPipe } from \"@angular/common\";\r\nimport { Address, BasketSummary, BasketSummaryDetails, CurrentTransactionDetails, Customer, DELIVERY_METHODS, PROMOTION_LEVEL, PROMOTION_TYPE, INITIATING_MODULE, LinePromotions, OrderDetails, PROVIDERS, ShipmentDetails, TRANSACTION_TYPE, TransactionDocument, TransactionInfo, TransactionPromotion, Trigger, externalTransactionDetails, TProduct, RefundProductChange } from \"./mapper-library.model\";\r\nimport { NumberUtilService } from \"./number-util.service\";\r\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.service';\r\n\r\nexport class WebReturnSalesforceMapperBuilderClass {\r\n\r\n className = \"WebReturnSalesforceMapperBuilderClass\";\r\n private orderDetails: OrderDetails;\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 isInStoreOrder: false,\r\n basket: {},\r\n basketSummary: {},\r\n baseCurrency: \"\",\r\n customer: {\r\n id: '',\r\n email: '',\r\n firstName: '',\r\n lastName: '',\r\n billingAddress: [],\r\n shippingAddress: [],\r\n shipmentDetails: [],\r\n telephone: '',\r\n postCode: '',\r\n noCustomerSelected: false\r\n },\r\n currentTransactionDetails: {} as CurrentTransactionDetails\r\n }\r\n numberUtilService: any;\r\n\r\n constructor(orderDetails: OrderDetails,\r\n private currencyPipe?: CurrencyPipe\r\n ) {\r\n if (orderDetails) {\r\n this.orderDetails = orderDetails;\r\n }\r\n this.numberUtilService = new NumberUtilService(currencyPipe);\r\n }\r\n\r\n webReturnCommonMapper() {\r\n AppLoggerService.logDebug(this.className, \"webReturnCommonMapper\", \"Mapper library: WebReturnSalesforceMapperBuilderClass: webReturnCommonMapper started...\");\r\n this.webReturnObject['type'] = TRANSACTION_TYPE.WEB_RETURNS;\r\n this.webReturnObject['datetime'] = this.getUTCDateTime(this.orderDetails.last_modified);\r\n this.webReturnObject.baseCurrency = this.orderDetails.currency;\r\n this.webReturnObject.subsidiaryId = '1';\r\n this.webReturnObject.export = true;\r\n this.webReturnObject.initiatingModule = INITIATING_MODULE.EBASKET;\r\n this.webReturnObject.createdAt = this.getUTCDateTime(this.orderDetails.creation_date);\r\n this.webReturnObject.updatedAt = this.getUTCDateTime(this.orderDetails.last_modified);\r\n this.webReturnObject.transCompletedAt = this.getUTCDateTime(this.orderDetails.last_modified);\r\n this.webReturnObject['externalTransactionId'] = this.orderDetails.order_no;\r\n AppLoggerService.logDebug(this.className, \"webReturnCommonMapper\", \"webReturnCommonMapper ended...\");\r\n return this;\r\n }\r\n\r\n // export(status, details) {\r\n // AppLoggerService.logDebug(this.className, \"Mapper library: WebReturnSalesforceMapperBuilderClass: export mapping started...\");\r\n // AppLoggerService.logDebug(this.className, \"Mapper library: WebReturnSalesforceMapperBuilderClass: status:\", status);\r\n // AppLoggerService.logDebug(this.className, \"Mapper library: WebReturnSalesforceMapperBuilderClass: details:\", JSON.stringify(details));\r\n // if (status && details && details.providers && details.providers.length > 0) {\r\n // details.providers.forEach(\r\n // providerObj => {\r\n // if (providerObj.provider && providerObj.provider === PROVIDERS.SALESFORCE) {\r\n // this.webReturnObject.export = true;\r\n // } else {\r\n // this.webReturnObject.export = false;\r\n // }\r\n // }\r\n // );\r\n // } else {\r\n // this.webReturnObject.export = false;\r\n // }\r\n // AppLoggerService.logDebug(this.className, \"Mapper library: WebReturnSalesforceMapperBuilderClass: export mapping end...\")\r\n // return this;\r\n // }\r\n\r\n getDeliveryMethod() {\r\n if(this.orderDetails.shipments && this.orderDetails.shipments.length > 0) {\r\n const shipToStoreShipment = this.orderDetails.shipments.find(shipment => shipment.c_fromStoreId);\r\n if(shipToStoreShipment) return DELIVERY_METHODS.SHIP_TO_STORE;\r\n else return DELIVERY_METHODS.DELIVERY;\r\n } else {\r\n return '';\r\n }\r\n }\r\n\r\n product() {\r\n AppLoggerService.logDebug(this.className, \"product\", \"product mapping started...\");\r\n this.webReturnObject.basket['products'] = [];\r\n if (this.orderDetails.product_items && this.orderDetails.product_items.length > 0) {\r\n this.orderDetails.product_items.forEach(\r\n (product, index) => {\r\n const productObj = {\r\n description: product.item_text ? product.item_text : '',\r\n SKU: product.product_id ? product.product_id : '',\r\n quantity: product.quantity ? product.quantity : 0,\r\n refundedQuantity: 0,\r\n price: product.base_price ? product.base_price : 0,\r\n itemLineId: (index + 1).toString(),\r\n deliveryMethod: this.getDeliveryMethod().toString(),\r\n totalLinePrice: product.price ? product.price : 0\r\n }\r\n if (product && product.price != 0) {\r\n this.webReturnObject.basket['products'].push(productObj);\r\n }\r\n }\r\n );\r\n }\r\n AppLoggerService.logDebug(this.className, \"product\", \"product mapping ended...\");\r\n return this;\r\n }\r\n\r\n linePromotion() {\r\n AppLoggerService.logDebug(this.className, \"linePromotion\", \"linePromotion mapping started...\");\r\n this.webReturnObject.basket.linePromotion = [] as LinePromotions[];\r\n let linePromotionArray = [] as LinePromotions[];\r\n if (this.orderDetails.product_items && this.orderDetails.product_items.length > 0) {\r\n this.orderDetails.product_items.forEach(\r\n (product, index) => {\r\n product.item_id = (index + 1).toString();\r\n if (product.price_adjustments && product.price_adjustments.length > 0) {\r\n product.price_adjustments.forEach(\r\n (promotion) => {\r\n if (!promotion.coupon_code) {\r\n let linePromotionObj = {} as LinePromotions;\r\n let trigger = {} as Trigger;\r\n trigger.itemLineId = product.item_id;\r\n trigger.quantity = product.quantity ? product.quantity : 0;\r\n linePromotionObj.trigger = [] as Trigger[];\r\n linePromotionObj.trigger.push(trigger);\r\n\r\n linePromotionObj.itemLineId = index + 1;\r\n linePromotionObj.promotionId = promotion.promotion_id ? promotion.promotion_id : '';\r\n linePromotionObj.displayText = promotion.item_text ? promotion.item_text : '';\r\n linePromotionObj.promotionType = promotion.applied_discount && promotion.applied_discount.type ? promotion.applied_discount.type : '';\r\n linePromotionObj.promotionAmount = promotion.price ? Math.abs(promotion.price) : 0;\r\n linePromotionObj.name = promotion.coupon_code ? promotion.coupon_code : (promotion.item_text ? promotion.item_text :'');\r\n linePromotionObj.promotionInfo = promotion.item_text ? promotion.item_text : '';\r\n linePromotionObj.promotionLinePrice = product.price - Math.abs(promotion.price);\r\n linePromotionArray.push(linePromotionObj);\r\n }\r\n }\r\n );\r\n }\r\n }\r\n );\r\n }\r\n this.webReturnObject.basket.linePromotion = linePromotionArray;\r\n AppLoggerService.logDebug(this.className, \"linePromotion\", \"linePromotion mapping ended...\");\r\n return this;\r\n }\r\n\r\n transactionPromotion() {\r\n AppLoggerService.logDebug(this.className, \"transactionPromotion\", \"transactionPromotion mapping started...\");\r\n\r\n let transactionPromotionArray = this.getTransactionPromotions(this.orderDetails);\r\n\r\n this.webReturnObject.basket.transactionPromotion = transactionPromotionArray;\r\n AppLoggerService.logDebug(this.className, \"transactionPromotion\", \"transactionPromotion mapping ended...\");\r\n return this;\r\n }\r\n\r\n getTransactionPromotions(basket): TransactionPromotion[] {\r\n try {\r\n let transactionPromotionArray = [] as TransactionPromotion[];\r\n if (basket.order_price_adjustments && basket.order_price_adjustments.length > 0) {\r\n basket.order_price_adjustments.forEach(\r\n (transactionPromotion) => {\r\n let transactionPromotionObj = {} as TransactionPromotion;\r\n\r\n transactionPromotionObj.displayText = transactionPromotion.item_text ? transactionPromotion.item_text : '';\r\n transactionPromotionObj.name = transactionPromotion.coupon_code ? transactionPromotion.coupon_code : (transactionPromotion .item_text?transactionPromotion.item_text : '');\r\n transactionPromotionObj.promotionAmount = transactionPromotion.price ? Math.abs(transactionPromotion.price) : 0;\r\n transactionPromotionObj.promotionId = transactionPromotion.promotion_id ? transactionPromotion.promotion_id : '';\r\n transactionPromotionObj.promotionInfo = transactionPromotion.item_text ? transactionPromotion.item_text : '';\r\n transactionPromotionObj.promotionType = transactionPromotion.applied_discount && transactionPromotion.applied_discount.type ? transactionPromotion.applied_discount.type : '';\r\n transactionPromotionObj.itemLineIds = this.orderDetails.product_items.map((product, index) => index + 1);\r\n if (transactionPromotion.coupon_code) {\r\n transactionPromotionObj.type = PROMOTION_TYPE.COUPON;\r\n transactionPromotionObj.couponCode = transactionPromotion.coupon_code;\r\n transactionPromotionObj.subLevelType = PROMOTION_LEVEL.TRANSACTION;\r\n }\r\n transactionPromotionArray.push(transactionPromotionObj);\r\n }\r\n );\r\n }\r\n\r\n\r\n AppLoggerService.logDebug(this.className, \"getTransactionPromotions\", \"getTransactionPromotions : \", transactionPromotionArray);\r\n return transactionPromotionArray;\r\n } catch (error) {\r\n AppLoggerService.logError(this.className, \"getTransactionPromotions\", \"failed:\", error);\r\n throw new Error(error);\r\n }\r\n }\r\n\r\n updateLinePromotionWithCoupon() {\r\n try {\r\n\r\n let transactionPromotion = {} as TransactionPromotion;\r\n let triggerPromotion = [] as Trigger[];\r\n if (this.orderDetails.product_items && this.orderDetails.product_items.length > 0) {\r\n this.orderDetails.product_items.forEach(\r\n (product, index) => {\r\n product.item_id = (index + 1).toString();\r\n\r\n if (product.price_adjustments && product.price_adjustments.length > 0) {\r\n product.price_adjustments.forEach(\r\n (promotion) => {\r\n if (promotion.coupon_code) {\r\n let trigger = {} as Trigger;\r\n trigger.itemLineId = product.item_id;\r\n trigger.quantity = product.quantity ? product.quantity : 0;\r\n trigger.totalQuantity = product.quantity ? product.quantity : 0;\r\n trigger.promotionAmount = promotion.price ? Math.abs(promotion.price) : 0;\r\n trigger.refundedReason = promotion.coupon_code ? promotion.coupon_code : '';\r\n trigger.refundedReasonDescription = promotion.item_text ? promotion.item_text : '';\r\n trigger.promotionId = promotion.promotion_id;\r\n triggerPromotion.push(trigger);\r\n }\r\n }\r\n );\r\n }\r\n }\r\n );\r\n }\r\n\r\n if (triggerPromotion.length > 0) {\r\n transactionPromotion.displayText = triggerPromotion[0].refundedReasonDescription;\r\n transactionPromotion.name = triggerPromotion[0].refundedReason;\r\n transactionPromotion.promotionAmount = -(triggerPromotion.reduce((n, { promotionAmount }) => n + promotionAmount, 0));\r\n transactionPromotion.promotionId = triggerPromotion[0].promotionId;\r\n transactionPromotion.promotionInfo = triggerPromotion[0].refundedReasonDescription;\r\n transactionPromotion.couponCode = triggerPromotion[0].refundedReason;\r\n transactionPromotion.itemLineIds = [];\r\n transactionPromotion.type = PROMOTION_TYPE.COUPON;\r\n transactionPromotion.subLevelType = PROMOTION_LEVEL.LINE;\r\n transactionPromotion.trigger = triggerPromotion;\r\n }\r\n AppLoggerService.logDebug(this.className, \"updateLinePromotionWithCoupon\", \"transactionPromotion\", transactionPromotion);\r\n\r\n if (!this.webReturnObject.basket.transactionPromotion ) {\r\n this.webReturnObject.basket.transactionPromotion = [];\r\n }\r\n\r\n if (transactionPromotion && transactionPromotion.promotionId ) {\r\n this.webReturnObject.basket.transactionPromotion.push(transactionPromotion);\r\n }\r\n\r\n return this;\r\n } catch (error) {\r\n AppLoggerService.logError(this.className, \"updateLinePromotionWithCoupon\", \"linePromotion mapping=> failed:\", error);\r\n throw new Error(error);\r\n }\r\n }\r\n\r\n updateTransactionPromotionPrtionCalc() {\r\n if (this.webReturnObject.basket.transactionPromotion && this.webReturnObject.basket.transactionPromotion.length > 0) {\r\n\r\n this.webReturnObject.basket.transactionPromotion.forEach(tr => {\r\n this.transactionPromotionProductPortionCalc(this.webReturnObject , tr)\r\n })\r\n }\r\n return this;\r\n }\r\n\r\n transactionPromotionProductPortionCalc(\r\n txDoc: TransactionDocument,\r\n promotion: TransactionPromotion\r\n ) {\r\n AppLoggerService.logDebug(this.className, \"transactionPromotionProductPortionCalc\",\r\n `trnsactionPromotion: ${JSON.stringify(\r\n promotion\r\n )}`\r\n );\r\n if (promotion.type === PROMOTION_TYPE.COUPON && promotion.subLevelType === PROMOTION_LEVEL.LINE) {\r\n txDoc.basket.products.forEach((product) => {\r\n product = this.validateProductItemDiscount(product);\r\n\r\n if (promotion.trigger && promotion.trigger.length > 0) {\r\n promotion.trigger.forEach((t) => {\r\n if (t.itemLineId === product.itemLineId.toString()) {\r\n product.itemDiscounts.trnPromotionsPortion += t.promotionAmount;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n else {\r\n txDoc.basket.products.forEach((product) => {\r\n product = this.validateProductItemDiscount(product);\r\n if (promotion.itemLineIds.includes(+product.itemLineId)) {\r\n const productItem = this.orderDetails.product_items.find(productItem => productItem.product_id === product.SKU);\r\n const transactionPromotionPortion = (productItem && productItem.price_after_item_discount && productItem.price_after_order_discount) ?\r\n (productItem.price_after_item_discount - productItem.price_after_order_discount) : 0;\r\n product.itemDiscounts.trnPromotionsPortion += this.numberUtilService.trimTo2Decimal2(transactionPromotionPortion);\r\n }\r\n });\r\n }\r\n return txDoc;\r\n }\r\n\r\n \r\n public validateProductItemDiscount(product: TProduct) {\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 \r\n customer() {\r\n AppLoggerService.logDebug(this.className, \"customer\", \"customer mapping started...\");\r\n let customerObj = {} as Customer;\r\n customerObj.email = this.orderDetails.customer_info && this.orderDetails.customer_info.email ? this.orderDetails.customer_info.email : '';\r\n customerObj.firstName = this.orderDetails.billing_address && this.orderDetails.billing_address.first_name ? this.orderDetails.billing_address.first_name : '';\r\n customerObj.lastName = this.orderDetails.billing_address && this.orderDetails.billing_address.last_name ? this.orderDetails.billing_address.last_name : '';\r\n\r\n let shippingAddress = [] as Address[];\r\n this.orderDetails.shipments.forEach(\r\n shipment => {\r\n let shippingAddressObj = {} as Address;\r\n shippingAddressObj.id = shipment.shipping_address && shipment.shipping_address.id ? shipment.shipping_address.id : '';\r\n shippingAddressObj.countryCode = shipment.shipping_address && shipment.shipping_address.country_code ? shipment.shipping_address.country_code : '';\r\n shippingAddressObj.address1 = shipment.shipping_address && shipment.shipping_address.address1 ? shipment.shipping_address.address1 : '';\r\n shippingAddressObj.city = shipment.shipping_address && shipment.shipping_address.city ? shipment.shipping_address.city : '';\r\n shippingAddressObj.country = '';\r\n shippingAddressObj.postCode = shipment.shipping_address && shipment.shipping_address.postal_code ? shipment.shipping_address.postal_code : '';\r\n shippingAddress.push(shippingAddressObj);\r\n }\r\n )\r\n customerObj.shippingAddress = shippingAddress;\r\n\r\n let billingAddress = [] as Address[];\r\n let billingAddressObj = {} as Address;\r\n billingAddressObj.id = this.orderDetails.billing_address && this.orderDetails.billing_address.id ? this.orderDetails.billing_address.id : '';\r\n billingAddressObj.countryCode = this.orderDetails.billing_address && this.orderDetails.billing_address.country_code ? this.orderDetails.billing_address.country_code : '';\r\n billingAddressObj.address1 = this.orderDetails.billing_address && this.orderDetails.billing_address.address1 ? this.orderDetails.billing_address.address1 : '';\r\n billingAddressObj.city = this.orderDetails.billing_address && this.orderDetails.billing_address.city ? this.orderDetails.billing_address.city : '';\r\n billingAddressObj.country = '';\r\n billingAddressObj.postCode = '';\r\n billingAddress.push(billingAddressObj);\r\n customerObj.billingAddress = billingAddress;\r\n\r\n let shipmentDetails = [] as ShipmentDetails[];\r\n this.orderDetails.shipments.forEach(\r\n shipment => {\r\n let shipmentDetailsObj = {} as ShipmentDetails;\r\n shipmentDetailsObj.id = shipment.shipment_id ? shipment.shipment_id : '';\r\n shipmentDetailsObj.deliveryGroup = shipment.shipment_id ? shipment.shipment_id : '';\r\n shipmentDetails.push(shipmentDetailsObj);\r\n }\r\n );\r\n customerObj.shipmentDetails = shipmentDetails;\r\n\r\n this.webReturnObject.customer = customerObj;\r\n AppLoggerService.logDebug(this.className, \"customer\", \"customer mapping ended...\");\r\n return this;\r\n }\r\n\r\n isInStoreOrder() {\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"isInStoreOrder mapping started...\");\r\n if(this.orderDetails.c_isInStoreOrder) {\r\n this.webReturnObject.isInStoreOrder = true;\r\n }\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"isInStoreOrder mapping ended...\");\r\n return this;\r\n }\r\n\r\n externalTransactionDetails() {\r\n AppLoggerService.logDebug(this.className, \"externalTransactionDetails\", \"externalTransactionDetails mapping started...\");\r\n let externalTransactionDetails = [] as externalTransactionDetails[];\r\n if (this.orderDetails.shipments && this.orderDetails.shipments.length > 0) {\r\n this.orderDetails.shipments.forEach(\r\n shipment => {\r\n let externalTransactionDetailsObj = {} as externalTransactionDetails;\r\n let transactionInfo = {} as TransactionInfo;\r\n externalTransactionDetailsObj.uniqueId = this.orderDetails.order_no ? this.orderDetails.order_no : '';\r\n externalTransactionDetailsObj.providerType = PROVIDERS.SALESFORCE;\r\n transactionInfo.shippingId = shipment.shipping_method && shipment.shipping_method.id ? shipment.shipping_method.id : '';\r\n transactionInfo.externalShippingId = shipment.shipment_id ? shipment.shipment_id : '';\r\n externalTransactionDetailsObj.details = transactionInfo;\r\n externalTransactionDetails.push(externalTransactionDetailsObj);\r\n }\r\n );\r\n }\r\n this.webReturnObject.externalTransactionDetails = externalTransactionDetails;\r\n AppLoggerService.logDebug(this.className, \"externalTransactionDetails\", \"externalTransactionDetails mapping ended...\");\r\n return this;\r\n }\r\n\r\n basketSummary() {\r\n AppLoggerService.logDebug(this.className, \"basketSummary\", \"basketSummary mapping started...\");\r\n let basketSummary = {} as BasketSummary;\r\n let basketSummaryWebOrder = {} as BasketSummaryDetails;\r\n const linePromotionTotal = this.webReturnObject.basket.linePromotion.map(linePromotion => linePromotion.promotionAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);\r\n const transactionPromotionTotal = this.webReturnObject.basket.transactionPromotion.map(transactionPromotion => transactionPromotion.promotionAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);\r\n basketSummary.discountTotal = linePromotionTotal + transactionPromotionTotal;\r\n basketSummary.VATTotal = this.orderDetails.tax_total ? this.orderDetails.tax_total : 0;\r\n basketSummary.saleTotal = this.orderDetails.order_total ? this.orderDetails.order_total : 0;\r\n basketSummary.basketTotal = this.orderDetails.order_total ? this.orderDetails.order_total : 0;\r\n basketSummary.totalItems = this.orderDetails.product_items && this.orderDetails.product_items.length > 0 ? this.orderDetails.product_items.length : 0;\r\n basketSummary.shippingTotal = this.orderDetails.shipping_total ? this.orderDetails.shipping_total : 0;\r\n basketSummary.basketTotalWithShippingTotal = this.orderDetails.order_total ? this.orderDetails.order_total : 0;\r\n basketSummaryWebOrder.shippingTotal = this.orderDetails.shipping_total ? this.orderDetails.shipping_total : 0;\r\n basketSummaryWebOrder.basketTotalWithShippingTotal = this.orderDetails.order_total ? this.orderDetails.order_total : 0;\r\n basketSummary.webOrder = basketSummaryWebOrder;\r\n this.webReturnObject.basketSummary = basketSummary;\r\n AppLoggerService.logDebug(this.className, \"basketSummary\", \"basketSummary mapping ended...\");\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 AppLoggerService.logDebug(this.className, \"build\", \"mapping done...\");\r\n return this.webReturnObject;\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","import { CurrencyPipe } from \"@angular/common\";\r\nimport { Address, BasketSummary, BasketSummaryDetails, CurrentTransactionDetails, Customer, DELIVERY_METHODS, PROMOTION_LEVEL, PROMOTION_TYPE, INITIATING_MODULE, LinePromotions, OrderDetails, PROVIDERS, ShipmentDetails, TRANSACTION_TYPE, TransactionDocument, TransactionInfo, TransactionPromotion, Trigger, externalTransactionDetails, TProduct, RefundProductChange, Coupons, TaxBreakdown } from \"./mapper-library.model\";\r\nimport { NumberUtilService } from \"./number-util.service\";\r\nimport { AppLoggerService } from '@pmcretail/common-services/common/app-logger.service';\r\n\r\nexport class WebReturnMagento2RestV1MapperBuilderClass {\r\n\r\n className = \"WebReturnMagento2RestV1MapperBuilderClass\";\r\n private orderDetails: 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 isInStoreOrder: false,\r\n basket: {},\r\n basketSummary: {},\r\n baseCurrency: \"\",\r\n customer: {\r\n id: '',\r\n email: '',\r\n firstName: '',\r\n lastName: '',\r\n billingAddress: [],\r\n shippingAddress: [],\r\n shipmentDetails: [],\r\n telephone: '',\r\n postCode: '',\r\n noCustomerSelected: false\r\n },\r\n currentTransactionDetails: {} as CurrentTransactionDetails,\r\n externalTransactionDetails: [] as externalTransactionDetails[]\r\n }\r\n numberUtilService: any;\r\n\r\n constructor(orderDetails: any,\r\n private currencyPipe?: CurrencyPipe\r\n ) {\r\n if (orderDetails) {\r\n this.orderDetails = orderDetails;\r\n }\r\n this.numberUtilService = new NumberUtilService(currencyPipe);\r\n }\r\n\r\n webReturnCommonMapper() {\r\n AppLoggerService.logDebug(this.className, \"webReturnCommonMapper\", \"Mapping started...\");\r\n this.webReturnObject['datetime'] = this.getUTCDateTime(this.orderDetails.updated_at);\r\n this.webReturnObject.baseCurrency = this.orderDetails.order_currency_code;\r\n this.webReturnObject.subsidiaryId = '1';\r\n this.webReturnObject.export = true;\r\n this.webReturnObject.initiatingModule = INITIATING_MODULE.EBASKET;\r\n this.webReturnObject.createdAt = this.getUTCDateTime(this.orderDetails.created_at);\r\n this.webReturnObject.updatedAt = this.getUTCDateTime(this.orderDetails.updated_at);\r\n this.webReturnObject.transCompletedAt = this.getUTCDateTime(this.orderDetails.updated_at);\r\n this.webReturnObject['externalTransactionId'] = this.orderDetails.increment_id;\r\n AppLoggerService.logDebug(this.className, \"webReturnCommonMapper\", \"Mapping ended...\");\r\n return this;\r\n }\r\n\r\n product() {\r\n AppLoggerService.logDebug(this.className, \"product\", \"Mapping started...\");\r\n \r\n this.webReturnObject.basket['products'] = this.orderDetails.items\r\n ?.filter(product => product?.base_price)\r\n .map((product, index) => ({\r\n description: product.name || '',\r\n SKU: product.sku || '',\r\n quantity: product.qty_ordered || 0,\r\n refundedQuantity: product.qty_refunded || 0,\r\n price: product.base_price || 0,\r\n itemLineId: (index + 1).toString(),\r\n externalItemLineId: product.item_id || (index + 1).toString(),\r\n totalLinePrice: (product.qty_ordered ?? 0) * (product.base_price ?? 0),\r\n refundedTotal: product.amount_refunded || 0\r\n })) || [];\r\n \r\n AppLoggerService.logDebug(this.className, \"product\", \"Mapping ended...\");\r\n return this;\r\n }\r\n\r\n linePromotion() {\r\n AppLoggerService.logDebug(this.className, \"linePromotion\", \"Mapping started...\");\r\n \r\n this.webReturnObject.basket['linePromotion'] = this.orderDetails.items\r\n ?.filter(product => product?.base_price && product.discount_amount)\r\n .map((product, index) => ({\r\n trigger: [{ \r\n itemLineId: (index + 1).toString(), \r\n quantity: product.qty_ordered || 0 \r\n }],\r\n itemLineId: index + 1,\r\n promotionId: '',\r\n displayText: this.orderDetails.coupon_code || '',\r\n promotionType: '',\r\n promotionAmount: product.discount_amount || 0,\r\n name: this.orderDetails.coupon_code || '',\r\n promotionInfo: '',\r\n promotionLinePrice: product.row_total || 0\r\n })) || [];\r\n \r\n AppLoggerService.logDebug(this.className, \"linePromotion\", \"Mapping ended...\");\r\n return this;\r\n } \r\n \r\n customer() {\r\n AppLoggerService.logDebug(this.className, \"customer\", \"Mapping started...\");\r\n \r\n const { orderDetails, webReturnObject } = this;\r\n \r\n webReturnObject.customer = {\r\n id: orderDetails.customer_id || '',\r\n email: orderDetails.customer_email || '',\r\n firstName: orderDetails.customer_firstname || '',\r\n lastName: orderDetails.customer_lastname || '',\r\n shippingAddress: [],\r\n billingAddress: []\r\n } as any;\r\n \r\n const shippingAssignments = orderDetails.extension_attributes?.shipping_assignments || [];\r\n \r\n webReturnObject.customer.shippingAddress = shippingAssignments\r\n .filter(shipment => shipment?.shipping?.address)\r\n .map(shipment => {\r\n const address = shipment.shipping.address;\r\n return {\r\n id: address.customer_address_id || '',\r\n countryCode: address.country_id || '',\r\n address1: address.street?.[0] || '',\r\n address2: address.street?.[1] || '',\r\n address3: address.street?.[2] || '',\r\n city: address.city || '',\r\n country: '',\r\n postCode: address.postcode || ''\r\n };\r\n });\r\n \r\n const billingAddress = orderDetails.billing_address;\r\n if (billingAddress) {\r\n webReturnObject.customer.billingAddress.push({\r\n id: billingAddress.customer_address_id || '',\r\n countryCode: billingAddress.country_id || '',\r\n address1: billingAddress.street?.[0] || '',\r\n address2: billingAddress.street?.[1] || '',\r\n address3: billingAddress.street?.[2] || '',\r\n city: billingAddress.city || '',\r\n country: '',\r\n postCode: billingAddress.postcode || ''\r\n });\r\n }\r\n \r\n AppLoggerService.logDebug(this.className, \"customer\", \"Mpping ended...\");\r\n return this;\r\n } \r\n\r\n isInStoreOrder() {\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"Mapping started...\");\r\n this.webReturnObject.isInStoreOrder = false;\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"Mapping ended...\");\r\n return this;\r\n }\r\n\r\n externalTransactionDetails(invoiceId: string) {\r\n AppLoggerService.logDebug(this.className, \"externalTransactionDetails\", \"Mapping started...\");\r\n \r\n const coupon = this.orderDetails.coupon_code\r\n ? { name: this.orderDetails.coupon_code, id: this.orderDetails.coupon_code }\r\n : null;\r\n \r\n const externalTransactionDetailsObj = {\r\n uniqueId: this.orderDetails.increment_id || '',\r\n providerType: PROVIDERS.MAGENTO2,\r\n transactionInfo: { invoiceId: invoiceId?.toString() || '' },\r\n coupons: coupon ? [coupon] : []\r\n };\r\n \r\n this.webReturnObject.externalTransactionDetails.push(externalTransactionDetailsObj);\r\n \r\n AppLoggerService.logDebug(this.className, \"externalTransactionDetails\", \"Mapping ended...\");\r\n return this;\r\n }\r\n\r\n basketSummary() {\r\n AppLoggerService.logDebug(this.className, \"basketSummary\", \"Mapping started...\");\r\n \r\n const { orderDetails, webReturnObject } = this;\r\n\r\n const basketSummary: BasketSummary = {\r\n discountTotal: orderDetails.discount_amount || 0,\r\n VATTotal: orderDetails.tax_amount || 0,\r\n saleTotal: orderDetails.subtotal || 0,\r\n basketTotal: (orderDetails.subtotal || 0) - (orderDetails.total_online_refunded || 0),\r\n totalItems: orderDetails.total_qty_ordered ?? 0,\r\n refundTotal: orderDetails.total_online_refunded || 0,\r\n shippingTotal: orderDetails.shipping_incl_tax || 0,\r\n basketTotalWithShippingTotal: orderDetails.total_invoiced || 0,\r\n webOrder: {\r\n shippingTotal: orderDetails.shipping_incl_tax || 0,\r\n basketTotalWithShippingTotal: orderDetails.total_invoiced || 0\r\n }\r\n };\r\n \r\n webReturnObject.basketSummary = basketSummary;\r\n \r\n AppLoggerService.logDebug(this.className, \"basketSummary\", \"Mapping ended...\");\r\n return this;\r\n } \r\n\r\n refundRequest() {\r\n AppLoggerService.logDebug(this.className, \"refundRequest\", \"Mapping started...\");\r\n \r\n this.webReturnObject.refundRequest = this.orderDetails.items\r\n ?.filter(product => product?.base_price && (product.qty_refunded || 0) > 0)\r\n .map((product, index) => ({\r\n itemLineId: index + 1,\r\n refundedQuantity: product.qty_refunded || 0,\r\n refundWithPromotion: true,\r\n quantity: product.qty_ordered || 0\r\n })) || [];\r\n \r\n AppLoggerService.logDebug(this.className, \"refundRequest\", `Mapped ${this.webReturnObject.refundRequest.length} refund items.`);\r\n AppLoggerService.logDebug(this.className, \"refundRequest\", \"Mapping ended...\");\r\n \r\n return this;\r\n }\r\n\r\n updateTaxBreakdown() {\r\n AppLoggerService.logDebug(this.className, \"updateTaxBreakdown\", \"Mapping started...\");\r\n \r\n const taxLines = this.orderDetails.items\r\n ?.filter(product => product?.base_price)\r\n .map((product, index) => {\r\n const taxableAmount = product.row_total_incl_tax || 0;\r\n const VAT = product.tax_percent || 0;\r\n const preTax = this.numberUtilService.trimTo2Decimal2((taxableAmount * 100) / (100 + VAT));\r\n const taxLineTotal = this.numberUtilService.trimTo2Decimal2(taxableAmount - preTax);\r\n \r\n return {\r\n itemLineId: index + 1,\r\n VAT,\r\n VATCode: '',\r\n taxableAmount,\r\n PreTax: preTax,\r\n taxLineTotal\r\n };\r\n }) || [];\r\n \r\n this.webReturnObject.basket[\"taxBreakdown\"] = {\r\n taxLines,\r\n totalTaxableAmount: this.orderDetails.tax_amount || 0\r\n } as TaxBreakdown;\r\n \r\n AppLoggerService.logDebug(this.className, \"updateTaxBreakdown\", `Mapped ${taxLines.length} tax lines.`);\r\n AppLoggerService.logDebug(this.className, \"updateTaxBreakdown\", \"Mapping ended...\");\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() {\r\n this.webReturnObject.storeId = this.orderDetails.store_id;\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 AppLoggerService.logDebug(this.className, \"build\", \"Mapping done...\");\r\n return this.webReturnObject;\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","/*\r\n * Public API Surface of mapper-library\r\n */\r\n\r\nexport * from './lib/mapper-library.component';\r\nexport * from './lib/mapper-library.module';\r\nexport * from './lib/RJ-mapper.class';\r\nexport * from './lib/WebReturn-mapper.class';\r\nexport * from './lib/WebReturnSalesforceMapper.class';\r\nexport * from './lib/WebReturnMagento2RestV1.class';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAYa,sBAAsB,CAAA;AAEjC,IAAA,WAAA,GAAA,GAAiB;IAEjB,QAAQ,GAAA;KACP;;oHALU,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAtB,sBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,sBAAsB,EARvB,QAAA,EAAA,oBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,CAAA;4FAIU,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAVlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,Q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kBAAkB,GAAG,kBAAkB,CAAC;AAC7D,QAAA,OAAO,IAAI,CAAC;KACf;AAED,IAAA,KAAK,CAAC,KAAK,EAAA;AACP,QAAA,IAAI,CAAC,eAAe,CAAC,EAAE,GAAG,KAAK,CAAC;AAChC,QAAA,OAAO,IAAI,CAAC;KACf;AAED,IAAA,YAAY,CAAC,MAAc,EAAA;AACvB,QAAA,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC;AACrC,QAAA,OAAO,IAAI,CAAC;KACf;AAED,IAAA,cAAc,CAAC,IAAI,EAAA;AACf,QAAA,IAAI,CAAC,eAAe,CAAC,QAAQ,GAAG,IAAI,CAAC;AACrC,QAAA,OAAO,IAAI,CAAC;KACf;IAED,KAAK,GAAA;QACD,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC,eAAe,CAAC;KAC/B;AAED,IAAA,cAAc,CAAC,IAAI,EAAA;AACf,QAAA,IAAI,IAAI,EAAE;YACN,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AACvC,SAAA;KACJ;AACJ;;AC7TD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"pmcretail-mapper-library.js","sources":["../../../projects/mapper-library/src/lib/mapper-library.component.ts","../../../projects/mapper-library/src/lib/mapper-library.module.ts","../../../projects/mapper-library/src/lib/mapper-library.model.ts","../../../projects/mapper-library/src/lib/basket.service.ts","../../../projects/mapper-library/src/lib/number-util.service.ts","../../../projects/mapper-library/src/lib/TransactionDocumentBuilder.ts","../../../projects/mapper-library/src/lib/RJ-mapper.class.ts","../../../projects/mapper-library/src/lib/WebReturn-mapper.class.ts","../../../projects/mapper-library/src/lib/WebReturnSalesforceMapper.class.ts","../../../projects/mapper-library/src/lib/WebReturnMagento2RestV1.class.ts","../../../projects/mapper-library/src/public-api.ts","../../../projects/mapper-library/src/pmcretail-mapper-library.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'lib-mapper-library',\r\n template: `\r\n <p>\r\n mapper-library works!\r\n </p>\r\n `,\r\n styles: [\r\n ]\r\n})\r\nexport class MapperLibraryComponent implements OnInit {\r\n\r\n constructor() { }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { MapperLibraryComponent } from './mapper-library.component';\r\n\r\n\r\n\r\n@NgModule({\r\n declarations: [\r\n MapperLibraryComponent\r\n ],\r\n imports: [\r\n ],\r\n exports: [\r\n MapperLibraryComponent\r\n ]\r\n})\r\nexport class MapperLibraryModule { }\r\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 WEB_RETURNS = \"WEB_RETURNS\"\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 SHIP_TO_STORE = 4\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 linePromotionAmount?:number; // promotion amount applied accross the line\r\n promotionAmount?:number; // promotion amount applied on 1 unit\r\n refundedReason?: string;\r\n refundedReasonDescription?:string;\r\n promotionId?:string;\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 type?:string;\r\n subLevelType?:PROMOTION_LEVEL\r\n trigger?:Trigger[];\r\n couponCode?:string;\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: BasketSummary;\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 externalTransactionDetails?: externalTransactionDetails[];\r\n refundRequest?: any[];\r\n isInStoreOrder?: 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 shippingTotal?: number;\r\n basketTotalWithShippingTotal?: number;\r\n inStore?: BasketSummaryDetails;\r\n webOrder?: BasketSummaryDetails;\r\n cnc?: BasketSummaryDetails;\r\n}\r\n\r\nexport interface BasketSummaryDetails {\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 shippingTotal?: number;\r\n basketTotalWithShippingTotal?: 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 | Address[] | any;\r\n shippingAddress?: Address | Address[] | any;\r\n shipmentDetails?: ShipmentDetails[];\r\n addressDetail?: string;\r\n noCustomerSelected?: boolean;\r\n externalId?: string; \r\n}\r\n\r\nexport interface Address \r\n{\r\n id?: string;\r\n countryCode?: string;\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\n export interface ShipmentDetails {\r\n id?: string,\r\n deliveryGroup?: 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}\r\n\r\nexport interface TransactionInfo {\r\n shippingId?: string,\r\n externalShippingId?: string,\r\n invoiceId?: string\r\n}\r\n\r\nexport interface Coupons {\r\n name?: string;\r\n id?: string;\r\n}\r\n\r\nexport interface externalTransactionDetails {\r\n uniqueId?: string,\r\n providerType?: string,\r\n details?: TransactionInfo,\r\n coupons?: Coupons[]\r\n}\r\n\r\nexport enum INITIATING_MODULE {\r\n EBASKET = \"eBasket\"\r\n}\r\n\r\nexport interface pendingMethod {\r\n _type?: string;\r\n type?: string;\r\n message?: string;\r\n path?: string;\r\n details?: ShipmentId;\r\n}\r\n\r\nexport interface ShipmentId {\r\n shipmentId?: string;\r\n}\r\n\r\nexport interface CustomerAddress {\r\n _type?: string;\r\n email?: string;\r\n address1?: string;\r\n city?: string;\r\n country_code?: string;\r\n first_name?: string;\r\n full_name?: string;\r\n id?: string;\r\n last_name?: string;\r\n phone?: string;\r\n salutation?: string;\r\n c_area?: string;\r\n c_email?: string;\r\n c_phoneWhatsApp?: string;\r\n c_strValue?: string;\r\n postal_code?: string;\r\n}\r\n\r\nexport interface CustomerInfo {\r\n _type?: string;\r\n customer_id?: string;\r\n email?: string;\r\n}\r\n\r\nexport interface GroupedTaxItem {\r\n _type?: string;\r\n tax_rate?: number;\r\n tax_value?: number;\r\n}\r\n\r\nexport interface additionalNotes {\r\n _type?: string;\r\n link?: string;\r\n}\r\n\r\nexport interface ProductItem {\r\n _type?: string;\r\n adjusted_tax?: number;\r\n base_price?: number;\r\n bonus_product_line_item?: boolean;\r\n gift?: boolean;\r\n item_id?: string;\r\n item_text?: string;\r\n price?: number;\r\n price_adjustments?: PriceAdjustment[];\r\n price_after_item_discount?: number;\r\n price_after_order_discount?: number;\r\n product_id?: string;\r\n product_name?: string;\r\n quantity?: number;\r\n shipment_id?: string;\r\n tax?: number;\r\n tax_basis?: number;\r\n tax_class_id?: string;\r\n tax_rate?: number;\r\n c_osuObjectData?:string;\r\n}\r\n\r\nexport interface ShippingMethod {\r\n _type?: string;\r\n description?: string;\r\n id?: string;\r\n name?: string;\r\n price?: number;\r\n c_approachingThresholdMessage?: string;\r\n c_estimatedArrivalTime?: string;\r\n c_isEmail?: boolean;\r\n c_storePickupEnabled?: boolean;\r\n c_thresholdValue?: number;\r\n} \r\n\r\nexport interface shipment {\r\n _type?: string;\r\n adjusted_merchandize_total_tax?: number;\r\n adjusted_shipping_total_tax?: number;\r\n gift?: boolean;\r\n merchandize_total_tax?: number;\r\n product_sub_total?: number;\r\n product_total?: number;\r\n shipment_id?: string;\r\n shipment_total?: number;\r\n shipping_address?: CustomerAddress;\r\n shipping_method?: ShippingMethod;\r\n shipping_status?: string;\r\n shipping_total?: number;\r\n shipping_total_tax?: number;\r\n tax_total?: number;\r\n c_fromStoreId?: string;\r\n}\r\n\r\nexport interface ShippingItem {\r\n _type?: string;\r\n adjusted_tax?: number;\r\n base_price?: number;\r\n item_id?: string;\r\n item_text?: string;\r\n price?: number;\r\n price_after_item_discount?: number;\r\n shipment_id?: string;\r\n tax?: number;\r\n tax_basis?: number;\r\n tax_class_id?: string;\r\n tax_rate?: number;\r\n}\r\n\r\nexport interface AppliedDiscount {\r\n _type?: string,\r\n amount?: number,\r\n percentage?: number,\r\n type?: string\r\n}\r\n\r\nexport interface PriceAdjustment {\r\n _type?: string,\r\n applied_discount?: AppliedDiscount,\r\n coupon_code?: string,\r\n creation_date?: string,\r\n custom?: boolean,\r\n item_text?: string,\r\n last_modified?: string,\r\n manual?: boolean,\r\n price?: number\r\n price_adjustment_id?: string,\r\n promotion_id?: string,\r\n promotion_link?: string\r\n}\r\n\r\nexport interface OrderDetails {\r\n _v?: string;\r\n _type?: string;\r\n _resource_state?: string;\r\n _flash?: pendingMethod[];\r\n adjusted_merchandize_total_tax?: number;\r\n adjusted_shipping_total_tax?: number;\r\n agent_basket?: boolean;\r\n basket_id?: string;\r\n billing_address?: CustomerAddress;\r\n channel_type?: string;\r\n creation_date?: string;\r\n currency?: string;\r\n customer_info?: CustomerInfo;\r\n grouped_tax_items?: GroupedTaxItem[];\r\n last_modified?: string;\r\n merchandize_total_tax?: number;\r\n notes?: additionalNotes;\r\n order_price_adjustments?: PriceAdjustment[],\r\n order_no?: string;\r\n order_total?: number;\r\n product_items?: ProductItem[];\r\n product_sub_total?: number;\r\n product_total?: number;\r\n shipments?: shipment[];\r\n shipping_items?: ShippingItem[];\r\n shipping_total?: number;\r\n shipping_total_tax?: number;\r\n taxation?: string;\r\n tax_rounded_at_group?: boolean;\r\n tax_total?: number;\r\n c_isInStoreOrder?: boolean;\r\n}\r\n\r\nexport enum PROVIDERS {\r\n SALESFORCE = \"Salesforce\",\r\n MAGENTO = \"Magento\",\r\n MAGENTO2 = \"Magento2\" , // Its magento 2 , 2 is the root version (means second version of magento)\r\n}\r\n\r\nexport enum PROMOTION_LEVEL\r\n{\r\n LINE=\"LINE\",\r\n TRANSACTION=\"TRANSACTION\"\r\n}\r\n\r\nexport enum PROMOTION_TYPE\r\n{\r\n COUPON=\"COUPON\"\r\n}\r\n\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\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.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 className = \"BasketService\";\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 AppLoggerService.logDebug(this.className, \"updateBasketTotal\",\r\n `basketDetails updated values for transaction id\r\n ${basketDetails.transactionId}, basketDetails\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 AppLoggerService.logDebug(this.className, \"addlinePromotion\",\r\n `promotionList ${JSON.stringify(promotionList)} and \r\n basketDetails\r\n ${JSON.stringify(basketDetails)} for linePromotions`\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 AppLoggerService.logDebug(this.className, \"addTransactionPromotion\",\r\n `promotionList ${JSON.stringify(promotionList)} and \r\n basketDetails\r\n ${JSON.stringify(basketdetails)} for transactionPromotions ${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 AppLoggerService.logDebug(this.className, \"addTransactionPromotion\",\r\n \"basket details in refund calculation file\",\r\n 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 AppLoggerService.logDebug(this.className, \"updateProductTotalForSummary\",\r\n \"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 AppLoggerService.logInfo(this.className, \"updateBasketTotalForSummary\",\r\n \"update Basket Total for transaction transactionDiscount \",\r\n basketDetails.transactionDiscount\r\n );\r\n\r\n AppLoggerService.logInfo(this.className, \"updateBasketTotalForSummary\",\r\n \"update Basket Total for transaction transactionPromotion \",\r\n 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 AppLoggerService.logInfo(this.className, \"updateBasketTotalForSummary\",\r\n \"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 AppLoggerService.logDebug(this.className, \"updateTransactionDiscount\", \"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 AppLoggerService.logDebug(this.className, \"updateBasketTotalWithoutDiscount\",\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 AppLoggerService.logDebug(this.className, \"updateBasketTotalWithDiscounts\",\r\n `this.basketDetails new values ${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 AppLoggerService.logDebug(this.className, \"updateBasketTotalWithDiscounts\",\r\n \"basket new values\",\r\n 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 AppLoggerService.logDebug(this.className, \"transactionDiscountAndPromotionProductortionCalculation\",\r\n `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 AppLoggerService.logDebug(this.className, \"transactionPromotionProductPortionCalc\",\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 AppLoggerService.logDebug(this.className, \"transactionDiscountProductPortionCalc\",\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 AppLoggerService.logDebug(this.className, \"transactionDiscountProductPortionCalc\", \"discountable in basket service\", product.discountable);\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 AppLoggerService.logDebug(this.className, \"updateBasketProductDataAsPerQuantity\", `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 AppLoggerService.logDebug(this.className, \"updateBasketProductDataAsPerQuantity\", `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 AppLoggerService.logDebug(this.className, \"filterProductListWithWebOrder\", \"filterProductListWithWebOrder hit\", 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 AppLoggerService.logDebug(this.className, \"filterProductListWithDelivery\", \"filterProductListWithDelivery hit\", 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 AppLoggerService.logDebug(this.className, \"filterProductListWithDeliveryGroup\", \"filterProductListWithDeliveryGroup hit\", 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 AppLoggerService.logDebug(this.className, \"getDeliveryGroupNumbers\", \"getDeliveryGroupNumbers initiating : \",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 AppLoggerService.logDebug(this.className, \"getDeliveryGroupNumbers\", \"getDeliveryGroupNumbers : uniqueAndsortedResult\", uniqueAndsortedResult);\r\n }\r\n return uniqueAndsortedResult;\r\n }\r\n\r\n updateProductsWithNewDeliveryGroupNumber(products: Product[]) {\r\n AppLoggerService.logDebug(this.className, \"updateProductsWithNewDeliveryGroupNumber\", \"initiating : \", 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 AppLoggerService.logDebug(this.className, \"calculateEstimatedTime\", `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 AppLoggerService.logDebug(this.className, \"calculateEstimatedTime\", `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 AppLoggerService.logDebug(this.className, \"calculateEstimatedTime\", `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 AppLoggerService.logDebug(this.className, \"calculateEstimatedTime\", `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 AppLoggerService.logDebug(this.className, \"calculateEstimatedTime\", `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 AppLoggerService.logError(this.className, \"calculateEstimatedTime\", \"error in calculateEstimatedTime\", error);\r\n }\r\n return 0;\r\n }\r\n\r\n updateProductsWithDeliveryGroupNumber(oldGroup: string, newGroup: string) {\r\n AppLoggerService.logDebug(this.className, \"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 AppLoggerService.logDebug(this.className, \"getDeliveryInfo\", \"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 AppLoggerService.logError(this.className, \"getDeliveryInfo\", \"error while getting delivery info\", error);\r\n }\r\n }\r\n}\r\n","import { CurrencyPipe } from \"@angular/common\";\r\nimport { Injectable } from \"@angular/core\";\r\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.service';\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class NumberUtilService {\r\n className = \"NumberUtilService\";\r\n constructor( private cp: CurrencyPipe) {}\r\n\r\n trimTo2Decimal(no: number) {\r\n //return Math.floor(no * 100) / 100;\r\n return no;\r\n }\r\n\r\n trimTo2Decimal2(no: number) {\r\n // SEAM-11411 - Had to change 2nd param to 3 to fix rounding issue (FIXME - Needs a new story for refactoring)\r\n return Number(this.getFlooredFixed(no, 3));\r\n }\r\n\r\n getFlooredFixed(v, d) {\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 AppLoggerService.logDebug(this.className, \"AppendWithCurrencySymbol\", \"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\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.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 className = \"TransactionDocumentBuilder\";\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 AppLoggerService.logDebug(this.className, \"transactionRef\", \"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 AppLoggerService.logDebug(this.className, \"basket\", \"basket details update in transaction document\", 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 AppLoggerService.logInfo(this.className, \"basket\", \"transactiondocument basket details updated\", 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 AppLoggerService.logDebug(this.className, \"currentTransactionDetails\", \"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 AppLoggerService.logDebug(this.className, \"currentTransactionDetails\", \"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 AppLoggerService.logInfo(this.className, \"currentTransactionDetails\", \"currentTransactionDetails\", 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 AppLoggerService.logInfo(this.className, \"updateCurrentTransactionDetailsTaxBreakdown\", `item line ID :current transaction Details\",\r\n ${product.itemLineId}, tax line : ${taxLine}, basketDetails.basketTotal ${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 AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsTaxBreakdown\", \"eBasket:after calculating tax currenttransactionDetails\", this.transactionDocument.currentTransactionDetails)\r\n return this;\r\n }\r\n\r\n updateCurrentTransactionDetailsTotalTaxSummary(): TransactionDocumentBuilder {\r\n \r\n AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsTotalTaxSummary\", \"Total Tax Summery Request :\", this.transactionDocument.currentTransactionDetails.taxBreakdown);\r\n\r\n let totalTaxSummaryArray: TotalTaxSummary[] = []\r\n let totalTaxSummaryGroup = []\r\n\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 AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsTotalTaxSummary\", \"Total Tax Summery Without Grouped : \", 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 AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsTotalTaxSummary\", \"Total Tax Summer Group :\", 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 AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsDiscountTotal\", `refundTotal ${refundTotal}, basketTotal ${this.transactionDocument.currentTransactionDetails.basketSummary.basketTotal},saleTotal ${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 AppLoggerService.logDebug(this.className, \"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 AppLoggerService.logDebug(this.className, \"updateCurrentTransactionDetailsRefundTotal\", \"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 AppLoggerService.logInfo(this.className, \"basketSummary\", \"basketsummary updated in transaction document: \", 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 // AppLoggerService.logInfo(this.className, \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 AppLoggerService.logDebug(this.className, \"exchange\",\r\n \"this.transactionDocument.basket exchange\",\r\n 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 AppLoggerService.logDebug(this.className, \"transactionPromotion\",\r\n \"this.transactionDocument.basket.transactionPromotion\",\r\n 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 AppLoggerService.logDebug(this.className, \"transactionDiscount\",\r\n \"transaction Discount\",\r\n 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 AppLoggerService.logInfo(this.className, \"paymentDetails\", \"payment details after transaction completed\",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 AppLoggerService.logDebug(this.className, \"giftOption\",\r\n \"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 AppLoggerService.logInfo(this.className, \"getBasketDetails\", \"Getting Basket for transactionDocument\", 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 AppLoggerService.logDebug(this.className, 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 AppLoggerService.logInfo(this.className, \"getBasketDetails\", \"Basket created successfully\", 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 // // AppLoggerService.logDebug(this.className, 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 // AppLoggerService.logDebug(this.className, \"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 // AppLoggerService.logDebug(this.className, \r\n // \"ebasket : TransactionDocumentBuilder : update Basket Total: after promotion :basketTotal\",\r\n // basket.basketTotal\r\n // );\r\n\r\n // AppLoggerService.logDebug(this.className, \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 AppLoggerService.logDebug(this.className, \"getTotalDiscountWithTransactionDiscountsAndPromotions\", \"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 AppLoggerService.logDebug(this.className, \"appendCurrencySymbol\", \"add currency with value\", returnval);\r\n return returnval;\r\n } else {\r\n const returnval = \"-\" + (currency + value * -1);\r\n AppLoggerService.logDebug(this.className, \"appendCurrencySymbol\", \"returnVal\", returnval);\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 // AppLoggerService.logDebug(this.className, \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 // AppLoggerService.logDebug(this.className, \r\n // \"Promotion: basket linePromotion : \",\r\n // this.transactionDocument.basket.linePromotion\r\n // );\r\n // AppLoggerService.logDebug(this.className, \r\n // \"linePromotion.itemLineId.toString() : \",\r\n // linePromotion.itemLineId.toString()\r\n // );\r\n // AppLoggerService.logDebug(this.className, \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 // AppLoggerService.logDebug(this.className, \r\n // \"product.itemLineId : \" +\r\n // this.transactionDocument.basket.lineDiscount\r\n // );\r\n // AppLoggerService.logDebug(this.className, \r\n // \"lineDiscount.itemLineId.toString() : \" +\r\n // lineDiscount.itemLineId.toString()\r\n // );\r\n // AppLoggerService.logDebug(this.className, \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 // AppLoggerService.logDebug(this.className, \"Product description :\" + product.description);\r\n // AppLoggerService.logDebug(this.className, \"Product total :\" + product.refundedTotal);\r\n // // product.displayrefundedamount=this.appendCurrencySymbol(CURRENCY[this.transactionDocument.baseCurrency],product.refundedTotal);\r\n // // AppLoggerService.logDebug(this.className, 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 AppLoggerService.logDebug(this.className, \"getTotalWithLineDiscountAndLinePromotionApplied\",\r\n \"e-basket:update product Total:\" + saletotal,\r\n 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 AppLoggerService.logInfo(this.className, \"updateDiscountTotal\", `refundTotal: ${refundTotal} this.transactionDocument.basketSummary: ${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 AppLoggerService.logDebug(this.className, \"updateDiscountTotal\", \"discountTotal\", 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 AppLoggerService.logInfo(this.className, \"updateTaxBreakdown\", `item line ID :, ${product.itemLineId},\r\n \"tax line :\", ${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 AppLoggerService.logInfo(this.className, \"updateTaxBreakdown\", `item line ID , ${product.itemLineId},\r\n \"contribution :\", ${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 AppLoggerService.logDebug(this.className, \"updateTotalTaxSummary\", \"Total Tax Summery Request :\", this.transactionDocument.basket.taxBreakdown);\r\n\r\n\r\n let totalTaxSummaryArray: TotalTaxSummary[] = []\r\n let totalTaxSummaryGroup = []\r\n\r\n AppLoggerService.logDebug(this.className, \"updateTotalTaxSummary\", \"Tax Lines for Total Tax Summery :\", 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 AppLoggerService.logDebug(this.className, \"updateTotalTaxSummary\", \"Total Tax Summery Without Grouped : \", 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 AppLoggerService.logDebug(this.className, \"updateTotalTaxSummary\", \"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 AppLoggerService.logDebug(this.className, \"getRefundTotal\", \"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\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.service';\r\nexport class RJMapperBuilderClass {\r\n\r\n className = \"RJMapperBuilderClass\";\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 AppLoggerService.logError(this.className, \"convertToString\", '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 { CurrencyPipe } from \"@angular/common\";\r\nimport { CurrentTransactionDetails, TransactionDocument, Trigger, PROMOTION_LEVEL, PROMOTION_TYPE, TProduct, TransactionPromotion } from \"./mapper-library.model\";\r\nimport { NumberUtilService } from \"./number-util.service\";\r\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.service';\r\n\r\nexport class WebReturnMapperBuilderClass {\r\n className = \"WebReturnMapperBuilderClass\";\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 isInStoreOrder: 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 currentTransactionDetails: {} as CurrentTransactionDetails\r\n }\r\n numberUtilService: any;\r\n\r\n constructor(document, private currencyPipe?: CurrencyPipe) {\r\n if (document) {\r\n this.document = document;\r\n }\r\n this.numberUtilService = new NumberUtilService(currencyPipe);\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'] = Math.abs(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 \r\n\r\n // basket products \r\n this.webReturnObject.basket['products'] = [];\r\n this.webReturnObject.basket['linePromotion']=[];\r\n this.webReturnObject.basket['transactionDiscount'] = [];\r\n this.webReturnObject.basket['transactionPromotion'] = [];\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\r\n let product : any= {};\r\n if (this.document.items && this.document.items.item) {\r\n if (this.document.items.item instanceof Array) {\r\n this.document.items.item.forEach((element, index) => {\r\n let qty = this.getText(element.qty_ordered) ? Number(this.getText(element.qty_ordered)) : 0;\r\n let refundQty = this.getText(element.qty_refunded) ? Number(this.getText(element.qty_refunded)) : 0;\r\n let price = this.getText(element.price_incl_tax) ? Number(this.getText(element.price_incl_tax)) : 0;\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(element.qty_refunded)) : 0,\r\n //price: (element.original_price) ? Number(this.getText(element.original_price)) : 0,\r\n price: price,\r\n \r\n itemLineId: (index + 1).toString(),\r\n // totalLinePrice: (element.row_invoiced) ? Number(this.getText(element.row_invoiced)) : 0,\r\n totalLinePrice: ((qty - refundQty) * price),\r\n }\r\n\r\n let promotionAmount = this.getText(element.discount_amount) ? Number(this.getText(element.discount_amount)) : 0;\r\n let appliedIDs = this.getText(element.applied_rule_ids) ? this.getText(element.applied_rule_ids):'';\r\n\r\n if (product && product.price != 0) {\r\n if(promotionAmount)\r\n {\r\n let trigger = {} as Trigger;\r\n trigger.itemLineId = product.itemLineId;\r\n trigger.quantity = product.quantity ? product.quantity : 0;\r\n \r\n let promotion = {\r\n promotionAmount:promotionAmount,\r\n promotionId:appliedIDs,\r\n itemLineId:product.itemLineId,\r\n promotionLinePrice: product.totalLinePrice - promotionAmount,\r\n trigger:trigger\r\n }\r\n\r\n this.webReturnObject.basket['linePromotion'].push(promotion);\r\n }\r\n\r\n this.webReturnObject.basket['products'].push(product);\r\n }\r\n\r\n });\r\n } else {\r\n let qty = (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 let refundQty = (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 let price = (this.document.items && this.document.items.item && this.document.items.item.price_incl_tax) ? Number(this.getText(this.document.items.item.price_incl_tax)) : 0;\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 price: price,\r\n\r\n itemLineId: \"1\",\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: ((qty - refundQty) * price),\r\n }\r\n let promotionAmount = this.getText(this.document.items.item.discount_amount) ? Number(this.getText(this.document.items.item.discount_amount)) : 0;\r\n let appliedIDs = this.getText(this.document.items.item.applied_rule_ids) ? this.getText(this.document.items.item.applied_rule_ids):'';\r\n\r\n if (product && product.price != 0) {\r\n if(promotionAmount)\r\n {\r\n let trigger = {} as Trigger;\r\n trigger.itemLineId = product.itemLineId;\r\n trigger.quantity = product.quantity ? product.quantity : 0;\r\n \r\n let promotion = {\r\n promotionAmount:promotionAmount,\r\n promotionId:appliedIDs,\r\n itemLineId:product.itemLineId,\r\n promotionLinePrice: product.totalLinePrice - promotionAmount,\r\n trigger:trigger\r\n }\r\n\r\n this.webReturnObject.basket['linePromotion'].push(promotion);\r\n }\r\n\r\n this.webReturnObject.basket['products'].push(product);\r\n }\r\n }\r\n\r\n let couponCode = this.getText(this.document.coupon_code) ? this.getText(this.document.coupon_code) : 0;\r\n let appliedIDs = this.getText(this.document.applied_rule_ids) ? this.getText(this.document.applied_rule_ids):'';\r\n let discountDescription = this.getText(this.document.discount_description) ? this.getText(this.document.discount_description):'';\r\n\r\n let couponTriggerPromotions = [] as Trigger[];\r\n if(couponCode && appliedIDs)\r\n {\r\n let transactionPromotion = {} as TransactionPromotion;\r\n\r\n if(this.webReturnObject.basket['linePromotion'] && this.webReturnObject.basket['linePromotion'].length > 0)\r\n {\r\n this.webReturnObject.basket['linePromotion'].forEach(\r\n (promotion)=>{\r\n if(promotion.promotionId === appliedIDs)\r\n {\r\n let trigger = {} as Trigger;\r\n trigger.itemLineId = promotion.itemLineId;\r\n trigger.quantity = promotion.trigger.quantity;\r\n trigger.totalQuantity = promotion.trigger.quantity;\r\n trigger.promotionAmount = promotion.promotionAmount;\r\n trigger.refundedReason = couponCode;\r\n trigger.refundedReasonDescription = discountDescription;\r\n trigger.promotionId = promotion.promotionId;\r\n couponTriggerPromotions.push(trigger);\r\n this.webReturnObject.basket['linePromotion'] = this.webReturnObject.basket['linePromotion'].filter((x)=>x.itemLineId !== promotion.itemLineId);\r\n }\r\n }\r\n );\r\n }\r\n\r\n if (couponTriggerPromotions.length > 0) {\r\n transactionPromotion.displayText = couponTriggerPromotions[0].refundedReasonDescription;\r\n transactionPromotion.name = couponTriggerPromotions[0].refundedReason;\r\n transactionPromotion.promotionAmount = -(couponTriggerPromotions.reduce((n, { promotionAmount }) => n + promotionAmount, 0));\r\n transactionPromotion.promotionId = couponTriggerPromotions[0].promotionId;\r\n transactionPromotion.promotionInfo = couponTriggerPromotions[0].refundedReasonDescription;\r\n transactionPromotion.couponCode = couponCode;\r\n transactionPromotion.itemLineIds = [];\r\n transactionPromotion.type = PROMOTION_TYPE.COUPON;\r\n transactionPromotion.subLevelType = PROMOTION_LEVEL.LINE;\r\n transactionPromotion.trigger = couponTriggerPromotions;\r\n }\r\n \r\n AppLoggerService.logDebug(this.className, \"WebReturnMapper\", \"update LinePromotion With Coupon\",transactionPromotion);\r\n \r\n if (!this.webReturnObject.basket.transactionPromotion ) {\r\n this.webReturnObject.basket.transactionPromotion = [];\r\n }\r\n \r\n if (transactionPromotion && transactionPromotion.promotionId ) {\r\n this.webReturnObject.basket.transactionPromotion.push(transactionPromotion);\r\n }\r\n }\r\n\r\n this.updateTransactionPromotionPrtionCalc();\r\n }\r\n return this;\r\n }\r\n\r\n public validateProductItemDiscount(product: TProduct) {\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 transactionPromotionProductPortionCalc(\r\n txDoc: TransactionDocument,\r\n promotion: TransactionPromotion\r\n ) {\r\n AppLoggerService.logDebug(this.className, \"transactionPromotionProductPortionCalc\",\r\n `trnsactionPromotion: ${JSON.stringify(\r\n promotion\r\n )}`\r\n );\r\n if (promotion.type === PROMOTION_TYPE.COUPON && promotion.subLevelType === PROMOTION_LEVEL.LINE) {\r\n txDoc.basket.products.forEach((product) => {\r\n product = this.validateProductItemDiscount(product);\r\n\r\n if (promotion.trigger && promotion.trigger.length > 0) {\r\n promotion.trigger.forEach((t) => {\r\n if (t.itemLineId === product.itemLineId.toString()) {\r\n product.itemDiscounts.trnPromotionsPortion += t.promotionAmount;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n else {\r\n txDoc.basket.products.forEach((product) => {\r\n product = this.validateProductItemDiscount(product);\r\n if (promotion.itemLineIds.includes(+product.itemLineId)) {\r\n let discountAmount = 0;\r\n if (this.document.items.item instanceof Array) {\r\n const productItem = this.document.items.item.find(productItem => productItem.sku === product.SKU);\r\n discountAmount = productItem.discount_amount ? +productItem.discount_amount : 0;\r\n } else {\r\n discountAmount = this.document.items.item.sku === product.SKU && this.document.items.item.discount_amount ?\r\n +this.document.items.item.discount_amount : 0;\r\n }\r\n const transactionPromotionPortion = discountAmount;\r\n product.itemDiscounts.trnPromotionsPortion += this.numberUtilService.trimTo2Decimal2(transactionPromotionPortion);\r\n }\r\n });\r\n }\r\n return txDoc;\r\n }\r\n\r\n updateTransactionPromotionPrtionCalc() {\r\n try {\r\n if (this.webReturnObject.basket.transactionPromotion && this.webReturnObject.basket.transactionPromotion.length > 0) {\r\n this.webReturnObject.basket.transactionPromotion.forEach(tr => {\r\n this.transactionPromotionProductPortionCalc(this.webReturnObject, tr)\r\n })\r\n }\r\n } catch(error) {\r\n AppLoggerService.logError(this.className, \"updateTransactionPromotionPrtionCalc\", \"updateTransactionPromotionPrtionCalc => failed:\", error);\r\n }\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 isInStoreOrder() {\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"isInStoreOrder mapping started...\"); \r\n if(this.document.payment && this.document.payment.method && this.document.payment.method === 'pos_order'){\r\n this.webReturnObject.isInStoreOrder = true;\r\n }\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"isInStoreOrder mapping ended...\");\r\n return this;\r\n }\r\n}\r\n","import { CurrencyPipe } from \"@angular/common\";\r\nimport { Address, BasketSummary, BasketSummaryDetails, CurrentTransactionDetails, Customer, DELIVERY_METHODS, PROMOTION_LEVEL, PROMOTION_TYPE, INITIATING_MODULE, LinePromotions, OrderDetails, PROVIDERS, ShipmentDetails, TRANSACTION_TYPE, TransactionDocument, TransactionInfo, TransactionPromotion, Trigger, externalTransactionDetails, TProduct, RefundProductChange } from \"./mapper-library.model\";\r\nimport { NumberUtilService } from \"./number-util.service\";\r\nimport {AppLoggerService} from '@pmcretail/common-services/common/app-logger.service';\r\n\r\nexport class WebReturnSalesforceMapperBuilderClass {\r\n\r\n className = \"WebReturnSalesforceMapperBuilderClass\";\r\n private orderDetails: OrderDetails;\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 isInStoreOrder: false,\r\n basket: {},\r\n basketSummary: {},\r\n baseCurrency: \"\",\r\n customer: {\r\n id: '',\r\n email: '',\r\n firstName: '',\r\n lastName: '',\r\n billingAddress: [],\r\n shippingAddress: [],\r\n shipmentDetails: [],\r\n telephone: '',\r\n postCode: '',\r\n noCustomerSelected: false\r\n },\r\n currentTransactionDetails: {} as CurrentTransactionDetails\r\n }\r\n numberUtilService: any;\r\n\r\n constructor(orderDetails: OrderDetails,\r\n private currencyPipe?: CurrencyPipe\r\n ) {\r\n if (orderDetails) {\r\n this.orderDetails = orderDetails;\r\n }\r\n this.numberUtilService = new NumberUtilService(currencyPipe);\r\n }\r\n\r\n webReturnCommonMapper() {\r\n AppLoggerService.logDebug(this.className, \"webReturnCommonMapper\", \"Mapper library: WebReturnSalesforceMapperBuilderClass: webReturnCommonMapper started...\");\r\n this.webReturnObject['type'] = TRANSACTION_TYPE.WEB_RETURNS;\r\n this.webReturnObject['datetime'] = this.getUTCDateTime(this.orderDetails.last_modified);\r\n this.webReturnObject.baseCurrency = this.orderDetails.currency;\r\n this.webReturnObject.subsidiaryId = '1';\r\n this.webReturnObject.export = true;\r\n this.webReturnObject.initiatingModule = INITIATING_MODULE.EBASKET;\r\n this.webReturnObject.createdAt = this.getUTCDateTime(this.orderDetails.creation_date);\r\n this.webReturnObject.updatedAt = this.getUTCDateTime(this.orderDetails.last_modified);\r\n this.webReturnObject.transCompletedAt = this.getUTCDateTime(this.orderDetails.last_modified);\r\n this.webReturnObject['externalTransactionId'] = this.orderDetails.order_no;\r\n AppLoggerService.logDebug(this.className, \"webReturnCommonMapper\", \"webReturnCommonMapper ended...\");\r\n return this;\r\n }\r\n\r\n // export(status, details) {\r\n // AppLoggerService.logDebug(this.className, \"Mapper library: WebReturnSalesforceMapperBuilderClass: export mapping started...\");\r\n // AppLoggerService.logDebug(this.className, \"Mapper library: WebReturnSalesforceMapperBuilderClass: status:\", status);\r\n // AppLoggerService.logDebug(this.className, \"Mapper library: WebReturnSalesforceMapperBuilderClass: details:\", JSON.stringify(details));\r\n // if (status && details && details.providers && details.providers.length > 0) {\r\n // details.providers.forEach(\r\n // providerObj => {\r\n // if (providerObj.provider && providerObj.provider === PROVIDERS.SALESFORCE) {\r\n // this.webReturnObject.export = true;\r\n // } else {\r\n // this.webReturnObject.export = false;\r\n // }\r\n // }\r\n // );\r\n // } else {\r\n // this.webReturnObject.export = false;\r\n // }\r\n // AppLoggerService.logDebug(this.className, \"Mapper library: WebReturnSalesforceMapperBuilderClass: export mapping end...\")\r\n // return this;\r\n // }\r\n\r\n getDeliveryMethod() {\r\n if(this.orderDetails.shipments && this.orderDetails.shipments.length > 0) {\r\n const shipToStoreShipment = this.orderDetails.shipments.find(shipment => shipment.c_fromStoreId);\r\n if(shipToStoreShipment) return DELIVERY_METHODS.SHIP_TO_STORE;\r\n else return DELIVERY_METHODS.DELIVERY;\r\n } else {\r\n return '';\r\n }\r\n }\r\n\r\n product() {\r\n AppLoggerService.logDebug(this.className, \"product\", \"product mapping started...\");\r\n this.webReturnObject.basket['products'] = [];\r\n if (this.orderDetails.product_items && this.orderDetails.product_items.length > 0) {\r\n this.orderDetails.product_items.forEach(\r\n (product, index) => {\r\n const productObj = {\r\n description: product.item_text ? product.item_text : '',\r\n SKU: product.product_id ? product.product_id : '',\r\n quantity: product.quantity ? product.quantity : 0,\r\n refundedQuantity: 0,\r\n price: product.base_price ? product.base_price : 0,\r\n itemLineId: (index + 1).toString(),\r\n deliveryMethod: this.getDeliveryMethod().toString(),\r\n totalLinePrice: product.price ? product.price : 0\r\n }\r\n if (product && product.price != 0) {\r\n this.webReturnObject.basket['products'].push(productObj);\r\n }\r\n }\r\n );\r\n }\r\n AppLoggerService.logDebug(this.className, \"product\", \"product mapping ended...\");\r\n return this;\r\n }\r\n\r\n linePromotion() {\r\n AppLoggerService.logDebug(this.className, \"linePromotion\", \"linePromotion mapping started...\");\r\n this.webReturnObject.basket.linePromotion = [] as LinePromotions[];\r\n let linePromotionArray = [] as LinePromotions[];\r\n if (this.orderDetails.product_items && this.orderDetails.product_items.length > 0) {\r\n this.orderDetails.product_items.forEach(\r\n (product, index) => {\r\n product.item_id = (index + 1).toString();\r\n if (product.price_adjustments && product.price_adjustments.length > 0) {\r\n product.price_adjustments.forEach(\r\n (promotion) => {\r\n if (!promotion.coupon_code) {\r\n let linePromotionObj = {} as LinePromotions;\r\n let trigger = {} as Trigger;\r\n trigger.itemLineId = product.item_id;\r\n trigger.quantity = product.quantity ? product.quantity : 0;\r\n linePromotionObj.trigger = [] as Trigger[];\r\n linePromotionObj.trigger.push(trigger);\r\n\r\n linePromotionObj.itemLineId = index + 1;\r\n linePromotionObj.promotionId = promotion.promotion_id ? promotion.promotion_id : '';\r\n linePromotionObj.displayText = promotion.item_text ? promotion.item_text : '';\r\n linePromotionObj.promotionType = promotion.applied_discount && promotion.applied_discount.type ? promotion.applied_discount.type : '';\r\n linePromotionObj.promotionAmount = promotion.price ? Math.abs(promotion.price) : 0;\r\n linePromotionObj.name = promotion.coupon_code ? promotion.coupon_code : (promotion.item_text ? promotion.item_text :'');\r\n linePromotionObj.promotionInfo = promotion.item_text ? promotion.item_text : '';\r\n linePromotionObj.promotionLinePrice = product.price - Math.abs(promotion.price);\r\n linePromotionArray.push(linePromotionObj);\r\n }\r\n }\r\n );\r\n }\r\n }\r\n );\r\n }\r\n this.webReturnObject.basket.linePromotion = linePromotionArray;\r\n AppLoggerService.logDebug(this.className, \"linePromotion\", \"linePromotion mapping ended...\");\r\n return this;\r\n }\r\n\r\n transactionPromotion() {\r\n AppLoggerService.logDebug(this.className, \"transactionPromotion\", \"transactionPromotion mapping started...\");\r\n\r\n let transactionPromotionArray = this.getTransactionPromotions(this.orderDetails);\r\n\r\n this.webReturnObject.basket.transactionPromotion = transactionPromotionArray;\r\n AppLoggerService.logDebug(this.className, \"transactionPromotion\", \"transactionPromotion mapping ended...\");\r\n return this;\r\n }\r\n\r\n getTransactionPromotions(basket): TransactionPromotion[] {\r\n try {\r\n let transactionPromotionArray = [] as TransactionPromotion[];\r\n if (basket.order_price_adjustments && basket.order_price_adjustments.length > 0) {\r\n basket.order_price_adjustments.forEach(\r\n (transactionPromotion) => {\r\n let transactionPromotionObj = {} as TransactionPromotion;\r\n\r\n transactionPromotionObj.displayText = transactionPromotion.item_text ? transactionPromotion.item_text : '';\r\n transactionPromotionObj.name = transactionPromotion.coupon_code ? transactionPromotion.coupon_code : (transactionPromotion .item_text?transactionPromotion.item_text : '');\r\n transactionPromotionObj.promotionAmount = transactionPromotion.price ? Math.abs(transactionPromotion.price) : 0;\r\n transactionPromotionObj.promotionId = transactionPromotion.promotion_id ? transactionPromotion.promotion_id : '';\r\n transactionPromotionObj.promotionInfo = transactionPromotion.item_text ? transactionPromotion.item_text : '';\r\n transactionPromotionObj.promotionType = transactionPromotion.applied_discount && transactionPromotion.applied_discount.type ? transactionPromotion.applied_discount.type : '';\r\n transactionPromotionObj.itemLineIds = this.orderDetails.product_items.map((product, index) => index + 1);\r\n if (transactionPromotion.coupon_code) {\r\n transactionPromotionObj.type = PROMOTION_TYPE.COUPON;\r\n transactionPromotionObj.couponCode = transactionPromotion.coupon_code;\r\n transactionPromotionObj.subLevelType = PROMOTION_LEVEL.TRANSACTION;\r\n }\r\n transactionPromotionArray.push(transactionPromotionObj);\r\n }\r\n );\r\n }\r\n\r\n\r\n AppLoggerService.logDebug(this.className, \"getTransactionPromotions\", \"getTransactionPromotions : \", transactionPromotionArray);\r\n return transactionPromotionArray;\r\n } catch (error) {\r\n AppLoggerService.logError(this.className, \"getTransactionPromotions\", \"failed:\", error);\r\n throw new Error(error);\r\n }\r\n }\r\n\r\n updateLinePromotionWithCoupon() {\r\n try {\r\n\r\n let transactionPromotion = {} as TransactionPromotion;\r\n let triggerPromotion = [] as Trigger[];\r\n if (this.orderDetails.product_items && this.orderDetails.product_items.length > 0) {\r\n this.orderDetails.product_items.forEach(\r\n (product, index) => {\r\n product.item_id = (index + 1).toString();\r\n\r\n if (product.price_adjustments && product.price_adjustments.length > 0) {\r\n product.price_adjustments.forEach(\r\n (promotion) => {\r\n if (promotion.coupon_code) {\r\n let trigger = {} as Trigger;\r\n trigger.itemLineId = product.item_id;\r\n trigger.quantity = product.quantity ? product.quantity : 0;\r\n trigger.totalQuantity = product.quantity ? product.quantity : 0;\r\n trigger.promotionAmount = promotion.price ? Math.abs(promotion.price) : 0;\r\n trigger.refundedReason = promotion.coupon_code ? promotion.coupon_code : '';\r\n trigger.refundedReasonDescription = promotion.item_text ? promotion.item_text : '';\r\n trigger.promotionId = promotion.promotion_id;\r\n triggerPromotion.push(trigger);\r\n }\r\n }\r\n );\r\n }\r\n }\r\n );\r\n }\r\n\r\n if (triggerPromotion.length > 0) {\r\n transactionPromotion.displayText = triggerPromotion[0].refundedReasonDescription;\r\n transactionPromotion.name = triggerPromotion[0].refundedReason;\r\n transactionPromotion.promotionAmount = -(triggerPromotion.reduce((n, { promotionAmount }) => n + promotionAmount, 0));\r\n transactionPromotion.promotionId = triggerPromotion[0].promotionId;\r\n transactionPromotion.promotionInfo = triggerPromotion[0].refundedReasonDescription;\r\n transactionPromotion.couponCode = triggerPromotion[0].refundedReason;\r\n transactionPromotion.itemLineIds = [];\r\n transactionPromotion.type = PROMOTION_TYPE.COUPON;\r\n transactionPromotion.subLevelType = PROMOTION_LEVEL.LINE;\r\n transactionPromotion.trigger = triggerPromotion;\r\n }\r\n AppLoggerService.logDebug(this.className, \"updateLinePromotionWithCoupon\", \"transactionPromotion\", transactionPromotion);\r\n\r\n if (!this.webReturnObject.basket.transactionPromotion ) {\r\n this.webReturnObject.basket.transactionPromotion = [];\r\n }\r\n\r\n if (transactionPromotion && transactionPromotion.promotionId ) {\r\n this.webReturnObject.basket.transactionPromotion.push(transactionPromotion);\r\n }\r\n\r\n return this;\r\n } catch (error) {\r\n AppLoggerService.logError(this.className, \"updateLinePromotionWithCoupon\", \"linePromotion mapping=> failed:\", error);\r\n throw new Error(error);\r\n }\r\n }\r\n\r\n updateTransactionPromotionPrtionCalc() {\r\n if (this.webReturnObject.basket.transactionPromotion && this.webReturnObject.basket.transactionPromotion.length > 0) {\r\n\r\n this.webReturnObject.basket.transactionPromotion.forEach(tr => {\r\n this.transactionPromotionProductPortionCalc(this.webReturnObject , tr)\r\n })\r\n }\r\n return this;\r\n }\r\n\r\n transactionPromotionProductPortionCalc(\r\n txDoc: TransactionDocument,\r\n promotion: TransactionPromotion\r\n ) {\r\n AppLoggerService.logDebug(this.className, \"transactionPromotionProductPortionCalc\",\r\n `trnsactionPromotion: ${JSON.stringify(\r\n promotion\r\n )}`\r\n );\r\n if (promotion.type === PROMOTION_TYPE.COUPON && promotion.subLevelType === PROMOTION_LEVEL.LINE) {\r\n txDoc.basket.products.forEach((product) => {\r\n product = this.validateProductItemDiscount(product);\r\n\r\n if (promotion.trigger && promotion.trigger.length > 0) {\r\n promotion.trigger.forEach((t) => {\r\n if (t.itemLineId === product.itemLineId.toString()) {\r\n product.itemDiscounts.trnPromotionsPortion += t.promotionAmount;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n else {\r\n txDoc.basket.products.forEach((product) => {\r\n product = this.validateProductItemDiscount(product);\r\n if (promotion.itemLineIds.includes(+product.itemLineId)) {\r\n const productItem = this.orderDetails.product_items.find(productItem => productItem.product_id === product.SKU);\r\n const transactionPromotionPortion = (productItem && productItem.price_after_item_discount && productItem.price_after_order_discount) ?\r\n (productItem.price_after_item_discount - productItem.price_after_order_discount) : 0;\r\n product.itemDiscounts.trnPromotionsPortion += this.numberUtilService.trimTo2Decimal2(transactionPromotionPortion);\r\n }\r\n });\r\n }\r\n return txDoc;\r\n }\r\n\r\n \r\n public validateProductItemDiscount(product: TProduct) {\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 \r\n customer() {\r\n AppLoggerService.logDebug(this.className, \"customer\", \"customer mapping started...\");\r\n let customerObj = {} as Customer;\r\n customerObj.email = this.orderDetails.customer_info && this.orderDetails.customer_info.email ? this.orderDetails.customer_info.email : '';\r\n customerObj.firstName = this.orderDetails.billing_address && this.orderDetails.billing_address.first_name ? this.orderDetails.billing_address.first_name : '';\r\n customerObj.lastName = this.orderDetails.billing_address && this.orderDetails.billing_address.last_name ? this.orderDetails.billing_address.last_name : '';\r\n\r\n let shippingAddress = [] as Address[];\r\n this.orderDetails.shipments.forEach(\r\n shipment => {\r\n let shippingAddressObj = {} as Address;\r\n shippingAddressObj.id = shipment.shipping_address && shipment.shipping_address.id ? shipment.shipping_address.id : '';\r\n shippingAddressObj.countryCode = shipment.shipping_address && shipment.shipping_address.country_code ? shipment.shipping_address.country_code : '';\r\n shippingAddressObj.address1 = shipment.shipping_address && shipment.shipping_address.address1 ? shipment.shipping_address.address1 : '';\r\n shippingAddressObj.city = shipment.shipping_address && shipment.shipping_address.city ? shipment.shipping_address.city : '';\r\n shippingAddressObj.country = '';\r\n shippingAddressObj.postCode = shipment.shipping_address && shipment.shipping_address.postal_code ? shipment.shipping_address.postal_code : '';\r\n shippingAddress.push(shippingAddressObj);\r\n }\r\n )\r\n customerObj.shippingAddress = shippingAddress;\r\n\r\n let billingAddress = [] as Address[];\r\n let billingAddressObj = {} as Address;\r\n billingAddressObj.id = this.orderDetails.billing_address && this.orderDetails.billing_address.id ? this.orderDetails.billing_address.id : '';\r\n billingAddressObj.countryCode = this.orderDetails.billing_address && this.orderDetails.billing_address.country_code ? this.orderDetails.billing_address.country_code : '';\r\n billingAddressObj.address1 = this.orderDetails.billing_address && this.orderDetails.billing_address.address1 ? this.orderDetails.billing_address.address1 : '';\r\n billingAddressObj.city = this.orderDetails.billing_address && this.orderDetails.billing_address.city ? this.orderDetails.billing_address.city : '';\r\n billingAddressObj.country = '';\r\n billingAddressObj.postCode = '';\r\n billingAddress.push(billingAddressObj);\r\n customerObj.billingAddress = billingAddress;\r\n\r\n let shipmentDetails = [] as ShipmentDetails[];\r\n this.orderDetails.shipments.forEach(\r\n shipment => {\r\n let shipmentDetailsObj = {} as ShipmentDetails;\r\n shipmentDetailsObj.id = shipment.shipment_id ? shipment.shipment_id : '';\r\n shipmentDetailsObj.deliveryGroup = shipment.shipment_id ? shipment.shipment_id : '';\r\n shipmentDetails.push(shipmentDetailsObj);\r\n }\r\n );\r\n customerObj.shipmentDetails = shipmentDetails;\r\n\r\n this.webReturnObject.customer = customerObj;\r\n AppLoggerService.logDebug(this.className, \"customer\", \"customer mapping ended...\");\r\n return this;\r\n }\r\n\r\n isInStoreOrder() {\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"isInStoreOrder mapping started...\");\r\n if(this.orderDetails.c_isInStoreOrder) {\r\n this.webReturnObject.isInStoreOrder = true;\r\n }\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"isInStoreOrder mapping ended...\");\r\n return this;\r\n }\r\n\r\n externalTransactionDetails() {\r\n AppLoggerService.logDebug(this.className, \"externalTransactionDetails\", \"externalTransactionDetails mapping started...\");\r\n let externalTransactionDetails = [] as externalTransactionDetails[];\r\n if (this.orderDetails.shipments && this.orderDetails.shipments.length > 0) {\r\n this.orderDetails.shipments.forEach(\r\n shipment => {\r\n let externalTransactionDetailsObj = {} as externalTransactionDetails;\r\n let transactionInfo = {} as TransactionInfo;\r\n externalTransactionDetailsObj.uniqueId = this.orderDetails.order_no ? this.orderDetails.order_no : '';\r\n externalTransactionDetailsObj.providerType = PROVIDERS.SALESFORCE;\r\n transactionInfo.shippingId = shipment.shipping_method && shipment.shipping_method.id ? shipment.shipping_method.id : '';\r\n transactionInfo.externalShippingId = shipment.shipment_id ? shipment.shipment_id : '';\r\n externalTransactionDetailsObj.details = transactionInfo;\r\n externalTransactionDetails.push(externalTransactionDetailsObj);\r\n }\r\n );\r\n }\r\n this.webReturnObject.externalTransactionDetails = externalTransactionDetails;\r\n AppLoggerService.logDebug(this.className, \"externalTransactionDetails\", \"externalTransactionDetails mapping ended...\");\r\n return this;\r\n }\r\n\r\n basketSummary() {\r\n AppLoggerService.logDebug(this.className, \"basketSummary\", \"basketSummary mapping started...\");\r\n let basketSummary = {} as BasketSummary;\r\n let basketSummaryWebOrder = {} as BasketSummaryDetails;\r\n const linePromotionTotal = this.webReturnObject.basket.linePromotion.map(linePromotion => linePromotion.promotionAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);\r\n const transactionPromotionTotal = this.webReturnObject.basket.transactionPromotion.map(transactionPromotion => transactionPromotion.promotionAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);\r\n basketSummary.discountTotal = linePromotionTotal + transactionPromotionTotal;\r\n basketSummary.VATTotal = this.orderDetails.tax_total ? this.orderDetails.tax_total : 0;\r\n basketSummary.saleTotal = this.orderDetails.order_total ? this.orderDetails.order_total : 0;\r\n basketSummary.basketTotal = this.orderDetails.order_total ? this.orderDetails.order_total : 0;\r\n basketSummary.totalItems = this.orderDetails.product_items && this.orderDetails.product_items.length > 0 ? this.orderDetails.product_items.length : 0;\r\n basketSummary.shippingTotal = this.orderDetails.shipping_total ? this.orderDetails.shipping_total : 0;\r\n basketSummary.basketTotalWithShippingTotal = this.orderDetails.order_total ? this.orderDetails.order_total : 0;\r\n basketSummaryWebOrder.shippingTotal = this.orderDetails.shipping_total ? this.orderDetails.shipping_total : 0;\r\n basketSummaryWebOrder.basketTotalWithShippingTotal = this.orderDetails.order_total ? this.orderDetails.order_total : 0;\r\n basketSummary.webOrder = basketSummaryWebOrder;\r\n this.webReturnObject.basketSummary = basketSummary;\r\n AppLoggerService.logDebug(this.className, \"basketSummary\", \"basketSummary mapping ended...\");\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 AppLoggerService.logDebug(this.className, \"build\", \"mapping done...\");\r\n return this.webReturnObject;\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","import { CurrencyPipe } from \"@angular/common\";\r\nimport { Address, BasketSummary, BasketSummaryDetails, CurrentTransactionDetails, Customer, DELIVERY_METHODS, PROMOTION_LEVEL, PROMOTION_TYPE, INITIATING_MODULE, LinePromotions, OrderDetails, PROVIDERS, ShipmentDetails, TRANSACTION_TYPE, TransactionDocument, TransactionInfo, TransactionPromotion, Trigger, externalTransactionDetails, TProduct, RefundProductChange, Coupons, TaxBreakdown } from \"./mapper-library.model\";\r\nimport { NumberUtilService } from \"./number-util.service\";\r\nimport { AppLoggerService } from '@pmcretail/common-services/common/app-logger.service';\r\n\r\nexport class WebReturnMagento2RestV1MapperBuilderClass {\r\n\r\n className = \"WebReturnMagento2RestV1MapperBuilderClass\";\r\n private orderDetails: 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 isInStoreOrder: false,\r\n basket: {},\r\n basketSummary: {},\r\n baseCurrency: \"\",\r\n customer: {\r\n id: '',\r\n email: '',\r\n firstName: '',\r\n lastName: '',\r\n billingAddress: [],\r\n shippingAddress: [],\r\n shipmentDetails: [],\r\n telephone: '',\r\n postCode: '',\r\n noCustomerSelected: false\r\n },\r\n currentTransactionDetails: {} as CurrentTransactionDetails,\r\n externalTransactionDetails: [] as externalTransactionDetails[]\r\n }\r\n numberUtilService: any;\r\n\r\n constructor(orderDetails: any,\r\n private currencyPipe?: CurrencyPipe\r\n ) {\r\n if (orderDetails) {\r\n this.orderDetails = orderDetails;\r\n }\r\n this.numberUtilService = new NumberUtilService(currencyPipe);\r\n }\r\n\r\n webReturnCommonMapper() {\r\n AppLoggerService.logDebug(this.className, \"webReturnCommonMapper\", \"Mapping started...\");\r\n this.webReturnObject['type'] = TRANSACTION_TYPE.WEB_RETURNS;\r\n this.webReturnObject['datetime'] = this.getUTCDateTime(this.orderDetails.updated_at);\r\n this.webReturnObject.baseCurrency = this.orderDetails.order_currency_code;\r\n this.webReturnObject.subsidiaryId = '1';\r\n this.webReturnObject.export = true;\r\n this.webReturnObject.initiatingModule = INITIATING_MODULE.EBASKET;\r\n this.webReturnObject.createdAt = this.getUTCDateTime(this.orderDetails.created_at);\r\n this.webReturnObject.updatedAt = this.getUTCDateTime(this.orderDetails.updated_at);\r\n this.webReturnObject.transCompletedAt = this.getUTCDateTime(this.orderDetails.updated_at);\r\n this.webReturnObject['externalTransactionId'] = this.orderDetails.increment_id;\r\n AppLoggerService.logDebug(this.className, \"webReturnCommonMapper\", \"Mapping ended...\");\r\n return this;\r\n }\r\n\r\n product() {\r\n AppLoggerService.logDebug(this.className, \"product\", \"Mapping started...\");\r\n \r\n this.webReturnObject.basket['products'] = this.orderDetails.items\r\n ?.filter(product => product?.base_price)\r\n .map((product, index) => ({\r\n description: product.name || '',\r\n SKU: product.sku || '',\r\n quantity: product.qty_ordered || 0,\r\n refundedQuantity: product.qty_refunded || 0,\r\n price: product.base_price || 0,\r\n itemLineId: (index + 1).toString(),\r\n externalItemLineId: product.item_id || (index + 1).toString(),\r\n totalLinePrice: (product.qty_ordered ?? 0) * (product.base_price ?? 0),\r\n refundedTotal: product.amount_refunded || 0\r\n })) || [];\r\n \r\n AppLoggerService.logDebug(this.className, \"product\", \"Mapping ended...\");\r\n return this;\r\n }\r\n\r\n linePromotion() {\r\n AppLoggerService.logDebug(this.className, \"linePromotion\", \"Mapping started...\");\r\n \r\n this.webReturnObject.basket['linePromotion'] = this.orderDetails.items\r\n ?.filter(product => product?.base_price && product.discount_amount)\r\n .map((product, index) => ({\r\n trigger: [{ \r\n itemLineId: (index + 1).toString(), \r\n quantity: product.qty_ordered || 0 \r\n }],\r\n itemLineId: index + 1,\r\n promotionId: '',\r\n displayText: this.orderDetails.coupon_code || '',\r\n promotionType: '',\r\n promotionAmount: product.discount_amount || 0,\r\n name: this.orderDetails.coupon_code || '',\r\n promotionInfo: '',\r\n promotionLinePrice: product.row_total || 0\r\n })) || [];\r\n \r\n AppLoggerService.logDebug(this.className, \"linePromotion\", \"Mapping ended...\");\r\n return this;\r\n } \r\n \r\n customer() {\r\n AppLoggerService.logDebug(this.className, \"customer\", \"Mapping started...\");\r\n \r\n const { orderDetails, webReturnObject } = this;\r\n \r\n webReturnObject.customer = {\r\n id: orderDetails.customer_id || '',\r\n email: orderDetails.customer_email || '',\r\n firstName: orderDetails.customer_firstname || '',\r\n lastName: orderDetails.customer_lastname || '',\r\n shippingAddress: [],\r\n billingAddress: []\r\n } as any;\r\n \r\n const shippingAssignments = orderDetails.extension_attributes?.shipping_assignments || [];\r\n \r\n webReturnObject.customer.shippingAddress = shippingAssignments\r\n .filter(shipment => shipment?.shipping?.address)\r\n .map(shipment => {\r\n const address = shipment.shipping.address;\r\n return {\r\n id: address.customer_address_id || '',\r\n countryCode: address.country_id || '',\r\n address1: address.street?.[0] || '',\r\n address2: address.street?.[1] || '',\r\n address3: address.street?.[2] || '',\r\n city: address.city || '',\r\n country: '',\r\n postCode: address.postcode || ''\r\n };\r\n });\r\n \r\n const billingAddress = orderDetails.billing_address;\r\n if (billingAddress) {\r\n webReturnObject.customer.billingAddress.push({\r\n id: billingAddress.customer_address_id || '',\r\n countryCode: billingAddress.country_id || '',\r\n address1: billingAddress.street?.[0] || '',\r\n address2: billingAddress.street?.[1] || '',\r\n address3: billingAddress.street?.[2] || '',\r\n city: billingAddress.city || '',\r\n country: '',\r\n postCode: billingAddress.postcode || ''\r\n });\r\n }\r\n \r\n AppLoggerService.logDebug(this.className, \"customer\", \"Mpping ended...\");\r\n return this;\r\n } \r\n\r\n isInStoreOrder() {\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"Mapping started...\");\r\n this.webReturnObject.isInStoreOrder = false;\r\n AppLoggerService.logDebug(this.className, \"isInStoreOrder\", \"Mapping ended...\");\r\n return this;\r\n }\r\n\r\n externalTransactionDetails(invoiceId: string) {\r\n AppLoggerService.logDebug(this.className, \"externalTransactionDetails\", \"Mapping started...\");\r\n \r\n const coupon = this.orderDetails.coupon_code\r\n ? { name: this.orderDetails.coupon_code, id: this.orderDetails.coupon_code }\r\n : null;\r\n \r\n const externalTransactionDetailsObj = {\r\n uniqueId: this.orderDetails.increment_id || '',\r\n providerType: PROVIDERS.MAGENTO2,\r\n details: { invoiceId: invoiceId?.toString() || '' },\r\n coupons: coupon ? [coupon] : []\r\n };\r\n \r\n this.webReturnObject.externalTransactionDetails.push(externalTransactionDetailsObj);\r\n \r\n AppLoggerService.logDebug(this.className, \"externalTransactionDetails\", \"Mapping ended...\");\r\n return this;\r\n }\r\n\r\n basketSummary() {\r\n AppLoggerService.logDebug(this.className, \"basketSummary\", \"Mapping started...\");\r\n \r\n const { orderDetails, webReturnObject } = this;\r\n\r\n const basketSummary: BasketSummary = {\r\n discountTotal: orderDetails.discount_amount || 0,\r\n VATTotal: orderDetails.tax_amount || 0,\r\n saleTotal: orderDetails.subtotal || 0,\r\n basketTotal: (orderDetails.subtotal || 0) - (orderDetails.total_online_refunded || 0),\r\n totalItems: orderDetails.total_qty_ordered ?? 0,\r\n refundTotal: orderDetails.total_online_refunded || 0,\r\n shippingTotal: orderDetails.shipping_incl_tax || 0,\r\n basketTotalWithShippingTotal: orderDetails.total_invoiced || 0,\r\n webOrder: {\r\n shippingTotal: orderDetails.shipping_incl_tax || 0,\r\n basketTotalWithShippingTotal: orderDetails.total_invoiced || 0\r\n }\r\n };\r\n \r\n webReturnObject.basketSummary = basketSummary;\r\n \r\n AppLoggerService.logDebug(this.className, \"basketSummary\", \"Mapping ended...\");\r\n return this;\r\n } \r\n\r\n refundRequest() {\r\n AppLoggerService.logDebug(this.className, \"refundRequest\", \"Mapping started...\");\r\n \r\n this.webReturnObject.refundRequest = this.orderDetails.items\r\n ?.filter(product => product?.base_price && (product.qty_refunded || 0) > 0)\r\n .map((product, index) => ({\r\n itemLineId: index + 1,\r\n refundedQuantity: product.qty_refunded || 0,\r\n refundWithPromotion: true,\r\n quantity: product.qty_ordered || 0\r\n })) || [];\r\n \r\n AppLoggerService.logDebug(this.className, \"refundRequest\", `Mapped ${this.webReturnObject.refundRequest.length} refund items.`);\r\n AppLoggerService.logDebug(this.className, \"refundRequest\", \"Mapping ended...\");\r\n \r\n return this;\r\n }\r\n\r\n updateTaxBreakdown() {\r\n AppLoggerService.logDebug(this.className, \"updateTaxBreakdown\", \"Mapping started...\");\r\n \r\n const taxLines = this.orderDetails.items\r\n ?.filter(product => product?.base_price)\r\n .map((product, index) => {\r\n const taxableAmount = product.row_total_incl_tax || 0;\r\n const VAT = product.tax_percent || 0;\r\n const preTax = this.numberUtilService.trimTo2Decimal2((taxableAmount * 100) / (100 + VAT));\r\n const taxLineTotal = this.numberUtilService.trimTo2Decimal2(taxableAmount - preTax);\r\n \r\n return {\r\n itemLineId: index + 1,\r\n VAT,\r\n VATCode: '',\r\n taxableAmount,\r\n PreTax: preTax,\r\n taxLineTotal\r\n };\r\n }) || [];\r\n \r\n this.webReturnObject.basket[\"taxBreakdown\"] = {\r\n taxLines,\r\n totalTaxableAmount: this.orderDetails.tax_amount || 0\r\n } as TaxBreakdown;\r\n \r\n AppLoggerService.logDebug(this.className, \"updateTaxBreakdown\", `Mapped ${taxLines.length} tax lines.`);\r\n AppLoggerService.logDebug(this.className, \"updateTaxBreakdown\", \"Mapping ended...\");\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() {\r\n this.webReturnObject.storeId = this.orderDetails.store_id;\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 AppLoggerService.logDebug(this.className, \"build\", \"Mapping done...\");\r\n return this.webReturnObject;\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","/*\r\n * Public API Surface of mapper-library\r\n */\r\n\r\nexport * from './lib/mapper-library.component';\r\nexport * from './lib/mapper-library.module';\r\nexport * from './lib/RJ-mapper.class';\r\nexport * from './lib/WebReturn-mapper.class';\r\nexport * from './lib/WebReturnSalesforceMapper.class';\r\nexport * from './lib/WebReturnMagento2RestV1.class';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAYa,sBAAsB,CAAA;AAEjC,IAAA,WAAA,GAAA,GAAiB;IAEjB,QAAQ,GAAA;KACP;;oHALU,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAtB,sBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,sBAAsB,EARvB,QAAA,EAAA,oBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,CAAA;4FAIU,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAVlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,QAAQ,EAAE,CAAA;;;;AAIT,EAAA,CAAA;AACD,oBAAA,MAAM,EAAE,EACP;AACF,iBAAA,CAAA;;;MCIY,mBAAmB,CAAA;;iHAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kHAAnB,mBAAmB,EAAA,YAAA,EAAA,CAR5B,sBAAsB,CAAA,EAAA,OAAA,EAAA,CAKtB,sBAAsB,CAAA,EAAA,CAAA,CAAA;AAGb,mBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YANrB,EACR,CAAA,EAAA,CAAA,CAAA;4FA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