Skip to content

Commit

Permalink
Persist Premium Code
Browse files Browse the repository at this point in the history
  • Loading branch information
reldredge71 committed Aug 26, 2021
1 parent 222c461 commit 0adf54f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/branded/step-1/branded-checkout-step-1.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class BrandedCheckoutStep1Controller {
this.resetSubmission()
this.initItemConfig()
this.initCart()

this.premiumSelected = false
}

initItemConfig () {
this.defaultItemConfig = angular.copy(this.itemConfig)

this.itemConfig = {}
this.itemConfig['campaign-code'] = this.campaignCode
if (this.itemConfig['campaign-code'] &&
Expand Down Expand Up @@ -60,6 +60,13 @@ class BrandedCheckoutStep1Controller {
}
this.itemConfig['recurring-day-of-month'] = this.day
this.itemConfig.frequency = this.frequency

this.premiumSelected = false

if (this.defaultItemConfig && this.defaultItemConfig['premium-code']) {
this.itemConfig['premium-code'] = this.defaultItemConfig['premium-code']
this.premiumSelected = true
}
}

initCart () {
Expand Down
6 changes: 6 additions & 0 deletions src/app/branded/step-1/branded-checkout-step-1.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ describe('branded checkout step 1', () => {
$ctrl.initItemConfig()
expect($ctrl.itemConfig['campaign-code']).toEqual('')
})

it('should persist premium-code in item config', () => {
$ctrl.itemConfig = { 'premium-code': '112233' }
$ctrl.initItemConfig()
expect($ctrl.itemConfig['premium-code']).toEqual('112233')
})
})

describe('initCart', () => {
Expand Down

0 comments on commit 0adf54f

Please sign in to comment.