From 0a0ec9e57d6755245964cc3c81af06a8bbe56c83 Mon Sep 17 00:00:00 2001 From: Bill Randall Date: Fri, 3 Nov 2023 08:50:52 -0400 Subject: [PATCH 1/2] Fix case for item config properties --- src/app/analytics/analytics.factory.js | 12 ++-- src/app/analytics/analytics.factory.spec.js | 74 ++++++++++----------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/app/analytics/analytics.factory.js b/src/app/analytics/analytics.factory.js index 4b1226586..a53c7ce1b 100644 --- a/src/app/analytics/analytics.factory.js +++ b/src/app/analytics/analytics.factory.js @@ -138,7 +138,7 @@ const analyticsFactory = /* @ngInject */ function ($window, $timeout, envService donationFrequency: frequency, siebel: { productType: 'designation', - campaignCode: item.config['campaign-code'] + campaignCode: item.config.CAMPAIGN_CODE } } } @@ -161,7 +161,7 @@ const analyticsFactory = /* @ngInject */ function ($window, $timeout, envService designationType: productData.designationType }, price: { - basePrice: itemConfig.amount + basePrice: itemConfig.AMOUNT }, attributes: { siebel: { @@ -204,7 +204,7 @@ const analyticsFactory = /* @ngInject */ function ($window, $timeout, envService cart.item[0].attributes.donationType = 'one-time donation' } else { cart.item[0].attributes.donationType = 'recurring donation' - recurringDate = moment(`${moment().year()}-${itemConfig['recurring-start-month']}-${itemConfig['recurring-day-of-month']} ${moment().format('h:mm:ss a')}`) + recurringDate = moment(`${moment().year()}-${itemConfig.RECURRING_START_MONTH}-${itemConfig.RECURRING_DAY_OF_MONTH} ${moment().format('h:mm:ss a')}`) } // Set donation frequency @@ -221,7 +221,7 @@ const analyticsFactory = /* @ngInject */ function ($window, $timeout, envService currencyCode: 'USD', add: { products: [generateProduct(productData, { - price: itemConfig.amount, + price: itemConfig.AMOUNT, recurringDate })] } @@ -244,7 +244,7 @@ const analyticsFactory = /* @ngInject */ function ($window, $timeout, envService donationFrequency: frequency, siebel: { productType: 'designation', - campaignCode: item.config['campaign-code'] + campaignCode: item.config.CAMPAIGN_CODE } } }] @@ -569,7 +569,7 @@ const analyticsFactory = /* @ngInject */ function ($window, $timeout, envService donation_frequency: frequency, payment_type: paymentType, purchase_number: purchaseData.rawData['purchase-number'], - campaign_code: cartItem.config['campaign-code'] !== '' ? cartItem.config['campaign-code'] : undefined, + campaign_code: cartItem.config.CAMPAIGN_CODE !== '' ? cartItem.config.CAMPAIGN_CODE : undefined, designation: 'designation' } }) diff --git a/src/app/analytics/analytics.factory.spec.js b/src/app/analytics/analytics.factory.spec.js index d3a17fe59..08da285d9 100644 --- a/src/app/analytics/analytics.factory.spec.js +++ b/src/app/analytics/analytics.factory.spec.js @@ -65,9 +65,9 @@ describe('analytics factory', () => { const itemConfig = { "campaign-page": "", "jcr-title": "John Doe", - "recurring-day-of-month": "13", - "recurring-start-month": "09", - "amount": 50 + "RECURRING_DAY_OF_MONTH": "13", + "RECURRING_START_MONTH": "09", + "AMOUNT": 50 } const productData = { "uri": "items/crugive/a5t4fmspmfpwpqv3le7hgksifu=", @@ -121,7 +121,7 @@ describe('analytics factory', () => { item_category: productData.designationType.toLowerCase(), item_variant: 'monthly', currency: 'USD', - price: itemConfig.amount.toString(), + price: itemConfig.AMOUNT.toString(), quantity: '1', recurring_date: 'September 13, 2023' }) @@ -142,7 +142,7 @@ describe('analytics factory', () => { item_category: productData.designationType.toLowerCase(), item_variant: 'single', currency: 'USD', - price: itemConfig.amount.toString(), + price: itemConfig.AMOUNT.toString(), quantity: '1', recurring_date: undefined }) @@ -163,14 +163,14 @@ describe('analytics factory', () => { "price": "$50.00", "priceWithFees": "$51.20", "config": { - "amount": 50, - "amount-with-fees": 51.2, - "campaign-code": "", - "donation-services-comments": "", - "premium-code": "", - "recipient-comments": "", - "recurring-day-of-month": "15", - "recurring-start-month": "09" + "AMOUNT": 50, + "AMOUNT_WITH_FEES": 51.2, + "CAMPAIGN_CODE": "", + "DONATION_SERVICES_COMMENTS": "", + "PREMIUM_CODE": "", + "RECIPIENT_COMMENTS": "", + "RECURRING_DAY_OF_MONTH": "15", + "RECURRING_START_MONTH": "09" }, "frequency": "Monthly", "amount": 50, @@ -224,14 +224,14 @@ describe('analytics factory', () => { "price": "$50.00", "priceWithFees": "$51.20", "config": { - "amount": 50, - "amount-with-fees": 51.2, - "campaign-code": "CAMPAIGN", - "donation-services-comments": "", - "premium-code": "", - "recipient-comments": "", - "recurring-day-of-month": "15", - "recurring-start-month": "09" + "AMOUNT": 50, + "AMOUNT_WITH_FEES": 51.2, + "CAMPAIGN_CODE": "CAMPAIGN", + "DONATION_SERVICES_COMMENTS": "", + "PREMIUM_CODE": "", + "RECIPIENT_COMMENTS": "", + "RECURRING_DAY_OF_MONTH": "15", + "RECURRING_START_MONTH": "09" }, "frequency": "Monthly", "amount": 50, @@ -293,14 +293,14 @@ describe('analytics factory', () => { "price": "$50.00", "priceWithFees": "$51.20", "config": { - "amount": 50, - "amount-with-fees": 51.2, - "campaign-code": "", - "donation-services-comments": "", - "premium-code": "", - "recipient-comments": "", - "recurring-day-of-month": "", - "recurring-start-month": "" + "AMOUNT": 50, + "AMOUNT_WITH_FEES": 51.2, + "CAMPAIGN_CODE": "", + "DONATION_SERVICES_COMMENTS": "", + "PREMIUM_CODE": "", + "RECIPIENT_COMMENTS": "", + "RECURRING_DAY_OF_MONTH": "", + "RECURRING_START_MONTH": "" }, "frequency": "Single", "amount": 50, @@ -563,14 +563,14 @@ describe('analytics factory', () => { "price": "$50.00", "priceWithFees": "$51.20", "config": { - "amount": 50, - "amount-with-fees": 51.2, - "campaign-code": "", - "donation-services-comments": "", - "premium-code": "", - "recipient-comments": "", - "recurring-day-of-month": "", - "recurring-start-month": "" + "AMOUNT": 50, + "AMOUNT_WITH_FEES": 51.2, + "CAMPAIGN_CODE": "", + "DONATION_SERVICES_COMMENTS": "", + "PREMIUM_CODE": "", + "RECIPIENT_COMMENTS": "", + "RECURRING_DAY_OF_MONTH": "", + "RECURRING_START_MONTH": "" }, "frequency": "Single", "amount": 50, From 936aa00d38f07750cc929c97c6a6ccae6a89797b Mon Sep 17 00:00:00 2001 From: Bill Randall Date: Fri, 3 Nov 2023 09:04:44 -0400 Subject: [PATCH 2/2] Fix orgId issues in test --- src/app/analytics/analytics.factory.spec.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/analytics/analytics.factory.spec.js b/src/app/analytics/analytics.factory.spec.js index 08da285d9..d4e033e0c 100644 --- a/src/app/analytics/analytics.factory.spec.js +++ b/src/app/analytics/analytics.factory.spec.js @@ -522,7 +522,7 @@ describe('analytics factory', () => { "facet": "person", "startMonth": null, "ministry": "Staff Giving", - "orgId": "1-TG-11", + "orgId": "STAFF", "$$hashKey": "object:26" } it('should add product-detail-click event', () => { @@ -539,7 +539,7 @@ describe('analytics factory', () => { { item_id: '0643021', item_name: 'John Doe', - item_brand: '1-TG-11', + item_brand: 'STAFF', item_category: 'staff', item_variant: undefined, price: undefined, @@ -637,7 +637,6 @@ describe('analytics factory', () => { { item_id: '0643021', item_name: 'John Doe', - item_brand: '1-TG-11', item_category: 'staff', item_variant: 'single', price: '50',