Skip to content

Commit

Permalink
Add shared privacy policy account integration data structure
Browse files Browse the repository at this point in the history
  • Loading branch information
bsardo committed Nov 17, 2020
1 parent 6c9965e commit 679cb47
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
20 changes: 6 additions & 14 deletions config/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ type Account struct {

// AccountCCPA represents account-specific CCPA configuration
type AccountCCPA struct {
Enabled *bool `mapstructure:"enabled" json:"enabled,omitempty"`
IntegrationEnabled AccountCCPAIntegration `mapstructure:"integration_enabled" json:"integration_enabled"`
Enabled *bool `mapstructure:"enabled" json:"enabled,omitempty"`
IntegrationEnabled AccountIntegration `mapstructure:"integration_enabled" json:"integration_enabled"`
}

// EnabledForIntegrationType indicates whether CCPA is turned on at the account level for the specified integration type
Expand Down Expand Up @@ -53,18 +53,10 @@ func (a *AccountCCPA) EnabledForIntegrationType(integrationType IntegrationType)
return nil
}

// AccountCCPAIntegration indicates whether CCPA is enabled for each request type
type AccountCCPAIntegration struct {
AMP *bool `mapstructure:"amp" json:"amp,omitempty"`
App *bool `mapstructure:"app" json:"app,omitempty"`
Video *bool `mapstructure:"video" json:"video,omitempty"`
Web *bool `mapstructure:"web" json:"web,omitempty"`
}

// AccountGDPR represents account-specific GDPR configuration
type AccountGDPR struct {
Enabled *bool `mapstructure:"enabled" json:"enabled,omitempty"`
IntegrationEnabled AccountGDPRIntegration `mapstructure:"integration_enabled" json:"integration_enabled"`
Enabled *bool `mapstructure:"enabled" json:"enabled,omitempty"`
IntegrationEnabled AccountIntegration `mapstructure:"integration_enabled" json:"integration_enabled"`
}

// EnabledForIntegrationType indicates whether GDPR is turned on at the account level for the specified integration type
Expand Down Expand Up @@ -93,8 +85,8 @@ func (a *AccountGDPR) EnabledForIntegrationType(integrationType IntegrationType)
return nil
}

// AccountGDPRIntegration indicates whether GDPR is enabled for each integration type
type AccountGDPRIntegration struct {
// AccountIntegration indicates whether a particular privacy policy (GDPR, CCPA) is enabled for each integration type
type AccountIntegration struct {
AMP *bool `mapstructure:"amp" json:"amp,omitempty"`
App *bool `mapstructure:"app" json:"app,omitempty"`
Video *bool `mapstructure:"video" json:"video,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions config/accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestAccountGDPREnabledForIntegrationType(t *testing.T) {
account := Account{
GDPR: AccountGDPR{
Enabled: tt.giveGDPREnabled,
IntegrationEnabled: AccountGDPRIntegration{
IntegrationEnabled: AccountIntegration{
AMP: tt.giveAMPGDPREnabled,
App: tt.giveAppGDPREnabled,
Video: tt.giveVideoGDPREnabled,
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestAccountCCPAEnabledForIntegrationType(t *testing.T) {
account := Account{
CCPA: AccountCCPA{
Enabled: tt.giveCCPAEnabled,
IntegrationEnabled: AccountCCPAIntegration{
IntegrationEnabled: AccountIntegration{
AMP: tt.giveAMPCCPAEnabled,
App: tt.giveAppCCPAEnabled,
Video: tt.giveVideoCCPAEnabled,
Expand Down

0 comments on commit 679cb47

Please sign in to comment.