Merge pull request #1879 from Safelite/feature/CSR-1994

Tech review changes
This commit is contained in:
AMSNEHA 2024-06-12 20:37:35 +05:30 committed by GitHub
commit 862cd5a90b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 14 additions and 15 deletions

View file

@ -72,7 +72,7 @@ const endpoints = {
url: "/parts/api/v1/parts/mobile-fee",
method: "GET",
},
CashServicePackageDiscount: {
GetServicePackageDiscountPart: {
url: "/parts/api/v1/parts/service-package-discount",
method: "POST",
},

View file

@ -29,7 +29,7 @@ const storeActions = {
GET_PART_FROM_CAPABILITY_QUESTION_ANSWER: "getPartFromCapabilityQuestionAnswer",
GET_MOLDING_QUESTIONS: "getMoldingQuestions",
GET_MOBILE_FEE_PART: "getMobileFeePart",
CASH_SERVICE_PACKAGE_DISCOUNT: "cashServicePackageDiscount",
GET_SERVICE_PACKAGE_DISCOUNT_PART: "getServicePackageDiscountPart",
GET_SERVICEABILITY_DETAILS: "getServiceabilityDetails",
GET_SHOP_TIME_SLOTS: "getShopTimeSlots",
GET_MOBILE_TIME_SLOTS: "getMobileTimeSlots",

View file

@ -229,7 +229,7 @@ export default {
const servicePackageDiscountLineItems = this.servicePackageDiscountCartItem;
let subTotal = 0;
subTotal += servicePackageDiscountLineItems?.subTotal;
subTotal += servicePackageDiscountLineItems?.subTotal ?? 0;
return subTotal;
},
getVapsCartItemsForSelectedPackage(packageName) {
@ -272,7 +272,7 @@ export default {
getLineItemAmount(amount, useVerifyingText, category) {
if (useVerifyingText) return this.verifyingCoverageText;
return category == ("promos" && "servicePackageDiscount")
return category == "promos" || category == "servicePackageDiscount"
? "(" + this.currencyFormatter.format(amount * -1) + ")"
: this.currencyFormatter.format(amount);
},
@ -825,11 +825,8 @@ export default {
otherSupportingItemsCartItem() {
let cartItem = null;
const servicePackageDiscountLineItem = this.supportingItems.find(
(lineItem) => lineItem.partType == partTypeStrings.SERVICE_PACKAGE_DISCOUNT
);
const otherSupportingItems = this.supportingItems.filter((item) => {
return item != servicePackageDiscountLineItem;
return item.partType != partTypeStrings.SERVICE_PACKAGE_DISCOUNT;
});
// Don't include fees they are part of the package total
let otherSupportingItemsLineItems =

View file

@ -166,11 +166,12 @@ export default {
if (isServicePackageDiscount) {
const servicePackageDiscountPartResponse =
await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.CASH_SERVICE_PACKAGE_DISCOUNT,
storeActions.GET_SERVICE_PACKAGE_DISCOUNT_PART,
null,
"quote"
);
servicePackageDiscountPart.push(servicePackageDiscountPartResponse.data);
if (servicePackageDiscountPartResponse.data)
servicePackageDiscountPart.push(servicePackageDiscountPartResponse.data);
}
const availableLineItems = [
resultMap.rainDefense,
@ -296,8 +297,8 @@ export default {
vapsItemsSelectedAction(vapsItemsSelected) {
this.lineItems.vaps = vapsItemsSelected;
},
servicePackageDiscountSelectedAction(servicePackageDiscountSelected) {
this.lineItems.supportingItems = servicePackageDiscountSelected;
servicePackageDiscountSelectedAction(supportingItemsSelected) {
this.lineItems.supportingItems = supportingItemsSelected;
},
backButtonAction() {
vehicleQuestionsMixin.methods.navigateBack(this);

View file

@ -121,6 +121,7 @@ export default {
buttonLabel: this.getHeaderTextFromCms(answer.SubWidgetName),
buttonLabelSubCopy: this.getSubheaderTextFromCms(answer.SubWidgetName),
buttonBodyCopy: this.getBodyTextFromCms(answer.SubWidgetName),
//The package supports service-package-discount if it has the text value in CMS
buttonAuxillaryCopy: this.getDiscountedPackagePriceString(
answer.Name,
this.isServicePackageDiscountOnOrder && answer.Text != ""

View file

@ -1422,15 +1422,15 @@ export const actions = {
pageNameToLog: pageNameToLog,
});
},
cashServicePackageDiscount(context, { pageNameToLog }) {
getServicePackageDiscountPart(context, { pageNameToLog }) {
const damage = context.getters.damage;
const damageType = damage.isRepair ? "Repair" : "Replace";
const glassPieces = convertGlassPieceNamingForApi(damage.glassToReplace);
return globalMethods
.callHttpClient({
method: endpoints.CashServicePackageDiscount.method,
endpoint: endpoints.CashServicePackageDiscount.url,
method: endpoints.GetServicePackageDiscountPart.method,
endpoint: endpoints.GetServicePackageDiscountPart.url,
payload: {
glassPieces: glassPieces,
damageType: damageType,