From 9a1fc94766ae9013e335123e522080dafd32de1d Mon Sep 17 00:00:00 2001 From: Caleb Alldrin Date: Wed, 13 Nov 2024 10:16:40 -0800 Subject: [PATCH] Change to PREMIUM_CODE --- README.md | 4 ++-- src/app/branded/branded-checkout.component.js | 1 + .../step-1/branded-checkout-step-1.component.js | 12 ++++++------ .../branded/step-1/branded-checkout-step-1.spec.js | 12 ++++++------ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6902ba1ca..a8feb8bbe 100644 --- a/README.md +++ b/README.md @@ -81,8 +81,8 @@ The `` element is where the branded checkout Angular app will - `campaign-page` - the campaign page you would like to use, used for suggested amounts - *Optional* - `campaign-code` - the campaign code you would like to use - *Optional* - `premium-code` - the premium code you would like to use - *Optional* - make sure you use the proper premium code associated with the campaign -- `premium-name` - the name of the premium offered to donors - *optional* -- `premium-image-url` - the custom image to appear when selecting a premium - *optional* +- `premium-name` - the name of the premium offered to donors - *Optional* +- `premium-image-url` - the custom image to appear when selecting a premium - *Optional* - `tsys-device` - the device name that corresponds to the TSYS Merchant Account which will be used for tokenizing your site's credit cards with TSYS - **Required** - Will be provided by DPS when adding your domain to the TSYS whitelist. `cru` is the default and corresponds with Cru's main TSYS Merchant ID - `amount` - defaults the gift's amount - *Optional* - `frequency` - defaults the gift's frequency - *Optional* - can be one of the following values: diff --git a/src/app/branded/branded-checkout.component.js b/src/app/branded/branded-checkout.component.js index ecf6b8648..df6118070 100644 --- a/src/app/branded/branded-checkout.component.js +++ b/src/app/branded/branded-checkout.component.js @@ -180,6 +180,7 @@ export default angular premiumCode: '@', premiumName: '@', premiumImageUrl: '@', + itemConfig: '=', donorDetailsVariable: '@donorDetails', defaultPaymentType: '@', hidePaymentTypeOptions: '@', diff --git a/src/app/branded/step-1/branded-checkout-step-1.component.js b/src/app/branded/step-1/branded-checkout-step-1.component.js index 33081d72d..4bf8eb180 100644 --- a/src/app/branded/step-1/branded-checkout-step-1.component.js +++ b/src/app/branded/step-1/branded-checkout-step-1.component.js @@ -40,7 +40,7 @@ class BrandedCheckoutStep1Controller { (this.itemConfig.CAMPAIGN_CODE.match(/^[a-z0-9]+$/i) === null || this.itemConfig.CAMPAIGN_CODE.length > 30)) { this.itemConfig.CAMPAIGN_CODE = '' } - this.itemConfig['campaign-page'] = this.campaignPage + this.itemConfig.CAMPAIGN_PAGE = this.campaignPage this.itemConfig.AMOUNT = this.amount // These lines calculate the price with fees for amounts coming in from the client site via component config @@ -65,8 +65,8 @@ class BrandedCheckoutStep1Controller { this.premiumSelected = false - if (this.defaultItemConfig && this.defaultItemConfig['premium-code']) { - this.itemConfig['premium-code'] = this.defaultItemConfig['premium-code'] + if (this.defaultItemConfig && this.defaultItemConfig.PREMIUM_CODE) { + this.itemConfig.PREMIUM_CODE = this.defaultItemConfig.PREMIUM_CODE this.premiumSelected = true } } @@ -84,7 +84,7 @@ class BrandedCheckoutStep1Controller { this.itemConfig = item.config // add campaign page - this.itemConfig['campaign-page'] = this.campaignPage + this.itemConfig.CAMPAIGN_PAGE = this.campaignPage } this.loadingProductConfig = false }, @@ -162,9 +162,9 @@ class BrandedCheckoutStep1Controller { onSelectPremiumOption () { if (this.premiumSelected) { - this.itemConfig['premium-code'] = this.premiumCode + this.itemConfig.PREMIUM_CODE = this.premiumCode } else { - this.itemConfig['premium-code'] = undefined + this.itemConfig.PREMIUM_CODE = undefined } } diff --git a/src/app/branded/step-1/branded-checkout-step-1.spec.js b/src/app/branded/step-1/branded-checkout-step-1.spec.js index 343295260..fc5c2fd4d 100644 --- a/src/app/branded/step-1/branded-checkout-step-1.spec.js +++ b/src/app/branded/step-1/branded-checkout-step-1.spec.js @@ -40,7 +40,7 @@ describe('branded checkout step 1', () => { expect($ctrl.itemConfig).toEqual({ CAMPAIGN_CODE: '1234', - 'campaign-page': '135', + CAMPAIGN_PAGE: '135', AMOUNT: '75', priceWithFees: '$76.80', 'RECURRING_DAY_OF_MONTH': '9' @@ -86,9 +86,9 @@ describe('branded checkout step 1', () => { }) it('should persist premium-code in item config', () => { - $ctrl.itemConfig = { 'premium-code': '112233' } + $ctrl.itemConfig = { PREMIUM_CODE: '112233' } $ctrl.initItemConfig() - expect($ctrl.itemConfig['premium-code']).toEqual('112233') + expect($ctrl.itemConfig.PREMIUM_CODE).toEqual('112233') }) }) @@ -107,7 +107,7 @@ describe('branded checkout step 1', () => { expect($ctrl.cartService.get).toHaveBeenCalled() expect($ctrl.isEdit).toEqual(true) expect($ctrl.item.code).toEqual('1234567') - expect($ctrl.itemConfig['campaign-page']).toEqual('campaign1') + expect($ctrl.itemConfig.CAMPAIGN_PAGE).toEqual('campaign1') expect($ctrl.loadingProductConfig).toEqual(false) }) @@ -294,7 +294,7 @@ describe('branded checkout step 1', () => { $ctrl.onSelectPremiumOption() - expect($ctrl.itemConfig['premium-code']).toEqual($ctrl.premiumCode) + expect($ctrl.itemConfig.PREMIUM_CODE).toEqual($ctrl.premiumCode) }) it('premium deselected', () => { @@ -302,7 +302,7 @@ describe('branded checkout step 1', () => { $ctrl.onSelectPremiumOption() - expect($ctrl.itemConfig['premium-code']).toEqual(undefined) + expect($ctrl.itemConfig.PREMIUM_CODE).toEqual(undefined) }) })