Skip to content

Commit

Permalink
Merge pull request #1072 from CruGlobal/analytics-fix-ep-upgrade
Browse files Browse the repository at this point in the history
Analytics fix EP upgrade
  • Loading branch information
wrandall22 authored Nov 3, 2023
2 parents cc06e74 + 936aa00 commit 0d56166
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 46 deletions.
12 changes: 6 additions & 6 deletions src/app/analytics/analytics.factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand All @@ -161,7 +161,7 @@ const analyticsFactory = /* @ngInject */ function ($window, $timeout, envService
designationType: productData.designationType
},
price: {
basePrice: itemConfig.amount
basePrice: itemConfig.AMOUNT
},
attributes: {
siebel: {
Expand Down Expand Up @@ -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
Expand All @@ -221,7 +221,7 @@ const analyticsFactory = /* @ngInject */ function ($window, $timeout, envService
currencyCode: 'USD',
add: {
products: [generateProduct(productData, {
price: itemConfig.amount,
price: itemConfig.AMOUNT,
recurringDate
})]
}
Expand All @@ -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
}
}
}]
Expand Down Expand Up @@ -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'
}
})
Expand Down
79 changes: 39 additions & 40 deletions src/app/analytics/analytics.factory.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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=",
Expand Down Expand Up @@ -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'
})
Expand All @@ -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
})
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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', () => {
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 0d56166

Please sign in to comment.