From c0991727d75008530c330a75b7ecb2092e325cfc Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Tue, 26 Mar 2024 15:33:10 -0400 Subject: [PATCH 1/2] create a method to build the formatted line item --- src/layouts/payment-page/payment-page.vue | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/layouts/payment-page/payment-page.vue b/src/layouts/payment-page/payment-page.vue index d8d2f907..a81e50d1 100644 --- a/src/layouts/payment-page/payment-page.vue +++ b/src/layouts/payment-page/payment-page.vue @@ -664,21 +664,26 @@ export default { }, getPayInAdvanceLineItems(cartItems) { const { glassParts } = useMainStore().order.lineItems; - const lineItems = (glassParts === null) ? ['Labor|0|1', 'Repair supplies|0|1'] : ['Parts and labor|0|1']; + const lineItems = (glassParts === null) + ? [this.getPayInAdvanceFormattedLineItem('Labor', 0, 1), this.getPayInAdvanceFormattedLineItem('Repair supplies', 0, 1)] + : [this.getPayInAdvanceFormattedLineItem('Parts and labor', 0, 1)]; cartItems.forEach((item) => { if (item.name !== null && item.category !== 'promos') { - lineItems.push(`${item.name}|${(item.salesTax + item.subTotal).toFixed(2)}|1`); + lineItems.push(this.getPayInAdvanceFormattedLineItem(item.name, (item.salesTax + item.subTotal).toFixed(2), 1)); } }); this.payInAdvanceLineItems = lineItems.join('||'); }, + getPayInAdvanceFormattedLineItem(description, price, quantity) { + return `${description}|${price}|${quantity}`; + }, getMockPiaLineItems() { let lineItems = []; - lineItems = ['Parts and labor|0|1']; - lineItems.push('New wiper blades|75.22|1'); - lineItems.push('Recycling|37.60|1'); + lineItems = [this.getPayInAdvanceFormattedLineItem('Parts and labor', 0, 1)]; + lineItems.push(this.getPayInAdvanceFormattedLineItem('New wiper blades', 75.22, 1)); + lineItems.push(this.getPayInAdvanceFormattedLineItem('Recycling', 37.60, 1)); this.payInAdvanceLineItems = lineItems.join('||'); }, From d3c40ce287d159e754e3d033c19372f88b444849 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Tue, 26 Mar 2024 15:34:39 -0400 Subject: [PATCH 2/2] changed description to itemName --- src/layouts/payment-page/payment-page.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layouts/payment-page/payment-page.vue b/src/layouts/payment-page/payment-page.vue index a81e50d1..d8b6d3b5 100644 --- a/src/layouts/payment-page/payment-page.vue +++ b/src/layouts/payment-page/payment-page.vue @@ -676,8 +676,8 @@ export default { this.payInAdvanceLineItems = lineItems.join('||'); }, - getPayInAdvanceFormattedLineItem(description, price, quantity) { - return `${description}|${price}|${quantity}`; + getPayInAdvanceFormattedLineItem(itemName, price, quantity) { + return `${itemName}|${price}|${quantity}`; }, getMockPiaLineItems() { let lineItems = [];