From edc9abe000de9e4c43260dcaad487bd6390d8df1 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 17 Mar 2025 10:32:56 -0400 Subject: [PATCH] CASH-152: update endpoints --- src/constants/endpoints.js | 4 ++++ src/helpers/pricing-helper.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 29d36d091..bfc02d034 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -72,6 +72,10 @@ const endpoints = { url: "/parts/api/v1/parts/mobile-fee", method: "GET", }, + GetPricingByDayUpchargePart: { + url: "/parts/api/v1/parts/get-pricing-by-day-part-number", + method: "GET", + }, GetServicePackageDiscountPart: { url: "/parts/api/v1/parts/service-package-discount", method: "POST", diff --git a/src/helpers/pricing-helper.js b/src/helpers/pricing-helper.js index b9262f95d..4a215eaa0 100644 --- a/src/helpers/pricing-helper.js +++ b/src/helpers/pricing-helper.js @@ -58,6 +58,34 @@ export function getSubTotal(lineItemsObject) { export function getSalesTax(lineItemsObject) { // this is amountDue minus subTotal return (((getAmountDue(lineItemsObject) - getSubTotal(lineItemsObject)) * 100) / 100).toFixed(2); +export async function getPriceUpchargeByDayPart(pageNameToLog) { + // Get the Pricing By Day Part + const basePriceByDayPart = await baseMixin.methods.dispatchStoreActionWithLogging( + storeActions.GET_PRICING_BY_DAY_UPCHARGE_PART, + null, + pageNameToLog, + false + ); + + if ( + basePriceByDayPart?.data === null || + basePriceByDayPart?.data === undefined || + basePriceByDayPart?.data === "" + ) { + return null; + } + + // Get the Pricing By Day Base Part price + const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging( + storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA, + { + availableLineItems: [basePriceByDayPart?.data], + }, + pageNameToLog, + false + ); + + return pricingResults[0]; } export async function getPriceUpchargeByDayPart(pageNameToLog) {