forked from LiveRamp/iabconsent
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PX-2203] Parse Whole GPP Strings and Parsing functionality for MSPA …
…US National + GPC Subsection (LiveRamp#24) * add new mspa struct, usnational parse + test fixtures + tests. * total gpp header and string parsing, and tests. * gpp subsection parsing + gpc specific subsection
- Loading branch information
1 parent
6fd0b25
commit 91d8694
Showing
7 changed files
with
986 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
package iabconsent_test | ||
|
||
import ( | ||
"github.com/LiveRamp/iabconsent" | ||
) | ||
|
||
// Test fixtures can be created here: https://iabgpp.com/ | ||
|
||
var gppParsedConsentFixtures = map[string]map[int]*iabconsent.MspaParsedConsent{ | ||
// Valid GPP w/ US National MSPA, No Subsection. | ||
"DBABL~BVVqAAEABAA": {7: { | ||
Version: 1, | ||
SharingNotice: iabconsent.NoticeProvided, | ||
SaleOptOutNotice: iabconsent.NoticeProvided, | ||
SharingOptOutNotice: iabconsent.NoticeProvided, | ||
TargetedAdvertisingOptOutNotice: iabconsent.NoticeProvided, | ||
SensitiveDataProcessingOptOutNotice: iabconsent.NoticeProvided, | ||
SensitiveDataLimitUseNotice: iabconsent.NoticeProvided, | ||
SaleOptOut: iabconsent.NotOptedOut, | ||
SharingOptOut: iabconsent.NotOptedOut, | ||
TargetedAdvertisingOptOut: iabconsent.NotOptedOut, | ||
SensitiveDataProcessing: map[int]iabconsent.MspaConsent{ | ||
0: iabconsent.ConsentNotApplicable, | ||
1: iabconsent.ConsentNotApplicable, | ||
2: iabconsent.ConsentNotApplicable, | ||
3: iabconsent.ConsentNotApplicable, | ||
4: iabconsent.ConsentNotApplicable, | ||
5: iabconsent.ConsentNotApplicable, | ||
6: iabconsent.ConsentNotApplicable, | ||
7: iabconsent.NoConsent, | ||
8: iabconsent.ConsentNotApplicable, | ||
9: iabconsent.ConsentNotApplicable, | ||
10: iabconsent.ConsentNotApplicable, | ||
11: iabconsent.ConsentNotApplicable, | ||
}, | ||
KnownChildSensitiveDataConsents: map[int]iabconsent.MspaConsent{ | ||
0: iabconsent.ConsentNotApplicable, | ||
1: iabconsent.ConsentNotApplicable, | ||
}, | ||
PersonalDataConsents: iabconsent.NoConsent, | ||
MspaCoveredTransaction: iabconsent.MspaNotApplicable, | ||
MspaOptOutOptionMode: iabconsent.MspaNotApplicable, | ||
MspaServiceProviderMode: iabconsent.MspaNotApplicable, | ||
Gpc: false, | ||
}, | ||
}, | ||
// Valid GPP w/ US National MSPA, Subsection of GPC False. | ||
"DBABL~BVVqAAEABAA.QA": {7: { | ||
Version: 1, | ||
SharingNotice: iabconsent.NoticeProvided, | ||
SaleOptOutNotice: iabconsent.NoticeProvided, | ||
SharingOptOutNotice: iabconsent.NoticeProvided, | ||
TargetedAdvertisingOptOutNotice: iabconsent.NoticeProvided, | ||
SensitiveDataProcessingOptOutNotice: iabconsent.NoticeProvided, | ||
SensitiveDataLimitUseNotice: iabconsent.NoticeProvided, | ||
SaleOptOut: iabconsent.NotOptedOut, | ||
SharingOptOut: iabconsent.NotOptedOut, | ||
TargetedAdvertisingOptOut: iabconsent.NotOptedOut, | ||
SensitiveDataProcessing: map[int]iabconsent.MspaConsent{ | ||
0: iabconsent.ConsentNotApplicable, | ||
1: iabconsent.ConsentNotApplicable, | ||
2: iabconsent.ConsentNotApplicable, | ||
3: iabconsent.ConsentNotApplicable, | ||
4: iabconsent.ConsentNotApplicable, | ||
5: iabconsent.ConsentNotApplicable, | ||
6: iabconsent.ConsentNotApplicable, | ||
7: iabconsent.NoConsent, | ||
8: iabconsent.ConsentNotApplicable, | ||
9: iabconsent.ConsentNotApplicable, | ||
10: iabconsent.ConsentNotApplicable, | ||
11: iabconsent.ConsentNotApplicable, | ||
}, | ||
KnownChildSensitiveDataConsents: map[int]iabconsent.MspaConsent{ | ||
0: iabconsent.ConsentNotApplicable, | ||
1: iabconsent.ConsentNotApplicable, | ||
}, | ||
PersonalDataConsents: iabconsent.NoConsent, | ||
MspaCoveredTransaction: iabconsent.MspaNotApplicable, | ||
MspaOptOutOptionMode: iabconsent.MspaNotApplicable, | ||
MspaServiceProviderMode: iabconsent.MspaNotApplicable, | ||
Gpc: false, | ||
}, | ||
}, | ||
// Valid GPP w/ US National MSPA, Subsection of GPC True. | ||
"DBABL~BVVqAAEABAA.YA": {7: { | ||
Version: 1, | ||
SharingNotice: iabconsent.NoticeProvided, | ||
SaleOptOutNotice: iabconsent.NoticeProvided, | ||
SharingOptOutNotice: iabconsent.NoticeProvided, | ||
TargetedAdvertisingOptOutNotice: iabconsent.NoticeProvided, | ||
SensitiveDataProcessingOptOutNotice: iabconsent.NoticeProvided, | ||
SensitiveDataLimitUseNotice: iabconsent.NoticeProvided, | ||
SaleOptOut: iabconsent.NotOptedOut, | ||
SharingOptOut: iabconsent.NotOptedOut, | ||
TargetedAdvertisingOptOut: iabconsent.NotOptedOut, | ||
SensitiveDataProcessing: map[int]iabconsent.MspaConsent{ | ||
0: iabconsent.ConsentNotApplicable, | ||
1: iabconsent.ConsentNotApplicable, | ||
2: iabconsent.ConsentNotApplicable, | ||
3: iabconsent.ConsentNotApplicable, | ||
4: iabconsent.ConsentNotApplicable, | ||
5: iabconsent.ConsentNotApplicable, | ||
6: iabconsent.ConsentNotApplicable, | ||
7: iabconsent.NoConsent, | ||
8: iabconsent.ConsentNotApplicable, | ||
9: iabconsent.ConsentNotApplicable, | ||
10: iabconsent.ConsentNotApplicable, | ||
11: iabconsent.ConsentNotApplicable, | ||
}, | ||
KnownChildSensitiveDataConsents: map[int]iabconsent.MspaConsent{ | ||
0: iabconsent.ConsentNotApplicable, | ||
1: iabconsent.ConsentNotApplicable, | ||
}, | ||
PersonalDataConsents: iabconsent.NoConsent, | ||
MspaCoveredTransaction: iabconsent.MspaNotApplicable, | ||
MspaOptOutOptionMode: iabconsent.MspaNotApplicable, | ||
MspaServiceProviderMode: iabconsent.MspaNotApplicable, | ||
Gpc: true, | ||
}, | ||
}, | ||
// Valid GPP string w/ sections for EU TCF V2 and US Privacy | ||
// Since both are not supported, Consent fixture should be blank. | ||
"DBACNY~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1YNN": {}, | ||
// Valid GPP w/ US National MSPA and US Privacy, but skip US Privacy until supported. | ||
"DBABzw~1YNN~BVVqAAEABAA.QA": {7: { | ||
Version: 1, | ||
SharingNotice: iabconsent.NoticeProvided, | ||
SaleOptOutNotice: iabconsent.NoticeProvided, | ||
SharingOptOutNotice: iabconsent.NoticeProvided, | ||
TargetedAdvertisingOptOutNotice: iabconsent.NoticeProvided, | ||
SensitiveDataProcessingOptOutNotice: iabconsent.NoticeProvided, | ||
SensitiveDataLimitUseNotice: iabconsent.NoticeProvided, | ||
SaleOptOut: iabconsent.NotOptedOut, | ||
SharingOptOut: iabconsent.NotOptedOut, | ||
TargetedAdvertisingOptOut: iabconsent.NotOptedOut, | ||
SensitiveDataProcessing: map[int]iabconsent.MspaConsent{ | ||
0: iabconsent.ConsentNotApplicable, | ||
1: iabconsent.ConsentNotApplicable, | ||
2: iabconsent.ConsentNotApplicable, | ||
3: iabconsent.ConsentNotApplicable, | ||
4: iabconsent.ConsentNotApplicable, | ||
5: iabconsent.ConsentNotApplicable, | ||
6: iabconsent.ConsentNotApplicable, | ||
7: iabconsent.NoConsent, | ||
8: iabconsent.ConsentNotApplicable, | ||
9: iabconsent.ConsentNotApplicable, | ||
10: iabconsent.ConsentNotApplicable, | ||
11: iabconsent.ConsentNotApplicable, | ||
}, | ||
KnownChildSensitiveDataConsents: map[int]iabconsent.MspaConsent{ | ||
0: iabconsent.ConsentNotApplicable, | ||
1: iabconsent.ConsentNotApplicable, | ||
}, | ||
PersonalDataConsents: iabconsent.NoConsent, | ||
MspaCoveredTransaction: iabconsent.MspaNotApplicable, | ||
MspaOptOutOptionMode: iabconsent.MspaNotApplicable, | ||
MspaServiceProviderMode: iabconsent.MspaNotApplicable, | ||
}, | ||
}, | ||
} |
Oops, something went wrong.