From 85c03cd4e4fdd44c8bb45db53212d16670d3ca33 Mon Sep 17 00:00:00 2001 From: chad Date: Fri, 14 Oct 2022 02:11:51 -0600 Subject: [PATCH 01/41] initial multi state implementation --- .../java/com/iab/gpp/encoder/GppModel.java | 90 +++++++++- .../EncodableFixedNullableBitfield.java | 34 ++++ .../iab/gpp/encoder/field/UspCaV1Field.java | 20 +++ .../iab/gpp/encoder/field/UspCoV1Field.java | 18 ++ .../iab/gpp/encoder/field/UspCtV1Field.java | 17 ++ .../iab/gpp/encoder/field/UspNatV1Field.java | 22 +++ .../iab/gpp/encoder/field/UspUtV1Field.java | 17 ++ .../iab/gpp/encoder/field/UspVaV1Field.java | 17 ++ .../com/iab/gpp/encoder/section/UspCaV1.java | 136 +++++++++++++++ .../com/iab/gpp/encoder/section/UspCoV1.java | 138 +++++++++++++++ .../com/iab/gpp/encoder/section/UspCtV1.java | 131 +++++++++++++++ .../com/iab/gpp/encoder/section/UspNatV1.java | 158 ++++++++++++++++++ .../com/iab/gpp/encoder/section/UspUtV1.java | 136 +++++++++++++++ .../com/iab/gpp/encoder/section/UspVaV1.java | 129 ++++++++++++++ 14 files changed, 1062 insertions(+), 1 deletion(-) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedNullableBitfield.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspUtV1Field.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspVaV1Field.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index 02fe98d7..c9eb5b49 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -11,11 +11,18 @@ import com.iab.gpp.encoder.section.HeaderV1; import com.iab.gpp.encoder.section.TcfCaV2; import com.iab.gpp.encoder.section.TcfEuV2; +import com.iab.gpp.encoder.section.UspCaV1; +import com.iab.gpp.encoder.section.UspCoV1; +import com.iab.gpp.encoder.section.UspCtV1; +import com.iab.gpp.encoder.section.UspNatV1; +import com.iab.gpp.encoder.section.UspUtV1; import com.iab.gpp.encoder.section.UspV1; +import com.iab.gpp.encoder.section.UspVaV1; public class GppModel { private Map sections = new HashMap<>(); - private String[] sectionOrder = new String[] {TcfEuV2.NAME, TcfCaV2.NAME, UspV1.NAME}; + private String[] sectionOrder = new String[] {TcfEuV2.NAME, TcfCaV2.NAME, UspV1.NAME, UspNatV1.NAME, UspCaV1.NAME, + UspVaV1.NAME, UspCoV1.NAME, UspUtV1.NAME, UspCtV1.NAME}; public GppModel() { @@ -39,6 +46,24 @@ public void setFieldValue(String sectionName, String fieldName, Object value) { } else if (sectionName.equals(UspV1.NAME)) { section = new UspV1(); this.sections.put(UspV1.NAME, section); + } else if (sectionName.equals(UspNatV1.NAME)) { + section = new UspNatV1(); + this.sections.put(UspNatV1.NAME, section); + } else if (sectionName.equals(UspCaV1.NAME)) { + section = new UspCaV1(); + this.sections.put(UspCaV1.NAME, section); + } else if (sectionName.equals(UspVaV1.NAME)) { + section = new UspVaV1(); + this.sections.put(UspVaV1.NAME, section); + } else if (sectionName.equals(UspCoV1.NAME)) { + section = new UspCoV1(); + this.sections.put(UspCoV1.NAME, section); + } else if (sectionName.equals(UspUtV1.NAME)) { + section = new UspUtV1(); + this.sections.put(UspUtV1.NAME, section); + } else if (sectionName.equals(UspCtV1.NAME)) { + section = new UspCtV1(); + this.sections.put(UspCtV1.NAME, section); } } else { section = this.sections.get(sectionName); @@ -97,6 +122,30 @@ public UspV1 getUspV1Section() { return (UspV1) getSection(UspV1.NAME); } + public UspNatV1 getUspNatV1Section() { + return (UspNatV1) getSection(UspNatV1.NAME); + } + + public UspCaV1 getUspCaV1Section() { + return (UspCaV1) getSection(UspCaV1.NAME); + } + + public UspVaV1 getUspVaV1Section() { + return (UspVaV1) getSection(UspVaV1.NAME); + } + + public UspCoV1 getUspCoV1Section() { + return (UspCoV1) getSection(UspCoV1.NAME); + } + + public UspUtV1 getUspUtV1Section() { + return (UspUtV1) getSection(UspUtV1.NAME); + } + + public UspCtV1 getUspCtV1Section() { + return (UspCtV1) getSection(UspCtV1.NAME); + } + public List getSectionIds() { List sectionIds = new ArrayList<>(); for (int i = 0; i < this.sectionOrder.length; i++) { @@ -148,6 +197,24 @@ public void decode(String str) throws DecodingException { } else if (sectionIds.get(i).equals(UspV1.ID)) { UspV1 section = new UspV1(encodedSections[i + 1]); this.sections.put(UspV1.NAME, section); + } else if (sectionIds.get(i).equals(UspCaV1.ID)) { + UspCaV1 section = new UspCaV1(encodedSections[i + 1]); + this.sections.put(UspCaV1.NAME, section); + } else if (sectionIds.get(i).equals(UspNatV1.ID)) { + UspNatV1 section = new UspNatV1(encodedSections[i + 1]); + this.sections.put(UspNatV1.NAME, section); + } else if (sectionIds.get(i).equals(UspVaV1.ID)) { + UspVaV1 section = new UspVaV1(encodedSections[i + 1]); + this.sections.put(UspVaV1.NAME, section); + } else if (sectionIds.get(i).equals(UspCoV1.ID)) { + UspCoV1 section = new UspCoV1(encodedSections[i + 1]); + this.sections.put(UspCoV1.NAME, section); + } else if (sectionIds.get(i).equals(UspUtV1.ID)) { + UspUtV1 section = new UspUtV1(encodedSections[i + 1]); + this.sections.put(UspUtV1.NAME, section); + } else if (sectionIds.get(i).equals(UspCtV1.ID)) { + UspCtV1 section = new UspCtV1(encodedSections[i + 1]); + this.sections.put(UspCtV1.NAME, section); } } } @@ -172,6 +239,27 @@ public void decodeSection(String sectionName, String encodedString) throws Decod } else if (sectionName.equals(UspV1.NAME)) { section = new UspV1(); this.sections.put(UspV1.NAME, section); + } else if (sectionName.equals(UspV1.NAME)) { + section = new UspV1(); + this.sections.put(UspV1.NAME, section); + } else if (sectionName.equals(UspNatV1.NAME)) { + section = new UspNatV1(); + this.sections.put(UspNatV1.NAME, section); + } else if (sectionName.equals(UspCaV1.NAME)) { + section = new UspCaV1(); + this.sections.put(UspCaV1.NAME, section); + } else if (sectionName.equals(UspVaV1.NAME)) { + section = new UspVaV1(); + this.sections.put(UspVaV1.NAME, section); + } else if (sectionName.equals(UspCoV1.NAME)) { + section = new UspCoV1(); + this.sections.put(UspCoV1.NAME, section); + } else if (sectionName.equals(UspUtV1.NAME)) { + section = new UspUtV1(); + this.sections.put(UspUtV1.NAME, section); + } else if (sectionName.equals(UspCtV1.NAME)) { + section = new UspCtV1(); + this.sections.put(UspCtV1.NAME, section); } } else { section = this.sections.get(sectionName); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedNullableBitfield.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedNullableBitfield.java new file mode 100644 index 00000000..12a8fc1c --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedNullableBitfield.java @@ -0,0 +1,34 @@ +package com.iab.gpp.encoder.datatype; + +import java.util.List; +import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; + +public class EncodableFixedNullableBitfield extends AbstractEncodableBitStringDataType> { + + private int bitStringLength; + + public EncodableFixedNullableBitfield(int bitStringLength) { + super(); + this.bitStringLength = bitStringLength; + } + + public EncodableFixedNullableBitfield(int bitStringLength, List value) { + super(value); + this.bitStringLength = bitStringLength; + } + + public String encode() throws EncodingException { + return FixedBitfieldEncoder.encode(this.value, this.bitStringLength); + } + + public void decode(String bitString) throws DecodingException { + this.value = FixedBitfieldEncoder.decode(bitString); + } + + public String substring(String bitString, int fromIndex) { + // TODO: validate + return bitString.substring(fromIndex, fromIndex + this.bitStringLength); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java new file mode 100644 index 00000000..cf00bd0b --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java @@ -0,0 +1,20 @@ +package com.iab.gpp.encoder.field; + +public class UspCaV1Field { + + public static String VERSION = "Version"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String SHARING_OPT_OUT_NOTICE = "SharingOptOutNotice"; + public static String SENSITIVE_DATA_LIMIT_USE_NOTICE = "SensitiveDataLimitUseNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String SHARING_OPT_OUT = "SharingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String PERSONAL_DATA_CONSENTS = "PersonalDataConsents"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC = "Gpc"; + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java new file mode 100644 index 00000000..e7867d78 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java @@ -0,0 +1,18 @@ +package com.iab.gpp.encoder.field; + +public class UspCoV1Field { + + public static String VERSION = "Version"; + public static String SHARING_NOTICE = "SharingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC = "Gpc"; +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java new file mode 100644 index 00000000..ec044e90 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java @@ -0,0 +1,17 @@ +package com.iab.gpp.encoder.field; + +public class UspCtV1Field { + + public static String VERSION = "Version"; + public static String SHARING_NOTICE = "SharingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java new file mode 100644 index 00000000..d794c80c --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java @@ -0,0 +1,22 @@ +package com.iab.gpp.encoder.field; + +public class UspNatV1Field { + + public static String VERSION = "Version"; + public static String SHARING_NOTICE = "SharingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE = "SensitiveDataProcessingOptOutNotice"; + public static String SENSITIVE_DATA_LIMIT_USE_NOTICE = "SensitiveDataLimitUseNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String SHARING_OPT_OUT = "SharingOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC = "Gpc"; + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspUtV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspUtV1Field.java new file mode 100644 index 00000000..0ceffa78 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspUtV1Field.java @@ -0,0 +1,17 @@ +package com.iab.gpp.encoder.field; + +public class UspUtV1Field { + + public static String VERSION = "Version"; + public static String SHARING_NOTICE = "SharingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE = "SensitiveDataProcessingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspVaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspVaV1Field.java new file mode 100644 index 00000000..ceca6a1e --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspVaV1Field.java @@ -0,0 +1,17 @@ +package com.iab.gpp.encoder.field; + +public class UspVaV1Field { + + public static String VERSION = "Version"; + public static String SHARING_NOTICE = "SharingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java new file mode 100644 index 00000000..9cf8744a --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java @@ -0,0 +1,136 @@ +package com.iab.gpp.encoder.section; + +import java.util.HashMap; +import java.util.List; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspCaV1Field; +import com.iab.gpp.encoder.field.UspCoV1Field; +import com.iab.gpp.encoder.field.UspV1Field; + +public class UspCaV1 extends AbstractEncodableBitStringSection { + public static int ID = 8; + public static int VERSION = 1; + public static String NAME = "uspca"; + + public UspCaV1() { + initFields(); + } + + public UspCaV1(String encodedString) throws DecodingException { + initFields(); + + if (encodedString != null && encodedString.length() > 0) { + this.decode(encodedString); + } + } + + private void initFields() { + fields = new HashMap<>(); + + fields.put(UspCaV1Field.VERSION, new EncodableFixedInteger(6, UspCaV1.VERSION)); + fields.put(UspCaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspCaV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspCaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspCaV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspCaV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedBitfield(9)); + fields.put(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedBitfield(2)); + fields.put(UspCaV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2)); + fields.put(UspCaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); + fields.put(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); + fields.put(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); + fields.put(UspCaV1Field.GPC, new EncodableBoolean()); + + //@formatter:off + fieldOrder = new String[] { + UspCaV1Field.VERSION, + UspCaV1Field.SALE_OPT_OUT_NOTICE, + UspCaV1Field.SHARING_OPT_OUT_NOTICE, + UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, + UspCaV1Field.SALE_OPT_OUT, + UspCaV1Field.SHARING_OPT_OUT, + UspCaV1Field.SENSITIVE_DATA_PROCESSING, + UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UspCaV1Field.PERSONAL_DATA_CONSENTS, + UspCaV1Field.MSPA_COVERED_TRANSACTION, + UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, + UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, + UspCaV1Field.GPC + }; + //@formatter:on + } + + @Override + public String encode() throws EncodingException { + String bitString = this.encodeToBitString(); + String encodedString = Base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + public void decode(String encodedString) throws DecodingException { + String bitString = Base64UrlEncoder.decode(encodedString); + this.decodeFromBitString(bitString); + } + + @Override + public int getId() { + return UspCaV1.ID; + } + + @Override + public String getName() { + return UspCaV1.NAME; + } + + public Integer getVersion() { + return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.fields.get(UspCaV1Field.SALE_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSensitiveDataLimitUseNotice() { + return (Integer) this.fields.get(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE).getValue(); + } + + public Integer getSaleOptOut() { + return (Integer) this.fields.get(UspCaV1Field.SALE_OPT_OUT).getValue(); + } + + public Integer getSharingOptOut() { + return (Integer) this.fields.get(UspCaV1Field.SHARING_OPT_OUT).getValue(); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspCaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + } + + @SuppressWarnings("unchecked") + public List getKnownChildSensitiveDataConsents() { + return (List) this.fields.get(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + } + + public Integer getMspaCoveredtransaction() { + return (Integer) this.fields.get(UspCaV1Field.MSPA_COVERED_TRANSACTION).getValue(); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.fields.get(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.fields.get(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + } + + public Boolean getGpc() { + return (Boolean) this.fields.get(UspCaV1Field.GPC).getValue(); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java new file mode 100644 index 00000000..c670432a --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java @@ -0,0 +1,138 @@ +package com.iab.gpp.encoder.section; + +import java.util.HashMap; +import java.util.List; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspCoV1Field; +import com.iab.gpp.encoder.field.UspV1Field; + +public class UspCoV1 extends AbstractEncodableBitStringSection { + public static int ID = 10; + public static int VERSION = 1; + public static String NAME = "uspco"; + + public UspCoV1() { + initFields(); + } + + public UspCoV1(String encodedString) throws DecodingException { + initFields(); + + if (encodedString != null && encodedString.length() > 0) { + this.decode(encodedString); + } + } + + private void initFields() { + fields = new HashMap<>(); + + fields.put(UspCoV1Field.VERSION, new EncodableFixedInteger(6, UspCoV1.VERSION)); + fields.put(UspCoV1Field.SHARING_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspCoV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspCoV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspCoV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedBitfield(7)); + fields.put(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2)); + fields.put(UspCoV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); + fields.put(UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); + fields.put(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); + + fields.put(UspCoV1Field.GPC, new EncodableBoolean()); + + + + //@formatter:off + fieldOrder = new String[] { + UspCoV1Field.VERSION, + UspCoV1Field.SHARING_NOTICE, + UspCoV1Field.SALE_OPT_OUT_NOTICE, + UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UspCoV1Field.SALE_OPT_OUT, + UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT, + UspCoV1Field.SENSITIVE_DATA_PROCESSING, + UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UspCoV1Field.MSPA_COVERED_TRANSACTION, + UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE, + UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, + UspCoV1Field.GPC + }; + //@formatter:on + } + + @Override + public String encode() throws EncodingException { + String bitString = this.encodeToBitString(); + String encodedString = Base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + public void decode(String encodedString) throws DecodingException { + String bitString = Base64UrlEncoder.decode(encodedString); + this.decodeFromBitString(bitString); + } + + @Override + public int getId() { + return UspCoV1.ID; + } + + @Override + public String getName() { + return UspCoV1.NAME; + } + + public Integer getVersion() { + return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + } + + public Integer getSharingNotice() { + return (Integer) this.fields.get(UspCoV1Field.SHARING_NOTICE).getValue(); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.fields.get(UspCoV1Field.SALE_OPT_OUT_NOTICE).getValue(); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.fields.get(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSaleOptOut() { + return (Integer) this.fields.get(UspCoV1Field.SALE_OPT_OUT).getValue(); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.fields.get(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspCoV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + } + + public Integer getKnownChildSensitiveDataConsents() { + return (Integer) this.fields.get(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + } + + public Integer getMspaCoveredtransaction() { + return (Integer) this.fields.get(UspCoV1Field.MSPA_COVERED_TRANSACTION).getValue(); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.fields.get(UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.fields.get(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + } + + public Boolean getGpc() { + return (Boolean) this.fields.get(UspCoV1Field.GPC).getValue(); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java new file mode 100644 index 00000000..3f4ad9fb --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java @@ -0,0 +1,131 @@ +package com.iab.gpp.encoder.section; + +import java.util.HashMap; +import java.util.List; +import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspCtV1Field; +import com.iab.gpp.encoder.field.UspV1Field; + +public class UspCtV1 extends AbstractEncodableBitStringSection { + public static int ID = 12; + public static int VERSION = 1; + public static String NAME = "uspct"; + + public UspCtV1() { + initFields(); + } + + public UspCtV1(String encodedString) throws DecodingException { + initFields(); + + if (encodedString != null && encodedString.length() > 0) { + this.decode(encodedString); + } + } + + private void initFields() { + fields = new HashMap<>(); + + fields.put(UspCtV1Field.VERSION, new EncodableFixedInteger(6, UspCtV1.VERSION)); + fields.put(UspCtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspCtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspCtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspCtV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedBitfield(8)); + fields.put(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedBitfield(3)); + fields.put(UspCtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); + fields.put(UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); + fields.put(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); + + //@formatter:off + fieldOrder = new String[] { + UspCtV1Field.VERSION, + UspCtV1Field.SHARING_NOTICE, + UspCtV1Field.SALE_OPT_OUT_NOTICE, + UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UspCtV1Field.SALE_OPT_OUT, + UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT, + UspCtV1Field.SENSITIVE_DATA_PROCESSING, + UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UspCtV1Field.MSPA_COVERED_TRANSACTION, + UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE, + UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE + }; + //@formatter:on + } + + @Override + public String encode() throws EncodingException { + String bitString = this.encodeToBitString(); + String encodedString = Base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + public void decode(String encodedString) throws DecodingException { + String bitString = Base64UrlEncoder.decode(encodedString); + this.decodeFromBitString(bitString); + } + + @Override + public int getId() { + return UspCtV1.ID; + } + + @Override + public String getName() { + return UspCtV1.NAME; + } + + public Integer getVersion() { + return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + } + + public Integer getSharingNotice() { + return (Integer) this.fields.get(UspCtV1Field.SHARING_NOTICE).getValue(); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.fields.get(UspCtV1Field.SALE_OPT_OUT_NOTICE).getValue(); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.fields.get(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSaleOptOut() { + return (Integer) this.fields.get(UspCtV1Field.SALE_OPT_OUT).getValue(); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.fields.get(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspCtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + } + + @SuppressWarnings("unchecked") + public List getKnownChildSensitiveDataConsents() { + return (List) this.fields.get(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + } + + public Integer getMspaCoveredtransaction() { + return (Integer) this.fields.get(UspCtV1Field.MSPA_COVERED_TRANSACTION).getValue(); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.fields.get(UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.fields.get(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java new file mode 100644 index 00000000..21c62ee6 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java @@ -0,0 +1,158 @@ +package com.iab.gpp.encoder.section; + +import java.util.HashMap; +import java.util.List; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspNatV1Field; +import com.iab.gpp.encoder.field.UspV1Field; + +public class UspNatV1 extends AbstractEncodableBitStringSection { + public static int ID = 7; + public static int VERSION = 1; + public static String NAME = "uspnat"; + + public UspNatV1() { + initFields(); + } + + public UspNatV1(String encodedString) throws DecodingException { + initFields(); + + if (encodedString != null && encodedString.length() > 0) { + this.decode(encodedString); + } + } + + private void initFields() { + fields = new HashMap<>(); + + fields.put(UspNatV1Field.VERSION, new EncodableFixedInteger(6, UspNatV1.VERSION)); + fields.put(UspNatV1Field.SHARING_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspNatV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspNatV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspNatV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspNatV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedBitfield(12)); + fields.put(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedBitfield(2)); + fields.put(UspNatV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); + fields.put(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); + fields.put(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); + + fields.put(UspNatV1Field.GPC, new EncodableBoolean()); + + + + //@formatter:off + fieldOrder = new String[] { + UspNatV1Field.VERSION, + UspNatV1Field.SHARING_NOTICE, + UspNatV1Field.SALE_OPT_OUT_NOTICE, + UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, + UspNatV1Field.SALE_OPT_OUT, + UspNatV1Field.SHARING_OPT_OUT, + UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, + UspNatV1Field.SENSITIVE_DATA_PROCESSING, + UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UspNatV1Field.MSPA_COVERED_TRANSACTION, + UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, + UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, + UspNatV1Field.GPC + }; + //@formatter:on + } + + @Override + public String encode() throws EncodingException { + String bitString = this.encodeToBitString(); + String encodedString = Base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + public void decode(String encodedString) throws DecodingException { + String bitString = Base64UrlEncoder.decode(encodedString); + this.decodeFromBitString(bitString); + } + + @Override + public int getId() { + return UspNatV1.ID; + } + + @Override + public String getName() { + return UspNatV1.NAME; + } + + public Integer getVersion() { + return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + } + + public Integer getSharingNotice() { + return (Integer) this.fields.get(UspNatV1Field.SHARING_NOTICE).getValue(); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.fields.get(UspNatV1Field.SALE_OPT_OUT_NOTICE).getValue(); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.fields.get(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSensitiveDataProcessingOptOutNotice() { + return (Integer) this.fields.get(UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSensitiveDataLimitUseNotice() { + return (Integer) this.fields.get(UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE).getValue(); + } + + public Integer getSaleOptOut() { + return (Integer) this.fields.get(UspNatV1Field.SALE_OPT_OUT).getValue(); + } + + public Integer getSharingOptOut() { + return (Integer) this.fields.get(UspNatV1Field.SHARING_OPT_OUT).getValue(); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.fields.get(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspNatV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + } + + @SuppressWarnings("unchecked") + public List getKnownChildSensitiveDataConsents() { + return (List) this.fields.get(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + } + + public Integer getMspaCoveredtransaction() { + return (Integer) this.fields.get(UspNatV1Field.MSPA_COVERED_TRANSACTION).getValue(); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.fields.get(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.fields.get(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + } + + public Boolean getGpc() { + return (Boolean) this.fields.get(UspNatV1Field.GPC).getValue(); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java new file mode 100644 index 00000000..5d5d2808 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java @@ -0,0 +1,136 @@ +package com.iab.gpp.encoder.section; + +import java.util.HashMap; +import java.util.List; +import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspUtV1Field; +import com.iab.gpp.encoder.field.UspV1Field; + +public class UspUtV1 extends AbstractEncodableBitStringSection { + public static int ID = 11; + public static int VERSION = 1; + public static String NAME = "usput"; + + public UspUtV1() { + initFields(); + } + + public UspUtV1(String encodedString) throws DecodingException { + initFields(); + + if (encodedString != null && encodedString.length() > 0) { + this.decode(encodedString); + } + } + + private void initFields() { + fields = new HashMap<>(); + + fields.put(UspUtV1Field.VERSION, new EncodableFixedInteger(6, UspUtV1.VERSION)); + fields.put(UspUtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspUtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspUtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspUtV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedBitfield(8)); + fields.put(UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2)); + fields.put(UspUtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); + fields.put(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); + fields.put(UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); + + //@formatter:off + fieldOrder = new String[] { + UspUtV1Field.VERSION, + UspUtV1Field.SHARING_NOTICE, + UspUtV1Field.SALE_OPT_OUT_NOTICE, + UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UspUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + UspUtV1Field.SALE_OPT_OUT, + UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT, + UspUtV1Field.SENSITIVE_DATA_PROCESSING, + UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UspUtV1Field.MSPA_COVERED_TRANSACTION, + UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, + UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE + }; + //@formatter:on + } + + @Override + public String encode() throws EncodingException { + String bitString = this.encodeToBitString(); + String encodedString = Base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + public void decode(String encodedString) throws DecodingException { + String bitString = Base64UrlEncoder.decode(encodedString); + this.decodeFromBitString(bitString); + } + + @Override + public int getId() { + return UspUtV1.ID; + } + + @Override + public String getName() { + return UspUtV1.NAME; + } + + public Integer getVersion() { + return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + } + + public Integer getSharingNotice() { + return (Integer) this.fields.get(UspUtV1Field.SHARING_NOTICE).getValue(); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.fields.get(UspUtV1Field.SALE_OPT_OUT_NOTICE).getValue(); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.fields.get(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSensitiveDataProcessingOptOutNotice() { + return (Integer) this.fields.get(UspUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSaleOptOut() { + return (Integer) this.fields.get(UspUtV1Field.SALE_OPT_OUT).getValue(); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.fields.get(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspUtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + } + + public Integer getKnownChildSensitiveDataConsents() { + return (Integer) this.fields.get(UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + } + + public Integer getMspaCoveredtransaction() { + return (Integer) this.fields.get(UspUtV1Field.MSPA_COVERED_TRANSACTION).getValue(); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.fields.get(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.fields.get(UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java new file mode 100644 index 00000000..d22ceddb --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java @@ -0,0 +1,129 @@ +package com.iab.gpp.encoder.section; + +import java.util.HashMap; +import java.util.List; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspV1Field; +import com.iab.gpp.encoder.field.UspVaV1Field; + +public class UspVaV1 extends AbstractEncodableBitStringSection { + public static int ID = 9; + public static int VERSION = 1; + public static String NAME = "uspva"; + + public UspVaV1() { + initFields(); + } + + public UspVaV1(String encodedString) throws DecodingException { + initFields(); + + if (encodedString != null && encodedString.length() > 0) { + this.decode(encodedString); + } + } + + private void initFields() { + fields = new HashMap<>(); + + fields.put(UspVaV1Field.VERSION, new EncodableFixedInteger(6, UspVaV1.VERSION)); + fields.put(UspVaV1Field.SHARING_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspVaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); + fields.put(UspVaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2)); + fields.put(UspVaV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedInteger(8)); + fields.put(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2)); + fields.put(UspVaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); + fields.put(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); + fields.put(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); + + //@formatter:off + fieldOrder = new String[] { + UspVaV1Field.VERSION, + UspVaV1Field.SHARING_NOTICE, + UspVaV1Field.SALE_OPT_OUT_NOTICE, + UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UspVaV1Field.SALE_OPT_OUT, + UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT, + UspVaV1Field.SENSITIVE_DATA_PROCESSING, + UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UspVaV1Field.MSPA_COVERED_TRANSACTION, + UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, + UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE + }; + //@formatter:on + } + + @Override + public String encode() throws EncodingException { + String bitString = this.encodeToBitString(); + String encodedString = Base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + public void decode(String encodedString) throws DecodingException { + String bitString = Base64UrlEncoder.decode(encodedString); + this.decodeFromBitString(bitString); + } + + @Override + public int getId() { + return UspVaV1.ID; + } + + @Override + public String getName() { + return UspVaV1.NAME; + } + + public Integer getVersion() { + return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + } + + public Integer getSharingNotice() { + return (Integer) this.fields.get(UspVaV1Field.SHARING_NOTICE).getValue(); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.fields.get(UspVaV1Field.SALE_OPT_OUT_NOTICE).getValue(); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.fields.get(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSaleOptOut() { + return (Integer) this.fields.get(UspVaV1Field.SALE_OPT_OUT).getValue(); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.fields.get(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspVaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + } + + public Integer getKnownChildSensitiveDataConsents() { + return (Integer) this.fields.get(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + } + + public Integer getMspaCoveredtransaction() { + return (Integer) this.fields.get(UspVaV1Field.MSPA_COVERED_TRANSACTION).getValue(); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.fields.get(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.fields.get(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + } + +} From 293e2356db6158579e9bbcdbcb5c9835c257fac7 Mon Sep 17 00:00:00 2001 From: chad Date: Wed, 9 Nov 2022 21:18:31 -0700 Subject: [PATCH 02/41] multi state --- .../datatype/EncodableFixedIntegerList.java | 37 +++ .../encoder/FixedIntegerListEncoder.java | 60 +++++ .../iab/gpp/encoder/field/TcfCaV2Field.java | 3 +- .../iab/gpp/encoder/field/UspCaV1Field.java | 1 + .../iab/gpp/encoder/field/UspCoV1Field.java | 1 + .../iab/gpp/encoder/field/UspCtV1Field.java | 2 + .../iab/gpp/encoder/field/UspNatV1Field.java | 3 + .../com/iab/gpp/encoder/section/TcfCaV2.java | 12 +- .../com/iab/gpp/encoder/section/TcfEuV2.java | 4 +- .../com/iab/gpp/encoder/section/UspCaV1.java | 116 +++++++--- .../com/iab/gpp/encoder/section/UspCoV1.java | 99 ++++++-- .../com/iab/gpp/encoder/section/UspCtV1.java | 108 ++++++--- .../com/iab/gpp/encoder/section/UspNatV1.java | 122 +++++++--- .../com/iab/gpp/encoder/section/UspUtV1.java | 31 +-- .../com/iab/gpp/encoder/section/UspVaV1.java | 28 +-- .../com/iab/gpp/encoder/GppModelTest.java | 2 +- ...ava => EncodableFixedIntegerListTest.java} | 2 +- .../encoder/FixedIntegerListEncoderTest.java | 216 ++++++++++++++++++ .../iab/gpp/encoder/section/TcfCaV2Test.java | 4 +- .../iab/gpp/encoder/section/UspCaV1Test.java | 57 +++++ .../iab/gpp/encoder/section/UspCoV1Test.java | 54 +++++ .../iab/gpp/encoder/section/UspCtV1Test.java | 54 +++++ .../iab/gpp/encoder/section/UspNatV1Test.java | 65 ++++++ .../iab/gpp/encoder/section/UspUtV1Test.java | 53 +++++ .../iab/gpp/encoder/section/UspVaV1Test.java | 52 +++++ 25 files changed, 1034 insertions(+), 152 deletions(-) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java rename iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/{EncodableFixedBitfieldTest.java => EncodableFixedIntegerListTest.java} (90%) create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java new file mode 100644 index 00000000..99c2d089 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java @@ -0,0 +1,37 @@ +package com.iab.gpp.encoder.datatype; + +import java.util.List; +import com.iab.gpp.encoder.datatype.encoder.FixedIntegerListEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; + +public class EncodableFixedIntegerList extends AbstractEncodableBitStringDataType> { + + private int elementBitStringLength; + private int numElements; + + public EncodableFixedIntegerList(int elementBitStringLength, int size) { + super(); + this.elementBitStringLength = elementBitStringLength; + this.numElements = size; + } + + public EncodableFixedIntegerList(int elementBitStringLength, List value) { + super(value); + this.elementBitStringLength = elementBitStringLength; + this.numElements = value.size(); + } + + public String encode() throws EncodingException { + return FixedIntegerListEncoder.encode(this.value, this.elementBitStringLength, this.numElements); + } + + public void decode(String bitString) throws DecodingException { + this.value = FixedIntegerListEncoder.decode(bitString, this.elementBitStringLength, this.numElements); + } + + public String substring(String bitString, int fromIndex) { + // TODO: validate + return bitString.substring(fromIndex, fromIndex + (this.elementBitStringLength * numElements)); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java new file mode 100644 index 00000000..6f1d191a --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.datatype.encoder; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; + +public class FixedIntegerListEncoder { + + private static Pattern BITSTRING_VERIFICATION_PATTERN = Pattern.compile("^[0-1]*$", Pattern.CASE_INSENSITIVE); + + public static String encode(List value, int elementBitStringLength, int numElements) + throws EncodingException { + String bitString = ""; + for (int i = 0; i < value.size(); i++) { + bitString += FixedIntegerEncoder.encode(value.get(i), elementBitStringLength); + } + + while (bitString.length() < elementBitStringLength * numElements) { + bitString += "0"; + } + + return bitString; + } + + public static List decode(String bitString, int elementBitStringLength, int numElements) + throws DecodingException { + if (!BITSTRING_VERIFICATION_PATTERN.matcher(bitString).matches()) { + throw new DecodingException("Undecodable FixedIntegerList '" + bitString + "'"); + } + + if(bitString.length() > elementBitStringLength * numElements) { + throw new DecodingException("Undecodable FixedIntegerList '" + bitString + "'"); + } + + if(bitString.length() % elementBitStringLength != 0) { + throw new DecodingException("Undecodable FixedIntegerList '" + bitString + "'"); + } + + while (bitString.length() < elementBitStringLength * numElements) { + bitString += "0"; + } + + if(bitString.length() > elementBitStringLength * numElements) { + bitString = bitString.substring(0, elementBitStringLength * numElements); + } + + List value = new ArrayList<>(); + for (int i = 0; i < bitString.length(); i += elementBitStringLength) { + value.add(FixedIntegerEncoder.decode(bitString.substring(i, i + elementBitStringLength))); + } + + while (value.size() < numElements) { + value.add(0); + } + + return value; + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV2Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV2Field.java index 2aeba45b..6069f9b1 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV2Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV2Field.java @@ -17,7 +17,8 @@ public class TcfCaV2Field { public static String PURPOSES_IMPLIED_CONSENT = "PurposesImpliedConsent"; public static String VENDOR_EXPRESS_CONSENT = "VendorExpressConsent"; public static String VENDOR_IMPLIED_CONSENT = "VendorImpliedConsent"; - public static String SEGMENT_TYPE = "SegmentType"; + + public static String PUB_PURPOSES_SEGMENT_TYPE = "PubPurposesSegmentType"; public static String PUB_PURPOSES_EXPRESS_CONSENT = "PubPurposesExpressConsent"; public static String PUB_PURPOSES_IMPLIED_CONSENT = "PubPurposesImpliedConsent"; public static String NUM_CUSTOM_PURPOSES = "NumCustomPurposes"; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java index cf00bd0b..33e623c4 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java @@ -15,6 +15,7 @@ public class UspCaV1Field { public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; public static String GPC = "Gpc"; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java index e7867d78..95e75882 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java @@ -14,5 +14,6 @@ public class UspCoV1Field { public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; public static String GPC = "Gpc"; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java index ec044e90..8090c50e 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java @@ -14,4 +14,6 @@ public class UspCtV1Field { public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC = "Gpc"; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java index d794c80c..033957fd 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java @@ -5,6 +5,7 @@ public class UspNatV1Field { public static String VERSION = "Version"; public static String SHARING_NOTICE = "SharingNotice"; public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String SHARING_OPT_OUT_NOTICE = "SharingOptOutNotice"; public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; public static String SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE = "SensitiveDataProcessingOptOutNotice"; public static String SENSITIVE_DATA_LIMIT_USE_NOTICE = "SensitiveDataLimitUseNotice"; @@ -13,10 +14,12 @@ public class UspNatV1Field { public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String PERSONAL_DATA_CONSENTS = "PersonalDataConsents"; public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; public static String GPC = "Gpc"; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV2.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV2.java index a5c27280..98a3d57d 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV2.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV2.java @@ -58,7 +58,7 @@ private void initFields() { fields.put(TcfCaV2Field.VENDOR_IMPLIED_CONSENT, new EncodableFixedIntegerRange(new ArrayList<>())); // publisher purposes segment - fields.put(TcfCaV2Field.SEGMENT_TYPE, new EncodableFixedInteger(3, 3)); + fields.put(TcfCaV2Field.PUB_PURPOSES_SEGMENT_TYPE, new EncodableFixedInteger(3, 3)); fields.put(TcfCaV2Field.PUB_PURPOSES_EXPRESS_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); fields.put(TcfCaV2Field.PUB_PURPOSES_IMPLIED_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); @@ -100,7 +100,7 @@ public int getAsInt() { }; String[] publisherPurposesSegment = new String[] { - TcfCaV2Field.SEGMENT_TYPE, + TcfCaV2Field.PUB_PURPOSES_SEGMENT_TYPE, TcfCaV2Field.PUB_PURPOSES_EXPRESS_CONSENT, TcfCaV2Field.PUB_PURPOSES_IMPLIED_CONSENT, TcfCaV2Field.NUM_CUSTOM_PURPOSES, @@ -136,8 +136,8 @@ public void decode(String encodedSection) throws DecodingException { String[] segmentBitStrings = new String[4]; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 3. In version 1 and 2 of the TC string - * there is no segment type for the CORE string. Instead the first 6 bits are reserved for the + * first char will contain 6 bits, we only need the first 3. + * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the * encoding version, but because we're only on a maximum of encoding version 2 the first 3 bits in * the core segment will evaluate to 0. */ @@ -247,8 +247,8 @@ public List getVendorImpliedConsent() { return (List) this.fields.get(TcfCaV2Field.VENDOR_IMPLIED_CONSENT).getValue(); } - public Integer getSegmentType() { - return (Integer) this.fields.get(TcfCaV2Field.SEGMENT_TYPE).getValue(); + public Integer getPubPurposesSegmentType() { + return (Integer) this.fields.get(TcfCaV2Field.PUB_PURPOSES_SEGMENT_TYPE).getValue(); } @SuppressWarnings("unchecked") diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java index 498ae46b..f7df528a 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java @@ -175,8 +175,8 @@ public void decode(String encodedSection) throws DecodingException { String[] segmentBitStrings = new String[4]; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 3. In version 1 and 2 of the TC string - * there is no segment type for the CORE string. Instead the first 6 bits are reserved for the + * first char will contain 6 bits, we only need the first 3. + * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the * encoding version, but because we're only on a maximum of encoding version 2 the first 3 bits in * the core segment will evaluate to 0. */ diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java index 9cf8744a..59f38f0d 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java @@ -1,18 +1,20 @@ package com.iab.gpp.encoder.section; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.stream.Collectors; import com.iab.gpp.encoder.datatype.EncodableBoolean; -import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.UspCaV1Field; -import com.iab.gpp.encoder.field.UspCoV1Field; import com.iab.gpp.encoder.field.UspV1Field; -public class UspCaV1 extends AbstractEncodableBitStringSection { +public class UspCaV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 8; public static int VERSION = 1; public static String NAME = "uspca"; @@ -33,21 +35,24 @@ private void initFields() { fields = new HashMap<>(); fields.put(UspCaV1Field.VERSION, new EncodableFixedInteger(6, UspCaV1.VERSION)); - fields.put(UspCaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspCaV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspCaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspCaV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspCaV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedBitfield(9)); - fields.put(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedBitfield(2)); - fields.put(UspCaV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2)); - fields.put(UspCaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); - fields.put(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); - fields.put(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); - fields.put(UspCaV1Field.GPC, new EncodableBoolean()); - + fields.put(UspCaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspCaV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspCaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspCaV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspCaV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(9, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); + fields.put(UspCaV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); + fields.put(UspCaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + + // gpc segment + fields.put(UspCaV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(3, 1)); + fields.put(UspCaV1Field.GPC, new EncodableBoolean(false)); + //@formatter:off - fieldOrder = new String[] { + String[] coreSegment = new String[] { UspCaV1Field.VERSION, UspCaV1Field.SALE_OPT_OUT_NOTICE, UspCaV1Field.SHARING_OPT_OUT_NOTICE, @@ -59,23 +64,63 @@ private void initFields() { UspCaV1Field.PERSONAL_DATA_CONSENTS, UspCaV1Field.MSPA_COVERED_TRANSACTION, UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, - UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, + UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE + }; + + String[] gpcSegment = new String[] { + UspCaV1Field.GPC_SEGMENT_TYPE, UspCaV1Field.GPC }; + + segments = new String[][] { + coreSegment, + gpcSegment + }; //@formatter:on } @Override public String encode() throws EncodingException { - String bitString = this.encodeToBitString(); - String encodedString = Base64UrlEncoder.encode(bitString); - return encodedString; + List segmentBitStrings = this.encodeSegmentsToBitStrings(); + List encodedSegments = new ArrayList<>(); + if (segmentBitStrings.size() >= 1) { + encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(0))); + + if (segmentBitStrings.size() >= 2) { + encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(1))); + } + } + + return encodedSegments.stream().collect(Collectors.joining(".")); } @Override - public void decode(String encodedString) throws DecodingException { - String bitString = Base64UrlEncoder.decode(encodedString); - this.decodeFromBitString(bitString); + public void decode(String encodedSection) throws DecodingException { + String[] encodedSegments = encodedSection.split("\\."); + String[] segmentBitStrings = new String[2]; + for (int i = 0; i < encodedSegments.length; i++) { + /** + * first char will contain 6 bits, we only need the first 3. + * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the + * encoding version, but because we're only on a maximum of encoding version 2 the first 3 bits in + * the core segment will evaluate to 0. + */ + String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); + switch (segmentBitString.substring(0, 3)) { + case "000": { + segmentBitStrings[0] = segmentBitString; + break; + } + case "001": { + segmentBitStrings[1] = segmentBitString; + break; + } + default: { + throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); + } + } + } + this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); } @Override @@ -100,6 +145,10 @@ public Integer getSensitiveDataLimitUseNotice() { return (Integer) this.fields.get(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE).getValue(); } + public Integer getSharingOptOutNotice() { + return (Integer) this.fields.get(UspCaV1Field.SHARING_OPT_OUT_NOTICE).getValue(); + } + public Integer getSaleOptOut() { return (Integer) this.fields.get(UspCaV1Field.SALE_OPT_OUT).getValue(); } @@ -109,16 +158,21 @@ public Integer getSharingOptOut() { } @SuppressWarnings("unchecked") - public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspCaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspCaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + } + + @SuppressWarnings("unchecked") + public List getKnownChildSensitiveDataConsents() { + return (List) this.fields.get(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); } @SuppressWarnings("unchecked") - public List getKnownChildSensitiveDataConsents() { - return (List) this.fields.get(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + public List getPersonalDataConsents() { + return (List) this.fields.get(UspCaV1Field.PERSONAL_DATA_CONSENTS).getValue(); } - public Integer getMspaCoveredtransaction() { + public Integer getMspaCoveredTransaction() { return (Integer) this.fields.get(UspCaV1Field.MSPA_COVERED_TRANSACTION).getValue(); } @@ -130,6 +184,10 @@ public Integer getMspaServiceProviderMode() { return (Integer) this.fields.get(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); } + public Boolean getGpcSegmentType() { + return (Boolean) this.fields.get(UspCaV1Field.GPC_SEGMENT_TYPE).getValue(); + } + public Boolean getGpc() { return (Boolean) this.fields.get(UspCaV1Field.GPC).getValue(); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java index c670432a..8d852be0 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java @@ -1,17 +1,20 @@ package com.iab.gpp.encoder.section; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.stream.Collectors; import com.iab.gpp.encoder.datatype.EncodableBoolean; -import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.UspCoV1Field; import com.iab.gpp.encoder.field.UspV1Field; -public class UspCoV1 extends AbstractEncodableBitStringSection { +public class UspCoV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 10; public static int VERSION = 1; public static String NAME = "uspco"; @@ -32,22 +35,24 @@ private void initFields() { fields = new HashMap<>(); fields.put(UspCoV1Field.VERSION, new EncodableFixedInteger(6, UspCoV1.VERSION)); - fields.put(UspCoV1Field.SHARING_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspCoV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspCoV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspCoV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedBitfield(7)); - fields.put(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2)); - fields.put(UspCoV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); - fields.put(UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); - fields.put(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); - - fields.put(UspCoV1Field.GPC, new EncodableBoolean()); - + fields.put(UspCoV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspCoV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspCoV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspCoV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0))); + fields.put(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UspCoV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + + // gpc segment + fields.put(UspCoV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(3, 1)); + fields.put(UspCoV1Field.GPC, new EncodableBoolean(false)); //@formatter:off - fieldOrder = new String[] { + String[] coreSegment = new String[] { UspCoV1Field.VERSION, UspCoV1Field.SHARING_NOTICE, UspCoV1Field.SALE_OPT_OUT_NOTICE, @@ -58,23 +63,63 @@ private void initFields() { UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, UspCoV1Field.MSPA_COVERED_TRANSACTION, UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE, - UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, + UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE + }; + + String[] gpcSegment = new String[] { + UspCoV1Field.GPC_SEGMENT_TYPE, UspCoV1Field.GPC }; + + segments = new String[][] { + coreSegment, + gpcSegment + }; //@formatter:on } @Override public String encode() throws EncodingException { - String bitString = this.encodeToBitString(); - String encodedString = Base64UrlEncoder.encode(bitString); - return encodedString; + List segmentBitStrings = this.encodeSegmentsToBitStrings(); + List encodedSegments = new ArrayList<>(); + if (segmentBitStrings.size() >= 1) { + encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(0))); + + if (segmentBitStrings.size() >= 2) { + encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(1))); + } + } + + return encodedSegments.stream().collect(Collectors.joining(".")); } @Override - public void decode(String encodedString) throws DecodingException { - String bitString = Base64UrlEncoder.decode(encodedString); - this.decodeFromBitString(bitString); + public void decode(String encodedSection) throws DecodingException { + String[] encodedSegments = encodedSection.split("\\."); + String[] segmentBitStrings = new String[2]; + for (int i = 0; i < encodedSegments.length; i++) { + /** + * first char will contain 6 bits, we only need the first 3. + * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the + * encoding version, but because we're only on a maximum of encoding version 2 the first 3 bits in + * the core segment will evaluate to 0. + */ + String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); + switch (segmentBitString.substring(0, 3)) { + case "000": { + segmentBitStrings[0] = segmentBitString; + break; + } + case "001": { + segmentBitStrings[1] = segmentBitString; + break; + } + default: { + throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); + } + } + } + this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); } @Override @@ -112,15 +157,15 @@ public Integer getTargetedAdvertisingOptOut() { } @SuppressWarnings("unchecked") - public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspCoV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspCoV1Field.SENSITIVE_DATA_PROCESSING).getValue(); } public Integer getKnownChildSensitiveDataConsents() { return (Integer) this.fields.get(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); } - public Integer getMspaCoveredtransaction() { + public Integer getMspaCoveredTransaction() { return (Integer) this.fields.get(UspCoV1Field.MSPA_COVERED_TRANSACTION).getValue(); } @@ -132,6 +177,10 @@ public Integer getMspaServiceProviderMode() { return (Integer) this.fields.get(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); } + public Boolean getGpcSegmentType() { + return (Boolean) this.fields.get(UspCoV1Field.GPC_SEGMENT_TYPE).getValue(); + } + public Boolean getGpc() { return (Boolean) this.fields.get(UspCoV1Field.GPC).getValue(); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java index 3f4ad9fb..6b9bd3ba 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java @@ -1,16 +1,20 @@ package com.iab.gpp.encoder.section; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; -import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; +import java.util.stream.Collectors; +import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.UspCtV1Field; import com.iab.gpp.encoder.field.UspV1Field; -public class UspCtV1 extends AbstractEncodableBitStringSection { +public class UspCtV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 12; public static int VERSION = 1; public static String NAME = "uspct"; @@ -31,19 +35,23 @@ private void initFields() { fields = new HashMap<>(); fields.put(UspCtV1Field.VERSION, new EncodableFixedInteger(6, UspCtV1.VERSION)); - fields.put(UspCtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspCtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspCtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspCtV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedBitfield(8)); - fields.put(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedBitfield(3)); - fields.put(UspCtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); - fields.put(UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); - fields.put(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); - + fields.put(UspCtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspCtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspCtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspCtV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0))); + fields.put(UspCtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + + // gpc segment + fields.put(UspCtV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(3, 1)); + fields.put(UspCtV1Field.GPC, new EncodableBoolean(false)); + //@formatter:off - fieldOrder = new String[] { + String[] coreSegment = new String[] { UspCtV1Field.VERSION, UspCtV1Field.SHARING_NOTICE, UspCtV1Field.SALE_OPT_OUT_NOTICE, @@ -56,22 +64,63 @@ private void initFields() { UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE, UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE }; + + String[] gpcSegment = new String[] { + UspCtV1Field.GPC_SEGMENT_TYPE, + UspCtV1Field.GPC + }; + + segments = new String[][] { + coreSegment, + gpcSegment + }; //@formatter:on } @Override public String encode() throws EncodingException { - String bitString = this.encodeToBitString(); - String encodedString = Base64UrlEncoder.encode(bitString); - return encodedString; + List segmentBitStrings = this.encodeSegmentsToBitStrings(); + List encodedSegments = new ArrayList<>(); + if (segmentBitStrings.size() >= 1) { + encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(0))); + + if (segmentBitStrings.size() >= 2) { + encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(1))); + } + } + + return encodedSegments.stream().collect(Collectors.joining(".")); } @Override - public void decode(String encodedString) throws DecodingException { - String bitString = Base64UrlEncoder.decode(encodedString); - this.decodeFromBitString(bitString); + public void decode(String encodedSection) throws DecodingException { + String[] encodedSegments = encodedSection.split("\\."); + String[] segmentBitStrings = new String[2]; + for (int i = 0; i < encodedSegments.length; i++) { + /** + * first char will contain 6 bits, we only need the first 3. + * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the + * encoding version, but because we're only on a maximum of encoding version 2 the first 3 bits in + * the core segment will evaluate to 0. + */ + String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); + switch (segmentBitString.substring(0, 3)) { + case "000": { + segmentBitStrings[0] = segmentBitString; + break; + } + case "001": { + segmentBitStrings[1] = segmentBitString; + break; + } + default: { + throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); + } + } + } + this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); } - + @Override public int getId() { return UspCtV1.ID; @@ -107,16 +156,16 @@ public Integer getTargetedAdvertisingOptOut() { } @SuppressWarnings("unchecked") - public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspCtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspCtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); } @SuppressWarnings("unchecked") - public List getKnownChildSensitiveDataConsents() { - return (List) this.fields.get(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + public List getKnownChildSensitiveDataConsents() { + return (List) this.fields.get(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); } - public Integer getMspaCoveredtransaction() { + public Integer getMspaCoveredTransaction() { return (Integer) this.fields.get(UspCtV1Field.MSPA_COVERED_TRANSACTION).getValue(); } @@ -128,4 +177,11 @@ public Integer getMspaServiceProviderMode() { return (Integer) this.fields.get(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); } + public Boolean getGpcSegmentType() { + return (Boolean) this.fields.get(UspCtV1Field.GPC_SEGMENT_TYPE).getValue(); + } + + public Boolean getGpc() { + return (Boolean) this.fields.get(UspCtV1Field.GPC).getValue(); + } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java index 21c62ee6..422269e5 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java @@ -1,17 +1,20 @@ package com.iab.gpp.encoder.section; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.stream.Collectors; import com.iab.gpp.encoder.datatype.EncodableBoolean; -import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.UspNatV1Field; import com.iab.gpp.encoder.field.UspV1Field; -public class UspNatV1 extends AbstractEncodableBitStringSection { +public class UspNatV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 7; public static int VERSION = 1; public static String NAME = "uspnat"; @@ -32,29 +35,33 @@ private void initFields() { fields = new HashMap<>(); fields.put(UspNatV1Field.VERSION, new EncodableFixedInteger(6, UspNatV1.VERSION)); - fields.put(UspNatV1Field.SHARING_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspNatV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspNatV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspNatV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspNatV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedBitfield(12)); - fields.put(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedBitfield(2)); - fields.put(UspNatV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); - fields.put(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); - fields.put(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); - - fields.put(UspNatV1Field.GPC, new EncodableBoolean()); - + fields.put(UspNatV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspNatV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspNatV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspNatV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspNatV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspNatV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); + fields.put(UspNatV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); + fields.put(UspNatV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + + // gpc segment + fields.put(UspNatV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(3, 1)); + fields.put(UspNatV1Field.GPC, new EncodableBoolean(false)); //@formatter:off - fieldOrder = new String[] { + String[] coreSegment = new String[] { UspNatV1Field.VERSION, UspNatV1Field.SHARING_NOTICE, UspNatV1Field.SALE_OPT_OUT_NOTICE, + UspNatV1Field.SHARING_OPT_OUT_NOTICE, UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, @@ -63,25 +70,65 @@ private void initFields() { UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, UspNatV1Field.SENSITIVE_DATA_PROCESSING, UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UspNatV1Field.PERSONAL_DATA_CONSENTS, UspNatV1Field.MSPA_COVERED_TRANSACTION, UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, - UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, + UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE + }; + + String[] gpcSegment = new String[] { + UspNatV1Field.GPC_SEGMENT_TYPE, UspNatV1Field.GPC }; + + segments = new String[][] { + coreSegment, + gpcSegment + }; //@formatter:on } @Override public String encode() throws EncodingException { - String bitString = this.encodeToBitString(); - String encodedString = Base64UrlEncoder.encode(bitString); - return encodedString; + List segmentBitStrings = this.encodeSegmentsToBitStrings(); + List encodedSegments = new ArrayList<>(); + if (segmentBitStrings.size() >= 1) { + encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(0))); + + if (segmentBitStrings.size() >= 2) { + encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(1))); + } + } + + return encodedSegments.stream().collect(Collectors.joining(".")); } @Override - public void decode(String encodedString) throws DecodingException { - String bitString = Base64UrlEncoder.decode(encodedString); - this.decodeFromBitString(bitString); + public void decode(String encodedSection) throws DecodingException { + String[] encodedSegments = encodedSection.split("\\."); + String[] segmentBitStrings = new String[2]; + for (int i = 0; i < encodedSegments.length; i++) { + /** + * first char will contain 6 bits, we only need the first 3. There is no segment type for the CORE + * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on + * a maximum of encoding version 2 the first 3 bits in the core segment will evaluate to 0. + */ + String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); + switch (segmentBitString.substring(0, 3)) { + case "000": { + segmentBitStrings[0] = segmentBitString; + break; + } + case "001": { + segmentBitStrings[1] = segmentBitString; + break; + } + default: { + throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); + } + } + } + this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); } @Override @@ -106,6 +153,10 @@ public Integer getSaleOptOutNotice() { return (Integer) this.fields.get(UspNatV1Field.SALE_OPT_OUT_NOTICE).getValue(); } + public Integer getSharingOptOutNotice() { + return (Integer) this.fields.get(UspNatV1Field.SHARING_OPT_OUT_NOTICE).getValue(); + } + public Integer getTargetedAdvertisingOptOutNotice() { return (Integer) this.fields.get(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); } @@ -131,16 +182,21 @@ public Integer getTargetedAdvertisingOptOut() { } @SuppressWarnings("unchecked") - public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspNatV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspNatV1Field.SENSITIVE_DATA_PROCESSING).getValue(); } @SuppressWarnings("unchecked") - public List getKnownChildSensitiveDataConsents() { - return (List) this.fields.get(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + public List getKnownChildSensitiveDataConsents() { + return (List) this.fields.get(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); } - public Integer getMspaCoveredtransaction() { + @SuppressWarnings("unchecked") + public List getPersonalDataConsents() { + return (List) this.fields.get(UspNatV1Field.PERSONAL_DATA_CONSENTS).getValue(); + } + + public Integer getMspaCoveredTransaction() { return (Integer) this.fields.get(UspNatV1Field.MSPA_COVERED_TRANSACTION).getValue(); } @@ -152,6 +208,10 @@ public Integer getMspaServiceProviderMode() { return (Integer) this.fields.get(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); } + public Boolean getGpcSegmentType() { + return (Boolean) this.fields.get(UspNatV1Field.GPC_SEGMENT_TYPE).getValue(); + } + public Boolean getGpc() { return (Boolean) this.fields.get(UspNatV1Field.GPC).getValue(); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java index 5d5d2808..366a3034 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java @@ -1,9 +1,10 @@ package com.iab.gpp.encoder.section; +import java.util.Arrays; import java.util.HashMap; import java.util.List; -import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; @@ -31,17 +32,17 @@ private void initFields() { fields = new HashMap<>(); fields.put(UspUtV1Field.VERSION, new EncodableFixedInteger(6, UspUtV1.VERSION)); - fields.put(UspUtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspUtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspUtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspUtV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedBitfield(8)); - fields.put(UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2)); - fields.put(UspUtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); - fields.put(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); - fields.put(UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); + fields.put(UspUtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspUtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspUtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspUtV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UspUtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); //@formatter:off fieldOrder = new String[] { @@ -113,15 +114,15 @@ public Integer getTargetedAdvertisingOptOut() { } @SuppressWarnings("unchecked") - public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspUtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspUtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); } public Integer getKnownChildSensitiveDataConsents() { return (Integer) this.fields.get(UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); } - public Integer getMspaCoveredtransaction() { + public Integer getMspaCoveredTransaction() { return (Integer) this.fields.get(UspUtV1Field.MSPA_COVERED_TRANSACTION).getValue(); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java index d22ceddb..55cedc36 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java @@ -1,8 +1,10 @@ package com.iab.gpp.encoder.section; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; @@ -30,16 +32,16 @@ private void initFields() { fields = new HashMap<>(); fields.put(UspVaV1Field.VERSION, new EncodableFixedInteger(6, UspVaV1.VERSION)); - fields.put(UspVaV1Field.SHARING_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspVaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2)); - fields.put(UspVaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2)); - fields.put(UspVaV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedInteger(8)); - fields.put(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2)); - fields.put(UspVaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2)); - fields.put(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2)); - fields.put(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2)); + fields.put(UspVaV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspVaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspVaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UspVaV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UspVaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); //@formatter:off fieldOrder = new String[] { @@ -106,15 +108,15 @@ public Integer getTargetedAdvertisingOptOut() { } @SuppressWarnings("unchecked") - public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspVaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UspVaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); } public Integer getKnownChildSensitiveDataConsents() { return (Integer) this.fields.get(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); } - public Integer getMspaCoveredtransaction() { + public Integer getMspaCoveredTransaction() { return (Integer) this.fields.get(UspVaV1Field.MSPA_COVERED_TRANSACTION).getValue(); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 247736f4..3c2553e1 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -395,6 +395,6 @@ public void testDecodeUspv1AndTcfEuV2AndTcfCaV2() throws DecodingException { Assertions.assertEquals("EN", tcfCaV2Section.getConsentLanguage()); Assertions.assertEquals(5, tcfCaV2Section.getId()); - Assertions.assertEquals(3, tcfCaV2Section.getSegmentType()); + Assertions.assertEquals(3, tcfCaV2Section.getPubPurposesSegmentType()); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfieldTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java similarity index 90% rename from iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfieldTest.java rename to iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java index e57e292b..48c5e669 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfieldTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java @@ -3,7 +3,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -class EncodableFixedBitfieldTest { +class EncodableFixedIntegerListTest { @Test void testSubstring1() { diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java new file mode 100644 index 00000000..6faf52be --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java @@ -0,0 +1,216 @@ +package com.iab.gpp.encoder.datatype.encoder; + +import java.util.ArrayList; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; + +class FixedIntegerListEncoderTest { + + @Test + void testEncode1() throws EncodingException { + Assertions.assertEquals("0000", FixedIntegerListEncoder.encode(new ArrayList<>(), 2, 2)); + } + + @Test + void testEncode2() throws EncodingException { + Assertions.assertEquals("0000", FixedIntegerListEncoder.encode(Arrays.asList(0), 2, 2)); + } + + @Test + void testEncode3() throws EncodingException { + Assertions.assertEquals("0000", FixedIntegerListEncoder.encode(Arrays.asList(0, 0), 2, 2)); + } + + @Test + void testEncode4() throws EncodingException { + Assertions.assertEquals("0001", FixedIntegerListEncoder.encode(Arrays.asList(0, 1), 2, 2)); + } + + @Test + void testEncode5() throws EncodingException { + Assertions.assertEquals("0010", FixedIntegerListEncoder.encode(Arrays.asList(0, 2), 2, 2)); + } + + @Test + void testEncode6() throws EncodingException { + Assertions.assertEquals("0011", FixedIntegerListEncoder.encode(Arrays.asList(0, 3), 2, 2)); + } + + @Test + void testEncode7() throws EncodingException { + Assertions.assertEquals("0100", FixedIntegerListEncoder.encode(Arrays.asList(1, 0), 2, 2)); + } + + @Test + void testEncode8() throws EncodingException { + Assertions.assertEquals("0101", FixedIntegerListEncoder.encode(Arrays.asList(1, 1), 2, 2)); + } + + @Test + void testEncode9() throws EncodingException { + Assertions.assertEquals("0110", FixedIntegerListEncoder.encode(Arrays.asList(1, 2), 2, 2)); + } + + @Test + void testEncode10() throws EncodingException { + Assertions.assertEquals("0111", FixedIntegerListEncoder.encode(Arrays.asList(1, 3), 2, 2)); + } + + @Test + void testEncode11() throws EncodingException { + Assertions.assertEquals("1000", FixedIntegerListEncoder.encode(Arrays.asList(2, 0), 2, 2)); + } + + @Test + void testEncode12() throws EncodingException { + Assertions.assertEquals("1001", FixedIntegerListEncoder.encode(Arrays.asList(2, 1), 2, 2)); + } + + @Test + void testEncode13() throws EncodingException { + Assertions.assertEquals("1010", FixedIntegerListEncoder.encode(Arrays.asList(2, 2), 2, 2)); + } + + @Test + void testEncode14() throws EncodingException { + Assertions.assertEquals("1011", FixedIntegerListEncoder.encode(Arrays.asList(2, 3), 2, 2)); + } + + @Test + void testEncode15() throws EncodingException { + Assertions.assertEquals("1100", FixedIntegerListEncoder.encode(Arrays.asList(3, 0), 2, 2)); + } + + @Test + void testEncode16() throws EncodingException { + Assertions.assertEquals("1101", FixedIntegerListEncoder.encode(Arrays.asList(3, 1), 2, 2)); + } + + @Test + void testEncode17() throws EncodingException { + Assertions.assertEquals("1110", FixedIntegerListEncoder.encode(Arrays.asList(3, 2), 2, 2)); + } + + @Test + void testEncode18() throws EncodingException { + Assertions.assertEquals("1111", FixedIntegerListEncoder.encode(Arrays.asList(3, 3), 2, 2)); + } + + @Test + void testDecode1() throws DecodingException { + Assertions.assertEquals(Arrays.asList(0, 0), FixedIntegerListEncoder.decode("", 2, 2)); + } + + @Test + void testDecode2() throws DecodingException { + Assertions.assertEquals(Arrays.asList(0, 0), FixedIntegerListEncoder.decode("0000", 2, 2)); + } + + @Test + void testDecode3() throws DecodingException { + Assertions.assertEquals(Arrays.asList(0, 1), FixedIntegerListEncoder.decode("0001", 2, 2)); + } + + @Test + void testDecode4() throws DecodingException { + Assertions.assertEquals(Arrays.asList(0, 2), FixedIntegerListEncoder.decode("0010", 2, 2)); + } + + @Test + void testDecode5() throws DecodingException { + Assertions.assertEquals(Arrays.asList(0, 3), FixedIntegerListEncoder.decode("0011", 2, 2)); + } + + @Test + void testDecode6() throws DecodingException { + Assertions.assertEquals(Arrays.asList(1, 0), FixedIntegerListEncoder.decode("0100", 2, 2)); + } + + @Test + void testDecode7() throws DecodingException { + Assertions.assertEquals(Arrays.asList(1, 1), FixedIntegerListEncoder.decode("0101", 2, 2)); + } + + @Test + void testDecode8() throws DecodingException { + Assertions.assertEquals(Arrays.asList(1, 2), FixedIntegerListEncoder.decode("0110", 2, 2)); + } + + @Test + void testDecode9() throws DecodingException { + Assertions.assertEquals(Arrays.asList(1, 3), FixedIntegerListEncoder.decode("0111", 2, 2)); + } + + @Test + void testDecode10() throws DecodingException { + Assertions.assertEquals(Arrays.asList(2, 0), FixedIntegerListEncoder.decode("1000", 2, 2)); + } + + @Test + void testDecode11() throws DecodingException { + Assertions.assertEquals(Arrays.asList(2, 1), FixedIntegerListEncoder.decode("1001", 2, 2)); + } + + @Test + void testDecode12() throws DecodingException { + Assertions.assertEquals(Arrays.asList(2, 2), FixedIntegerListEncoder.decode("1010", 2, 2)); + } + + @Test + void testDecode13() throws DecodingException { + Assertions.assertEquals(Arrays.asList(2, 3), FixedIntegerListEncoder.decode("1011", 2, 2)); + } + + @Test + void testDecode14() throws DecodingException { + Assertions.assertEquals(Arrays.asList(3, 0), FixedIntegerListEncoder.decode("1100", 2, 2)); + } + + @Test + void testDecode15() throws DecodingException { + Assertions.assertEquals(Arrays.asList(3, 1), FixedIntegerListEncoder.decode("1101", 2, 2)); + } + + @Test + void testDecode16() throws DecodingException { + Assertions.assertEquals(Arrays.asList(3, 2), FixedIntegerListEncoder.decode("1110", 2, 2)); + } + + @Test + void testDecode17() throws DecodingException { + Assertions.assertEquals(Arrays.asList(3, 3), FixedIntegerListEncoder.decode("1111", 2, 2)); + } + + @Test + void testDecode18() { + try { + FixedIntegerListEncoder.decode("111111", 2, 2); + Assertions.fail("DecodingException expected"); + } catch (DecodingException e) { + + } + } + + @Test + void testDecode19() { + try { + FixedIntegerListEncoder.decode("2", 2, 2); + Assertions.fail("DecodingException expected"); + } catch (DecodingException e) { + + } + } + + @Test + void testDecode20() { + try { + FixedIntegerListEncoder.decode("111", 2, 2); + Assertions.fail("DecodingException expected"); + } catch (DecodingException e) { + + } + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java index a80c640a..7d2dacca 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java @@ -92,7 +92,7 @@ public void testDecode1() throws DecodingException { Assertions.assertEquals("EN", tcfCaV2.getConsentLanguage()); Assertions.assertEquals(5, tcfCaV2.getId()); - Assertions.assertEquals(3, tcfCaV2.getSegmentType()); + Assertions.assertEquals(3, tcfCaV2.getPubPurposesSegmentType()); } @Test @@ -131,6 +131,6 @@ public void testDecode2() throws DecodingException { Assertions.assertEquals("EN", tcfCaV2.getConsentLanguage()); Assertions.assertEquals(5, tcfCaV2.getId()); - Assertions.assertEquals(3, tcfCaV2.getSegmentType()); + Assertions.assertEquals(3, tcfCaV2.getPubPurposesSegmentType()); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java new file mode 100644 index 00000000..db05369a --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java @@ -0,0 +1,57 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspCaV1Field; + +public class UspCaV1Test { + + @Test + public void testEncode1() throws EncodingException { + + UspCaV1 uspCaV1 = new UspCaV1(); + Assertions.assertEquals("BAAAAAAAAAAAAAAAAAA.IA", uspCaV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException { + UspCaV1 uspCaV1 = new UspCaV1(); + + uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT_NOTICE, 1); + uspCaV1.setFieldValue(UspCaV1Field.SHARING_OPT_OUT_NOTICE, 2); + uspCaV1.setFieldValue(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); + uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT, 1); + uspCaV1.setFieldValue(UspCaV1Field.SHARING_OPT_OUT, 2); + uspCaV1.setFieldValue(UspCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0)); + uspCaV1.setFieldValue(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 1)); + uspCaV1.setFieldValue(UspCaV1Field.PERSONAL_DATA_CONSENTS, Arrays.asList(2, 3)); + uspCaV1.setFieldValue(UspCaV1Field.MSPA_COVERED_TRANSACTION, 3); + uspCaV1.setFieldValue(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + uspCaV1.setFieldValue(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + uspCaV1.setFieldValue(UspCaV1Field.GPC, true); + + Assertions.assertEquals("BbYAAEBAMAAEBAMADew.MA", uspCaV1.encode()); + } + + @Test + public void testDecodde1() throws DecodingException { + UspCaV1 uspCaV1 = new UspCaV1("BbYAAEBAMAAEBAMADew.MA"); + + Assertions.assertEquals(1, uspCaV1.getSaleOptOutNotice()); + Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); + Assertions.assertEquals(3, uspCaV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, uspCaV1.getSaleOptOut()); + Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0), uspCaV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(0, 1), uspCaV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(Arrays.asList(2, 3), uspCaV1.getPersonalDataConsents()); + Assertions.assertEquals(3, uspCaV1.getMspaCoveredTransaction()); + Assertions.assertEquals(1, uspCaV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, uspCaV1.getMspaServiceProviderMode()); + Assertions.assertEquals(true, uspCaV1.getGpc()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java new file mode 100644 index 00000000..4d0d9a0b --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java @@ -0,0 +1,54 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspCoV1Field; + +public class UspCoV1Test { + + @Test + public void testEncode1() throws EncodingException { + UspCoV1 uspCoV1 = new UspCoV1(); + Assertions.assertEquals("BAAAAAA.IA", uspCoV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException { + UspCoV1 uspCoV1 = new UspCoV1(); + + uspCoV1.setFieldValue(UspCoV1Field.SHARING_NOTICE, 1); + uspCoV1.setFieldValue(UspCoV1Field.SALE_OPT_OUT_NOTICE, 2); + uspCoV1.setFieldValue(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + uspCoV1.setFieldValue(UspCoV1Field.SALE_OPT_OUT, 1); + uspCoV1.setFieldValue(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + uspCoV1.setFieldValue(UspCoV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2)); + uspCoV1.setFieldValue(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + uspCoV1.setFieldValue(UspCoV1Field.MSPA_COVERED_TRANSACTION, 1); + uspCoV1.setFieldValue(UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + uspCoV1.setFieldValue(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + uspCoV1.setFieldValue(UspCoV1Field.GPC, true); + + Assertions.assertEquals("BbYbG2w.MA", uspCoV1.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UspCoV1 uspCoV1 = new UspCoV1("BbYbG2w.MA"); + + Assertions.assertEquals(1, uspCoV1.getSharingNotice()); + Assertions.assertEquals(2, uspCoV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspCoV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, uspCoV1.getSaleOptOut()); + Assertions.assertEquals(2, uspCoV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2), uspCoV1.getSensitiveDataProcessing()); + Assertions.assertEquals(3, uspCoV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspCoV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspCoV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspCoV1.getMspaServiceProviderMode()); + Assertions.assertEquals(true, uspCoV1.getGpc()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java new file mode 100644 index 00000000..f6f146a0 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java @@ -0,0 +1,54 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspCtV1Field; + +public class UspCtV1Test { + + @Test + public void testEncode1() throws EncodingException { + UspCtV1 uspCtV1 = new UspCtV1(); + Assertions.assertEquals("BAAAAAAA.IA", uspCtV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException { + UspCtV1 uspCtV1 = new UspCtV1(); + + uspCtV1.setFieldValue(UspCtV1Field.SHARING_NOTICE, 1); + uspCtV1.setFieldValue(UspCtV1Field.SALE_OPT_OUT_NOTICE, 2); + uspCtV1.setFieldValue(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + uspCtV1.setFieldValue(UspCtV1Field.SALE_OPT_OUT, 1); + uspCtV1.setFieldValue(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + uspCtV1.setFieldValue(UspCtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); + uspCtV1.setFieldValue(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); + uspCtV1.setFieldValue(UspCtV1Field.MSPA_COVERED_TRANSACTION, 1); + uspCtV1.setFieldValue(UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + uspCtV1.setFieldValue(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + uspCtV1.setFieldValue(UspCtV1Field.GPC, true); + + Assertions.assertEquals("BbYbG22w.MA", uspCtV1.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UspCtV1 uspCtV1 = new UspCtV1("BbYbG22w.MA"); + + Assertions.assertEquals(1, uspCtV1.getSharingNotice()); + Assertions.assertEquals(2, uspCtV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspCtV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, uspCtV1.getSaleOptOut()); + Assertions.assertEquals(2, uspCtV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspCtV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(1, 2, 3), uspCtV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspCtV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspCtV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspCtV1.getMspaServiceProviderMode()); + Assertions.assertEquals(true, uspCtV1.getGpc()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java new file mode 100644 index 00000000..eb9a4b83 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java @@ -0,0 +1,65 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspNatV1Field; + +public class UspNatV1Test { + + @Test + public void testEncode1() throws EncodingException { + + UspNatV1 uspNatV1 = new UspNatV1(); + Assertions.assertEquals("BAAAAAAAAAA.IA", uspNatV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException { + UspNatV1 uspNatV1 = new UspNatV1(); + + uspNatV1.setFieldValue(UspNatV1Field.SHARING_NOTICE, 1); + uspNatV1.setFieldValue(UspNatV1Field.SALE_OPT_OUT_NOTICE, 2); + uspNatV1.setFieldValue(UspNatV1Field.SHARING_OPT_OUT_NOTICE, 3); + uspNatV1.setFieldValue(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 2); + uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); + uspNatV1.setFieldValue(UspNatV1Field.SALE_OPT_OUT, 1); + uspNatV1.setFieldValue(UspNatV1Field.SHARING_OPT_OUT, 2); + uspNatV1.setFieldValue(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); + uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3)); + uspNatV1.setFieldValue(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 1)); + uspNatV1.setFieldValue(UspNatV1Field.PERSONAL_DATA_CONSENTS, Arrays.asList(2, 3)); + uspNatV1.setFieldValue(UspNatV1Field.MSPA_COVERED_TRANSACTION, 1); + uspNatV1.setFieldValue(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + uspNatV1.setFieldValue(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + uspNatV1.setFieldValue(UspNatV1Field.GPC, true); + + Assertions.assertEquals("BbbbGxsbG2w.MA", uspNatV1.encode()); + } + + @Test + public void testDecodde1() throws DecodingException { + UspNatV1 uspNatV1 = new UspNatV1("BbbbGxsbG2w.MA"); + + Assertions.assertEquals(1, uspNatV1.getSharingNotice()); + Assertions.assertEquals(2, uspNatV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspNatV1.getSharingOptOutNotice()); + Assertions.assertEquals(1, uspNatV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(2, uspNatV1.getSensitiveDataProcessingOptOutNotice()); + Assertions.assertEquals(3, uspNatV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, uspNatV1.getSaleOptOut()); + Assertions.assertEquals(2, uspNatV1.getSharingOptOut()); + Assertions.assertEquals(3, uspNatV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3), uspNatV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(0, 1), uspNatV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(Arrays.asList(2, 3), uspNatV1.getPersonalDataConsents()); + Assertions.assertEquals(1, uspNatV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspNatV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspNatV1.getMspaServiceProviderMode()); + Assertions.assertEquals(true, uspNatV1.getGpc()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java new file mode 100644 index 00000000..e7962f94 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java @@ -0,0 +1,53 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspUtV1Field; + +public class UspUtV1Test { + + @Test + public void testEncode1() throws EncodingException { + UspUtV1 uspUtV1 = new UspUtV1(); + Assertions.assertEquals("BAAAAAAA", uspUtV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException { + UspUtV1 uspUtV1 = new UspUtV1(); + + uspUtV1.setFieldValue(UspUtV1Field.SHARING_NOTICE, 1); + uspUtV1.setFieldValue(UspUtV1Field.SALE_OPT_OUT_NOTICE, 2); + uspUtV1.setFieldValue(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + uspUtV1.setFieldValue(UspUtV1Field.SALE_OPT_OUT, 1); + uspUtV1.setFieldValue(UspUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); + uspUtV1.setFieldValue(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + uspUtV1.setFieldValue(UspUtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); + uspUtV1.setFieldValue(UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + uspUtV1.setFieldValue(UspUtV1Field.MSPA_COVERED_TRANSACTION, 1); + uspUtV1.setFieldValue(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + uspUtV1.setFieldValue(UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + + Assertions.assertEquals("BbWGxvbA", uspUtV1.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UspUtV1 uspUtV1 = new UspUtV1("BbWGxvbA"); + + Assertions.assertEquals(1, uspUtV1.getSharingNotice()); + Assertions.assertEquals(2, uspUtV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspUtV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, uspUtV1.getSaleOptOut()); + Assertions.assertEquals(2, uspUtV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspUtV1.getSensitiveDataProcessing()); + Assertions.assertEquals(3, uspUtV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspUtV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspUtV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspUtV1.getMspaServiceProviderMode()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java new file mode 100644 index 00000000..54d2d8e4 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java @@ -0,0 +1,52 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspVaV1Field; + +public class UspVaV1Test { + + @Test + public void testEncode1() throws EncodingException { + UspVaV1 uspVaV1 = new UspVaV1(); + Assertions.assertEquals("BAAAAAA", uspVaV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException { + UspVaV1 uspVaV1 = new UspVaV1(); + + uspVaV1.setFieldValue(UspVaV1Field.SHARING_NOTICE, 1); + uspVaV1.setFieldValue(UspVaV1Field.SALE_OPT_OUT_NOTICE, 2); + uspVaV1.setFieldValue(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + uspVaV1.setFieldValue(UspVaV1Field.SALE_OPT_OUT, 1); + uspVaV1.setFieldValue(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + uspVaV1.setFieldValue(UspVaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); + uspVaV1.setFieldValue(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + uspVaV1.setFieldValue(UspVaV1Field.MSPA_COVERED_TRANSACTION, 1); + uspVaV1.setFieldValue(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + uspVaV1.setFieldValue(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + + Assertions.assertEquals("BbYbG9s", uspVaV1.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UspVaV1 uspVaV1 = new UspVaV1("BbYbG9s"); + + Assertions.assertEquals(1, uspVaV1.getSharingNotice()); + Assertions.assertEquals(2, uspVaV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspVaV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, uspVaV1.getSaleOptOut()); + Assertions.assertEquals(2, uspVaV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspVaV1.getSensitiveDataProcessing()); + Assertions.assertEquals(3, uspVaV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspVaV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspVaV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspVaV1.getMspaServiceProviderMode()); + } +} From 331b0d474a0f61e5074522ed9b9296d373741ef2 Mon Sep 17 00:00:00 2001 From: chad Date: Wed, 9 Nov 2022 21:48:32 -0700 Subject: [PATCH 03/41] unit tests --- .../com/iab/gpp/encoder/GppModelTest.java | 2 +- .../datatype/EncodableBooleanTest.java | 6 +- .../datatype/EncodableDatetimeTest.java | 6 +- .../EncodableFibonacciIntegerRangeTest.java | 4 +- .../EncodableFibonacciIntegerTest.java | 4 +- .../EncodableFixedIntegerListTest.java | 6 +- .../EncodableFixedIntegerRangeTest.java | 4 +- .../datatype/EncodableFixedIntegerTest.java | 6 +- .../datatype/EncodableFixedStringTest.java | 6 +- .../encoder/Base64UrlEncoderTest.java | 14 ++-- .../datatype/encoder/BooleanEncoderTest.java | 20 ++--- .../datatype/encoder/DatetimeEncoderTest.java | 4 +- .../encoder/FibonacciIntegerEncoderTest.java | 36 ++++----- .../FibonacciIntegerRangeEncoderTest.java | 28 +++---- .../encoder/FixedBitfieldEncoderTest.java | 32 ++++---- .../encoder/FixedIntegerEncoderTest.java | 26 +++---- .../encoder/FixedIntegerListEncoderTest.java | 78 +++++++++---------- .../encoder/FixedIntegerRangeEncoderTest.java | 28 +++---- .../encoder/FixedLongEncoderTest.java | 30 +++---- .../encoder/FixedStringEncoderTest.java | 14 ++-- .../iab/gpp/encoder/section/HeaderV1Test.java | 2 +- 21 files changed, 178 insertions(+), 178 deletions(-) diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 3c2553e1..4a37d2f9 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -15,7 +15,7 @@ import com.iab.gpp.encoder.section.TcfEuV2; import com.iab.gpp.encoder.section.UspV1; -class GppModelTest { +public class GppModelTest { private ZonedDateTime utcDateTime = ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableBooleanTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableBooleanTest.java index c6b7ab45..3ea44dbb 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableBooleanTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableBooleanTest.java @@ -3,16 +3,16 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -class EncodableBooleanTest { +public class EncodableBooleanTest { @Test - void testSubstring1() { + public void testSubstring1() { Assertions.assertEquals("000000000000000000000000000000000000", new EncodableDatetime().substring("10000000000000000000000000000000000001", 1)); } @Test - void testSubstring2() { + public void testSubstring2() { Assertions.assertEquals("111111111111111111111111111111111111", new EncodableDatetime().substring("01111111111111111111111111111111111110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableDatetimeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableDatetimeTest.java index a607bd6f..d7a6a759 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableDatetimeTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableDatetimeTest.java @@ -4,16 +4,16 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -class EncodableDatetimeTest { +public class EncodableDatetimeTest { @Test - void testSubstring1() throws DecodingException { + public void testSubstring1() throws DecodingException { Assertions.assertEquals("000000000000000000000000000000000000", new EncodableDatetime().substring("10000000000000000000000000000000000001", 1)); } @Test - void testSubstring2() throws DecodingException { + public void testSubstring2() throws DecodingException { Assertions.assertEquals("111111111111111111111111111111111111", new EncodableDatetime().substring("01111111111111111111111111111111111110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRangeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRangeTest.java index c99ed18e..faac8ddc 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRangeTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRangeTest.java @@ -4,10 +4,10 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -class EncodableFibonacciIntegerRangeTest { +public class EncodableFibonacciIntegerRangeTest { @Test - void testSubstring1() throws DecodingException { + public void testSubstring1() throws DecodingException { Assertions.assertEquals("0000000000100001110110011", new EncodableFibonacciIntegerRange().substring("100000000001000011101100110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerTest.java index b78d4a12..bb982c7f 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerTest.java @@ -4,10 +4,10 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -class EncodableFibonacciIntegerTest { +public class EncodableFibonacciIntegerTest { @Test - void testSubstring1() throws DecodingException { + public void testSubstring1() throws DecodingException { Assertions.assertEquals("0011", new EncodableFibonacciInteger().substring("100111", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java index 48c5e669..3969cd48 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java @@ -3,15 +3,15 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -class EncodableFixedIntegerListTest { +public class EncodableFixedIntegerListTest { @Test - void testSubstring1() { + public void testSubstring1() { Assertions.assertEquals("000", new EncodableFixedBitfield(3).substring("10001", 1)); } @Test - void testSubstring2() { + public void testSubstring2() { Assertions.assertEquals("111", new EncodableFixedBitfield(3).substring("01110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java index e9c6dcf2..51d71a2f 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java @@ -4,10 +4,10 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -class EncodableFixedIntegerRangeTest { +public class EncodableFixedIntegerRangeTest { @Test - void testSubstring1() throws DecodingException { + public void testSubstring1() throws DecodingException { Assertions.assertEquals("00000000001000000000000000011100000000000001010000000000001000", new EncodableFixedIntegerRange().substring("1000000000010000000000000000111000000000000010100000000000010001", 1)); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerTest.java index a39987a9..1236da01 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerTest.java @@ -3,15 +3,15 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -class EncodableFixedIntegerTest { +public class EncodableFixedIntegerTest { @Test - void testSubstring1() { + public void testSubstring1() { Assertions.assertEquals("000", new EncodableFixedInteger(3).substring("10001", 1)); } @Test - void testSubstring2() { + public void testSubstring2() { Assertions.assertEquals("111", new EncodableFixedInteger(3).substring("01110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedStringTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedStringTest.java index 8305f9c4..a9014d8e 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedStringTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedStringTest.java @@ -3,15 +3,15 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -class EncodableFixedStringTest { +public class EncodableFixedStringTest { @Test - void testSubstring1() { + public void testSubstring1() { Assertions.assertEquals("000000000000", new EncodableFixedString(2).substring("10000000000001", 1)); } @Test - void testSubstring2() { + public void testSubstring2() { Assertions.assertEquals("111111111111", new EncodableFixedString(2).substring("01111111111110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java index 5f2f8b9f..50640349 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java @@ -5,35 +5,35 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -class Base64UrlEncoderTest { +public class Base64UrlEncoderTest { @Test - void testEncode1() throws EncodingException { + public void testEncode1() throws EncodingException { Assertions.assertEquals("DBABMA", Base64UrlEncoder.encode("0000110000010000000000010011")); } @Test - void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException { Assertions.assertEquals("DBACNYA", Base64UrlEncoder.encode("000011000001000000000010001101011")); } @Test - void testEncode3() throws EncodingException { + public void testEncode3() throws EncodingException { Assertions.assertEquals("DBABjw", Base64UrlEncoder.encode("00001100000100000000000110001111")); } @Test - void testDecode1() throws DecodingException { + public void testDecode1() throws DecodingException { Assertions.assertEquals("000011000001000000000001001100000000", Base64UrlEncoder.decode("DBABMA")); } @Test - void testDecode2() throws DecodingException { + public void testDecode2() throws DecodingException { Assertions.assertEquals("000011000001000000000010001101011000000000", Base64UrlEncoder.decode("DBACNYA")); } @Test - void testDecode3() throws DecodingException { + public void testDecode3() throws DecodingException { Assertions.assertEquals("000011000001000000000001100011110000", Base64UrlEncoder.decode("DBABjw")); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoderTest.java index e7af9742..3d1450f5 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoderTest.java @@ -5,30 +5,30 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -class BooleanEncoderTest { +public class BooleanEncoderTest { @Test - void testEncode1() throws EncodingException { + public void testEncode1() throws EncodingException { Assertions.assertEquals("0", BooleanEncoder.encode(false)); } @Test - void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException { Assertions.assertEquals("1", BooleanEncoder.encode(true)); } @Test - void testDecode1() throws DecodingException { + public void testDecode1() throws DecodingException { Assertions.assertEquals(false, BooleanEncoder.decode("0")); } @Test - void testDecode2() throws DecodingException { + public void testDecode2() throws DecodingException { Assertions.assertEquals(true, BooleanEncoder.decode("1")); } @Test - void testDecode3() { + public void testDecode3() { try { BooleanEncoder.decode(""); Assertions.fail("DecodingException expected"); @@ -38,7 +38,7 @@ void testDecode3() { } @Test - void testDecode4() { + public void testDecode4() { try { BooleanEncoder.decode("2"); Assertions.fail("DecodingException expected"); @@ -48,7 +48,7 @@ void testDecode4() { } @Test - void testDecode5() { + public void testDecode5() { try { BooleanEncoder.decode("00"); Assertions.fail("DecodingException expected"); @@ -58,7 +58,7 @@ void testDecode5() { } @Test - void testDecode6() { + public void testDecode6() { try { BooleanEncoder.decode("01"); Assertions.fail("DecodingException expected"); @@ -68,7 +68,7 @@ void testDecode6() { } @Test - void testDecode7() { + public void testDecode7() { try { BooleanEncoder.decode("10"); Assertions.fail("DecodingException expected"); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/DatetimeEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/DatetimeEncoderTest.java index ec67d019..ec75a122 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/DatetimeEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/DatetimeEncoderTest.java @@ -6,10 +6,10 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -class DatetimeEncoderTest { +public class DatetimeEncoderTest { @Test - void test1() throws DecodingException { + public void test1() throws DecodingException { ZonedDateTime date1 = ZonedDateTime.now(ZoneId.of("UTC")); String encodedDate1 = DatetimeEncoder.encode(date1); ZonedDateTime date2 = DatetimeEncoder.decode(encodedDate1); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerEncoderTest.java index b951c7d3..2948b035 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerEncoderTest.java @@ -4,74 +4,74 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -class FibonacciIntegerEncoderTest { +public class FibonacciIntegerEncoderTest { @Test - void testEncode1() { + public void testEncode1() { Assertions.assertEquals("11", FibonacciIntegerEncoder.encode(1)); } - void testEncode2() { + public void testEncode2() { Assertions.assertEquals("011", FibonacciIntegerEncoder.encode(2)); } - void testEncode3() { + public void testEncode3() { Assertions.assertEquals("0011", FibonacciIntegerEncoder.encode(3)); } - void testEncode4() { + public void testEncode4() { Assertions.assertEquals("1011", FibonacciIntegerEncoder.encode(4)); } - void testEncode5() { + public void testEncode5() { Assertions.assertEquals("00011", FibonacciIntegerEncoder.encode(5)); } - void testEncode6() { + public void testEncode6() { Assertions.assertEquals("10011", FibonacciIntegerEncoder.encode(6)); } - void testEncode7() { + public void testEncode7() { Assertions.assertEquals("01011", FibonacciIntegerEncoder.encode(7)); } @Test - void testDecode1() throws DecodingException { + public void testDecode1() throws DecodingException { Assertions.assertEquals(1, FibonacciIntegerEncoder.decode("11")); } @Test - void testDecode2() throws DecodingException { + public void testDecode2() throws DecodingException { Assertions.assertEquals(2, FibonacciIntegerEncoder.decode("011")); } @Test - void testDecode3() throws DecodingException { + public void testDecode3() throws DecodingException { Assertions.assertEquals(3, FibonacciIntegerEncoder.decode("0011")); } @Test - void testDecode4() throws DecodingException { + public void testDecode4() throws DecodingException { Assertions.assertEquals(4, FibonacciIntegerEncoder.decode("1011")); } @Test - void testDecode5() throws DecodingException { + public void testDecode5() throws DecodingException { Assertions.assertEquals(5, FibonacciIntegerEncoder.decode("00011")); } @Test - void testDecode6() throws DecodingException { + public void testDecode6() throws DecodingException { Assertions.assertEquals(6, FibonacciIntegerEncoder.decode("10011")); } @Test - void testDecode7() throws DecodingException { + public void testDecode7() throws DecodingException { Assertions.assertEquals(7, FibonacciIntegerEncoder.decode("01011")); } @Test - void testDecode8() { + public void testDecode8() { try { FibonacciIntegerEncoder.decode("110"); Assertions.fail("DecodingException expected"); @@ -81,7 +81,7 @@ void testDecode8() { } @Test - void testDecode9() { + public void testDecode9() { try { FibonacciIntegerEncoder.decode("1100"); Assertions.fail("DecodingException expected"); @@ -91,7 +91,7 @@ void testDecode9() { } @Test - void testDecode10() { + public void testDecode10() { try { FibonacciIntegerEncoder.decode("0110000000"); Assertions.fail("DecodingException expected"); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java index 55cfc97b..4a7a6c76 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java @@ -6,67 +6,67 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -class FibonacciIntegerRangeEncoderTest { +public class FibonacciIntegerRangeEncoderTest { @Test - void testEncode1() { + public void testEncode1() { Assertions.assertEquals("000000000000", FibonacciIntegerRangeEncoder.encode(new ArrayList<>())); } @Test - void testEncode2() { + public void testEncode2() { Assertions.assertEquals("0000000000010011", FibonacciIntegerRangeEncoder.encode(Arrays.asList(2))); } @Test - void testEncode3() { + public void testEncode3() { Assertions.assertEquals("00000000000110111011", FibonacciIntegerRangeEncoder.encode(Arrays.asList(2, 3, 4, 5, 6))); } @Test - void testEncode4() { + public void testEncode4() { Assertions.assertEquals("000000000010001110011011", FibonacciIntegerRangeEncoder.encode(Arrays.asList(2, 5, 6, 7))); } @Test - void testEncode5() { + public void testEncode5() { Assertions.assertEquals("000000000010001110011011", FibonacciIntegerRangeEncoder.encode(Arrays.asList(6, 7, 2, 5))); } @Test - void testEncode6() { + public void testEncode6() { Assertions.assertEquals("0000000000100001110110011", FibonacciIntegerRangeEncoder.encode(Arrays.asList(3, 5, 6, 7, 8))); } @Test - void testDecode1() throws DecodingException { + public void testDecode1() throws DecodingException { Assertions.assertEquals(new ArrayList<>(), FibonacciIntegerRangeEncoder.decode("000000000000")); } @Test - void testDecode2() throws DecodingException { + public void testDecode2() throws DecodingException { Assertions.assertEquals(Arrays.asList(2), FibonacciIntegerRangeEncoder.decode("0000000000010011")); } @Test - void testDecode3() throws DecodingException { + public void testDecode3() throws DecodingException { Assertions.assertEquals(Arrays.asList(2, 3, 4, 5, 6), FibonacciIntegerRangeEncoder.decode("00000000000110111011")); } @Test - void testDecode4() throws DecodingException { + public void testDecode4() throws DecodingException { Assertions.assertEquals(Arrays.asList(2, 5, 6, 7), FibonacciIntegerRangeEncoder.decode("000000000010001110011011")); } @Test - void testDecode5() throws DecodingException { + public void testDecode5() throws DecodingException { Assertions.assertEquals(Arrays.asList(3, 5, 6, 7, 8), FibonacciIntegerRangeEncoder.decode("0000000000100001110110011")); } @Test - void testDecode6() { + public void testDecode6() { try { FibonacciIntegerRangeEncoder.decode("0011"); Assertions.fail("DecodingException expected"); @@ -76,7 +76,7 @@ void testDecode6() { } @Test - void testDecode7() { + public void testDecode7() { try { FibonacciIntegerRangeEncoder.decode("000000000002"); Assertions.fail("DecodingException expected"); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java index 8714e273..77b5c9cf 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java @@ -7,80 +7,80 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -class FixedBitfieldEncoderTest { +public class FixedBitfieldEncoderTest { @Test - void testEncode1() throws EncodingException { + public void testEncode1() throws EncodingException { Assertions.assertEquals("00", FixedBitfieldEncoder.encode(new ArrayList<>(), 2)); } @Test - void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException { Assertions.assertEquals("0", FixedBitfieldEncoder.encode(Arrays.asList(false), 1)); } @Test - void testEncode3() throws EncodingException { + public void testEncode3() throws EncodingException { Assertions.assertEquals("1", FixedBitfieldEncoder.encode(Arrays.asList(true), 1)); } @Test - void testEncode4() throws EncodingException { + public void testEncode4() throws EncodingException { Assertions.assertEquals("00", FixedBitfieldEncoder.encode(Arrays.asList(false, false), 2)); } @Test - void testEncode5() throws EncodingException { + public void testEncode5() throws EncodingException { Assertions.assertEquals("01", FixedBitfieldEncoder.encode(Arrays.asList(false, true), 2)); } @Test - void testEncode6() throws EncodingException { + public void testEncode6() throws EncodingException { Assertions.assertEquals("10", FixedBitfieldEncoder.encode(Arrays.asList(true, false), 2)); } @Test - void testEncode7() throws EncodingException { + public void testEncode7() throws EncodingException { Assertions.assertEquals("11", FixedBitfieldEncoder.encode(Arrays.asList(true, true), 2)); } @Test - void testDecode1() throws DecodingException { + public void testDecode1() throws DecodingException { Assertions.assertEquals(new ArrayList<>(), FixedBitfieldEncoder.decode("")); } @Test - void testDecode2() throws DecodingException { + public void testDecode2() throws DecodingException { Assertions.assertEquals(Arrays.asList(false), FixedBitfieldEncoder.decode("0")); } @Test - void testDecode3() throws DecodingException { + public void testDecode3() throws DecodingException { Assertions.assertEquals(Arrays.asList(true), FixedBitfieldEncoder.decode("1")); } @Test - void testDecode4() throws DecodingException { + public void testDecode4() throws DecodingException { Assertions.assertEquals(Arrays.asList(false, false), FixedBitfieldEncoder.decode("00")); } @Test - void testDecode5() throws DecodingException { + public void testDecode5() throws DecodingException { Assertions.assertEquals(Arrays.asList(false, true), FixedBitfieldEncoder.decode("01")); } @Test - void testDecode6() throws DecodingException { + public void testDecode6() throws DecodingException { Assertions.assertEquals(Arrays.asList(true, false), FixedBitfieldEncoder.decode("10")); } @Test - void testDecode7() throws DecodingException { + public void testDecode7() throws DecodingException { Assertions.assertEquals(Arrays.asList(true, true), FixedBitfieldEncoder.decode("11")); } @Test - void testDecode8() { + public void testDecode8() { try { FixedBitfieldEncoder.decode("2"); Assertions.fail("DecodingException expected"); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoderTest.java index 77069188..cc8cc48b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoderTest.java @@ -4,65 +4,65 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -class FixedIntegerEncoderTest { +public class FixedIntegerEncoderTest { @Test - void testEncode1() { + public void testEncode1() { Assertions.assertEquals("0", FixedIntegerEncoder.encode(0, 1)); } @Test - void testEncode2() { + public void testEncode2() { Assertions.assertEquals("000000", FixedIntegerEncoder.encode(0, 6)); } @Test - void testEncode3() { + public void testEncode3() { Assertions.assertEquals("1", FixedIntegerEncoder.encode(1, 1)); } @Test - void testEncode4() { + public void testEncode4() { Assertions.assertEquals("0001", FixedIntegerEncoder.encode(1, 4)); } @Test - void testEncode5() { + public void testEncode5() { Assertions.assertEquals("00000111", FixedIntegerEncoder.encode(7, 8)); } @Test - void testDecode1() throws DecodingException { + public void testDecode1() throws DecodingException { Assertions.assertEquals(0, FixedIntegerEncoder.decode("")); } @Test - void testDecode2() throws DecodingException { + public void testDecode2() throws DecodingException { Assertions.assertEquals(0, FixedIntegerEncoder.decode("0")); } @Test - void testDecode3() throws DecodingException { + public void testDecode3() throws DecodingException { Assertions.assertEquals(0, FixedIntegerEncoder.decode("000000")); } @Test - void testDecode4() throws DecodingException { + public void testDecode4() throws DecodingException { Assertions.assertEquals(1, FixedIntegerEncoder.decode("1")); } @Test - void testDecode5() throws DecodingException { + public void testDecode5() throws DecodingException { Assertions.assertEquals(1, FixedIntegerEncoder.decode("000001")); } @Test - void testDecode6() throws DecodingException { + public void testDecode6() throws DecodingException { Assertions.assertEquals(8, FixedIntegerEncoder.decode("1000")); } @Test - void testDecode7() throws DecodingException { + public void testDecode7() throws DecodingException { Assertions.assertEquals(8, FixedIntegerEncoder.decode("0000001000")); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java index 6faf52be..58651d5d 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java @@ -7,185 +7,185 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -class FixedIntegerListEncoderTest { +public class FixedIntegerListEncoderTest { @Test - void testEncode1() throws EncodingException { + public void testEncode1() throws EncodingException { Assertions.assertEquals("0000", FixedIntegerListEncoder.encode(new ArrayList<>(), 2, 2)); } @Test - void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException { Assertions.assertEquals("0000", FixedIntegerListEncoder.encode(Arrays.asList(0), 2, 2)); } @Test - void testEncode3() throws EncodingException { + public void testEncode3() throws EncodingException { Assertions.assertEquals("0000", FixedIntegerListEncoder.encode(Arrays.asList(0, 0), 2, 2)); } @Test - void testEncode4() throws EncodingException { + public void testEncode4() throws EncodingException { Assertions.assertEquals("0001", FixedIntegerListEncoder.encode(Arrays.asList(0, 1), 2, 2)); } @Test - void testEncode5() throws EncodingException { + public void testEncode5() throws EncodingException { Assertions.assertEquals("0010", FixedIntegerListEncoder.encode(Arrays.asList(0, 2), 2, 2)); } @Test - void testEncode6() throws EncodingException { + public void testEncode6() throws EncodingException { Assertions.assertEquals("0011", FixedIntegerListEncoder.encode(Arrays.asList(0, 3), 2, 2)); } @Test - void testEncode7() throws EncodingException { + public void testEncode7() throws EncodingException { Assertions.assertEquals("0100", FixedIntegerListEncoder.encode(Arrays.asList(1, 0), 2, 2)); } @Test - void testEncode8() throws EncodingException { + public void testEncode8() throws EncodingException { Assertions.assertEquals("0101", FixedIntegerListEncoder.encode(Arrays.asList(1, 1), 2, 2)); } @Test - void testEncode9() throws EncodingException { + public void testEncode9() throws EncodingException { Assertions.assertEquals("0110", FixedIntegerListEncoder.encode(Arrays.asList(1, 2), 2, 2)); } @Test - void testEncode10() throws EncodingException { + public void testEncode10() throws EncodingException { Assertions.assertEquals("0111", FixedIntegerListEncoder.encode(Arrays.asList(1, 3), 2, 2)); } @Test - void testEncode11() throws EncodingException { + public void testEncode11() throws EncodingException { Assertions.assertEquals("1000", FixedIntegerListEncoder.encode(Arrays.asList(2, 0), 2, 2)); } @Test - void testEncode12() throws EncodingException { + public void testEncode12() throws EncodingException { Assertions.assertEquals("1001", FixedIntegerListEncoder.encode(Arrays.asList(2, 1), 2, 2)); } @Test - void testEncode13() throws EncodingException { + public void testEncode13() throws EncodingException { Assertions.assertEquals("1010", FixedIntegerListEncoder.encode(Arrays.asList(2, 2), 2, 2)); } @Test - void testEncode14() throws EncodingException { + public void testEncode14() throws EncodingException { Assertions.assertEquals("1011", FixedIntegerListEncoder.encode(Arrays.asList(2, 3), 2, 2)); } @Test - void testEncode15() throws EncodingException { + public void testEncode15() throws EncodingException { Assertions.assertEquals("1100", FixedIntegerListEncoder.encode(Arrays.asList(3, 0), 2, 2)); } @Test - void testEncode16() throws EncodingException { + public void testEncode16() throws EncodingException { Assertions.assertEquals("1101", FixedIntegerListEncoder.encode(Arrays.asList(3, 1), 2, 2)); } @Test - void testEncode17() throws EncodingException { + public void testEncode17() throws EncodingException { Assertions.assertEquals("1110", FixedIntegerListEncoder.encode(Arrays.asList(3, 2), 2, 2)); } @Test - void testEncode18() throws EncodingException { + public void testEncode18() throws EncodingException { Assertions.assertEquals("1111", FixedIntegerListEncoder.encode(Arrays.asList(3, 3), 2, 2)); } @Test - void testDecode1() throws DecodingException { + public void testDecode1() throws DecodingException { Assertions.assertEquals(Arrays.asList(0, 0), FixedIntegerListEncoder.decode("", 2, 2)); } @Test - void testDecode2() throws DecodingException { + public void testDecode2() throws DecodingException { Assertions.assertEquals(Arrays.asList(0, 0), FixedIntegerListEncoder.decode("0000", 2, 2)); } @Test - void testDecode3() throws DecodingException { + public void testDecode3() throws DecodingException { Assertions.assertEquals(Arrays.asList(0, 1), FixedIntegerListEncoder.decode("0001", 2, 2)); } @Test - void testDecode4() throws DecodingException { + public void testDecode4() throws DecodingException { Assertions.assertEquals(Arrays.asList(0, 2), FixedIntegerListEncoder.decode("0010", 2, 2)); } @Test - void testDecode5() throws DecodingException { + public void testDecode5() throws DecodingException { Assertions.assertEquals(Arrays.asList(0, 3), FixedIntegerListEncoder.decode("0011", 2, 2)); } @Test - void testDecode6() throws DecodingException { + public void testDecode6() throws DecodingException { Assertions.assertEquals(Arrays.asList(1, 0), FixedIntegerListEncoder.decode("0100", 2, 2)); } @Test - void testDecode7() throws DecodingException { + public void testDecode7() throws DecodingException { Assertions.assertEquals(Arrays.asList(1, 1), FixedIntegerListEncoder.decode("0101", 2, 2)); } @Test - void testDecode8() throws DecodingException { + public void testDecode8() throws DecodingException { Assertions.assertEquals(Arrays.asList(1, 2), FixedIntegerListEncoder.decode("0110", 2, 2)); } @Test - void testDecode9() throws DecodingException { + public void testDecode9() throws DecodingException { Assertions.assertEquals(Arrays.asList(1, 3), FixedIntegerListEncoder.decode("0111", 2, 2)); } @Test - void testDecode10() throws DecodingException { + public void testDecode10() throws DecodingException { Assertions.assertEquals(Arrays.asList(2, 0), FixedIntegerListEncoder.decode("1000", 2, 2)); } @Test - void testDecode11() throws DecodingException { + public void testDecode11() throws DecodingException { Assertions.assertEquals(Arrays.asList(2, 1), FixedIntegerListEncoder.decode("1001", 2, 2)); } @Test - void testDecode12() throws DecodingException { + public void testDecode12() throws DecodingException { Assertions.assertEquals(Arrays.asList(2, 2), FixedIntegerListEncoder.decode("1010", 2, 2)); } @Test - void testDecode13() throws DecodingException { + public void testDecode13() throws DecodingException { Assertions.assertEquals(Arrays.asList(2, 3), FixedIntegerListEncoder.decode("1011", 2, 2)); } @Test - void testDecode14() throws DecodingException { + public void testDecode14() throws DecodingException { Assertions.assertEquals(Arrays.asList(3, 0), FixedIntegerListEncoder.decode("1100", 2, 2)); } @Test - void testDecode15() throws DecodingException { + public void testDecode15() throws DecodingException { Assertions.assertEquals(Arrays.asList(3, 1), FixedIntegerListEncoder.decode("1101", 2, 2)); } @Test - void testDecode16() throws DecodingException { + public void testDecode16() throws DecodingException { Assertions.assertEquals(Arrays.asList(3, 2), FixedIntegerListEncoder.decode("1110", 2, 2)); } @Test - void testDecode17() throws DecodingException { + public void testDecode17() throws DecodingException { Assertions.assertEquals(Arrays.asList(3, 3), FixedIntegerListEncoder.decode("1111", 2, 2)); } @Test - void testDecode18() { + public void testDecode18() { try { FixedIntegerListEncoder.decode("111111", 2, 2); Assertions.fail("DecodingException expected"); @@ -195,7 +195,7 @@ void testDecode18() { } @Test - void testDecode19() { + public void testDecode19() { try { FixedIntegerListEncoder.decode("2", 2, 2); Assertions.fail("DecodingException expected"); @@ -205,7 +205,7 @@ void testDecode19() { } @Test - void testDecode20() { + public void testDecode20() { try { FixedIntegerListEncoder.decode("111", 2, 2); Assertions.fail("DecodingException expected"); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerRangeEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerRangeEncoderTest.java index 5e3a2798..8eb99b1e 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerRangeEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerRangeEncoderTest.java @@ -6,72 +6,72 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -class FixedIntegerRangeEncoderTest { +public class FixedIntegerRangeEncoderTest { @Test - void testEncode1() { + public void testEncode1() { Assertions.assertEquals("000000000000", FixedIntegerRangeEncoder.encode(new ArrayList<>())); } @Test - void testEncode2() { + public void testEncode2() { Assertions.assertEquals("00000000000100000000000000010", FixedIntegerRangeEncoder.encode(Arrays.asList(2))); } @Test - void testEncode3() { + public void testEncode3() { Assertions.assertEquals("000000000001100000000000000100000000000000110", FixedIntegerRangeEncoder.encode(Arrays.asList(2, 3, 4, 5, 6))); } @Test - void testEncode4() { + public void testEncode4() { Assertions.assertEquals("00000000001000000000000000010100000000000001010000000000000111", FixedIntegerRangeEncoder.encode(Arrays.asList(2, 5, 6, 7))); } @Test - void testEncode5() { + public void testEncode5() { Assertions.assertEquals("00000000001000000000000000010100000000000001010000000000000111", FixedIntegerRangeEncoder.encode(Arrays.asList(5, 2, 7, 6))); } @Test - void testEncode6() { + public void testEncode6() { Assertions.assertEquals("00000000001000000000000000011100000000000001010000000000001000", FixedIntegerRangeEncoder.encode(Arrays.asList(3, 5, 6, 7, 8))); } @Test - void testDecode1() throws DecodingException { + public void testDecode1() throws DecodingException { Assertions.assertEquals(new ArrayList<>(), FixedIntegerRangeEncoder.decode("000000000000")); } @Test - void testDecode2() throws DecodingException { + public void testDecode2() throws DecodingException { Assertions.assertEquals(Arrays.asList(2), FixedIntegerRangeEncoder.decode("00000000000100000000000000010")); } @Test - void testDecode3() throws DecodingException { + public void testDecode3() throws DecodingException { Assertions.assertEquals(Arrays.asList(2, 3, 4, 5, 6), FixedIntegerRangeEncoder.decode("000000000001100000000000000100000000000000110")); } @Test - void testDecode4() throws DecodingException { + public void testDecode4() throws DecodingException { Assertions.assertEquals(Arrays.asList(2, 5, 6, 7), FixedIntegerRangeEncoder.decode("00000000001000000000000000010100000000000001010000000000000111")); } @Test - void testDecode5() throws DecodingException { + public void testDecode5() throws DecodingException { Assertions.assertEquals(Arrays.asList(3, 5, 6, 7, 8), FixedIntegerRangeEncoder.decode("00000000001000000000000000011100000000000001010000000000001000")); } @Test - void testDecode6() { + public void testDecode6() { try { FixedIntegerRangeEncoder.decode("0011"); Assertions.fail("DecodingException expected"); @@ -81,7 +81,7 @@ void testDecode6() { } @Test - void testDecode7() { + public void testDecode7() { try { FixedIntegerRangeEncoder.decode("000000000002"); Assertions.fail("DecodingException expected"); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoderTest.java index 2c9a65c7..b762f314 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoderTest.java @@ -4,75 +4,75 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -class FixedLongEncoderTest { +public class FixedLongEncoderTest { @Test - void testEncode1() { + public void testEncode1() { Assertions.assertEquals("0", FixedLongEncoder.encode(0, 1)); } @Test - void testEncode2() { + public void testEncode2() { Assertions.assertEquals("000000", FixedLongEncoder.encode(0, 6)); } @Test - void testEncode3() { + public void testEncode3() { Assertions.assertEquals("1", FixedLongEncoder.encode(1, 1)); } @Test - void testEncode4() { + public void testEncode4() { Assertions.assertEquals("0001", FixedLongEncoder.encode(1, 4)); } @Test - void testEncode5() { + public void testEncode5() { Assertions.assertEquals("00000111", FixedLongEncoder.encode(7, 8)); } @Test - void testEncode6() { + public void testEncode6() { Assertions.assertEquals("001111011111010001110101111011110101", FixedLongEncoder.encode(16630898421L, 36)); } @Test - void testDecode1() throws DecodingException { + public void testDecode1() throws DecodingException { Assertions.assertEquals(0, FixedLongEncoder.decode("")); } @Test - void testDecode2() throws DecodingException { + public void testDecode2() throws DecodingException { Assertions.assertEquals(0, FixedLongEncoder.decode("0")); } @Test - void testDecode3() throws DecodingException { + public void testDecode3() throws DecodingException { Assertions.assertEquals(0, FixedLongEncoder.decode("000000")); } @Test - void testDecode4() throws DecodingException { + public void testDecode4() throws DecodingException { Assertions.assertEquals(1, FixedLongEncoder.decode("1")); } @Test - void testDecode5() throws DecodingException { + public void testDecode5() throws DecodingException { Assertions.assertEquals(1, FixedLongEncoder.decode("000001")); } @Test - void testDecode6() throws DecodingException { + public void testDecode6() throws DecodingException { Assertions.assertEquals(16630898421L, FixedLongEncoder.decode("001111011111010001110101111011110101")); } @Test - void testDecode7() throws DecodingException { + public void testDecode7() throws DecodingException { Assertions.assertEquals(8, FixedLongEncoder.decode("1000")); } @Test - void testDecode8() throws DecodingException { + public void testDecode8() throws DecodingException { Assertions.assertEquals(8, FixedLongEncoder.decode("0000001000")); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoderTest.java index 6c5be081..aba5ee84 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoderTest.java @@ -5,20 +5,20 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -class FixedStringEncoderTest { +public class FixedStringEncoderTest { @Test - void testEncode1() throws EncodingException { + public void testEncode1() throws EncodingException { Assertions.assertEquals("000000000001", FixedStringEncoder.encode("AB", 2)); } @Test - void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException { Assertions.assertEquals("100000111111", FixedStringEncoder.encode("a", 2)); } @Test - void testEncode3() { + public void testEncode3() { try { FixedStringEncoder.encode("1", 2); Assertions.fail("DecodingException expected"); @@ -28,17 +28,17 @@ void testEncode3() { } @Test - void testDecode1() throws DecodingException { + public void testDecode1() throws DecodingException { Assertions.assertEquals("AB", FixedStringEncoder.decode("000000000001")); } @Test - void testDecode2() throws DecodingException { + public void testDecode2() throws DecodingException { Assertions.assertEquals("a", FixedStringEncoder.decode("100000111111")); } @Test - void testDecode3() { + public void testDecode3() { try { FixedStringEncoder.decode("2"); Assertions.fail("DecodingException expected"); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java index 056251f6..37eae863 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java @@ -7,7 +7,7 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -class HeaderV1Test { +public class HeaderV1Test { @Test public void testEncodeToBitString1() throws EncodingException { From 55d0573a7c2fdfe00d68618e855129264794c412 Mon Sep 17 00:00:00 2001 From: chad Date: Fri, 18 Nov 2022 09:29:07 -0700 Subject: [PATCH 04/41] exposing id based methods in GppModel --- .../java/com/iab/gpp/encoder/GppModel.java | 41 +++++-- .../com/iab/gpp/encoder/section/Sections.java | 31 +++++ .../com/iab/gpp/encoder/GppModelTest.java | 109 ++++++++++++++++++ 3 files changed, 174 insertions(+), 7 deletions(-) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index c9eb5b49..61a7e0d2 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -9,6 +9,7 @@ import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.section.EncodableSection; import com.iab.gpp.encoder.section.HeaderV1; +import com.iab.gpp.encoder.section.Sections; import com.iab.gpp.encoder.section.TcfCaV2; import com.iab.gpp.encoder.section.TcfEuV2; import com.iab.gpp.encoder.section.UspCaV1; @@ -21,9 +22,7 @@ public class GppModel { private Map sections = new HashMap<>(); - private String[] sectionOrder = new String[] {TcfEuV2.NAME, TcfCaV2.NAME, UspV1.NAME, UspNatV1.NAME, UspCaV1.NAME, - UspVaV1.NAME, UspCoV1.NAME, UspUtV1.NAME, UspCtV1.NAME}; - + public GppModel() { } @@ -34,6 +33,10 @@ public GppModel(String encodedString) throws DecodingException { } } + public void setFieldValue(int sectionId, String fieldName, Object value) { + setFieldValue(Sections.SECTION_ID_NAME_MAP.get(sectionId), fieldName, value); + } + public void setFieldValue(String sectionName, String fieldName, Object value) { EncodableSection section = null; if (!this.sections.containsKey(sectionName)) { @@ -76,6 +79,10 @@ public void setFieldValue(String sectionName, String fieldName, Object value) { } } + public Object getFieldValue(int sectionId, String fieldName) { + return getFieldValue(Sections.SECTION_ID_NAME_MAP.get(sectionId), fieldName); + } + public Object getFieldValue(String sectionName, String fieldName) { if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).getFieldValue(fieldName); @@ -84,6 +91,10 @@ public Object getFieldValue(String sectionName, String fieldName) { } } + public boolean hasField(int sectionId, String fieldName) { + return hasField(Sections.SECTION_ID_NAME_MAP.get(sectionId), fieldName); + } + public boolean hasField(String sectionName, String fieldName) { if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).hasField(fieldName); @@ -92,6 +103,10 @@ public boolean hasField(String sectionName, String fieldName) { } } + public boolean hasSection(int sectionId) { + return hasSection(Sections.SECTION_ID_NAME_MAP.get(sectionId)); + } + public boolean hasSection(String sectionName) { return this.sections.containsKey(sectionName); } @@ -102,6 +117,10 @@ public HeaderV1 getHeader() { return header; } + public EncodableSection getSection(int sectionId) { + return getSection(Sections.SECTION_ID_NAME_MAP.get(sectionId)); + } + public EncodableSection getSection(String sectionName) { if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName); @@ -148,8 +167,8 @@ public UspCtV1 getUspCtV1Section() { public List getSectionIds() { List sectionIds = new ArrayList<>(); - for (int i = 0; i < this.sectionOrder.length; i++) { - String sectionName = this.sectionOrder[i]; + for (int i = 0; i < Sections.SECTION_ORDER.size(); i++) { + String sectionName = Sections.SECTION_ORDER.get(i); if (this.sections.containsKey(sectionName)) { EncodableSection section = this.sections.get(sectionName); sectionIds.add(section.getId()); @@ -161,8 +180,8 @@ public List getSectionIds() { public String encode() throws EncodingException { List encodedSections = new ArrayList<>(); List sectionIds = new ArrayList<>(); - for (int i = 0; i < this.sectionOrder.length; i++) { - String sectionName = this.sectionOrder[i]; + for (int i = 0; i < Sections.SECTION_ORDER.size(); i++) { + String sectionName = Sections.SECTION_ORDER.get(i); if (this.sections.containsKey(sectionName)) { EncodableSection section = this.sections.get(sectionName); encodedSections.add(section.encode()); @@ -219,6 +238,10 @@ public void decode(String str) throws DecodingException { } } + public String encodeSection(int sectionId) throws EncodingException { + return encodeSection(Sections.SECTION_ID_NAME_MAP.get(sectionId)); + } + public String encodeSection(String sectionName) throws EncodingException { if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).encode(); @@ -227,6 +250,10 @@ public String encodeSection(String sectionName) throws EncodingException { } } + public void decodeSection(int sectionId, String encodedString) throws DecodingException { + decodeSection(Sections.SECTION_ID_NAME_MAP.get(sectionId), encodedString); + } + public void decodeSection(String sectionName, String encodedString) throws DecodingException { EncodableSection section = null; if (!this.sections.containsKey(sectionName)) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java new file mode 100644 index 00000000..821eaa04 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java @@ -0,0 +1,31 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class Sections { + + public static List SECTION_ORDER; + + public static Map SECTION_ID_NAME_MAP; + + static { + SECTION_ID_NAME_MAP = new HashMap<>(); + + SECTION_ID_NAME_MAP.put(TcfEuV2.ID, TcfEuV2.NAME); + SECTION_ID_NAME_MAP.put(TcfCaV2.ID, TcfCaV2.NAME); + SECTION_ID_NAME_MAP.put(UspV1.ID, UspV1.NAME); + SECTION_ID_NAME_MAP.put(UspNatV1.ID, UspNatV1.NAME); + SECTION_ID_NAME_MAP.put(UspCaV1.ID, UspCaV1.NAME); + SECTION_ID_NAME_MAP.put(UspVaV1.ID, UspVaV1.NAME); + SECTION_ID_NAME_MAP.put(UspCoV1.ID, UspCoV1.NAME); + SECTION_ID_NAME_MAP.put(UspUtV1.ID, UspUtV1.NAME); + SECTION_ID_NAME_MAP.put(UspCtV1.ID, UspCtV1.NAME); + + SECTION_ORDER = new ArrayList(SECTION_ID_NAME_MAP.keySet()).stream().sorted().map(id -> SECTION_ID_NAME_MAP.get(id)) + .collect(Collectors.toList()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 4a37d2f9..565953a6 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -22,6 +22,10 @@ public class GppModelTest { @Test public void testEncodeDefault() throws EncodingException { GppModel gppModel = new GppModel(); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); @@ -30,6 +34,10 @@ public void testEncodeDefault() throws EncodingException { Assertions.assertEquals("DBAA", gppString); Assertions.assertEquals(new ArrayList<>(), gppModel.getSectionIds()); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); @@ -39,6 +47,10 @@ public void testEncodeDefault() throws EncodingException { @Test public void testEncodeUspv1() throws EncodingException { GppModel gppModel = new GppModel(); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); @@ -48,14 +60,24 @@ public void testEncodeUspv1() throws EncodingException { gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, 3); Assertions.assertEquals(Arrays.asList(6), gppModel.getSectionIds()); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + + String gppString = gppModel.encode(); Assertions.assertEquals("DBABTA~BbA", gppString); Assertions.assertEquals(Arrays.asList(6), gppModel.getSectionIds()); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); @@ -65,6 +87,10 @@ public void testEncodeUspv1() throws EncodingException { @Test public void testEncodeTcfEuV2() throws EncodingException { GppModel gppModel = new GppModel(); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); @@ -83,16 +109,25 @@ public void testEncodeTcfEuV2() throws EncodingException { gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV2Field.LAST_UPDATED, utcDateTime); Assertions.assertEquals(Arrays.asList(2), gppModel.getSectionIds()); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + String gppString = gppModel.encode(); Assertions.assertEquals("DBABMA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", gppString); Assertions.assertEquals(2, gppString.split("~").length); Assertions.assertEquals(Arrays.asList(2), gppModel.getSectionIds()); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); @@ -147,10 +182,15 @@ public void testEncodeUspV1AndTcfEuV2() throws EncodingException { @Test public void testEncodeUspV1AndTcfEuV2AndTcfCaV2() throws EncodingException { GppModel gppModel = new GppModel(); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_ID, 880); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_VERSION, 0); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.CONSENT_SCREEN, 0); @@ -166,6 +206,10 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV2() throws EncodingException { Assertions.assertEquals(Arrays.asList(2), gppModel.getSectionIds()); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); @@ -174,6 +218,10 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV2() throws EncodingException { gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, 2); gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, 3); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); @@ -207,6 +255,10 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV2() throws EncodingException { gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.CREATED, utcDateTime); gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.LAST_UPDATED, utcDateTime); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.NAME)); @@ -220,6 +272,10 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV2() throws EncodingException { Assertions.assertEquals(4, gppString.split("~").length); Assertions.assertEquals(Arrays.asList(2, 5, 6), gppModel.getSectionIds()); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.NAME)); @@ -230,6 +286,10 @@ public void testDecodeDefaults() throws DecodingException { String gppString = "DBAA"; GppModel gppModel = new GppModel(gppString); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); @@ -242,10 +302,18 @@ public void testDecodeUspv1() throws DecodingException { GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(6), gppModel.getSectionIds()); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(1, gppModel.getFieldValue(UspV1.ID, UspV1Field.NOTICE)); + Assertions.assertEquals(2, gppModel.getFieldValue(UspV1.ID, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals(3, gppModel.getFieldValue(UspV1.ID, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals(1, gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); Assertions.assertEquals(2, gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); Assertions.assertEquals(3, gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); @@ -257,10 +325,28 @@ public void testDecodeTcfEuV2() throws DecodingException { GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(2), gppModel.getSectionIds()); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.VERSION)); + Assertions.assertEquals(880, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CMP_ID)); + Assertions.assertEquals(0, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CMP_VERSION)); + Assertions.assertEquals(0, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CONSENT_SCREEN)); + Assertions.assertEquals("EN", gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CONSENT_LANGUAGE)); + Assertions.assertEquals(48, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.VENDOR_LIST_VERSION)); + Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.POLICY_VERSION)); + Assertions.assertEquals(false, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.IS_SERVICE_SPECIFIC)); + Assertions.assertEquals(false, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.USE_NON_STANDARD_STACKS)); + Assertions.assertEquals(false, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.PURPOSE_ONE_TREATMENT)); + Assertions.assertEquals("AA", gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.PUBLISHER_COUNTRY_CODE)); + Assertions.assertEquals(utcDateTime, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CREATED)); + Assertions.assertEquals(utcDateTime, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.LAST_UPDATED)); + Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VERSION)); Assertions.assertEquals(880, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_ID)); Assertions.assertEquals(0, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_VERSION)); @@ -282,14 +368,37 @@ public void testDecodeUspv1AndTcfEuV2() throws DecodingException { GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(2, 6), gppModel.getSectionIds()); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); + Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + + Assertions.assertEquals(1, gppModel.getFieldValue(UspV1.ID, UspV1Field.NOTICE)); + Assertions.assertEquals(2, gppModel.getFieldValue(UspV1.ID, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals(3, gppModel.getFieldValue(UspV1.ID, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals(1, gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); Assertions.assertEquals(2, gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); Assertions.assertEquals(3, gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.VERSION)); + Assertions.assertEquals(880, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CMP_ID)); + Assertions.assertEquals(0, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CMP_VERSION)); + Assertions.assertEquals(0, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CONSENT_SCREEN)); + Assertions.assertEquals("EN", gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CONSENT_LANGUAGE)); + Assertions.assertEquals(48, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.VENDOR_LIST_VERSION)); + Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.POLICY_VERSION)); + Assertions.assertEquals(false, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.IS_SERVICE_SPECIFIC)); + Assertions.assertEquals(false, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.USE_NON_STANDARD_STACKS)); + Assertions.assertEquals(false, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.PURPOSE_ONE_TREATMENT)); + Assertions.assertEquals("AA", gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.PUBLISHER_COUNTRY_CODE)); + Assertions.assertEquals(utcDateTime, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CREATED)); + Assertions.assertEquals(utcDateTime, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.LAST_UPDATED)); + Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VERSION)); Assertions.assertEquals(880, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_ID)); Assertions.assertEquals(0, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_VERSION)); From ded14f1fc18b21d389f1da0c1ae7131618aace5e Mon Sep 17 00:00:00 2001 From: chuff Date: Tue, 6 Dec 2022 07:01:05 -0700 Subject: [PATCH 05/41] personal data consents fix, reduce multi state subsection id (#10) Co-authored-by: chad --- .../datatype/encoder/Base64UrlEncoder.java | 4 --- .../com/iab/gpp/encoder/section/UspCaV1.java | 21 ++++++------ .../com/iab/gpp/encoder/section/UspCoV1.java | 12 +++---- .../com/iab/gpp/encoder/section/UspCtV1.java | 12 +++---- .../com/iab/gpp/encoder/section/UspNatV1.java | 22 ++++++------ .../com/iab/gpp/encoder/GppModelTest.java | 8 ++--- .../encoder/Base64UrlEncoderTest.java | 4 +-- .../iab/gpp/encoder/section/HeaderV1Test.java | 4 +-- .../iab/gpp/encoder/section/TcfCaV2Test.java | 2 +- .../iab/gpp/encoder/section/TcfEuV2Test.java | 4 +-- .../iab/gpp/encoder/section/UspCaV1Test.java | 32 +++++++++++++---- .../iab/gpp/encoder/section/UspCoV1Test.java | 6 ++-- .../iab/gpp/encoder/section/UspCtV1Test.java | 6 ++-- .../iab/gpp/encoder/section/UspNatV1Test.java | 34 ++++++++++++++++--- .../iab/gpp/encoder/section/UspUtV1Test.java | 6 ++-- .../iab/gpp/encoder/section/UspV1Test.java | 2 +- 16 files changed, 109 insertions(+), 70 deletions(-) diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoder.java index a141ecea..72f02399 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoder.java @@ -34,10 +34,6 @@ public static String encode(String bitString) throws EncodingException { throw new EncodingException("Unencodable Base64Url '" + bitString + "'"); } - while (bitString.length() % 8 > 0) { - bitString += "0"; - } - while (bitString.length() % 6 > 0) { bitString += "0"; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java index 59f38f0d..ed015ed3 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java @@ -40,15 +40,15 @@ private void initFields() { fields.put(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); fields.put(UspCaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); fields.put(UspCaV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspCaV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(9, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UspCaV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0))); fields.put(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); - fields.put(UspCaV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); + fields.put(UspCaV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); fields.put(UspCaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); fields.put(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); fields.put(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); // gpc segment - fields.put(UspCaV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(3, 1)); + fields.put(UspCaV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); fields.put(UspCaV1Field.GPC, new EncodableBoolean(false)); //@formatter:off @@ -100,18 +100,18 @@ public void decode(String encodedSection) throws DecodingException { String[] segmentBitStrings = new String[2]; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 3. + * first char will contain 6 bits, we only need the first 2. * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the - * encoding version, but because we're only on a maximum of encoding version 2 the first 3 bits in + * encoding version, but because we're only on a maximum of encoding version 2 the first 2 bits in * the core segment will evaluate to 0. */ String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); - switch (segmentBitString.substring(0, 3)) { - case "000": { + switch (segmentBitString.substring(0, 2)) { + case "00": { segmentBitStrings[0] = segmentBitString; break; } - case "001": { + case "01": { segmentBitStrings[1] = segmentBitString; break; } @@ -167,9 +167,8 @@ public List getKnownChildSensitiveDataConsents() { return (List) this.fields.get(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); } - @SuppressWarnings("unchecked") - public List getPersonalDataConsents() { - return (List) this.fields.get(UspCaV1Field.PERSONAL_DATA_CONSENTS).getValue(); + public Integer getPersonalDataConsents() { + return (Integer) this.fields.get(UspCaV1Field.PERSONAL_DATA_CONSENTS).getValue(); } public Integer getMspaCoveredTransaction() { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java index 8d852be0..b69616e7 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java @@ -47,7 +47,7 @@ private void initFields() { fields.put(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); // gpc segment - fields.put(UspCoV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(3, 1)); + fields.put(UspCoV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); fields.put(UspCoV1Field.GPC, new EncodableBoolean(false)); @@ -99,18 +99,18 @@ public void decode(String encodedSection) throws DecodingException { String[] segmentBitStrings = new String[2]; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 3. + * first char will contain 6 bits, we only need the first 2. * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the - * encoding version, but because we're only on a maximum of encoding version 2 the first 3 bits in + * encoding version, but because we're only on a maximum of encoding version 2 the first 2 bits in * the core segment will evaluate to 0. */ String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); - switch (segmentBitString.substring(0, 3)) { - case "000": { + switch (segmentBitString.substring(0, 2)) { + case "00": { segmentBitStrings[0] = segmentBitString; break; } - case "001": { + case "01": { segmentBitStrings[1] = segmentBitString; break; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java index 6b9bd3ba..82710a7d 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java @@ -47,7 +47,7 @@ private void initFields() { fields.put(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); // gpc segment - fields.put(UspCtV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(3, 1)); + fields.put(UspCtV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); fields.put(UspCtV1Field.GPC, new EncodableBoolean(false)); //@formatter:off @@ -98,18 +98,18 @@ public void decode(String encodedSection) throws DecodingException { String[] segmentBitStrings = new String[2]; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 3. + * first char will contain 6 bits, we only need the first 2. * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the - * encoding version, but because we're only on a maximum of encoding version 2 the first 3 bits in + * encoding version, but because we're only on a maximum of encoding version 2 the first 2 bits in * the core segment will evaluate to 0. */ String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); - switch (segmentBitString.substring(0, 3)) { - case "000": { + switch (segmentBitString.substring(0, 2)) { + case "00": { segmentBitStrings[0] = segmentBitString; break; } - case "001": { + case "01": { segmentBitStrings[1] = segmentBitString; break; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java index 422269e5..770e0778 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java @@ -46,13 +46,13 @@ private void initFields() { fields.put(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); fields.put(UspNatV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); fields.put(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); - fields.put(UspNatV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); + fields.put(UspNatV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); fields.put(UspNatV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); fields.put(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); fields.put(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); // gpc segment - fields.put(UspNatV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(3, 1)); + fields.put(UspNatV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); fields.put(UspNatV1Field.GPC, new EncodableBoolean(false)); @@ -109,17 +109,18 @@ public void decode(String encodedSection) throws DecodingException { String[] segmentBitStrings = new String[2]; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 3. There is no segment type for the CORE - * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on - * a maximum of encoding version 2 the first 3 bits in the core segment will evaluate to 0. + * first char will contain 6 bits, we only need the first 2. + * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the + * encoding version, but because we're only on a maximum of encoding version 2 the first 2 bits in + * the core segment will evaluate to 0. */ String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); - switch (segmentBitString.substring(0, 3)) { - case "000": { + switch (segmentBitString.substring(0, 2)) { + case "00": { segmentBitStrings[0] = segmentBitString; break; } - case "001": { + case "01": { segmentBitStrings[1] = segmentBitString; break; } @@ -191,9 +192,8 @@ public List getKnownChildSensitiveDataConsents() { return (List) this.fields.get(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); } - @SuppressWarnings("unchecked") - public List getPersonalDataConsents() { - return (List) this.fields.get(UspNatV1Field.PERSONAL_DATA_CONSENTS).getValue(); + public Integer getPersonalDataConsents() { + return (Integer) this.fields.get(UspNatV1Field.PERSONAL_DATA_CONSENTS).getValue(); } public Integer getMspaCoveredTransaction() { diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 565953a6..1723047d 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -71,7 +71,7 @@ public void testEncodeUspv1() throws EncodingException { String gppString = gppModel.encode(); - Assertions.assertEquals("DBABTA~BbA", gppString); + Assertions.assertEquals("DBABT~Bb", gppString); Assertions.assertEquals(Arrays.asList(6), gppModel.getSectionIds()); Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); @@ -119,7 +119,7 @@ public void testEncodeTcfEuV2() throws EncodingException { String gppString = gppModel.encode(); - Assertions.assertEquals("DBABMA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", gppString); + Assertions.assertEquals("DBABM~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", gppString); Assertions.assertEquals(2, gppString.split("~").length); @@ -168,7 +168,7 @@ public void testEncodeUspV1AndTcfEuV2() throws EncodingException { Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); String gppString = gppModel.encode(); - Assertions.assertEquals("DBACNYA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BbA", gppString); + Assertions.assertEquals("DBACNY~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~Bb", gppString); Assertions.assertEquals(3, gppString.split("~").length); @@ -266,7 +266,7 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV2() throws EncodingException { String gppString = gppModel.encode(); Assertions.assertEquals( - "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444ao~BbA", + "DBACOe~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444ao~Bb", gppString); Assertions.assertEquals(4, gppString.split("~").length); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java index 50640349..f0f6b828 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java @@ -9,12 +9,12 @@ public class Base64UrlEncoderTest { @Test public void testEncode1() throws EncodingException { - Assertions.assertEquals("DBABMA", Base64UrlEncoder.encode("0000110000010000000000010011")); + Assertions.assertEquals("DBABM", Base64UrlEncoder.encode("0000110000010000000000010011")); } @Test public void testEncode2() throws EncodingException { - Assertions.assertEquals("DBACNYA", Base64UrlEncoder.encode("000011000001000000000010001101011")); + Assertions.assertEquals("DBACNY", Base64UrlEncoder.encode("000011000001000000000010001101011")); } @Test diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java index 37eae863..77299810 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java @@ -65,14 +65,14 @@ public void testEncode1() throws EncodingException { public void testEncode2() throws EncodingException { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", Arrays.asList(2)); - Assertions.assertEquals("DBABMA", headerV1.encode()); + Assertions.assertEquals("DBABM", headerV1.encode()); } @Test public void testEncode3() throws EncodingException { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", Arrays.asList(2, 7)); - Assertions.assertEquals("DBACMMA", headerV1.encode()); + Assertions.assertEquals("DBACMM", headerV1.encode()); } @Test diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java index 7d2dacca..0af64291 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java @@ -16,7 +16,7 @@ public class TcfCaV2Test { public void testEncode1() throws EncodingException { TcfCaV2 tcfCaV2 = new TcfCaV2(); - Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAA.YAAAAAAAAAA", tcfCaV2.encode()); + Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAA.YAAAAAAAAA", tcfCaV2.encode()); } @Test diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java index ed480997..eec3faf7 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java @@ -15,7 +15,7 @@ public class TcfEuV2Test { @Test public void testEncode1() throws EncodingException { TcfEuV2 tcfEuV2 = new TcfEuV2(); - Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", tcfEuV2.encode()); + Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", tcfEuV2.encode()); } @Test @@ -24,7 +24,7 @@ public void testEncode2() throws EncodingException { tcfEuV2.setFieldValue(TcfEuV2Field.IS_SERVICE_SPECIFIC, true); tcfEuV2.setFieldValue(TcfEuV2Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); tcfEuV2.setFieldValue(TcfEuV2Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); - Assertions.assertEquals("CPSG_8APSG_8AAAAAAENAACgAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA", tcfEuV2.encode()); + Assertions.assertEquals("CPSG_8APSG_8AAAAAAENAACgAAAAAAAAAAAAAAAAAA.YAAAAAAAAA", tcfEuV2.encode()); } @Test diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java index db05369a..58d469f8 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java @@ -14,7 +14,7 @@ public class UspCaV1Test { public void testEncode1() throws EncodingException { UspCaV1 uspCaV1 = new UspCaV1(); - Assertions.assertEquals("BAAAAAAAAAAAAAAAAAA.IA", uspCaV1.encode()); + Assertions.assertEquals("BAAAAAAA.Q", uspCaV1.encode()); } @Test @@ -28,18 +28,38 @@ public void testEncode2() throws EncodingException { uspCaV1.setFieldValue(UspCaV1Field.SHARING_OPT_OUT, 2); uspCaV1.setFieldValue(UspCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0)); uspCaV1.setFieldValue(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 1)); - uspCaV1.setFieldValue(UspCaV1Field.PERSONAL_DATA_CONSENTS, Arrays.asList(2, 3)); + uspCaV1.setFieldValue(UspCaV1Field.PERSONAL_DATA_CONSENTS, 1); uspCaV1.setFieldValue(UspCaV1Field.MSPA_COVERED_TRANSACTION, 3); uspCaV1.setFieldValue(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); uspCaV1.setFieldValue(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); uspCaV1.setFieldValue(UspCaV1Field.GPC, true); - Assertions.assertEquals("BbYAAEBAMAAEBAMADew.MA", uspCaV1.encode()); + Assertions.assertEquals("BbYbGwXY.Y", uspCaV1.encode()); } @Test - public void testDecodde1() throws DecodingException { - UspCaV1 uspCaV1 = new UspCaV1("BbYAAEBAMAAEBAMADew.MA"); + public void testEncode3() throws EncodingException { + UspCaV1 uspCaV1 = new UspCaV1(); + + uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT_NOTICE, 1); + uspCaV1.setFieldValue(UspCaV1Field.SHARING_OPT_OUT_NOTICE, 1); + uspCaV1.setFieldValue(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT, 2); + uspCaV1.setFieldValue(UspCaV1Field.SHARING_OPT_OUT, 2); + uspCaV1.setFieldValue(UspCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0)); + uspCaV1.setFieldValue(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 0)); + uspCaV1.setFieldValue(UspCaV1Field.PERSONAL_DATA_CONSENTS, 0); + uspCaV1.setFieldValue(UspCaV1Field.MSPA_COVERED_TRANSACTION, 1); + uspCaV1.setFieldValue(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + uspCaV1.setFieldValue(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + uspCaV1.setFieldValue(UspCaV1Field.GPC, true); + + Assertions.assertEquals("BUoAAABQ.Y", uspCaV1.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UspCaV1 uspCaV1 = new UspCaV1("BbYbGwXY.Y"); Assertions.assertEquals(1, uspCaV1.getSaleOptOutNotice()); Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); @@ -48,7 +68,7 @@ public void testDecodde1() throws DecodingException { Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0), uspCaV1.getSensitiveDataProcessing()); Assertions.assertEquals(Arrays.asList(0, 1), uspCaV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(Arrays.asList(2, 3), uspCaV1.getPersonalDataConsents()); + Assertions.assertEquals(1, uspCaV1.getPersonalDataConsents()); Assertions.assertEquals(3, uspCaV1.getMspaCoveredTransaction()); Assertions.assertEquals(1, uspCaV1.getMspaOptOutOptionMode()); Assertions.assertEquals(2, uspCaV1.getMspaServiceProviderMode()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java index 4d0d9a0b..3f4bbaef 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java @@ -13,7 +13,7 @@ public class UspCoV1Test { @Test public void testEncode1() throws EncodingException { UspCoV1 uspCoV1 = new UspCoV1(); - Assertions.assertEquals("BAAAAAA.IA", uspCoV1.encode()); + Assertions.assertEquals("BAAAAAA.Q", uspCoV1.encode()); } @Test @@ -32,12 +32,12 @@ public void testEncode2() throws EncodingException { uspCoV1.setFieldValue(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); uspCoV1.setFieldValue(UspCoV1Field.GPC, true); - Assertions.assertEquals("BbYbG2w.MA", uspCoV1.encode()); + Assertions.assertEquals("BbYbG2w.Y", uspCoV1.encode()); } @Test public void testDecode1() throws DecodingException { - UspCoV1 uspCoV1 = new UspCoV1("BbYbG2w.MA"); + UspCoV1 uspCoV1 = new UspCoV1("BbYbG2w.Y"); Assertions.assertEquals(1, uspCoV1.getSharingNotice()); Assertions.assertEquals(2, uspCoV1.getSaleOptOutNotice()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java index f6f146a0..910f121d 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java @@ -13,7 +13,7 @@ public class UspCtV1Test { @Test public void testEncode1() throws EncodingException { UspCtV1 uspCtV1 = new UspCtV1(); - Assertions.assertEquals("BAAAAAAA.IA", uspCtV1.encode()); + Assertions.assertEquals("BAAAAAAA.Q", uspCtV1.encode()); } @Test @@ -32,12 +32,12 @@ public void testEncode2() throws EncodingException { uspCtV1.setFieldValue(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); uspCtV1.setFieldValue(UspCtV1Field.GPC, true); - Assertions.assertEquals("BbYbG22w.MA", uspCtV1.encode()); + Assertions.assertEquals("BbYbG22w.Y", uspCtV1.encode()); } @Test public void testDecode1() throws DecodingException { - UspCtV1 uspCtV1 = new UspCtV1("BbYbG22w.MA"); + UspCtV1 uspCtV1 = new UspCtV1("BbYbG22w.Y"); Assertions.assertEquals(1, uspCtV1.getSharingNotice()); Assertions.assertEquals(2, uspCtV1.getSaleOptOutNotice()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java index eb9a4b83..d3517d76 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java @@ -14,7 +14,7 @@ public class UspNatV1Test { public void testEncode1() throws EncodingException { UspNatV1 uspNatV1 = new UspNatV1(); - Assertions.assertEquals("BAAAAAAAAAA.IA", uspNatV1.encode()); + Assertions.assertEquals("BAAAAAAAAA.Q", uspNatV1.encode()); } @Test @@ -32,18 +32,42 @@ public void testEncode2() throws EncodingException { uspNatV1.setFieldValue(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3)); uspNatV1.setFieldValue(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 1)); - uspNatV1.setFieldValue(UspNatV1Field.PERSONAL_DATA_CONSENTS, Arrays.asList(2, 3)); + uspNatV1.setFieldValue(UspNatV1Field.PERSONAL_DATA_CONSENTS, 1); uspNatV1.setFieldValue(UspNatV1Field.MSPA_COVERED_TRANSACTION, 1); uspNatV1.setFieldValue(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); uspNatV1.setFieldValue(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); uspNatV1.setFieldValue(UspNatV1Field.GPC, true); - Assertions.assertEquals("BbbbGxsbG2w.MA", uspNatV1.encode()); + Assertions.assertEquals("BbbbGxsbFb.Y", uspNatV1.encode()); + } + + @Test + public void testEncode3() throws EncodingException { + UspNatV1 uspNatV1 = new UspNatV1(); + + uspNatV1.setFieldValue(UspNatV1Field.SHARING_NOTICE, 1); + uspNatV1.setFieldValue(UspNatV1Field.SALE_OPT_OUT_NOTICE, 1); + uspNatV1.setFieldValue(UspNatV1Field.SHARING_OPT_OUT_NOTICE, 1); + uspNatV1.setFieldValue(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 0); + uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + uspNatV1.setFieldValue(UspNatV1Field.SALE_OPT_OUT, 1); + uspNatV1.setFieldValue(UspNatV1Field.SHARING_OPT_OUT, 1); + uspNatV1.setFieldValue(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); + uspNatV1.setFieldValue(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 0)); + uspNatV1.setFieldValue(UspNatV1Field.PERSONAL_DATA_CONSENTS, 0); + uspNatV1.setFieldValue(UspNatV1Field.MSPA_COVERED_TRANSACTION, 1); + uspNatV1.setFieldValue(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + uspNatV1.setFieldValue(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + uspNatV1.setFieldValue(UspNatV1Field.GPC, true); + + Assertions.assertEquals("BVQVAAAAAU.Y", uspNatV1.encode()); } @Test public void testDecodde1() throws DecodingException { - UspNatV1 uspNatV1 = new UspNatV1("BbbbGxsbG2w.MA"); + UspNatV1 uspNatV1 = new UspNatV1("BbbbGxsbFb.Y"); Assertions.assertEquals(1, uspNatV1.getSharingNotice()); Assertions.assertEquals(2, uspNatV1.getSaleOptOutNotice()); @@ -56,7 +80,7 @@ public void testDecodde1() throws DecodingException { Assertions.assertEquals(3, uspNatV1.getTargetedAdvertisingOptOut()); Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3), uspNatV1.getSensitiveDataProcessing()); Assertions.assertEquals(Arrays.asList(0, 1), uspNatV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(Arrays.asList(2, 3), uspNatV1.getPersonalDataConsents()); + Assertions.assertEquals(1, uspNatV1.getPersonalDataConsents()); Assertions.assertEquals(1, uspNatV1.getMspaCoveredTransaction()); Assertions.assertEquals(2, uspNatV1.getMspaOptOutOptionMode()); Assertions.assertEquals(3, uspNatV1.getMspaServiceProviderMode()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java index e7962f94..961e05dd 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java @@ -13,7 +13,7 @@ public class UspUtV1Test { @Test public void testEncode1() throws EncodingException { UspUtV1 uspUtV1 = new UspUtV1(); - Assertions.assertEquals("BAAAAAAA", uspUtV1.encode()); + Assertions.assertEquals("BAAAAAA", uspUtV1.encode()); } @Test @@ -32,12 +32,12 @@ public void testEncode2() throws EncodingException { uspUtV1.setFieldValue(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); uspUtV1.setFieldValue(UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - Assertions.assertEquals("BbWGxvbA", uspUtV1.encode()); + Assertions.assertEquals("BbWGxvb", uspUtV1.encode()); } @Test public void testDecode1() throws DecodingException { - UspUtV1 uspUtV1 = new UspUtV1("BbWGxvbA"); + UspUtV1 uspUtV1 = new UspUtV1("BbWGxvb"); Assertions.assertEquals(1, uspUtV1.getSharingNotice()); Assertions.assertEquals(2, uspUtV1.getSaleOptOutNotice()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java index b7ffa054..ae0a9c2e 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java @@ -24,7 +24,7 @@ public void testEncode2() throws EncodingException { uspv1.setFieldValue("OptOutSale", 2); uspv1.setFieldValue("LspaCovered", 3); - Assertions.assertEquals("BbA", uspv1.encode()); + Assertions.assertEquals("Bb", uspv1.encode()); } @Test From ecd9ebec4ac4fa28ca676c9ce8001aab0587876e Mon Sep 17 00:00:00 2001 From: chuff Date: Fri, 9 Dec 2022 10:53:49 -0700 Subject: [PATCH 06/41] 3.0.0 (#11) * personal data consents fix, reduce multi state subsection id * scm * [maven-release-plugin] prepare release iabgpp-core-3.0.0 * scm * scm * scm * scm * 3.0.0 * 3.0.1-SNAPSHOT Co-authored-by: chad --- README.md | 4 +- iabgpp-encoder/pom.xml | 50 ++++---- .../datatype/encoder/Base64UrlEncoder.java | 2 +- .../com/iab/gpp/encoder/GppModelTest.java | 23 ++-- .../encoder/Base64UrlEncoderTest.java | 12 +- .../iab/gpp/encoder/section/HeaderV1Test.java | 8 +- .../iab/gpp/encoder/section/TcfCaV2Test.java | 8 +- .../iab/gpp/encoder/section/TcfEuV2Test.java | 8 +- .../iab/gpp/encoder/section/UspCaV1Test.java | 8 +- .../iab/gpp/encoder/section/UspCoV1Test.java | 6 +- .../iab/gpp/encoder/section/UspCtV1Test.java | 6 +- .../iab/gpp/encoder/section/UspNatV1Test.java | 8 +- .../iab/gpp/encoder/section/UspUtV1Test.java | 6 +- .../iab/gpp/encoder/section/UspV1Test.java | 4 +- .../iab/gpp/encoder/section/UspVaV1Test.java | 6 +- iabgpp-extras-jackson/pom.xml | 39 ++++--- iabgpp-extras/pom.xml | 72 ++---------- pom.xml | 107 +++++++++++++++++- 18 files changed, 218 insertions(+), 159 deletions(-) diff --git a/README.md b/README.md index 77277d72..e69080b3 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ Encode/decode consent information with the IAB GPP Framework -https://iabtechlab.com/gpp/ - ### Usage #### Maven @@ -25,7 +23,7 @@ import com.iab.gpp.encoder.GppModel; import com.iab.gpp.encoder.section.TcfEuV2; import com.iab.gpp.encoder.section.UspV1; -String gppString = "DBACDMA~CPdBusAPdBusANwAAAENAwCAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BbA"; +String gppString = "DBACNYAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BbAA"; GppModel gppModel = new GppModel(gppString); TcfEuV2 tcfEuV2Section = (TcfEuV2)gppModel.getSection(TcfEuV2.NAME); diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index 554e8cd5..26bfb8aa 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,30 +7,12 @@ com.iabgpp iabgpp-core - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT - com.iabgpp iabgpp-encoder - IAB GPP Java Encoder Library - 3.0.0-SNAPSHOT - Encode and decode consent information with the IAB GPP Framework jar - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - UTF-8 - 1.8 - 1.8 - - - org.junit.jupiter @@ -40,14 +22,26 @@ - - - - org.apache.maven.plugins - surefire - 3.0.0-M7 - - - + + + release + + + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin + + + org.apache.maven.plugins + maven-gpg-plugin + + + + + diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoder.java index 72f02399..d2517f5e 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoder.java @@ -34,7 +34,7 @@ public static String encode(String bitString) throws EncodingException { throw new EncodingException("Unencodable Base64Url '" + bitString + "'"); } - while (bitString.length() % 6 > 0) { + while (bitString.length() % 24 > 0) { bitString += "0"; } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 1723047d..56e2c82d 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -71,7 +71,7 @@ public void testEncodeUspv1() throws EncodingException { String gppString = gppModel.encode(); - Assertions.assertEquals("DBABT~Bb", gppString); + Assertions.assertEquals("DBABTAAA~BbAA", gppString); Assertions.assertEquals(Arrays.asList(6), gppModel.getSectionIds()); Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); @@ -119,7 +119,7 @@ public void testEncodeTcfEuV2() throws EncodingException { String gppString = gppModel.encode(); - Assertions.assertEquals("DBABM~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", gppString); + Assertions.assertEquals("DBABMAAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", gppString); Assertions.assertEquals(2, gppString.split("~").length); @@ -168,7 +168,7 @@ public void testEncodeUspV1AndTcfEuV2() throws EncodingException { Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); String gppString = gppModel.encode(); - Assertions.assertEquals("DBACNY~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~Bb", gppString); + Assertions.assertEquals("DBACNYAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BbAA", gppString); Assertions.assertEquals(3, gppString.split("~").length); @@ -266,7 +266,7 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV2() throws EncodingException { String gppString = gppModel.encode(); Assertions.assertEquals( - "DBACOe~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444ao~Bb", + "DBACOeAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444aoA~BbAA", gppString); Assertions.assertEquals(4, gppString.split("~").length); @@ -298,7 +298,7 @@ public void testDecodeDefaults() throws DecodingException { @Test public void testDecodeUspv1() throws DecodingException { - String gppString = "DBABTA~BbA"; + String gppString = "DBABTAAA~BbAA"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(6), gppModel.getSectionIds()); @@ -321,7 +321,7 @@ public void testDecodeUspv1() throws DecodingException { @Test public void testDecodeTcfEuV2() throws DecodingException { - String gppString = "DBABMA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA"; + String gppString = "DBABMAAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(2), gppModel.getSectionIds()); @@ -364,7 +364,7 @@ public void testDecodeTcfEuV2() throws DecodingException { @Test public void testDecodeUspv1AndTcfEuV2() throws DecodingException { - String gppString = "DBACNYA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BbA"; + String gppString = "DBACNYAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BbAA"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(2, 6), gppModel.getSectionIds()); @@ -429,7 +429,7 @@ public void testDecodeUspv1AndTcfEuV2() throws DecodingException { @Test public void testDecodeUspv1AndTcfEuV2AndTcfCaV2() throws DecodingException { String gppString = - "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444ao~BbA"; + "DBACOeAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444aoA~BbAA"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(2, 5, 6), gppModel.getSectionIds()); @@ -506,4 +506,11 @@ public void testDecodeUspv1AndTcfEuV2AndTcfCaV2() throws DecodingException { Assertions.assertEquals(5, tcfCaV2Section.getId()); Assertions.assertEquals(3, tcfCaV2Section.getPubPurposesSegmentType()); } + + @Test + public void testFoo() throws DecodingException { + String gppString = + "DBACNYAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BbAA"; + GppModel gppModel = new GppModel(gppString); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java index f0f6b828..b3a8e153 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java @@ -9,32 +9,32 @@ public class Base64UrlEncoderTest { @Test public void testEncode1() throws EncodingException { - Assertions.assertEquals("DBABM", Base64UrlEncoder.encode("0000110000010000000000010011")); + Assertions.assertEquals("DBABMAAA", Base64UrlEncoder.encode("0000110000010000000000010011")); } @Test public void testEncode2() throws EncodingException { - Assertions.assertEquals("DBACNY", Base64UrlEncoder.encode("000011000001000000000010001101011")); + Assertions.assertEquals("DBACNYAA", Base64UrlEncoder.encode("000011000001000000000010001101011")); } @Test public void testEncode3() throws EncodingException { - Assertions.assertEquals("DBABjw", Base64UrlEncoder.encode("00001100000100000000000110001111")); + Assertions.assertEquals("DBABjwAA", Base64UrlEncoder.encode("00001100000100000000000110001111")); } @Test public void testDecode1() throws DecodingException { - Assertions.assertEquals("000011000001000000000001001100000000", Base64UrlEncoder.decode("DBABMA")); + Assertions.assertEquals("000011000001000000000001001100000000000000000000", Base64UrlEncoder.decode("DBABMAAA")); } @Test public void testDecode2() throws DecodingException { - Assertions.assertEquals("000011000001000000000010001101011000000000", Base64UrlEncoder.decode("DBACNYA")); + Assertions.assertEquals("000011000001000000000010001101011000000000000000", Base64UrlEncoder.decode("DBACNYAA")); } @Test public void testDecode3() throws DecodingException { - Assertions.assertEquals("000011000001000000000001100011110000", Base64UrlEncoder.decode("DBABjw")); + Assertions.assertEquals("000011000001000000000001100011110000000000000000", Base64UrlEncoder.decode("DBABjwAA")); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java index 77299810..e04fa42c 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java @@ -65,14 +65,14 @@ public void testEncode1() throws EncodingException { public void testEncode2() throws EncodingException { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", Arrays.asList(2)); - Assertions.assertEquals("DBABM", headerV1.encode()); + Assertions.assertEquals("DBABMAAA", headerV1.encode()); } @Test public void testEncode3() throws EncodingException { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", Arrays.asList(2, 7)); - Assertions.assertEquals("DBACMM", headerV1.encode()); + Assertions.assertEquals("DBACMMAA", headerV1.encode()); } @Test @@ -87,7 +87,7 @@ public void testDecode1() throws DecodingException { @Test public void testDecode2() throws DecodingException { HeaderV1 headerV1 = new HeaderV1(); - headerV1.decode("DBABMA"); + headerV1.decode("DBABMAAA"); Assertions.assertEquals(Arrays.asList(2), headerV1.getFieldValue("SectionIds")); Assertions.assertEquals(headerV1.getFieldValue("Version"), headerV1.getVersion()); Assertions.assertEquals(headerV1.getFieldValue("SectionIds"), headerV1.getSectionsIds()); @@ -96,7 +96,7 @@ public void testDecode2() throws DecodingException { @Test public void testDecode3() throws DecodingException { HeaderV1 headerV1 = new HeaderV1(); - headerV1.decode("BDACNYA"); + headerV1.decode("BDACNYAA"); Assertions.assertEquals(Arrays.asList(2, 6), headerV1.getFieldValue("SectionIds")); Assertions.assertEquals(headerV1.getFieldValue("Version"), headerV1.getVersion()); Assertions.assertEquals(headerV1.getFieldValue("SectionIds"), headerV1.getSectionsIds()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java index 0af64291..60b1076d 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java @@ -16,7 +16,7 @@ public class TcfCaV2Test { public void testEncode1() throws EncodingException { TcfCaV2 tcfCaV2 = new TcfCaV2(); - Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAA.YAAAAAAAAA", tcfCaV2.encode()); + Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA", tcfCaV2.encode()); } @Test @@ -50,12 +50,12 @@ public void testEncode2() throws EncodingException { tcfCaV2.setFieldValue(TcfCaV2Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); tcfCaV2.setFieldValue(TcfCaV2Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); - Assertions.assertEquals("CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444ao", tcfCaV2.encode()); + Assertions.assertEquals("CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444aoA", tcfCaV2.encode()); } @Test public void testDecode1() throws DecodingException { - TcfCaV2 tcfCaV2 = new TcfCaV2("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAA.YAAAAAAAAAA"); + TcfCaV2 tcfCaV2 = new TcfCaV2("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA"); Assertions.assertEquals(0, tcfCaV2.getCmpId()); Assertions.assertEquals(0, tcfCaV2.getCmpVersion()); @@ -97,7 +97,7 @@ public void testDecode1() throws DecodingException { @Test public void testDecode2() throws DecodingException { - TcfCaV2 tcfCaV2 = new TcfCaV2("CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444ao.fHHHA4444ao"); + TcfCaV2 tcfCaV2 = new TcfCaV2("CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444aoA"); Assertions.assertEquals(50, tcfCaV2.getCmpId()); Assertions.assertEquals(2, tcfCaV2.getCmpVersion()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java index eec3faf7..6a1b0c64 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java @@ -15,7 +15,7 @@ public class TcfEuV2Test { @Test public void testEncode1() throws EncodingException { TcfEuV2 tcfEuV2 = new TcfEuV2(); - Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", tcfEuV2.encode()); + Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", tcfEuV2.encode()); } @Test @@ -24,12 +24,12 @@ public void testEncode2() throws EncodingException { tcfEuV2.setFieldValue(TcfEuV2Field.IS_SERVICE_SPECIFIC, true); tcfEuV2.setFieldValue(TcfEuV2Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); tcfEuV2.setFieldValue(TcfEuV2Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); - Assertions.assertEquals("CPSG_8APSG_8AAAAAAENAACgAAAAAAAAAAAAAAAAAA.YAAAAAAAAA", tcfEuV2.encode()); + Assertions.assertEquals("CPSG_8APSG_8AAAAAAENAACgAAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA", tcfEuV2.encode()); } @Test public void testDecode1() throws DecodingException { - TcfEuV2 tcfEuV2 = new TcfEuV2("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA"); + TcfEuV2 tcfEuV2 = new TcfEuV2("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA"); Assertions.assertEquals(2, tcfEuV2.getVersion()); Assertions.assertEquals(ZonedDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfEuV2.getCreated()); @@ -75,7 +75,7 @@ public void testDecode1() throws DecodingException { @Test public void testDecode2() throws DecodingException { - TcfEuV2 tcfEuV2 = new TcfEuV2("CPSG_8APSG_8AAAAAAENAACgAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA"); + TcfEuV2 tcfEuV2 = new TcfEuV2("CPSG_8APSG_8AAAAAAENAACgAAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA"); Assertions.assertEquals(2, tcfEuV2.getVersion()); Assertions.assertEquals(ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfEuV2.getCreated()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java index 58d469f8..5c66f7b4 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java @@ -14,7 +14,7 @@ public class UspCaV1Test { public void testEncode1() throws EncodingException { UspCaV1 uspCaV1 = new UspCaV1(); - Assertions.assertEquals("BAAAAAAA.Q", uspCaV1.encode()); + Assertions.assertEquals("BAAAAAAA.QAAA", uspCaV1.encode()); } @Test @@ -34,7 +34,7 @@ public void testEncode2() throws EncodingException { uspCaV1.setFieldValue(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); uspCaV1.setFieldValue(UspCaV1Field.GPC, true); - Assertions.assertEquals("BbYbGwXY.Y", uspCaV1.encode()); + Assertions.assertEquals("BbYbGwXY.YAAA", uspCaV1.encode()); } @Test @@ -54,12 +54,12 @@ public void testEncode3() throws EncodingException { uspCaV1.setFieldValue(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); uspCaV1.setFieldValue(UspCaV1Field.GPC, true); - Assertions.assertEquals("BUoAAABQ.Y", uspCaV1.encode()); + Assertions.assertEquals("BUoAAABQ.YAAA", uspCaV1.encode()); } @Test public void testDecode1() throws DecodingException { - UspCaV1 uspCaV1 = new UspCaV1("BbYbGwXY.Y"); + UspCaV1 uspCaV1 = new UspCaV1("BbYbGwXY.YAAA"); Assertions.assertEquals(1, uspCaV1.getSaleOptOutNotice()); Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java index 3f4bbaef..296e9aba 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java @@ -13,7 +13,7 @@ public class UspCoV1Test { @Test public void testEncode1() throws EncodingException { UspCoV1 uspCoV1 = new UspCoV1(); - Assertions.assertEquals("BAAAAAA.Q", uspCoV1.encode()); + Assertions.assertEquals("BAAAAAAA.QAAA", uspCoV1.encode()); } @Test @@ -32,12 +32,12 @@ public void testEncode2() throws EncodingException { uspCoV1.setFieldValue(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); uspCoV1.setFieldValue(UspCoV1Field.GPC, true); - Assertions.assertEquals("BbYbG2w.Y", uspCoV1.encode()); + Assertions.assertEquals("BbYbG2wA.YAAA", uspCoV1.encode()); } @Test public void testDecode1() throws DecodingException { - UspCoV1 uspCoV1 = new UspCoV1("BbYbG2w.Y"); + UspCoV1 uspCoV1 = new UspCoV1("BbYbG2wA.YAAA"); Assertions.assertEquals(1, uspCoV1.getSharingNotice()); Assertions.assertEquals(2, uspCoV1.getSaleOptOutNotice()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java index 910f121d..4a94a683 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java @@ -13,7 +13,7 @@ public class UspCtV1Test { @Test public void testEncode1() throws EncodingException { UspCtV1 uspCtV1 = new UspCtV1(); - Assertions.assertEquals("BAAAAAAA.Q", uspCtV1.encode()); + Assertions.assertEquals("BAAAAAAA.QAAA", uspCtV1.encode()); } @Test @@ -32,12 +32,12 @@ public void testEncode2() throws EncodingException { uspCtV1.setFieldValue(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); uspCtV1.setFieldValue(UspCtV1Field.GPC, true); - Assertions.assertEquals("BbYbG22w.Y", uspCtV1.encode()); + Assertions.assertEquals("BbYbG22w.YAAA", uspCtV1.encode()); } @Test public void testDecode1() throws DecodingException { - UspCtV1 uspCtV1 = new UspCtV1("BbYbG22w.Y"); + UspCtV1 uspCtV1 = new UspCtV1("BbYbG22w.YAAA"); Assertions.assertEquals(1, uspCtV1.getSharingNotice()); Assertions.assertEquals(2, uspCtV1.getSaleOptOutNotice()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java index d3517d76..e65d830b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java @@ -14,7 +14,7 @@ public class UspNatV1Test { public void testEncode1() throws EncodingException { UspNatV1 uspNatV1 = new UspNatV1(); - Assertions.assertEquals("BAAAAAAAAA.Q", uspNatV1.encode()); + Assertions.assertEquals("BAAAAAAAAAAA.QAAA", uspNatV1.encode()); } @Test @@ -38,7 +38,7 @@ public void testEncode2() throws EncodingException { uspNatV1.setFieldValue(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); uspNatV1.setFieldValue(UspNatV1Field.GPC, true); - Assertions.assertEquals("BbbbGxsbFb.Y", uspNatV1.encode()); + Assertions.assertEquals("BbbbGxsbFbAA.YAAA", uspNatV1.encode()); } @Test @@ -62,12 +62,12 @@ public void testEncode3() throws EncodingException { uspNatV1.setFieldValue(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); uspNatV1.setFieldValue(UspNatV1Field.GPC, true); - Assertions.assertEquals("BVQVAAAAAU.Y", uspNatV1.encode()); + Assertions.assertEquals("BVQVAAAAAUAA.YAAA", uspNatV1.encode()); } @Test public void testDecodde1() throws DecodingException { - UspNatV1 uspNatV1 = new UspNatV1("BbbbGxsbFb.Y"); + UspNatV1 uspNatV1 = new UspNatV1("BbbbGxsbFbAA.YAAA"); Assertions.assertEquals(1, uspNatV1.getSharingNotice()); Assertions.assertEquals(2, uspNatV1.getSaleOptOutNotice()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java index 961e05dd..e7962f94 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java @@ -13,7 +13,7 @@ public class UspUtV1Test { @Test public void testEncode1() throws EncodingException { UspUtV1 uspUtV1 = new UspUtV1(); - Assertions.assertEquals("BAAAAAA", uspUtV1.encode()); + Assertions.assertEquals("BAAAAAAA", uspUtV1.encode()); } @Test @@ -32,12 +32,12 @@ public void testEncode2() throws EncodingException { uspUtV1.setFieldValue(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); uspUtV1.setFieldValue(UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - Assertions.assertEquals("BbWGxvb", uspUtV1.encode()); + Assertions.assertEquals("BbWGxvbA", uspUtV1.encode()); } @Test public void testDecode1() throws DecodingException { - UspUtV1 uspUtV1 = new UspUtV1("BbWGxvb"); + UspUtV1 uspUtV1 = new UspUtV1("BbWGxvbA"); Assertions.assertEquals(1, uspUtV1.getSharingNotice()); Assertions.assertEquals(2, uspUtV1.getSaleOptOutNotice()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java index ae0a9c2e..3dd091f6 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java @@ -24,7 +24,7 @@ public void testEncode2() throws EncodingException { uspv1.setFieldValue("OptOutSale", 2); uspv1.setFieldValue("LspaCovered", 3); - Assertions.assertEquals("Bb", uspv1.encode()); + Assertions.assertEquals("BbAA", uspv1.encode()); } @Test @@ -44,7 +44,7 @@ public void testdecode1() throws DecodingException { @Test public void testDecode2() throws DecodingException { - UspV1 uspv1 = new UspV1("BbA"); + UspV1 uspv1 = new UspV1("BbAA"); Assertions.assertEquals(1, uspv1.getFieldValue("Notice")); Assertions.assertEquals(2, uspv1.getFieldValue("OptOutSale")); Assertions.assertEquals(3, uspv1.getFieldValue("LspaCovered")); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java index 54d2d8e4..9d620951 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java @@ -13,7 +13,7 @@ public class UspVaV1Test { @Test public void testEncode1() throws EncodingException { UspVaV1 uspVaV1 = new UspVaV1(); - Assertions.assertEquals("BAAAAAA", uspVaV1.encode()); + Assertions.assertEquals("BAAAAAAA", uspVaV1.encode()); } @Test @@ -31,12 +31,12 @@ public void testEncode2() throws EncodingException { uspVaV1.setFieldValue(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); uspVaV1.setFieldValue(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - Assertions.assertEquals("BbYbG9s", uspVaV1.encode()); + Assertions.assertEquals("BbYbG9sA", uspVaV1.encode()); } @Test public void testDecode1() throws DecodingException { - UspVaV1 uspVaV1 = new UspVaV1("BbYbG9s"); + UspVaV1 uspVaV1 = new UspVaV1("BbYbG9sA"); Assertions.assertEquals(1, uspVaV1.getSharingNotice()); Assertions.assertEquals(2, uspVaV1.getSaleOptOutNotice()); diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index a66edc22..6764dd30 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,26 +7,12 @@ iabgpp-core com.iabgpp - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT iabgpp-extras-jackson - IAB GPP Java GVL and CMP List Jackson jar - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - UTF-8 - 1.8 - 1.8 - - junit @@ -38,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT @@ -55,4 +41,25 @@ + + + release + + + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin + + + org.apache.maven.plugins + maven-gpg-plugin + + + + + diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index 30c6fd8d..5fcbce60 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,31 +7,25 @@ com.iabgpp iabgpp-core - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT iabgpp-extras - IAB GPP Java GVL and CMP List jar - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - UTF-8 - 1.8 - 1.8 - - - + release + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin + org.apache.maven.plugins maven-gpg-plugin @@ -40,50 +34,4 @@ - - - - - org.codehaus.mojo - license-maven-plugin - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - org.apache.maven.plugins - maven-source-plugin - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.5 - - - - report - - - - - - diff --git a/pom.xml b/pom.xml index ecc031cf..7547ebfe 100644 --- a/pom.xml +++ b/pom.xml @@ -6,8 +6,9 @@ com.iabgpp iabgpp-core - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT IAB GPP Core Library + https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. pom @@ -18,10 +19,114 @@ + + + Mayank Mishra + mayank@iabtechlab.com + IAB Tech Lab + https://www.iabtechlab.com + + + + + scm:git:git@github.com:IABTechLabs/iabgpp-java.git + scm:git:git@github.com:IABTechLabs/iabgpp-java.git + https://github.com/IABTechLabs/iabgpp-java + + + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://s01.oss.sonatype.org/content/repositories/snapshots/ + + + sonatype-nexus-staging + Nexus Release Repository + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + iabgpp-encoder iabgpp-extras iabgpp-extras-jackson + + UTF-8 + 1.8 + 1.8 + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.0 + + + attach-sources + verify + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.3.1 + + + attach-javadoc + verify + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin + + + org.apache.maven.plugins + maven-gpg-plugin + + + + + From 1028adf9314f2d9a54c6bd37f6599fc121bbda49 Mon Sep 17 00:00:00 2001 From: chuff Date: Tue, 13 Dec 2022 15:45:59 -0700 Subject: [PATCH 07/41] fix multi state name, add unit tests (#13) * personal data consents fix, reduce multi state subsection id * scm * [maven-release-plugin] prepare release iabgpp-core-3.0.0 * scm * scm * scm * scm * 3.0.0 * 3.0.1-SNAPSHOT * fix section names and add unit tests Co-authored-by: chad --- .../encoder/FibonacciIntegerRangeEncoder.java | 2 +- .../com/iab/gpp/encoder/section/UspCaV1.java | 2 +- .../com/iab/gpp/encoder/section/UspCoV1.java | 2 +- .../com/iab/gpp/encoder/section/UspCtV1.java | 2 +- .../com/iab/gpp/encoder/section/UspNatV1.java | 2 +- .../com/iab/gpp/encoder/section/UspUtV1.java | 2 +- .../com/iab/gpp/encoder/section/UspV1.java | 6 +- .../com/iab/gpp/encoder/section/UspVaV1.java | 2 +- .../com/iab/gpp/encoder/GppModelTest.java | 79 +++++++++++++++++-- .../datatype/EncodableFixedBitfieldTest.java | 18 +++++ .../EncodableFixedIntegerListTest.java | 4 +- .../FibonacciIntegerRangeEncoderTest.java | 16 +++- .../iab/gpp/encoder/section/HeaderV1Test.java | 1 - 13 files changed, 117 insertions(+), 21 deletions(-) create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfieldTest.java diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoder.java index 5960f92e..d5ff32b2 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoder.java @@ -27,7 +27,7 @@ public static String encode(List value) { groupStartIndex = groupEndIndex + 1; } - + String bitString = FixedIntegerEncoder.encode(groups.size(), 12); for (int i = 0; i < groups.size(); i++) { if (groups.get(i).size() == 1) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java index ed015ed3..3cff9390 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java @@ -17,7 +17,7 @@ public class UspCaV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 8; public static int VERSION = 1; - public static String NAME = "uspca"; + public static String NAME = "uspcav1"; public UspCaV1() { initFields(); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java index b69616e7..212431ab 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java @@ -17,7 +17,7 @@ public class UspCoV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 10; public static int VERSION = 1; - public static String NAME = "uspco"; + public static String NAME = "uspcov1"; public UspCoV1() { initFields(); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java index 82710a7d..47f5519a 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java @@ -17,7 +17,7 @@ public class UspCtV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 12; public static int VERSION = 1; - public static String NAME = "uspct"; + public static String NAME = "uspctv1"; public UspCtV1() { initFields(); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java index 770e0778..b36aa69c 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java @@ -17,7 +17,7 @@ public class UspNatV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 7; public static int VERSION = 1; - public static String NAME = "uspnat"; + public static String NAME = "uspnatv1"; public UspNatV1() { initFields(); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java index 366a3034..728617a5 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java @@ -14,7 +14,7 @@ public class UspUtV1 extends AbstractEncodableBitStringSection { public static int ID = 11; public static int VERSION = 1; - public static String NAME = "usput"; + public static String NAME = "usputv1"; public UspUtV1() { initFields(); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java index 2ef2e4bc..4d26d7fc 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java @@ -27,9 +27,9 @@ public UspV1(String encodedString) throws DecodingException { private void initFields() { fields = new HashMap<>(); fields.put(UspV1Field.VERSION, new EncodableFixedInteger(6, UspV1.VERSION)); - fields.put(UspV1Field.NOTICE, new EncodableFixedInteger(2)); - fields.put(UspV1Field.OPT_OUT_SALE, new EncodableFixedInteger(2)); - fields.put(UspV1Field.LSPA_COVERED, new EncodableFixedInteger(2)); + fields.put(UspV1Field.NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UspV1Field.OPT_OUT_SALE, new EncodableFixedInteger(2, 0)); + fields.put(UspV1Field.LSPA_COVERED, new EncodableFixedInteger(2, 0)); //@formatter:off fieldOrder = new String[] { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java index 55cedc36..c20658dd 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java @@ -14,7 +14,7 @@ public class UspVaV1 extends AbstractEncodableBitStringSection { public static int ID = 9; public static int VERSION = 1; - public static String NAME = "uspva"; + public static String NAME = "uspvav1"; public UspVaV1() { initFields(); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 56e2c82d..3f0369f4 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -10,10 +10,22 @@ import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.TcfCaV2Field; import com.iab.gpp.encoder.field.TcfEuV2Field; +import com.iab.gpp.encoder.field.UspCaV1Field; +import com.iab.gpp.encoder.field.UspCoV1Field; +import com.iab.gpp.encoder.field.UspCtV1Field; +import com.iab.gpp.encoder.field.UspNatV1Field; +import com.iab.gpp.encoder.field.UspUtV1Field; import com.iab.gpp.encoder.field.UspV1Field; +import com.iab.gpp.encoder.field.UspVaV1Field; import com.iab.gpp.encoder.section.TcfCaV2; import com.iab.gpp.encoder.section.TcfEuV2; +import com.iab.gpp.encoder.section.UspCaV1; +import com.iab.gpp.encoder.section.UspCoV1; +import com.iab.gpp.encoder.section.UspCtV1; +import com.iab.gpp.encoder.section.UspNatV1; +import com.iab.gpp.encoder.section.UspUtV1; import com.iab.gpp.encoder.section.UspV1; +import com.iab.gpp.encoder.section.UspVaV1; public class GppModelTest { @@ -43,6 +55,51 @@ public void testEncodeDefault() throws EncodingException { Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); } + + @Test + public void testEncodeDefaultAll() throws EncodingException { + GppModel gppModel = new GppModel(); + + Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UspNatV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UspCaV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UspVaV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UspCoV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UspUtV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UspCtV1.NAME)); + + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VERSION, TcfEuV2.VERSION); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV2Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV2Field.LAST_UPDATED, utcDateTime); + gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.VERSION, TcfCaV2.VERSION); + gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.LAST_UPDATED, utcDateTime); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.VERSION, UspV1.VERSION); + gppModel.setFieldValue(UspNatV1.NAME, UspNatV1Field.VERSION, UspNatV1.VERSION); + gppModel.setFieldValue(UspCaV1.NAME, UspCaV1Field.VERSION, UspCaV1.VERSION); + gppModel.setFieldValue(UspVaV1.NAME, UspVaV1Field.VERSION, UspVaV1.VERSION); + gppModel.setFieldValue(UspCoV1.NAME, UspCoV1Field.VERSION, UspCoV1.VERSION); + gppModel.setFieldValue(UspUtV1.NAME, UspUtV1Field.VERSION, UspUtV1.VERSION); + gppModel.setFieldValue(UspCtV1.NAME, UspCtV1Field.VERSION, UspCtV1.VERSION); + + + + Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspNatV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspCaV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspVaV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspCoV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspUtV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspCtV1.NAME)); + + String gppString = gppModel.encode(); + Assertions.assertEquals("DBACOawA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA~BAAA~BAAAAAAAAAAA.QAAA~BAAAAAAA.QAAA~BAAAAAAA~BAAAAAAA.QAAA~BAAAAAAA~BAAAAAAA.QAAA", gppString); + + } @Test public void testEncodeUspv1() throws EncodingException { @@ -295,6 +352,22 @@ public void testDecodeDefaults() throws DecodingException { Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); } + + @Test + public void testDecodeDefaultsAll() throws DecodingException { + String gppString = "DBACOawA~CPj9xr_Pj9xr_AAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPj9xr_Pj9xr_AAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA~BAAA~BAAAAAAAAAAA.QAAA~BAAAAAAA.QAAA~BAAAAAAA~BAAAAAAA.QAAA~BAAAAAAA~BAAAAAAA.QAAA"; + GppModel gppModel = new GppModel(gppString); + + Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspNatV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspCaV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspVaV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspCoV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspUtV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UspCtV1.NAME)); + } @Test public void testDecodeUspv1() throws DecodingException { @@ -507,10 +580,4 @@ public void testDecodeUspv1AndTcfEuV2AndTcfCaV2() throws DecodingException { Assertions.assertEquals(3, tcfCaV2Section.getPubPurposesSegmentType()); } - @Test - public void testFoo() throws DecodingException { - String gppString = - "DBACNYAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BbAA"; - GppModel gppModel = new GppModel(gppString); - } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfieldTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfieldTest.java new file mode 100644 index 00000000..f448f433 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfieldTest.java @@ -0,0 +1,18 @@ +package com.iab.gpp.encoder.datatype; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class EncodableFixedBitfieldTest { + + @Test + public void testSubstring1() { + Assertions.assertEquals("000", new EncodableFixedBitfield(3).substring("10001", 1)); + } + + @Test + public void testSubstring2() { + Assertions.assertEquals("111", new EncodableFixedBitfield(3).substring("01110", 1)); + } + +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java index 3969cd48..9d33e1da 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java @@ -7,12 +7,12 @@ public class EncodableFixedIntegerListTest { @Test public void testSubstring1() { - Assertions.assertEquals("000", new EncodableFixedBitfield(3).substring("10001", 1)); + Assertions.assertEquals("1000", new EncodableFixedIntegerList(2, 2).substring("10001", 0)); } @Test public void testSubstring2() { - Assertions.assertEquals("111", new EncodableFixedBitfield(3).substring("01110", 1)); + Assertions.assertEquals("1110", new EncodableFixedIntegerList(2, 2).substring("01110", 1)); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java index 4a7a6c76..af52512b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java @@ -38,6 +38,12 @@ public void testEncode6() { Assertions.assertEquals("0000000000100001110110011", FibonacciIntegerRangeEncoder.encode(Arrays.asList(3, 5, 6, 7, 8))); } + + @Test + public void testEncode7() { + Assertions.assertEquals("00000000001000111001101011", + FibonacciIntegerRangeEncoder.encode(Arrays.asList(2, 5, 6, 7, 8, 9, 10, 11, 12))); + } @Test public void testDecode1() throws DecodingException { @@ -64,9 +70,15 @@ public void testDecode5() throws DecodingException { Assertions.assertEquals(Arrays.asList(3, 5, 6, 7, 8), FibonacciIntegerRangeEncoder.decode("0000000000100001110110011")); } + + @Test + public void testDecode6() throws DecodingException { + Assertions.assertEquals(Arrays.asList(2, 5, 6, 7, 8, 9, 10, 11, 12), + FibonacciIntegerRangeEncoder.decode("00000000001000111001101011")); + } @Test - public void testDecode6() { + public void testDecode7() { try { FibonacciIntegerRangeEncoder.decode("0011"); Assertions.fail("DecodingException expected"); @@ -76,7 +88,7 @@ public void testDecode6() { } @Test - public void testDecode7() { + public void testDecode8() { try { FibonacciIntegerRangeEncoder.decode("000000000002"); Assertions.fail("DecodingException expected"); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java index e04fa42c..997941f1 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java @@ -101,5 +101,4 @@ public void testDecode3() throws DecodingException { Assertions.assertEquals(headerV1.getFieldValue("Version"), headerV1.getVersion()); Assertions.assertEquals(headerV1.getFieldValue("SectionIds"), headerV1.getSectionsIds()); } - } From 569a002ad44d27c958b682e44632fc1bb5095aac Mon Sep 17 00:00:00 2001 From: chuff Date: Tue, 13 Dec 2022 16:36:14 -0700 Subject: [PATCH 08/41] 3.0.1 (#14) * personal data consents fix, reduce multi state subsection id * scm * [maven-release-plugin] prepare release iabgpp-core-3.0.0 * scm * scm * scm * scm * 3.0.0 * 3.0.1-SNAPSHOT * fix section names and add unit tests * 3.0.1 * 3.1.0-SNAPSHOT * cleanup * fix groupId in README * fix groupId in README * fix groupId in README Co-authored-by: chad --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e69080b3..f2253a84 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ Encode/decode consent information with the IAB GPP Framework #### Maven -The official iabgpp java library is distributed through maven central. Please [search maven central](https://search.maven.org/search?q=g:com.iab.gpp) for the current release version. +The official iabgpp java library is distributed through maven central. Please [search maven central](https://search.maven.org/search?q=g:com.iabgpp) for the current release version. #### Decoding ``` - com.iab.gpp + com.iabgpp iabgpp-encoder VERSION @@ -39,7 +39,7 @@ Integer uspV1Notice = uspV1Section.getNotice(); ``` - com.iab.gpp + com.iabgpp iabgpp-encoder VERSION @@ -78,13 +78,13 @@ List respectively. The `iabgpp-extras-jackson` library uses Jackson 2.10.3 to pa ``` - com.iab.gpp + com.iabgpp iabgpp-extras VERSION - com.iab.gpp + com.iabgpp iabgpp-extras-jackson VERSION From 888f6e8786d888926b67f73497015106c810a60c Mon Sep 17 00:00:00 2001 From: chuff Date: Thu, 22 Dec 2022 07:54:29 -0700 Subject: [PATCH 09/41] Convenience Methods (#15) * personal data consents fix, reduce multi state subsection id * scm * [maven-release-plugin] prepare release iabgpp-core-3.0.0 * scm * scm * scm * scm * 3.0.0 * 3.0.1-SNAPSHOT * fix section names and add unit tests * 3.0.1 * 3.1.0-SNAPSHOT * cleanup * fix groupId in README * fix groupId in README * fix groupId in README * convenience methods * 3.0.2 * 3.1.0-SNAPSHOT Co-authored-by: chad --- .../main/java/com/iab/gpp/encoder/GppModel.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index 61a7e0d2..c640e07b 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -128,7 +128,21 @@ public EncodableSection getSection(String sectionName) { return null; } } + + public void deleteSection(int sectionId) { + deleteSection(Sections.SECTION_ID_NAME_MAP.get(sectionId)); + } + + public void deleteSection(String sectionName) { + if (this.sections.containsKey(sectionName)) { + this.sections.remove(sectionName); + } + } + public void clear() { + this.sections.clear(); + } + public TcfCaV2 getTcfCaV2Section() { return (TcfCaV2) getSection(TcfCaV2.NAME); } From 3b0e704dff93f3ff5b332a96886ebf668ddadf9d Mon Sep 17 00:00:00 2001 From: chuff Date: Sun, 1 Jan 2023 10:06:40 -0700 Subject: [PATCH 10/41] full list of fields to readme (#16) * personal data consents fix, reduce multi state subsection id * scm * [maven-release-plugin] prepare release iabgpp-core-3.0.0 * scm * scm * scm * scm * 3.0.0 * 3.0.1-SNAPSHOT * fix section names and add unit tests * 3.0.1 * 3.1.0-SNAPSHOT * cleanup * fix groupId in README * fix groupId in README * fix groupId in README * convenience methods * 3.0.2 * 3.1.0-SNAPSHOT * full list of fields to readme * rename array to list in readme Co-authored-by: chad --- README.md | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) diff --git a/README.md b/README.md index f2253a84..a5b31921 100644 --- a/README.md +++ b/README.md @@ -112,3 +112,144 @@ String cmpListContent = "..."; Loader loader = new Loader(); CmpList cmpList = loader.cmpList(cmpListContent); ``` + +### Fields + +|Section Name|Section ID|Field|Data Type/Value| +|------------|----------|-----|---------------| +|tcfeuv2|2|Version|6 bit int. Value is 2.| +|tcfeuv2|2|Created|Datetime. Updated when fields are set| +|tcfeuv2|2|LastUpdated|Datetime. Updated when fields are set| +|tcfeuv2|2|CmpId|12 bit int| +|tcfeuv2|2|CmpVersion|12 bit int| +|tcfeuv2|2|ConsentScreen|6 bit int| +|tcfeuv2|2|ConsentLanguage|2 character country code| +|tcfeuv2|2|VendorListVersion|12 bit int| +|tcfeuv2|2|PolicyVersion|6 bit int. Value is 2| +|tcfeuv2|2|IsServiceSpecific|Boolean| +|tcfeuv2|2|UseNonStandardStacks|Boolean| +|tcfeuv2|2|SpecialFeatureOptins|Boolean list of size 12| +|tcfeuv2|2|PurposeConsents|Boolean list of size 24| +|tcfeuv2|2|PurposeLegitimateInterests|Boolean list of size 24| +|tcfeuv2|2|PurposeOneTreatment|Boolean| +|tcfeuv2|2|PublisherCountryCode|2 character country code| +|tcfeuv2|2|VendorConsents|Integer list of variable size| +|tcfeuv2|2|VendorLegitimateInterests|Integer list of variable size| +|tcfeuv2|2|PublisherRestrictions|Integer list of variable size| +|tcfeuv2|2|PublisherPurposesSegmentType|3 bit int. Value is 3| +|tcfeuv2|2|PublisherConsents|Boolean list of size 24| +|tcfeuv2|2|PublisherLegitimateInterests|Boolean list of size 24| +|tcfeuv2|2|NumCustomPurposes|6 bit int| +|tcfeuv2|2|PublisherCustomConsents|Boolean list where size is set by the NumCustomPurposes field| +|tcfeuv2|2|PublisherCustomLegitimateInterests|Boolean list where size is set by the NumCustomPurposes field| +|tcfeuv2|2|VendorsAllowedSegmentType|3 bit int. Value is 2| +|tcfeuv2|2|VendorsAllowed|Integer list of variable size| +|tcfeuv2|2|VendorsDisclosedSegmentType|3 bit int. Value is 1| +|tcfeuv2|2|VendorsDisclosed|Integer list of variable size| +|tcfcav2|5|Version|6 bit int. Value is 2.| +|tcfcav2|5|Created|Datetime. Updated when any fields are set| +|tcfcav2|5|LastUpdated|Datetime. Updated when any fields are set| +|tcfcav2|5|CmpId|12 bit int| +|tcfcav2|5|CmpVersion|12 bit int| +|tcfcav2|5|ConsentScreen|6 bit int| +|tcfcav2|5|ConsentLanguage|2 character country code| +|tcfcav2|5|VendorListVersion|12 bit int| +|tcfcav2|5|TcfPolicyVersion|6 bit int. Value is 2.| +|tcfcav2|5|UseNonStandardStacks|Boolean| +|tcfcav2|5|SpecialFeatureExpressConsent|Boolean list of size 12| +|tcfcav2|5|PurposesExpressConsent|Boolean list of size 24| +|tcfcav2|5|PurposesImpliedConsent|Boolean list of size 24| +|tcfcav2|5|VendorExpressConsent|Integer list of variable size| +|tcfcav2|5|VendorImpliedConsent|Integer list of variable size| +|tcfcav2|5|PubPurposesSegmentType|3 bit int. Value is 3| +|tcfcav2|5|PubPurposesExpressConsent|Boolean list of size 24| +|tcfcav2|5|PubPurposesImpliedConsent|Boolean list of size 24| +|tcfcav2|5|NumCustomPurposes|6 bit int| +|tcfcav2|5|CustomPurposesExpressConsent|Boolean list where size is set by the NumCustomPurposes field| +|tcfcav2|5|CustomPurposesImpliedConsent|Boolean list where size is set by the NumCustomPurposes field| +|uspv1|6|Version|6 bit int. Value is 1| +|uspv1|6|Notice|2 bit int| +|uspv1|6|OptOutSale|2 bit int| +|uspv1|6|LspaCovered|2 bit int| +|uspnatv1|7|Version|6 bit int. Value is 1| +|uspnatv1|7|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|SharingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|SensitiveDataProcessingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|SensitiveDataLimitUseNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|SharingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|SensitiveDataProcessing|2 bit int list of size 12. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|KnownChildSensitiveDataConsents|2 bit int list of size 2. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|PersonalDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspnatv1|7|GpcSegmentType|2 bit int. Value is 1| +|uspnatv1|7|Gpc|Boolean| +|uspcav1|8|Version|6 bit int. Value is 1| +|uspcav1|8|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcav1|8|SharingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcav1|8|SensitiveDataLimitUseNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcav1|8|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcav1|8|SharingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcav1|8|SensitiveDataProcessing|2 bit int list of size 9. 0=Not applicable, 1=Yes, 2=No| +|uspcav1|8|KnownChildSensitiveDataConsents|2 bit int list of size 2. 0=Not applicable, 1=Yes, 2=No| +|uspcav1|8|PersonalDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcav1|8|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcav1|8|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcav1|8|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcav1|8|GpcSegmentType|2 bit int. Value is 1| +|uspcav1|8|Gpc|Boolean| +|uspvav1|9|Version|6 bit int. Value is 1| +|uspvav1|9|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspvav1|9|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspvav1|9|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspvav1|9|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspvav1|9|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspvav1|9|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| +|uspvav1|9|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspvav1|9|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspvav1|9|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspvav1|9|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcov1|10|Version|6 bit int. Value is 1| +|uspcov1|10|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcov1|10|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcov1|10|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcov1|10|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcov1|10|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcov1|10|SensitiveDataProcessing|2 bit int list of size 7. 0=Not applicable, 1=Yes, 2=No| +|uspcov1|10|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcov1|10|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcov1|10|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcov1|10|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspcov1|10|GpcSegmentType|2 bit int. Value is 1| +|uspcov1|10|Gpc|Boolean| +|usputv1|11|Version|6 bit int. Value is 1| +|usputv1|11|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usputv1|11|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usputv1|11|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usputv1|11|SensitiveDataProcessingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usputv1|11|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usputv1|11|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usputv1|11|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| +|usputv1|11|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usputv1|11|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usputv1|11|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usputv1|11|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspctv1|12|Version|6 bit int. Value is 1| +|uspctv1|12|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspctv1|12|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspctv1|12|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspctv1|12|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspctv1|12|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspctv1|12|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| +|uspctv1|12|KnownChildSensitiveDataConsents|2 bit int list of size 3. 0=Not applicable, 1=Yes, 2=No| +|uspctv1|12|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspctv1|12|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspctv1|12|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uspctv1|12|GpcSegmentType|2 bit int. Value is 1| +|uspctv1|12|Gpc|Boolean| + From 4d08f67c7a00be9f97bf71c5636b800913c76040 Mon Sep 17 00:00:00 2001 From: chuff Date: Tue, 10 Jan 2023 08:33:23 -0700 Subject: [PATCH 11/41] tcfeuv2 backwards compatible (#19) * Exception handling * compressed base64urlencoder for all non-tcfeuv2 segments * Revert uspv1 to original encoding * Rename tcfcav2 to tcfcav1 * update readme for tcfcav2 -> tcfcav1 and uspv1 changes * optional gpc segments * update readme with GpcSegmentIncluded fields * fix vendor list encoding / decoding * formatting * 3.0.3 * version bump Co-authored-by: chad --- README.md | 48 +-- iabgpp-encoder/pom.xml | 2 +- .../java/com/iab/gpp/encoder/GppModel.java | 46 +-- .../EncodableOptimizedFibonacciRange.java | 4 +- .../EncodableOptimizedFixedRange.java | 5 +- ...der.java => AbstractBase64UrlEncoder.java} | 17 +- .../encoder/CompressedBase64UrlEncoder.java | 17 + .../encoder/FibonacciIntegerRangeEncoder.java | 2 +- .../encoder/FixedIntegerListEncoder.java | 14 +- .../encoder/TraditionalBase64UrlEncoder.java | 13 + .../{TcfCaV2Field.java => TcfCaV1Field.java} | 4 +- .../iab/gpp/encoder/field/UspCaV1Field.java | 1 + .../iab/gpp/encoder/field/UspCoV1Field.java | 1 + .../iab/gpp/encoder/field/UspCtV1Field.java | 1 + .../iab/gpp/encoder/field/UspNatV1Field.java | 1 + ...actEncodableSegmentedBitStringSection.java | 20 +- .../com/iab/gpp/encoder/section/HeaderV1.java | 13 +- .../com/iab/gpp/encoder/section/Sections.java | 6 +- .../section/{TcfCaV2.java => TcfCaV1.java} | 167 +++++----- .../com/iab/gpp/encoder/section/TcfEuV2.java | 30 +- .../com/iab/gpp/encoder/section/UspCaV1.java | 37 ++- .../com/iab/gpp/encoder/section/UspCoV1.java | 35 +- .../com/iab/gpp/encoder/section/UspCtV1.java | 42 ++- .../com/iab/gpp/encoder/section/UspNatV1.java | 36 +- .../com/iab/gpp/encoder/section/UspUtV1.java | 12 +- .../com/iab/gpp/encoder/section/UspV1.java | 87 +++-- .../iab/gpp/encoder/section/UspV1Legacy.java | 101 ------ .../com/iab/gpp/encoder/section/UspVaV1.java | 12 +- .../com/iab/gpp/encoder/GppModelTest.java | 309 +++++++++--------- .../EncodableOptimizedFixedRangeTest.java | 37 +++ .../FibonacciIntegerRangeEncoderTest.java | 4 +- .../encoder/FixedIntegerListEncoderTest.java | 4 +- .../encoder/FixedIntegerRangeEncoderTest.java | 41 ++- ...a => TraditionalBase64UrlEncoderTest.java} | 16 +- .../iab/gpp/encoder/section/HeaderV1Test.java | 10 +- .../{TcfCaV2Test.java => TcfCaV1Test.java} | 124 +++---- .../iab/gpp/encoder/section/TcfEuV2Test.java | 110 +++++++ .../iab/gpp/encoder/section/UspCaV1Test.java | 48 ++- .../iab/gpp/encoder/section/UspCoV1Test.java | 60 +++- .../iab/gpp/encoder/section/UspCtV1Test.java | 58 +++- .../iab/gpp/encoder/section/UspNatV1Test.java | 54 ++- .../iab/gpp/encoder/section/UspUtV1Test.java | 30 +- .../gpp/encoder/section/UspV1LegacyTest.java | 64 ---- .../iab/gpp/encoder/section/UspV1Test.java | 47 +-- .../iab/gpp/encoder/section/UspVaV1Test.java | 34 +- iabgpp-extras-jackson/pom.xml | 4 +- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 48 files changed, 1055 insertions(+), 777 deletions(-) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/{Base64UrlEncoder.java => AbstractBase64UrlEncoder.java} (87%) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/CompressedBase64UrlEncoder.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoder.java rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{TcfCaV2Field.java => TcfCaV1Field.java} (97%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/{TcfCaV2.java => TcfCaV1.java} (52%) delete mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1Legacy.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java rename iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/{Base64UrlEncoderTest.java => TraditionalBase64UrlEncoderTest.java} (65%) rename iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/{TcfCaV2Test.java => TcfCaV1Test.java} (56%) delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1LegacyTest.java diff --git a/README.md b/README.md index a5b31921..9bd93b05 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ import com.iab.gpp.encoder.GppModel; import com.iab.gpp.encoder.section.TcfEuV2; import com.iab.gpp.encoder.section.UspV1; -String gppString = "DBACNYAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BbAA"; +String gppString = "DBACNYA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~1YNN"; GppModel gppModel = new GppModel(gppString); TcfEuV2 tcfEuV2Section = (TcfEuV2)gppModel.getSection(TcfEuV2.NAME); @@ -146,27 +146,27 @@ CmpList cmpList = loader.cmpList(cmpListContent); |tcfeuv2|2|VendorsAllowed|Integer list of variable size| |tcfeuv2|2|VendorsDisclosedSegmentType|3 bit int. Value is 1| |tcfeuv2|2|VendorsDisclosed|Integer list of variable size| -|tcfcav2|5|Version|6 bit int. Value is 2.| -|tcfcav2|5|Created|Datetime. Updated when any fields are set| -|tcfcav2|5|LastUpdated|Datetime. Updated when any fields are set| -|tcfcav2|5|CmpId|12 bit int| -|tcfcav2|5|CmpVersion|12 bit int| -|tcfcav2|5|ConsentScreen|6 bit int| -|tcfcav2|5|ConsentLanguage|2 character country code| -|tcfcav2|5|VendorListVersion|12 bit int| -|tcfcav2|5|TcfPolicyVersion|6 bit int. Value is 2.| -|tcfcav2|5|UseNonStandardStacks|Boolean| -|tcfcav2|5|SpecialFeatureExpressConsent|Boolean list of size 12| -|tcfcav2|5|PurposesExpressConsent|Boolean list of size 24| -|tcfcav2|5|PurposesImpliedConsent|Boolean list of size 24| -|tcfcav2|5|VendorExpressConsent|Integer list of variable size| -|tcfcav2|5|VendorImpliedConsent|Integer list of variable size| -|tcfcav2|5|PubPurposesSegmentType|3 bit int. Value is 3| -|tcfcav2|5|PubPurposesExpressConsent|Boolean list of size 24| -|tcfcav2|5|PubPurposesImpliedConsent|Boolean list of size 24| -|tcfcav2|5|NumCustomPurposes|6 bit int| -|tcfcav2|5|CustomPurposesExpressConsent|Boolean list where size is set by the NumCustomPurposes field| -|tcfcav2|5|CustomPurposesImpliedConsent|Boolean list where size is set by the NumCustomPurposes field| +|tcfcav1|5|Version|6 bit int. Value is 2.| +|tcfcav1|5|Created|Datetime. Updated when any fields are set| +|tcfcav1|5|LastUpdated|Datetime. Updated when any fields are set| +|tcfcav1|5|CmpId|12 bit int| +|tcfcav1|5|CmpVersion|12 bit int| +|tcfcav1|5|ConsentScreen|6 bit int| +|tcfcav1|5|ConsentLanguage|2 character country code| +|tcfcav1|5|VendorListVersion|12 bit int| +|tcfcav1|5|TcfPolicyVersion|6 bit int. Value is 2.| +|tcfcav1|5|UseNonStandardStacks|Boolean| +|tcfcav1|5|SpecialFeatureExpressConsent|Boolean list of size 12| +|tcfcav1|5|PurposesExpressConsent|Boolean list of size 24| +|tcfcav1|5|PurposesImpliedConsent|Boolean list of size 24| +|tcfcav1|5|VendorExpressConsent|Integer list of variable size| +|tcfcav1|5|VendorImpliedConsent|Integer list of variable size| +|tcfcav1|5|PubPurposesSegmentType|3 bit int. Value is 3| +|tcfcav1|5|PubPurposesExpressConsent|Boolean list of size 24| +|tcfcav1|5|PubPurposesImpliedConsent|Boolean list of size 24| +|tcfcav1|5|NumCustomPurposes|6 bit int| +|tcfcav1|5|CustomPurposesExpressConsent|Boolean list where size is set by the NumCustomPurposes field| +|tcfcav1|5|CustomPurposesImpliedConsent|Boolean list where size is set by the NumCustomPurposes field| |uspv1|6|Version|6 bit int. Value is 1| |uspv1|6|Notice|2 bit int| |uspv1|6|OptOutSale|2 bit int| @@ -188,6 +188,7 @@ CmpList cmpList = loader.cmpList(cmpListContent); |uspnatv1|7|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| |uspnatv1|7|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| |uspnatv1|7|GpcSegmentType|2 bit int. Value is 1| +|uspnatv1|7|GpcSegmentIncluded|Boolean. Default value is true| |uspnatv1|7|Gpc|Boolean| |uspcav1|8|Version|6 bit int. Value is 1| |uspcav1|8|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| @@ -202,6 +203,7 @@ CmpList cmpList = loader.cmpList(cmpListContent); |uspcav1|8|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| |uspcav1|8|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| |uspcav1|8|GpcSegmentType|2 bit int. Value is 1| +|uspcav1|8|GpcSegmentIncluded|Boolean. Default value is true| |uspcav1|8|Gpc|Boolean| |uspvav1|9|Version|6 bit int. Value is 1| |uspvav1|9|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| @@ -226,6 +228,7 @@ CmpList cmpList = loader.cmpList(cmpListContent); |uspcov1|10|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| |uspcov1|10|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| |uspcov1|10|GpcSegmentType|2 bit int. Value is 1| +|uspcov1|10|GpcSegmentIncluded|Boolean. Default value is true| |uspcov1|10|Gpc|Boolean| |usputv1|11|Version|6 bit int. Value is 1| |usputv1|11|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| @@ -251,5 +254,6 @@ CmpList cmpList = loader.cmpList(cmpListContent); |uspctv1|12|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| |uspctv1|12|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| |uspctv1|12|GpcSegmentType|2 bit int. Value is 1| +|uspctv1|12|GpcSegmentIncluded|Boolean. Default value is true| |uspctv1|12|Gpc|Boolean| diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index 26bfb8aa..cc430d85 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.0-SNAPSHOT + 3.0.4-SNAPSHOT iabgpp-encoder diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index c640e07b..12ae0c49 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -10,7 +10,7 @@ import com.iab.gpp.encoder.section.EncodableSection; import com.iab.gpp.encoder.section.HeaderV1; import com.iab.gpp.encoder.section.Sections; -import com.iab.gpp.encoder.section.TcfCaV2; +import com.iab.gpp.encoder.section.TcfCaV1; import com.iab.gpp.encoder.section.TcfEuV2; import com.iab.gpp.encoder.section.UspCaV1; import com.iab.gpp.encoder.section.UspCoV1; @@ -22,7 +22,7 @@ public class GppModel { private Map sections = new HashMap<>(); - + public GppModel() { } @@ -36,13 +36,13 @@ public GppModel(String encodedString) throws DecodingException { public void setFieldValue(int sectionId, String fieldName, Object value) { setFieldValue(Sections.SECTION_ID_NAME_MAP.get(sectionId), fieldName, value); } - + public void setFieldValue(String sectionName, String fieldName, Object value) { EncodableSection section = null; if (!this.sections.containsKey(sectionName)) { - if (sectionName.equals(TcfCaV2.NAME)) { - section = new TcfCaV2(); - this.sections.put(TcfCaV2.NAME, section); + if (sectionName.equals(TcfCaV1.NAME)) { + section = new TcfCaV1(); + this.sections.put(TcfCaV1.NAME, section); } else if (sectionName.equals(TcfEuV2.NAME)) { section = new TcfEuV2(); this.sections.put(TcfEuV2.NAME, section); @@ -82,7 +82,7 @@ public void setFieldValue(String sectionName, String fieldName, Object value) { public Object getFieldValue(int sectionId, String fieldName) { return getFieldValue(Sections.SECTION_ID_NAME_MAP.get(sectionId), fieldName); } - + public Object getFieldValue(String sectionName, String fieldName) { if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).getFieldValue(fieldName); @@ -94,7 +94,7 @@ public Object getFieldValue(String sectionName, String fieldName) { public boolean hasField(int sectionId, String fieldName) { return hasField(Sections.SECTION_ID_NAME_MAP.get(sectionId), fieldName); } - + public boolean hasField(String sectionName, String fieldName) { if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).hasField(fieldName); @@ -106,7 +106,7 @@ public boolean hasField(String sectionName, String fieldName) { public boolean hasSection(int sectionId) { return hasSection(Sections.SECTION_ID_NAME_MAP.get(sectionId)); } - + public boolean hasSection(String sectionName) { return this.sections.containsKey(sectionName); } @@ -120,7 +120,7 @@ public HeaderV1 getHeader() { public EncodableSection getSection(int sectionId) { return getSection(Sections.SECTION_ID_NAME_MAP.get(sectionId)); } - + public EncodableSection getSection(String sectionName) { if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName); @@ -128,11 +128,11 @@ public EncodableSection getSection(String sectionName) { return null; } } - + public void deleteSection(int sectionId) { deleteSection(Sections.SECTION_ID_NAME_MAP.get(sectionId)); } - + public void deleteSection(String sectionName) { if (this.sections.containsKey(sectionName)) { this.sections.remove(sectionName); @@ -142,9 +142,9 @@ public void deleteSection(String sectionName) { public void clear() { this.sections.clear(); } - - public TcfCaV2 getTcfCaV2Section() { - return (TcfCaV2) getSection(TcfCaV2.NAME); + + public TcfCaV1 getTcfCaV1Section() { + return (TcfCaV1) getSection(TcfCaV1.NAME); } public TcfEuV2 getTcfEuV2Section() { @@ -224,9 +224,9 @@ public void decode(String str) throws DecodingException { if (sectionIds.get(i).equals(TcfEuV2.ID)) { TcfEuV2 section = new TcfEuV2(encodedSections[i + 1]); this.sections.put(TcfEuV2.NAME, section); - } else if (sectionIds.get(i).equals(TcfCaV2.ID)) { - TcfCaV2 section = new TcfCaV2(encodedSections[i + 1]); - this.sections.put(TcfCaV2.NAME, section); + } else if (sectionIds.get(i).equals(TcfCaV1.ID)) { + TcfCaV1 section = new TcfCaV1(encodedSections[i + 1]); + this.sections.put(TcfCaV1.NAME, section); } else if (sectionIds.get(i).equals(UspV1.ID)) { UspV1 section = new UspV1(encodedSections[i + 1]); this.sections.put(UspV1.NAME, section); @@ -255,7 +255,7 @@ public void decode(String str) throws DecodingException { public String encodeSection(int sectionId) throws EncodingException { return encodeSection(Sections.SECTION_ID_NAME_MAP.get(sectionId)); } - + public String encodeSection(String sectionName) throws EncodingException { if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).encode(); @@ -267,16 +267,16 @@ public String encodeSection(String sectionName) throws EncodingException { public void decodeSection(int sectionId, String encodedString) throws DecodingException { decodeSection(Sections.SECTION_ID_NAME_MAP.get(sectionId), encodedString); } - + public void decodeSection(String sectionName, String encodedString) throws DecodingException { EncodableSection section = null; if (!this.sections.containsKey(sectionName)) { if (sectionName.equals(TcfEuV2.NAME)) { section = new TcfEuV2(); this.sections.put(TcfEuV2.NAME, section); - } else if (sectionName.equals(TcfCaV2.NAME)) { - section = new TcfCaV2(); - this.sections.put(TcfCaV2.NAME, section); + } else if (sectionName.equals(TcfCaV1.NAME)) { + section = new TcfCaV1(); + this.sections.put(TcfCaV1.NAME, section); } else if (sectionName.equals(UspV1.NAME)) { section = new UspV1(); this.sections.put(UspV1.NAME, section); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java index 43dcf112..37630a8b 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java @@ -27,7 +27,7 @@ public String encode() throws EncodingException { int bitFieldLength = max; if (rangeLength <= bitFieldLength) { - return "1" + FixedIntegerEncoder.encode(max, 16) + rangeBitString; + return FixedIntegerEncoder.encode(max, 16) + "1" + rangeBitString; } else { List bits = new ArrayList<>(); int index = 0; @@ -39,7 +39,7 @@ public String encode() throws EncodingException { bits.add(false); } } - return "0" + FixedIntegerEncoder.encode(max, 16) + FixedBitfieldEncoder.encode(bits, bitFieldLength); + return FixedIntegerEncoder.encode(max, 16) + "0" + FixedBitfieldEncoder.encode(bits, bitFieldLength); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java index 0fb2b7d3..a08428c6 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java @@ -27,7 +27,7 @@ public String encode() throws EncodingException { int bitFieldLength = max; if (rangeLength <= bitFieldLength) { - return "1" + FixedIntegerEncoder.encode(max, 16) + rangeBitString; + return FixedIntegerEncoder.encode(max, 16) + "1" + rangeBitString; } else { List bits = new ArrayList<>(); int index = 0; @@ -39,7 +39,8 @@ public String encode() throws EncodingException { bits.add(false); } } - return "0" + FixedIntegerEncoder.encode(max, 16) + FixedBitfieldEncoder.encode(bits, bitFieldLength); + + return FixedIntegerEncoder.encode(max, 16) + "0" + FixedBitfieldEncoder.encode(bits, bitFieldLength); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/AbstractBase64UrlEncoder.java similarity index 87% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoder.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/AbstractBase64UrlEncoder.java index d2517f5e..698a0994 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/AbstractBase64UrlEncoder.java @@ -7,7 +7,10 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -public class Base64UrlEncoder { +public abstract class AbstractBase64UrlEncoder { + + abstract protected String pad(String bitString); + /** * Base 64 URL character set. Different from standard Base64 char set in that '+' and '/' are * replaced with '-' and '_'. @@ -28,15 +31,13 @@ public class Base64UrlEncoder { private static Pattern BASE64URL_VERIFICATION_PATTERN = Pattern.compile("^[A-Za-z0-9\\-_]*$", Pattern.CASE_INSENSITIVE); - public static String encode(String bitString) throws EncodingException { + public String encode(String bitString) throws EncodingException { // should only be 0 or 1 if (!BITSTRING_VERIFICATION_PATTERN.matcher(bitString).matches()) { throw new EncodingException("Unencodable Base64Url '" + bitString + "'"); } - while (bitString.length() % 24 > 0) { - bitString += "0"; - } + bitString = pad(bitString); String str = ""; @@ -46,7 +47,7 @@ public static String encode(String bitString) throws EncodingException { try { int n = FixedIntegerEncoder.decode(s); - Character c = Base64UrlEncoder.DICT.charAt(n); + Character c = AbstractBase64UrlEncoder.DICT.charAt(n); str += c; index += 6; } catch (DecodingException e) { @@ -57,7 +58,7 @@ public static String encode(String bitString) throws EncodingException { return str; } - public static String decode(String str) throws DecodingException { + public String decode(String str) throws DecodingException { // should contain only characters from the base64url set if (!BASE64URL_VERIFICATION_PATTERN.matcher(str).matches()) { throw new DecodingException("Undecodable Base64URL string"); @@ -67,7 +68,7 @@ public static String decode(String str) throws DecodingException { for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); - Integer n = Base64UrlEncoder.REVERSE_DICT.get(c); + Integer n = AbstractBase64UrlEncoder.REVERSE_DICT.get(c); String s = FixedIntegerEncoder.encode(n, 6); bitString += s; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/CompressedBase64UrlEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/CompressedBase64UrlEncoder.java new file mode 100644 index 00000000..c41e7465 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/CompressedBase64UrlEncoder.java @@ -0,0 +1,17 @@ +package com.iab.gpp.encoder.datatype.encoder; + +public class CompressedBase64UrlEncoder extends AbstractBase64UrlEncoder { + + @Override + protected String pad(String bitString) { + while (bitString.length() % 8 > 0) { + bitString += "0"; + } + while (bitString.length() % 6 > 0) { + bitString += "0"; + } + + return bitString; + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoder.java index d5ff32b2..5960f92e 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoder.java @@ -27,7 +27,7 @@ public static String encode(List value) { groupStartIndex = groupEndIndex + 1; } - + String bitString = FixedIntegerEncoder.encode(groups.size(), 12); for (int i = 0; i < groups.size(); i++) { if (groups.get(i).size() == 1) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java index 6f1d191a..ba829322 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java @@ -30,22 +30,22 @@ public static List decode(String bitString, int elementBitStringLength, throw new DecodingException("Undecodable FixedIntegerList '" + bitString + "'"); } - if(bitString.length() > elementBitStringLength * numElements) { + if (bitString.length() > elementBitStringLength * numElements) { throw new DecodingException("Undecodable FixedIntegerList '" + bitString + "'"); } - - if(bitString.length() % elementBitStringLength != 0) { + + if (bitString.length() % elementBitStringLength != 0) { throw new DecodingException("Undecodable FixedIntegerList '" + bitString + "'"); } - + while (bitString.length() < elementBitStringLength * numElements) { bitString += "0"; } - - if(bitString.length() > elementBitStringLength * numElements) { + + if (bitString.length() > elementBitStringLength * numElements) { bitString = bitString.substring(0, elementBitStringLength * numElements); } - + List value = new ArrayList<>(); for (int i = 0; i < bitString.length(); i += elementBitStringLength) { value.add(FixedIntegerEncoder.decode(bitString.substring(i, i + elementBitStringLength))); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoder.java new file mode 100644 index 00000000..848bbfe5 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoder.java @@ -0,0 +1,13 @@ +package com.iab.gpp.encoder.datatype.encoder; + +public class TraditionalBase64UrlEncoder extends AbstractBase64UrlEncoder { + + @Override + protected String pad(String bitString) { + while (bitString.length() % 24 > 0) { + bitString += "0"; + } + return bitString; + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV2Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV1Field.java similarity index 97% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV2Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV1Field.java index 6069f9b1..86c91dff 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV2Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV1Field.java @@ -1,6 +1,6 @@ package com.iab.gpp.encoder.field; -public class TcfCaV2Field { +public class TcfCaV1Field { public static String VERSION = "Version"; public static String CREATED = "Created"; @@ -17,7 +17,7 @@ public class TcfCaV2Field { public static String PURPOSES_IMPLIED_CONSENT = "PurposesImpliedConsent"; public static String VENDOR_EXPRESS_CONSENT = "VendorExpressConsent"; public static String VENDOR_IMPLIED_CONSENT = "VendorImpliedConsent"; - + public static String PUB_PURPOSES_SEGMENT_TYPE = "PubPurposesSegmentType"; public static String PUB_PURPOSES_EXPRESS_CONSENT = "PubPurposesExpressConsent"; public static String PUB_PURPOSES_IMPLIED_CONSENT = "PubPurposesImpliedConsent"; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java index 33e623c4..12b30576 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java @@ -16,6 +16,7 @@ public class UspCaV1Field { public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; public static String GPC = "Gpc"; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java index 95e75882..21265235 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java @@ -15,5 +15,6 @@ public class UspCoV1Field { public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; public static String GPC = "Gpc"; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java index 8090c50e..56bdb071 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java @@ -15,5 +15,6 @@ public class UspCtV1Field { public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; public static String GPC = "Gpc"; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java index 033957fd..8707a5e3 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java @@ -20,6 +20,7 @@ public class UspNatV1Field { public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; public static String GPC = "Gpc"; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java index 2b796fbf..c64b45e7 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java @@ -45,8 +45,12 @@ public List encodeSegmentsToBitStrings() throws EncodingException { for (int j = 0; j < this.segments[i].length; j++) { String fieldName = this.segments[i][j]; if (this.fields.containsKey(fieldName)) { - AbstractEncodableBitStringDataType field = this.fields.get(fieldName); - segmentBitString += field.encode(); + try { + AbstractEncodableBitStringDataType field = this.fields.get(fieldName); + segmentBitString += field.encode(); + } catch (Exception e) { + throw new Error("Unable to encode " + fieldName, e); + } } else { throw new Error("Field not found: '" + fieldName + "'"); } @@ -65,10 +69,14 @@ public void decodeSegmentsFromBitStrings(List segmentBitStrings) throws for (int j = 0; j < this.segments[i].length; j++) { String fieldName = this.segments[i][j]; if (this.fields.containsKey(fieldName)) { - AbstractEncodableBitStringDataType field = this.fields.get(fieldName); - String substring = field.substring(segmentBitString, index); - field.decode(substring); - index += substring.length(); + try { + AbstractEncodableBitStringDataType field = this.fields.get(fieldName); + String substring = field.substring(segmentBitString, index); + field.decode(substring); + index += substring.length(); + } catch (Exception e) { + throw new Error("Unable to decode " + fieldName, e); + } } else { throw new Error("Field not found: '" + fieldName + "'"); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/HeaderV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/HeaderV1.java index cd2d9bf8..59ec9483 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/HeaderV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/HeaderV1.java @@ -3,11 +3,12 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.datatype.EncodableFibonacciIntegerRange; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.HeaderV1Field; public class HeaderV1 extends AbstractEncodableBitStringSection { @@ -15,6 +16,8 @@ public class HeaderV1 extends AbstractEncodableBitStringSection { public static int VERSION = 1; public static String NAME = "header"; + private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); + public HeaderV1() { initFields(); } @@ -45,13 +48,13 @@ private void initFields() { @Override public String encode() throws EncodingException { String bitString = this.encodeToBitString(); - String encodedString = Base64UrlEncoder.encode(bitString); + String encodedString = base64UrlEncoder.encode(bitString); return encodedString; } @Override public void decode(String encodedString) throws DecodingException { - String bitString = Base64UrlEncoder.decode(encodedString); + String bitString = base64UrlEncoder.decode(encodedString); this.decodeFromBitString(bitString); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java index 821eaa04..f98a74a3 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java @@ -16,7 +16,7 @@ public class Sections { SECTION_ID_NAME_MAP = new HashMap<>(); SECTION_ID_NAME_MAP.put(TcfEuV2.ID, TcfEuV2.NAME); - SECTION_ID_NAME_MAP.put(TcfCaV2.ID, TcfCaV2.NAME); + SECTION_ID_NAME_MAP.put(TcfCaV1.ID, TcfCaV1.NAME); SECTION_ID_NAME_MAP.put(UspV1.ID, UspV1.NAME); SECTION_ID_NAME_MAP.put(UspNatV1.ID, UspNatV1.NAME); SECTION_ID_NAME_MAP.put(UspCaV1.ID, UspCaV1.NAME); @@ -25,7 +25,7 @@ public class Sections { SECTION_ID_NAME_MAP.put(UspUtV1.ID, UspUtV1.NAME); SECTION_ID_NAME_MAP.put(UspCtV1.ID, UspCtV1.NAME); - SECTION_ORDER = new ArrayList(SECTION_ID_NAME_MAP.keySet()).stream().sorted().map(id -> SECTION_ID_NAME_MAP.get(id)) - .collect(Collectors.toList()); + SECTION_ORDER = new ArrayList(SECTION_ID_NAME_MAP.keySet()).stream().sorted() + .map(id -> SECTION_ID_NAME_MAP.get(id)).collect(Collectors.toList()); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV2.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java similarity index 52% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV2.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java index 98a3d57d..3afec30d 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV2.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java @@ -12,24 +12,27 @@ import com.iab.gpp.encoder.datatype.EncodableDatetime; import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerRange; import com.iab.gpp.encoder.datatype.EncodableFixedString; import com.iab.gpp.encoder.datatype.EncodableFlexibleBitfield; -import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.TcfCaV2Field; +import com.iab.gpp.encoder.field.TcfCaV1Field; -public class TcfCaV2 extends AbstractEncodableSegmentedBitStringSection { +public class TcfCaV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 5; public static int VERSION = 2; - public static String NAME = "tcfcav2"; + public static String NAME = "tcfcav1"; - public TcfCaV2() { + private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); + + public TcfCaV1() { initFields(); } - public TcfCaV2(String encodedString) throws DecodingException { + public TcfCaV1(String encodedString) throws DecodingException { initFields(); if (encodedString != null && encodedString.length() > 0) { @@ -41,29 +44,29 @@ private void initFields() { fields = new HashMap<>(); // core section - fields.put(TcfCaV2Field.VERSION, new EncodableFixedInteger(6, TcfCaV2.VERSION)); - fields.put(TcfCaV2Field.CREATED, new EncodableDatetime()); - fields.put(TcfCaV2Field.LAST_UPDATED, new EncodableDatetime()); - fields.put(TcfCaV2Field.CMP_ID, new EncodableFixedInteger(12, 0)); - fields.put(TcfCaV2Field.CMP_VERSION, new EncodableFixedInteger(12, 0)); - fields.put(TcfCaV2Field.CONSENT_SCREEN, new EncodableFixedInteger(6, 0)); - fields.put(TcfCaV2Field.CONSENT_LANGUAGE, new EncodableFixedString(2, "EN")); - fields.put(TcfCaV2Field.VENDOR_LIST_VERSION, new EncodableFixedInteger(12, 0)); - fields.put(TcfCaV2Field.TCF_POLICY_VERSION, new EncodableFixedInteger(6, 2)); - fields.put(TcfCaV2Field.USE_NON_STANDARD_STACKS, new EncodableBoolean(false)); - fields.put(TcfCaV2Field.SPECIAL_FEATURE_EXPRESS_CONSENT, new EncodableFixedBitfield(12, new ArrayList<>())); - fields.put(TcfCaV2Field.PURPOSES_EXPRESS_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); - fields.put(TcfCaV2Field.PURPOSES_IMPLIED_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); - fields.put(TcfCaV2Field.VENDOR_EXPRESS_CONSENT, new EncodableFixedIntegerRange(new ArrayList<>())); - fields.put(TcfCaV2Field.VENDOR_IMPLIED_CONSENT, new EncodableFixedIntegerRange(new ArrayList<>())); + fields.put(TcfCaV1Field.VERSION, new EncodableFixedInteger(6, TcfCaV1.VERSION)); + fields.put(TcfCaV1Field.CREATED, new EncodableDatetime()); + fields.put(TcfCaV1Field.LAST_UPDATED, new EncodableDatetime()); + fields.put(TcfCaV1Field.CMP_ID, new EncodableFixedInteger(12, 0)); + fields.put(TcfCaV1Field.CMP_VERSION, new EncodableFixedInteger(12, 0)); + fields.put(TcfCaV1Field.CONSENT_SCREEN, new EncodableFixedInteger(6, 0)); + fields.put(TcfCaV1Field.CONSENT_LANGUAGE, new EncodableFixedString(2, "EN")); + fields.put(TcfCaV1Field.VENDOR_LIST_VERSION, new EncodableFixedInteger(12, 0)); + fields.put(TcfCaV1Field.TCF_POLICY_VERSION, new EncodableFixedInteger(6, 2)); + fields.put(TcfCaV1Field.USE_NON_STANDARD_STACKS, new EncodableBoolean(false)); + fields.put(TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT, new EncodableFixedBitfield(12, new ArrayList<>())); + fields.put(TcfCaV1Field.PURPOSES_EXPRESS_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); + fields.put(TcfCaV1Field.PURPOSES_IMPLIED_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); + fields.put(TcfCaV1Field.VENDOR_EXPRESS_CONSENT, new EncodableOptimizedFixedRange(new ArrayList<>())); + fields.put(TcfCaV1Field.VENDOR_IMPLIED_CONSENT, new EncodableOptimizedFixedRange(new ArrayList<>())); // publisher purposes segment - fields.put(TcfCaV2Field.PUB_PURPOSES_SEGMENT_TYPE, new EncodableFixedInteger(3, 3)); - fields.put(TcfCaV2Field.PUB_PURPOSES_EXPRESS_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); - fields.put(TcfCaV2Field.PUB_PURPOSES_IMPLIED_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); + fields.put(TcfCaV1Field.PUB_PURPOSES_SEGMENT_TYPE, new EncodableFixedInteger(3, 3)); + fields.put(TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); + fields.put(TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); EncodableFixedInteger numCustomPurposes = new EncodableFixedInteger(6, 0); - fields.put(TcfCaV2Field.NUM_CUSTOM_PURPOSES, numCustomPurposes); + fields.put(TcfCaV1Field.NUM_CUSTOM_PURPOSES, numCustomPurposes); IntSupplier getLengthSupplier = new IntSupplier() { @@ -74,38 +77,38 @@ public int getAsInt() { }; - fields.put(TcfCaV2Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, + fields.put(TcfCaV1Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, new EncodableFlexibleBitfield(getLengthSupplier, new ArrayList<>())); - fields.put(TcfCaV2Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, + fields.put(TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, new EncodableFlexibleBitfield(getLengthSupplier, new ArrayList<>())); //@formatter:off String[] coreSegment = new String[] { - TcfCaV2Field.VERSION, - TcfCaV2Field.CREATED, - TcfCaV2Field.LAST_UPDATED, - TcfCaV2Field.CMP_ID, - TcfCaV2Field.CMP_VERSION, - TcfCaV2Field.CONSENT_SCREEN, - TcfCaV2Field.CONSENT_LANGUAGE, - TcfCaV2Field.VENDOR_LIST_VERSION, - TcfCaV2Field.TCF_POLICY_VERSION, - TcfCaV2Field.USE_NON_STANDARD_STACKS, - TcfCaV2Field.SPECIAL_FEATURE_EXPRESS_CONSENT, - TcfCaV2Field.PURPOSES_EXPRESS_CONSENT, - TcfCaV2Field.PURPOSES_IMPLIED_CONSENT, - TcfCaV2Field.VENDOR_EXPRESS_CONSENT, - TcfCaV2Field.VENDOR_IMPLIED_CONSENT + TcfCaV1Field.VERSION, + TcfCaV1Field.CREATED, + TcfCaV1Field.LAST_UPDATED, + TcfCaV1Field.CMP_ID, + TcfCaV1Field.CMP_VERSION, + TcfCaV1Field.CONSENT_SCREEN, + TcfCaV1Field.CONSENT_LANGUAGE, + TcfCaV1Field.VENDOR_LIST_VERSION, + TcfCaV1Field.TCF_POLICY_VERSION, + TcfCaV1Field.USE_NON_STANDARD_STACKS, + TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT, + TcfCaV1Field.PURPOSES_EXPRESS_CONSENT, + TcfCaV1Field.PURPOSES_IMPLIED_CONSENT, + TcfCaV1Field.VENDOR_EXPRESS_CONSENT, + TcfCaV1Field.VENDOR_IMPLIED_CONSENT }; String[] publisherPurposesSegment = new String[] { - TcfCaV2Field.PUB_PURPOSES_SEGMENT_TYPE, - TcfCaV2Field.PUB_PURPOSES_EXPRESS_CONSENT, - TcfCaV2Field.PUB_PURPOSES_IMPLIED_CONSENT, - TcfCaV2Field.NUM_CUSTOM_PURPOSES, - TcfCaV2Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, - TcfCaV2Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, + TcfCaV1Field.PUB_PURPOSES_SEGMENT_TYPE, + TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT, + TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT, + TcfCaV1Field.NUM_CUSTOM_PURPOSES, + TcfCaV1Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, + TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, }; segments = new String[][] { @@ -120,10 +123,9 @@ public String encode() throws EncodingException { List segmentBitStrings = this.encodeSegmentsToBitStrings(); List encodedSegments = new ArrayList<>(); if (segmentBitStrings.size() >= 1) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(0))); - + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); if (segmentBitStrings.size() >= 2) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(1))); + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); } } @@ -136,12 +138,11 @@ public void decode(String encodedSection) throws DecodingException { String[] segmentBitStrings = new String[4]; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 3. - * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the - * encoding version, but because we're only on a maximum of encoding version 2 the first 3 bits in - * the core segment will evaluate to 0. + * first char will contain 6 bits, we only need the first 3. There is no segment type for the CORE + * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on + * a maximum of encoding version 2 the first 3 bits in the core segment will evaluate to 0. */ - String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); + String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); switch (segmentBitString.substring(0, 3)) { // unfortunately, the segment ordering doesn't match the segment ids case "000": { @@ -164,115 +165,115 @@ public void decode(String encodedSection) throws DecodingException { public void setFieldValue(String fieldName, Object value) { super.setFieldValue(fieldName, value); - if (!fieldName.equals(TcfCaV2Field.CREATED) && !fieldName.equals(TcfCaV2Field.LAST_UPDATED)) { + if (!fieldName.equals(TcfCaV1Field.CREATED) && !fieldName.equals(TcfCaV1Field.LAST_UPDATED)) { ZonedDateTime utcDateTime = ZonedDateTime.now(ZoneId.of("UTC")); - super.setFieldValue(TcfCaV2Field.CREATED, utcDateTime); - super.setFieldValue(TcfCaV2Field.LAST_UPDATED, utcDateTime); + super.setFieldValue(TcfCaV1Field.CREATED, utcDateTime); + super.setFieldValue(TcfCaV1Field.LAST_UPDATED, utcDateTime); } } @Override public int getId() { - return TcfCaV2.ID; + return TcfCaV1.ID; } @Override public String getName() { - return TcfCaV2.NAME; + return TcfCaV1.NAME; } public Integer getVersion() { - return (Integer) this.fields.get(TcfCaV2Field.VERSION).getValue(); + return (Integer) this.fields.get(TcfCaV1Field.VERSION).getValue(); } public ZonedDateTime getCreated() { - return (ZonedDateTime) this.fields.get(TcfCaV2Field.CREATED).getValue(); + return (ZonedDateTime) this.fields.get(TcfCaV1Field.CREATED).getValue(); } public ZonedDateTime getLastUpdated() { - return (ZonedDateTime) this.fields.get(TcfCaV2Field.LAST_UPDATED).getValue(); + return (ZonedDateTime) this.fields.get(TcfCaV1Field.LAST_UPDATED).getValue(); } public Integer getCmpId() { - return (Integer) this.fields.get(TcfCaV2Field.CMP_ID).getValue(); + return (Integer) this.fields.get(TcfCaV1Field.CMP_ID).getValue(); } public Integer getCmpVersion() { - return (Integer) this.fields.get(TcfCaV2Field.CMP_VERSION).getValue(); + return (Integer) this.fields.get(TcfCaV1Field.CMP_VERSION).getValue(); } public Integer getConsentScreen() { - return (Integer) this.fields.get(TcfCaV2Field.CONSENT_SCREEN).getValue(); + return (Integer) this.fields.get(TcfCaV1Field.CONSENT_SCREEN).getValue(); } public String getConsentLanguage() { - return (String) this.fields.get(TcfCaV2Field.CONSENT_LANGUAGE).getValue(); + return (String) this.fields.get(TcfCaV1Field.CONSENT_LANGUAGE).getValue(); } public Integer getVendorListVersion() { - return (Integer) this.fields.get(TcfCaV2Field.VENDOR_LIST_VERSION).getValue(); + return (Integer) this.fields.get(TcfCaV1Field.VENDOR_LIST_VERSION).getValue(); } public Integer getPolicyVersion() { - return (Integer) this.fields.get(TcfCaV2Field.TCF_POLICY_VERSION).getValue(); + return (Integer) this.fields.get(TcfCaV1Field.TCF_POLICY_VERSION).getValue(); } public Boolean getUseNonStandardStacks() { - return (Boolean) this.fields.get(TcfCaV2Field.USE_NON_STANDARD_STACKS).getValue(); + return (Boolean) this.fields.get(TcfCaV1Field.USE_NON_STANDARD_STACKS).getValue(); } @SuppressWarnings("unchecked") public List getSpecialFeatureExpressConsent() { - return (List) this.fields.get(TcfCaV2Field.SPECIAL_FEATURE_EXPRESS_CONSENT).getValue(); + return (List) this.fields.get(TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT).getValue(); } @SuppressWarnings("unchecked") public List getPurposesExpressConsent() { - return (List) this.fields.get(TcfCaV2Field.PURPOSES_EXPRESS_CONSENT).getValue(); + return (List) this.fields.get(TcfCaV1Field.PURPOSES_EXPRESS_CONSENT).getValue(); } @SuppressWarnings("unchecked") public List getPurposesImpliedConsent() { - return (List) this.fields.get(TcfCaV2Field.PURPOSES_IMPLIED_CONSENT).getValue(); + return (List) this.fields.get(TcfCaV1Field.PURPOSES_IMPLIED_CONSENT).getValue(); } @SuppressWarnings("unchecked") public List getVendorExpressConsent() { - return (List) this.fields.get(TcfCaV2Field.VENDOR_EXPRESS_CONSENT).getValue(); + return (List) this.fields.get(TcfCaV1Field.VENDOR_EXPRESS_CONSENT).getValue(); } @SuppressWarnings("unchecked") public List getVendorImpliedConsent() { - return (List) this.fields.get(TcfCaV2Field.VENDOR_IMPLIED_CONSENT).getValue(); + return (List) this.fields.get(TcfCaV1Field.VENDOR_IMPLIED_CONSENT).getValue(); } public Integer getPubPurposesSegmentType() { - return (Integer) this.fields.get(TcfCaV2Field.PUB_PURPOSES_SEGMENT_TYPE).getValue(); + return (Integer) this.fields.get(TcfCaV1Field.PUB_PURPOSES_SEGMENT_TYPE).getValue(); } @SuppressWarnings("unchecked") public List getPubPurposesExpressConsent() { - return (List) this.fields.get(TcfCaV2Field.PUB_PURPOSES_EXPRESS_CONSENT).getValue(); + return (List) this.fields.get(TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT).getValue(); } @SuppressWarnings("unchecked") public List getPubPurposesImpliedConsent() { - return (List) this.fields.get(TcfCaV2Field.PUB_PURPOSES_IMPLIED_CONSENT).getValue(); + return (List) this.fields.get(TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT).getValue(); } public Integer getNumCustomPurposes() { - return (Integer) this.fields.get(TcfCaV2Field.NUM_CUSTOM_PURPOSES).getValue(); + return (Integer) this.fields.get(TcfCaV1Field.NUM_CUSTOM_PURPOSES).getValue(); } @SuppressWarnings("unchecked") public List getCustomPurposesExpressConsent() { - return (List) this.fields.get(TcfCaV2Field.CUSTOM_PURPOSES_EXPRESS_CONSENT).getValue(); + return (List) this.fields.get(TcfCaV1Field.CUSTOM_PURPOSES_EXPRESS_CONSENT).getValue(); } @SuppressWarnings("unchecked") public List getCustomPurposesImpliedConsent() { - return (List) this.fields.get(TcfCaV2Field.CUSTOM_PURPOSES_IMPLIED_CONSENT).getValue(); + return (List) this.fields.get(TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT).getValue(); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java index f7df528a..1b1b2489 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java @@ -8,9 +8,6 @@ import java.util.List; import java.util.function.IntSupplier; import java.util.stream.Collectors; -import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableDatetime; import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; @@ -19,6 +16,10 @@ import com.iab.gpp.encoder.datatype.EncodableFixedString; import com.iab.gpp.encoder.datatype.EncodableFlexibleBitfield; import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.TraditionalBase64UrlEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.TcfEuV2Field; public class TcfEuV2 extends AbstractEncodableSegmentedBitStringSection { @@ -26,6 +27,8 @@ public class TcfEuV2 extends AbstractEncodableSegmentedBitStringSection { public static int VERSION = 2; public static String NAME = "tcfeuv2"; + private AbstractBase64UrlEncoder base64UrlEncoder = new TraditionalBase64UrlEncoder(); + public TcfEuV2() { initFields(); } @@ -58,8 +61,8 @@ private void initFields() { fields.put(TcfEuV2Field.PURPOSE_LEGITIMATE_INTERESTS, new EncodableFixedBitfield(24, new ArrayList<>())); fields.put(TcfEuV2Field.PURPOSE_ONE_TREATMENT, new EncodableBoolean(false)); fields.put(TcfEuV2Field.PUBLISHER_COUNTRY_CODE, new EncodableFixedString(2, "AA")); - fields.put(TcfEuV2Field.VENDOR_CONSENTS, new EncodableFixedIntegerRange(new ArrayList<>())); - fields.put(TcfEuV2Field.VENDOR_LEGITIMATE_INTERESTS, new EncodableFixedIntegerRange(new ArrayList<>())); + fields.put(TcfEuV2Field.VENDOR_CONSENTS, new EncodableOptimizedFixedRange(new ArrayList<>())); + fields.put(TcfEuV2Field.VENDOR_LEGITIMATE_INTERESTS, new EncodableOptimizedFixedRange(new ArrayList<>())); fields.put(TcfEuV2Field.PUBLISHER_RESTRICTIONS, new EncodableFixedIntegerRange(new ArrayList<>())); @@ -148,19 +151,19 @@ public String encode() throws EncodingException { List segmentBitStrings = this.encodeSegmentsToBitStrings(); List encodedSegments = new ArrayList<>(); if (segmentBitStrings.size() >= 1) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(0))); + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); Boolean isServiceSpecific = (Boolean) this.getFieldValue(TcfEuV2Field.IS_SERVICE_SPECIFIC); if (isServiceSpecific) { if (segmentBitStrings.size() >= 2) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(1))); + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); } } else { if (segmentBitStrings.size() >= 2) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(2))); + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(2))); if (segmentBitStrings.size() >= 3) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(3))); + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(3))); } } } @@ -175,12 +178,11 @@ public void decode(String encodedSection) throws DecodingException { String[] segmentBitStrings = new String[4]; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 3. - * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the - * encoding version, but because we're only on a maximum of encoding version 2 the first 3 bits in - * the core segment will evaluate to 0. + * first char will contain 6 bits, we only need the first 3. There is no segment type for the CORE + * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on + * a maximum of encoding version 2 the first 3 bits in the core segment will evaluate to 0. */ - String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); + String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); switch (segmentBitString.substring(0, 3)) { // unfortunately, the segment ordering doesn't match the segment ids case "000": { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java index 3cff9390..7ee91b01 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java @@ -8,7 +8,8 @@ import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.UspCaV1Field; @@ -19,6 +20,8 @@ public class UspCaV1 extends AbstractEncodableSegmentedBitStringSection { public static int VERSION = 1; public static String NAME = "uspcav1"; + private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); + public UspCaV1() { initFields(); } @@ -40,7 +43,8 @@ private void initFields() { fields.put(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); fields.put(UspCaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); fields.put(UspCaV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspCaV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UspCaV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0))); fields.put(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); fields.put(UspCaV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); fields.put(UspCaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); @@ -49,8 +53,9 @@ private void initFields() { // gpc segment fields.put(UspCaV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UspCaV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); fields.put(UspCaV1Field.GPC, new EncodableBoolean(false)); - + //@formatter:off String[] coreSegment = new String[] { UspCaV1Field.VERSION, @@ -84,10 +89,14 @@ public String encode() throws EncodingException { List segmentBitStrings = this.encodeSegmentsToBitStrings(); List encodedSegments = new ArrayList<>(); if (segmentBitStrings.size() >= 1) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(0))); + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); if (segmentBitStrings.size() >= 2) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(1))); + Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).getValue(); + if (gpcSegmentIncluded) { + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); + } + } } @@ -98,20 +107,21 @@ public String encode() throws EncodingException { public void decode(String encodedSection) throws DecodingException { String[] encodedSegments = encodedSection.split("\\."); String[] segmentBitStrings = new String[2]; + boolean gpcSegmentIncluded = false; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 2. - * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the - * encoding version, but because we're only on a maximum of encoding version 2 the first 2 bits in - * the core segment will evaluate to 0. + * first char will contain 6 bits, we only need the first 2. There is no segment type for the CORE + * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on + * a maximum of encoding version 2 the first 2 bits in the core segment will evaluate to 0. */ - String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); + String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); switch (segmentBitString.substring(0, 2)) { case "00": { segmentBitStrings[0] = segmentBitString; break; } case "01": { + gpcSegmentIncluded = true; segmentBitStrings[1] = segmentBitString; break; } @@ -121,6 +131,7 @@ public void decode(String encodedSection) throws DecodingException { } } this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); + this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); } @Override @@ -186,7 +197,11 @@ public Integer getMspaServiceProviderMode() { public Boolean getGpcSegmentType() { return (Boolean) this.fields.get(UspCaV1Field.GPC_SEGMENT_TYPE).getValue(); } - + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).getValue(); + } + public Boolean getGpc() { return (Boolean) this.fields.get(UspCaV1Field.GPC).getValue(); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java index 212431ab..d68723f9 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java @@ -8,9 +8,11 @@ import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspCaV1Field; import com.iab.gpp.encoder.field.UspCoV1Field; import com.iab.gpp.encoder.field.UspV1Field; @@ -19,6 +21,8 @@ public class UspCoV1 extends AbstractEncodableSegmentedBitStringSection { public static int VERSION = 1; public static String NAME = "uspcov1"; + private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); + public UspCoV1() { initFields(); } @@ -40,7 +44,8 @@ private void initFields() { fields.put(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); fields.put(UspCoV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); fields.put(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspCoV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0))); + fields.put(UspCoV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0))); fields.put(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); fields.put(UspCoV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); fields.put(UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); @@ -48,6 +53,7 @@ private void initFields() { // gpc segment fields.put(UspCoV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UspCoV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); fields.put(UspCoV1Field.GPC, new EncodableBoolean(false)); @@ -83,10 +89,13 @@ public String encode() throws EncodingException { List segmentBitStrings = this.encodeSegmentsToBitStrings(); List encodedSegments = new ArrayList<>(); if (segmentBitStrings.size() >= 1) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(0))); + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); if (segmentBitStrings.size() >= 2) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(1))); + Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UspCoV1Field.GPC_SEGMENT_INCLUDED).getValue(); + if (gpcSegmentIncluded) { + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); + } } } @@ -97,20 +106,21 @@ public String encode() throws EncodingException { public void decode(String encodedSection) throws DecodingException { String[] encodedSegments = encodedSection.split("\\."); String[] segmentBitStrings = new String[2]; + boolean gpcSegmentIncluded = false; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 2. - * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the - * encoding version, but because we're only on a maximum of encoding version 2 the first 2 bits in - * the core segment will evaluate to 0. + * first char will contain 6 bits, we only need the first 2. There is no segment type for the CORE + * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on + * a maximum of encoding version 2 the first 2 bits in the core segment will evaluate to 0. */ - String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); + String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); switch (segmentBitString.substring(0, 2)) { case "00": { segmentBitStrings[0] = segmentBitString; break; } case "01": { + gpcSegmentIncluded = true; segmentBitStrings[1] = segmentBitString; break; } @@ -120,6 +130,7 @@ public void decode(String encodedSection) throws DecodingException { } } this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); + this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); } @Override @@ -180,7 +191,11 @@ public Integer getMspaServiceProviderMode() { public Boolean getGpcSegmentType() { return (Boolean) this.fields.get(UspCoV1Field.GPC_SEGMENT_TYPE).getValue(); } - + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.fields.get(UspCoV1Field.GPC_SEGMENT_INCLUDED).getValue(); + } + public Boolean getGpc() { return (Boolean) this.fields.get(UspCoV1Field.GPC).getValue(); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java index 47f5519a..58738fc6 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java @@ -8,9 +8,11 @@ import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspCaV1Field; import com.iab.gpp.encoder.field.UspCtV1Field; import com.iab.gpp.encoder.field.UspV1Field; @@ -19,6 +21,8 @@ public class UspCtV1 extends AbstractEncodableSegmentedBitStringSection { public static int VERSION = 1; public static String NAME = "uspctv1"; + private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); + public UspCtV1() { initFields(); } @@ -40,16 +44,19 @@ private void initFields() { fields.put(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); fields.put(UspCtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); fields.put(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspCtV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0))); + fields.put(UspCtV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0))); fields.put(UspCtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); fields.put(UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); fields.put(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); // gpc segment fields.put(UspCtV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UspCtV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); fields.put(UspCtV1Field.GPC, new EncodableBoolean(false)); - + //@formatter:off String[] coreSegment = new String[] { UspCtV1Field.VERSION, @@ -82,10 +89,13 @@ public String encode() throws EncodingException { List segmentBitStrings = this.encodeSegmentsToBitStrings(); List encodedSegments = new ArrayList<>(); if (segmentBitStrings.size() >= 1) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(0))); + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); if (segmentBitStrings.size() >= 2) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(1))); + Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UspCtV1Field.GPC_SEGMENT_INCLUDED).getValue(); + if (gpcSegmentIncluded) { + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); + } } } @@ -96,20 +106,21 @@ public String encode() throws EncodingException { public void decode(String encodedSection) throws DecodingException { String[] encodedSegments = encodedSection.split("\\."); String[] segmentBitStrings = new String[2]; + boolean gpcSegmentIncluded = false; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 2. - * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the - * encoding version, but because we're only on a maximum of encoding version 2 the first 2 bits in - * the core segment will evaluate to 0. + * first char will contain 6 bits, we only need the first 2. There is no segment type for the CORE + * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on + * a maximum of encoding version 2 the first 2 bits in the core segment will evaluate to 0. */ - String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); + String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); switch (segmentBitString.substring(0, 2)) { case "00": { segmentBitStrings[0] = segmentBitString; break; } case "01": { + gpcSegmentIncluded = true; segmentBitStrings[1] = segmentBitString; break; } @@ -119,8 +130,9 @@ public void decode(String encodedSection) throws DecodingException { } } this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); + this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); } - + @Override public int getId() { return UspCtV1.ID; @@ -180,7 +192,11 @@ public Integer getMspaServiceProviderMode() { public Boolean getGpcSegmentType() { return (Boolean) this.fields.get(UspCtV1Field.GPC_SEGMENT_TYPE).getValue(); } - + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.fields.get(UspCtV1Field.GPC_SEGMENT_INCLUDED).getValue(); + } + public Boolean getGpc() { return (Boolean) this.fields.get(UspCtV1Field.GPC).getValue(); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java index b36aa69c..18e0331a 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java @@ -8,9 +8,11 @@ import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspCaV1Field; import com.iab.gpp.encoder.field.UspNatV1Field; import com.iab.gpp.encoder.field.UspV1Field; @@ -19,6 +21,8 @@ public class UspNatV1 extends AbstractEncodableSegmentedBitStringSection { public static int VERSION = 1; public static String NAME = "uspnatv1"; + private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); + public UspNatV1() { initFields(); } @@ -44,8 +48,10 @@ private void initFields() { fields.put(UspNatV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); fields.put(UspNatV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); fields.put(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); + fields.put(UspNatV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); fields.put(UspNatV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); fields.put(UspNatV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); fields.put(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); @@ -53,6 +59,7 @@ private void initFields() { // gpc segment fields.put(UspNatV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UspNatV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); fields.put(UspNatV1Field.GPC, new EncodableBoolean(false)); @@ -93,10 +100,13 @@ public String encode() throws EncodingException { List segmentBitStrings = this.encodeSegmentsToBitStrings(); List encodedSegments = new ArrayList<>(); if (segmentBitStrings.size() >= 1) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(0))); + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); if (segmentBitStrings.size() >= 2) { - encodedSegments.add(Base64UrlEncoder.encode(segmentBitStrings.get(1))); + Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UspNatV1Field.GPC_SEGMENT_INCLUDED).getValue(); + if (gpcSegmentIncluded) { + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); + } } } @@ -107,20 +117,21 @@ public String encode() throws EncodingException { public void decode(String encodedSection) throws DecodingException { String[] encodedSegments = encodedSection.split("\\."); String[] segmentBitStrings = new String[2]; + boolean gpcSegmentIncluded = false; for (int i = 0; i < encodedSegments.length; i++) { /** - * first char will contain 6 bits, we only need the first 2. - * There is no segment type for the CORE string. Instead the first 6 bits are reserved for the - * encoding version, but because we're only on a maximum of encoding version 2 the first 2 bits in - * the core segment will evaluate to 0. + * first char will contain 6 bits, we only need the first 2. There is no segment type for the CORE + * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on + * a maximum of encoding version 2 the first 2 bits in the core segment will evaluate to 0. */ - String segmentBitString = Base64UrlEncoder.decode(encodedSegments[i]); + String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); switch (segmentBitString.substring(0, 2)) { case "00": { segmentBitStrings[0] = segmentBitString; break; } case "01": { + gpcSegmentIncluded = true; segmentBitStrings[1] = segmentBitString; break; } @@ -130,6 +141,7 @@ public void decode(String encodedSection) throws DecodingException { } } this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); + this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); } @Override @@ -212,6 +224,10 @@ public Boolean getGpcSegmentType() { return (Boolean) this.fields.get(UspNatV1Field.GPC_SEGMENT_TYPE).getValue(); } + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.fields.get(UspNatV1Field.GPC_SEGMENT_INCLUDED).getValue(); + } + public Boolean getGpc() { return (Boolean) this.fields.get(UspNatV1Field.GPC).getValue(); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java index 728617a5..b1e10af0 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java @@ -5,7 +5,8 @@ import java.util.List; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.UspUtV1Field; @@ -16,6 +17,8 @@ public class UspUtV1 extends AbstractEncodableBitStringSection { public static int VERSION = 1; public static String NAME = "usputv1"; + private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); + public UspUtV1() { initFields(); } @@ -38,7 +41,8 @@ private void initFields() { fields.put(UspUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); fields.put(UspUtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); fields.put(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspUtV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UspUtV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); fields.put(UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); fields.put(UspUtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); fields.put(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); @@ -65,13 +69,13 @@ private void initFields() { @Override public String encode() throws EncodingException { String bitString = this.encodeToBitString(); - String encodedString = Base64UrlEncoder.encode(bitString); + String encodedString = base64UrlEncoder.encode(bitString); return encodedString; } @Override public void decode(String encodedString) throws DecodingException { - String bitString = Base64UrlEncoder.decode(encodedString); + String bitString = base64UrlEncoder.decode(encodedString); this.decodeFromBitString(bitString); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java index 4d26d7fc..c267b8d5 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java @@ -1,22 +1,21 @@ package com.iab.gpp.encoder.section; import java.util.HashMap; -import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.field.UspV1Field; +import java.util.Map; +import com.iab.gpp.encoder.field.UspV1LegacyField; -public class UspV1 extends AbstractEncodableBitStringSection { +public class UspV1 implements EncodableSection { public static int ID = 6; public static int VERSION = 1; public static String NAME = "uspv1"; + protected Map fields; + public UspV1() { initFields(); } - public UspV1(String encodedString) throws DecodingException { + public UspV1(String encodedString) { initFields(); if (encodedString != null && encodedString.length() > 0) { @@ -26,32 +25,52 @@ public UspV1(String encodedString) throws DecodingException { private void initFields() { fields = new HashMap<>(); - fields.put(UspV1Field.VERSION, new EncodableFixedInteger(6, UspV1.VERSION)); - fields.put(UspV1Field.NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspV1Field.OPT_OUT_SALE, new EncodableFixedInteger(2, 0)); - fields.put(UspV1Field.LSPA_COVERED, new EncodableFixedInteger(2, 0)); - - //@formatter:off - fieldOrder = new String[] { - UspV1Field.VERSION, - UspV1Field.NOTICE, - UspV1Field.OPT_OUT_SALE, - UspV1Field.LSPA_COVERED, - }; - //@formatter:on + fields.put(UspV1LegacyField.VERSION, UspV1.VERSION); + fields.put(UspV1LegacyField.NOTICE, "-"); + fields.put(UspV1LegacyField.OPT_OUT_SALE, "-"); + fields.put(UspV1LegacyField.LSPA_COVERED, "-"); + } + + @Override + public boolean hasField(String fieldName) { + return this.fields.containsKey(fieldName); + } + + @Override + public Object getFieldValue(String fieldName) { + if (this.fields.containsKey(fieldName)) { + return this.fields.get(fieldName); + } else { + return null; + } + } + + @Override + public void setFieldValue(String fieldName, Object value) { + if (this.fields.containsKey(fieldName)) { + this.fields.put(fieldName, value); + } else { + throw new Error(fieldName + " not found"); + } } @Override - public String encode() throws EncodingException { - String bitString = this.encodeToBitString(); - String encodedString = Base64UrlEncoder.encode(bitString); - return encodedString; + public String encode() { + String str = ""; + str += this.getFieldValue(UspV1LegacyField.VERSION); + str += this.getFieldValue(UspV1LegacyField.NOTICE); + str += this.getFieldValue(UspV1LegacyField.OPT_OUT_SALE); + str += this.getFieldValue(UspV1LegacyField.LSPA_COVERED); + return str; } @Override - public void decode(String encodedString) throws DecodingException { - String bitString = Base64UrlEncoder.decode(encodedString); - this.decodeFromBitString(bitString); + public void decode(String encodedString) { + // TODO: validate + this.setFieldValue(UspV1LegacyField.VERSION, Integer.parseInt(String.valueOf(encodedString.charAt(0)))); + this.setFieldValue(UspV1LegacyField.NOTICE, String.valueOf(encodedString.charAt(1))); + this.setFieldValue(UspV1LegacyField.OPT_OUT_SALE, String.valueOf(encodedString.charAt(2))); + this.setFieldValue(UspV1LegacyField.LSPA_COVERED, String.valueOf(encodedString.charAt(3))); } @Override @@ -65,18 +84,18 @@ public String getName() { } public Integer getVersion() { - return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + return (Integer) this.fields.get(UspV1LegacyField.VERSION); } - public Integer getNotice() { - return (Integer) fields.get(UspV1Field.NOTICE).getValue(); + public String getNotice() { + return (String) fields.get(UspV1LegacyField.NOTICE); } - public Integer getOptOutSale() { - return (Integer) fields.get(UspV1Field.OPT_OUT_SALE).getValue(); + public String getOptOutSale() { + return (String) fields.get(UspV1LegacyField.OPT_OUT_SALE); } - public Integer getLspaCovered() { - return (Integer) fields.get(UspV1Field.LSPA_COVERED).getValue(); + public String getLspaCovered() { + return (String) fields.get(UspV1LegacyField.LSPA_COVERED); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1Legacy.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1Legacy.java deleted file mode 100644 index d7fd7b33..00000000 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1Legacy.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.iab.gpp.encoder.section; - -import java.util.HashMap; -import java.util.Map; -import com.iab.gpp.encoder.field.UspV1LegacyField; - -public class UspV1Legacy implements EncodableSection { - public static int ID = 6; - public static int VERSION = 1; - public static String NAME = "uspv1"; - - protected Map fields; - - public UspV1Legacy() { - initFields(); - } - - public UspV1Legacy(String encodedString) { - initFields(); - - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } - } - - private void initFields() { - fields = new HashMap<>(); - fields.put(UspV1LegacyField.VERSION, UspV1Legacy.VERSION); - fields.put(UspV1LegacyField.NOTICE, "-"); - fields.put(UspV1LegacyField.OPT_OUT_SALE, "-"); - fields.put(UspV1LegacyField.LSPA_COVERED, "-"); - } - - @Override - public boolean hasField(String fieldName) { - return this.fields.containsKey(fieldName); - } - - @Override - public Object getFieldValue(String fieldName) { - if (this.fields.containsKey(fieldName)) { - return this.fields.get(fieldName); - } else { - return null; - } - } - - @Override - public void setFieldValue(String fieldName, Object value) { - if (this.fields.containsKey(fieldName)) { - this.fields.put(fieldName, value); - } else { - throw new Error(fieldName + " not found"); - } - } - - @Override - public String encode() { - String str = ""; - str += this.getFieldValue(UspV1LegacyField.VERSION); - str += this.getFieldValue(UspV1LegacyField.NOTICE); - str += this.getFieldValue(UspV1LegacyField.OPT_OUT_SALE); - str += this.getFieldValue(UspV1LegacyField.LSPA_COVERED); - return str; - } - - @Override - public void decode(String encodedString) { - // TODO: validate - this.setFieldValue(UspV1LegacyField.VERSION, Integer.parseInt(String.valueOf(encodedString.charAt(0)))); - this.setFieldValue(UspV1LegacyField.NOTICE, String.valueOf(encodedString.charAt(1))); - this.setFieldValue(UspV1LegacyField.OPT_OUT_SALE, String.valueOf(encodedString.charAt(2))); - this.setFieldValue(UspV1LegacyField.LSPA_COVERED, String.valueOf(encodedString.charAt(3))); - } - - @Override - public int getId() { - return UspV1Legacy.ID; - } - - @Override - public String getName() { - return UspV1Legacy.NAME; - } - - public Integer getVersion() { - return (Integer) this.fields.get(UspV1LegacyField.VERSION); - } - - public String getNotice() { - return (String) fields.get(UspV1LegacyField.NOTICE); - } - - public String getOptOutSale() { - return (String) fields.get(UspV1LegacyField.OPT_OUT_SALE); - } - - public String getLspaCovered() { - return (String) fields.get(UspV1LegacyField.LSPA_COVERED); - } -} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java index c20658dd..475d1f10 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java @@ -5,7 +5,8 @@ import java.util.List; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.Base64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.UspV1Field; @@ -16,6 +17,8 @@ public class UspVaV1 extends AbstractEncodableBitStringSection { public static int VERSION = 1; public static String NAME = "uspvav1"; + private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); + public UspVaV1() { initFields(); } @@ -37,7 +40,8 @@ private void initFields() { fields.put(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); fields.put(UspVaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); fields.put(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspVaV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UspVaV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); fields.put(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); fields.put(UspVaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); fields.put(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); @@ -63,13 +67,13 @@ private void initFields() { @Override public String encode() throws EncodingException { String bitString = this.encodeToBitString(); - String encodedString = Base64UrlEncoder.encode(bitString); + String encodedString = base64UrlEncoder.encode(bitString); return encodedString; } @Override public void decode(String encodedString) throws DecodingException { - String bitString = Base64UrlEncoder.decode(encodedString); + String bitString = base64UrlEncoder.decode(encodedString); this.decodeFromBitString(bitString); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 3f0369f4..9fdb9f1c 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.TcfCaV2Field; +import com.iab.gpp.encoder.field.TcfCaV1Field; import com.iab.gpp.encoder.field.TcfEuV2Field; import com.iab.gpp.encoder.field.UspCaV1Field; import com.iab.gpp.encoder.field.UspCoV1Field; @@ -17,7 +17,7 @@ import com.iab.gpp.encoder.field.UspUtV1Field; import com.iab.gpp.encoder.field.UspV1Field; import com.iab.gpp.encoder.field.UspVaV1Field; -import com.iab.gpp.encoder.section.TcfCaV2; +import com.iab.gpp.encoder.section.TcfCaV1; import com.iab.gpp.encoder.section.TcfEuV2; import com.iab.gpp.encoder.section.UspCaV1; import com.iab.gpp.encoder.section.UspCoV1; @@ -36,11 +36,11 @@ public void testEncodeDefault() throws EncodingException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); - + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); String gppString = gppModel.encode(); Assertions.assertEquals("DBAA", gppString); @@ -48,20 +48,20 @@ public void testEncodeDefault() throws EncodingException { Assertions.assertEquals(new ArrayList<>(), gppModel.getSectionIds()); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); - + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); } - + @Test public void testEncodeDefaultAll() throws EncodingException { GppModel gppModel = new GppModel(); - + Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(UspNatV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(UspCaV1.NAME)); @@ -69,13 +69,13 @@ public void testEncodeDefaultAll() throws EncodingException { Assertions.assertEquals(false, gppModel.hasSection(UspCoV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(UspUtV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(UspCtV1.NAME)); - + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VERSION, TcfEuV2.VERSION); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV2Field.CREATED, utcDateTime); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV2Field.LAST_UPDATED, utcDateTime); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.VERSION, TcfCaV2.VERSION); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.CREATED, utcDateTime); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.LAST_UPDATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.VERSION, TcfCaV1.VERSION); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); gppModel.setFieldValue(UspV1.NAME, UspV1Field.VERSION, UspV1.VERSION); gppModel.setFieldValue(UspNatV1.NAME, UspNatV1Field.VERSION, UspNatV1.VERSION); gppModel.setFieldValue(UspCaV1.NAME, UspCaV1Field.VERSION, UspCaV1.VERSION); @@ -83,11 +83,11 @@ public void testEncodeDefaultAll() throws EncodingException { gppModel.setFieldValue(UspCoV1.NAME, UspCoV1Field.VERSION, UspCoV1.VERSION); gppModel.setFieldValue(UspUtV1.NAME, UspUtV1Field.VERSION, UspUtV1.VERSION); gppModel.setFieldValue(UspCtV1.NAME, UspCtV1Field.VERSION, UspCtV1.VERSION); - - - + + + Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UspNatV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UspCaV1.NAME)); @@ -97,7 +97,9 @@ public void testEncodeDefaultAll() throws EncodingException { Assertions.assertEquals(true, gppModel.hasSection(UspCtV1.NAME)); String gppString = gppModel.encode(); - Assertions.assertEquals("DBACOawA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA~BAAA~BAAAAAAAAAAA.QAAA~BAAAAAAA.QAAA~BAAAAAAA~BAAAAAAA.QAAA~BAAAAAAA~BAAAAAAA.QAAA", gppString); + Assertions.assertEquals( + "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAAA.QA~BAAAAAAA.QA~BAAAAAA~BAAAAAA.QA~BAAAAAAA~BAAAAAAA.QA", + gppString); } @@ -106,38 +108,38 @@ public void testEncodeUspv1() throws EncodingException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); - + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, 1); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, 2); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, 3); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, "Y"); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, "N"); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, "N"); Assertions.assertEquals(Arrays.asList(6), gppModel.getSectionIds()); Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); + + - - String gppString = gppModel.encode(); - Assertions.assertEquals("DBABTAAA~BbAA", gppString); + Assertions.assertEquals("DBABTA~1YNN", gppString); Assertions.assertEquals(Arrays.asList(6), gppModel.getSectionIds()); Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); - + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); } @@ -146,11 +148,11 @@ public void testEncodeTcfEuV2() throws EncodingException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_ID, 880); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_VERSION, 0); @@ -162,32 +164,32 @@ public void testEncodeTcfEuV2() throws EncodingException { gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.USE_NON_STANDARD_STACKS, false); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.PURPOSE_ONE_TREATMENT, false); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.PUBLISHER_COUNTRY_CODE, "AA"); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV2Field.CREATED, utcDateTime); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV2Field.LAST_UPDATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); Assertions.assertEquals(Arrays.asList(2), gppModel.getSectionIds()); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); + - String gppString = gppModel.encode(); - Assertions.assertEquals("DBABMAAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", gppString); + Assertions.assertEquals("DBABMA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", gppString); Assertions.assertEquals(2, gppString.split("~").length); Assertions.assertEquals(Arrays.asList(2), gppModel.getSectionIds()); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); } @@ -208,46 +210,46 @@ public void testEncodeUspV1AndTcfEuV2() throws EncodingException { gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.USE_NON_STANDARD_STACKS, false); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.PURPOSE_ONE_TREATMENT, false); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.PUBLISHER_COUNTRY_CODE, "AA"); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV2Field.CREATED, utcDateTime); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV2Field.LAST_UPDATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); Assertions.assertEquals(Arrays.asList(2), gppModel.getSectionIds()); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, 1); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, 2); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, 3); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, "Y"); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, "N"); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, "N"); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); String gppString = gppModel.encode(); - Assertions.assertEquals("DBACNYAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BbAA", gppString); + Assertions.assertEquals("DBACNYA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~1YNN", gppString); Assertions.assertEquals(3, gppString.split("~").length); Assertions.assertEquals(Arrays.asList(2, 6), gppModel.getSectionIds()); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); } @Test - public void testEncodeUspV1AndTcfEuV2AndTcfCaV2() throws EncodingException { + public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() throws EncodingException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); + - gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_ID, 880); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_VERSION, 0); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.CONSENT_SCREEN, 0); @@ -258,72 +260,72 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV2() throws EncodingException { gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.USE_NON_STANDARD_STACKS, false); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.PURPOSE_ONE_TREATMENT, false); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.PUBLISHER_COUNTRY_CODE, "AA"); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV2Field.CREATED, utcDateTime); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV2Field.LAST_UPDATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); Assertions.assertEquals(Arrays.asList(2), gppModel.getSectionIds()); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, 1); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, 2); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, 3); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, "Y"); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, "N"); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, "N"); Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.CMP_ID, 50); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.CMP_VERSION, 2); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.VENDOR_LIST_VERSION, 413); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.USE_NON_STANDARD_STACKS, true); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.SPECIAL_FEATURE_EXPRESS_CONSENT, + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.CMP_ID, 50); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.CMP_VERSION, 2); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.VENDOR_LIST_VERSION, 413); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.USE_NON_STANDARD_STACKS, true); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT, Arrays.asList(false, false, false, false, false, false, true, true, true, true, true, true)); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.PURPOSES_EXPRESS_CONSENT, + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.PURPOSES_EXPRESS_CONSENT, Arrays.asList(true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, true, true, false, false, false, false, false, false)); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.PURPOSES_IMPLIED_CONSENT, + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.PURPOSES_IMPLIED_CONSENT, Arrays.asList(false, false, false, false, false, false, true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, true, true)); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.VENDOR_EXPRESS_CONSENT, Arrays.asList(12, 24, 48)); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.VENDOR_IMPLIED_CONSENT, Arrays.asList(18, 30)); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.PUB_PURPOSES_EXPRESS_CONSENT, + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.VENDOR_EXPRESS_CONSENT, Arrays.asList(12, 24, 48)); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.VENDOR_IMPLIED_CONSENT, Arrays.asList(18, 30)); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT, Arrays.asList(true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false)); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.PUB_PURPOSES_IMPLIED_CONSENT, + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT, Arrays.asList(false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true)); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.NUM_CUSTOM_PURPOSES, 3); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.NUM_CUSTOM_PURPOSES, 3); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, Arrays.asList(false, true, false)); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, Arrays.asList(true, false, true)); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.CREATED, utcDateTime); - gppModel.setFieldValue(TcfCaV2.NAME, TcfCaV2Field.LAST_UPDATED, utcDateTime); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME)); String gppString = gppModel.encode(); Assertions.assertEquals( - "DBACOeAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444aoA~BbAA", + "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao~1YNN", gppString); Assertions.assertEquals(4, gppString.split("~").length); @@ -331,11 +333,11 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV2() throws EncodingException { Assertions.assertEquals(Arrays.asList(2, 5, 6), gppModel.getSectionIds()); Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.ID)); - + Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.ID)); + Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME)); } @Test @@ -345,21 +347,22 @@ public void testDecodeDefaults() throws DecodingException { Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); - + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); + Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); } - + @Test public void testDecodeDefaultsAll() throws DecodingException { - String gppString = "DBACOawA~CPj9xr_Pj9xr_AAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPj9xr_Pj9xr_AAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA~BAAA~BAAAAAAAAAAA.QAAA~BAAAAAAA.QAAA~BAAAAAAA~BAAAAAAA.QAAA~BAAAAAAA~BAAAAAAA.QAAA"; + String gppString = + "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAAA.QA~BAAAAAAA.QA~BAAAAAA~BAAAAAA.QA~BAAAAAAA~BAAAAAAA.QA"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UspNatV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UspCaV1.NAME)); @@ -371,40 +374,40 @@ public void testDecodeDefaultsAll() throws DecodingException { @Test public void testDecodeUspv1() throws DecodingException { - String gppString = "DBABTAAA~BbAA"; + String gppString = "DBABTA~1YNN"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(6), gppModel.getSectionIds()); Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); - - Assertions.assertEquals(1, gppModel.getFieldValue(UspV1.ID, UspV1Field.NOTICE)); - Assertions.assertEquals(2, gppModel.getFieldValue(UspV1.ID, UspV1Field.OPT_OUT_SALE)); - Assertions.assertEquals(3, gppModel.getFieldValue(UspV1.ID, UspV1Field.LSPA_COVERED)); - - Assertions.assertEquals(1, gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); - Assertions.assertEquals(2, gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); - Assertions.assertEquals(3, gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); + + Assertions.assertEquals("Y", gppModel.getFieldValue(UspV1.ID, UspV1Field.NOTICE)); + Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.ID, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.ID, UspV1Field.LSPA_COVERED)); + + Assertions.assertEquals("Y", gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); + Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); } @Test public void testDecodeTcfEuV2() throws DecodingException { - String gppString = "DBABMAAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA"; + String gppString = "DBABMA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(2), gppModel.getSectionIds()); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.VERSION)); Assertions.assertEquals(880, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CMP_ID)); @@ -419,7 +422,7 @@ public void testDecodeTcfEuV2() throws DecodingException { Assertions.assertEquals("AA", gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.PUBLISHER_COUNTRY_CODE)); Assertions.assertEquals(utcDateTime, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CREATED)); Assertions.assertEquals(utcDateTime, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.LAST_UPDATED)); - + Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VERSION)); Assertions.assertEquals(880, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_ID)); Assertions.assertEquals(0, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_VERSION)); @@ -437,26 +440,26 @@ public void testDecodeTcfEuV2() throws DecodingException { @Test public void testDecodeUspv1AndTcfEuV2() throws DecodingException { - String gppString = "DBACNYAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BbAA"; + String gppString = "DBACNYA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~1YNN"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(2, 6), gppModel.getSectionIds()); Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.ID)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); + - - Assertions.assertEquals(1, gppModel.getFieldValue(UspV1.ID, UspV1Field.NOTICE)); - Assertions.assertEquals(2, gppModel.getFieldValue(UspV1.ID, UspV1Field.OPT_OUT_SALE)); - Assertions.assertEquals(3, gppModel.getFieldValue(UspV1.ID, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals("Y", gppModel.getFieldValue(UspV1.ID, UspV1Field.NOTICE)); + Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.ID, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.ID, UspV1Field.LSPA_COVERED)); - Assertions.assertEquals(1, gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); - Assertions.assertEquals(2, gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); - Assertions.assertEquals(3, gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals("Y", gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); + Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.VERSION)); Assertions.assertEquals(880, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CMP_ID)); @@ -494,25 +497,25 @@ public void testDecodeUspv1AndTcfEuV2() throws DecodingException { UspV1 uspV1Section = (UspV1) gppModel.getSection(UspV1.NAME); Integer uspV1Version = uspV1Section.getVersion(); - Integer notice = uspV1Section.getNotice(); + String notice = uspV1Section.getNotice(); Assertions.assertEquals(1, uspV1Version); - Assertions.assertEquals(1, notice); + Assertions.assertEquals("Y", notice); } @Test - public void testDecodeUspv1AndTcfEuV2AndTcfCaV2() throws DecodingException { + public void testDecodeUspv1AndTcfEuV2AndTcfCaV1() throws DecodingException { String gppString = - "DBACOeAA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444aoA~BbAA"; + "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao~1YNN"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(2, 5, 6), gppModel.getSectionIds()); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(TcfCaV2.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME)); - Assertions.assertEquals(1, gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); - Assertions.assertEquals(2, gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); - Assertions.assertEquals(3, gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals("Y", gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); + Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VERSION)); Assertions.assertEquals(880, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_ID)); @@ -536,48 +539,48 @@ public void testDecodeUspv1AndTcfEuV2AndTcfCaV2() throws DecodingException { UspV1 uspV1Section = (UspV1) gppModel.getSection(UspV1.NAME); Integer uspV1Version = uspV1Section.getVersion(); - Integer notice = uspV1Section.getNotice(); + String notice = uspV1Section.getNotice(); Assertions.assertEquals(1, uspV1Version); - Assertions.assertEquals(1, notice); + Assertions.assertEquals("Y", notice); - TcfCaV2 tcfCaV2Section = (TcfCaV2) gppModel.getSection(TcfCaV2.NAME); - Assertions.assertEquals(50, tcfCaV2Section.getCmpId()); - Assertions.assertEquals(2, tcfCaV2Section.getCmpVersion()); - Assertions.assertEquals(413, tcfCaV2Section.getVendorListVersion()); - Assertions.assertEquals(true, tcfCaV2Section.getUseNonStandardStacks()); + TcfCaV1 tcfCaV1Section = (TcfCaV1) gppModel.getSection(TcfCaV1.NAME); + Assertions.assertEquals(50, tcfCaV1Section.getCmpId()); + Assertions.assertEquals(2, tcfCaV1Section.getCmpVersion()); + Assertions.assertEquals(413, tcfCaV1Section.getVendorListVersion()); + Assertions.assertEquals(true, tcfCaV1Section.getUseNonStandardStacks()); Assertions.assertEquals(Arrays.asList(false, false, false, false, false, false, true, true, true, true, true, true), - tcfCaV2Section.getSpecialFeatureExpressConsent()); + tcfCaV1Section.getSpecialFeatureExpressConsent()); Assertions .assertEquals( Arrays.asList(true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, true, true, false, false, false, false, false, false), - tcfCaV2Section.getPurposesExpressConsent()); + tcfCaV1Section.getPurposesExpressConsent()); Assertions .assertEquals( Arrays.asList(false, false, false, false, false, false, true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, true, true), - tcfCaV2Section.getPurposesImpliedConsent()); - Assertions.assertEquals(Arrays.asList(12, 24, 48), tcfCaV2Section.getVendorExpressConsent()); - Assertions.assertEquals(Arrays.asList(18, 30), tcfCaV2Section.getVendorImpliedConsent()); + tcfCaV1Section.getPurposesImpliedConsent()); + Assertions.assertEquals(Arrays.asList(12, 24, 48), tcfCaV1Section.getVendorExpressConsent()); + Assertions.assertEquals(Arrays.asList(18, 30), tcfCaV1Section.getVendorImpliedConsent()); Assertions .assertEquals( Arrays.asList(true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false), - tcfCaV2Section.getPubPurposesExpressConsent()); + tcfCaV1Section.getPubPurposesExpressConsent()); Assertions .assertEquals( Arrays.asList(false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true), - tcfCaV2Section.getPubPurposesImpliedConsent()); - Assertions.assertEquals(3, tcfCaV2Section.getNumCustomPurposes()); - Assertions.assertEquals(Arrays.asList(false, true, false), tcfCaV2Section.getCustomPurposesExpressConsent()); - Assertions.assertEquals(Arrays.asList(true, false, true), tcfCaV2Section.getCustomPurposesImpliedConsent()); - Assertions.assertEquals(utcDateTime, tcfCaV2Section.getCreated()); - Assertions.assertEquals(utcDateTime, tcfCaV2Section.getLastUpdated()); - - Assertions.assertEquals("EN", tcfCaV2Section.getConsentLanguage()); - Assertions.assertEquals(5, tcfCaV2Section.getId()); - Assertions.assertEquals(3, tcfCaV2Section.getPubPurposesSegmentType()); + tcfCaV1Section.getPubPurposesImpliedConsent()); + Assertions.assertEquals(3, tcfCaV1Section.getNumCustomPurposes()); + Assertions.assertEquals(Arrays.asList(false, true, false), tcfCaV1Section.getCustomPurposesExpressConsent()); + Assertions.assertEquals(Arrays.asList(true, false, true), tcfCaV1Section.getCustomPurposesImpliedConsent()); + Assertions.assertEquals(utcDateTime, tcfCaV1Section.getCreated()); + Assertions.assertEquals(utcDateTime, tcfCaV1Section.getLastUpdated()); + + Assertions.assertEquals("EN", tcfCaV1Section.getConsentLanguage()); + Assertions.assertEquals(5, tcfCaV1Section.getId()); + Assertions.assertEquals(3, tcfCaV1Section.getPubPurposesSegmentType()); } - + } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java new file mode 100644 index 00000000..f1075faf --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java @@ -0,0 +1,37 @@ +package com.iab.gpp.encoder.datatype; + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; + +public class EncodableOptimizedFixedRangeTest { + + private EncodableOptimizedFixedRange encodableOptimizedFixedRange = new EncodableOptimizedFixedRange(); + + @Test + public void testEncode1() throws EncodingException { + encodableOptimizedFixedRange.setValue(Arrays.asList(12, 24, 48)); + Assertions.assertEquals("00000000001100000000000000001000000000001000000000000000000000001", + encodableOptimizedFixedRange.encode()); + } + + @Test + public void testEncode2() throws EncodingException { + encodableOptimizedFixedRange.setValue(Arrays.asList(18, 30)); + Assertions.assertEquals("00000000000111100000000000000000001000000000001", encodableOptimizedFixedRange.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + encodableOptimizedFixedRange.decode("00000000001100000000000000001000000000001000000000000000000000001"); + Assertions.assertEquals(Arrays.asList(12, 24, 48), encodableOptimizedFixedRange.getValue()); + } + + @Test + public void testDecode2() throws DecodingException { + encodableOptimizedFixedRange.decode("00000000000111100000000000000000001000000000001"); + Assertions.assertEquals(Arrays.asList(18, 30), encodableOptimizedFixedRange.getValue()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java index af52512b..5e00de2f 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FibonacciIntegerRangeEncoderTest.java @@ -38,7 +38,7 @@ public void testEncode6() { Assertions.assertEquals("0000000000100001110110011", FibonacciIntegerRangeEncoder.encode(Arrays.asList(3, 5, 6, 7, 8))); } - + @Test public void testEncode7() { Assertions.assertEquals("00000000001000111001101011", @@ -70,7 +70,7 @@ public void testDecode5() throws DecodingException { Assertions.assertEquals(Arrays.asList(3, 5, 6, 7, 8), FibonacciIntegerRangeEncoder.decode("0000000000100001110110011")); } - + @Test public void testDecode6() throws DecodingException { Assertions.assertEquals(Arrays.asList(2, 5, 6, 7, 8, 9, 10, 11, 12), diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java index 58651d5d..2c95b455 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java @@ -193,7 +193,7 @@ public void testDecode18() { } } - + @Test public void testDecode19() { try { @@ -203,7 +203,7 @@ public void testDecode19() { } } - + @Test public void testDecode20() { try { diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerRangeEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerRangeEncoderTest.java index 8eb99b1e..a2f11e2d 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerRangeEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerRangeEncoderTest.java @@ -42,6 +42,25 @@ public void testEncode6() { FixedIntegerRangeEncoder.encode(Arrays.asList(3, 5, 6, 7, 8))); } + @Test + public void testEncode7() { + Assertions.assertEquals("000000000011000000000000011000000000000001100000000000000110000", + FixedIntegerRangeEncoder.encode(Arrays.asList(12, 24, 48))); + } + + @Test + public void testEncode8() { + Assertions.assertEquals("0000000000110000000000000110000000000000011000100000000001100000000000000110001", + FixedIntegerRangeEncoder.encode(Arrays.asList(12, 24, 48, 49))); + } + + @Test + public void testEncode9() { + Assertions.assertEquals( + "00000000100000000000000000010000000000000001100000000000000100000000000000001100000000000000100101000000000001011100000000000110010000000000010010100000000000101010", + FixedIntegerRangeEncoder.encode(Arrays.asList(2, 6, 8, 12, 18, 23, 24, 25, 37, 42))); + } + @Test public void testDecode1() throws DecodingException { Assertions.assertEquals(new ArrayList<>(), FixedIntegerRangeEncoder.decode("000000000000")); @@ -71,7 +90,25 @@ public void testDecode5() throws DecodingException { } @Test - public void testDecode6() { + public void testDecode6() throws DecodingException { + Assertions.assertEquals(Arrays.asList(12, 24, 48), + FixedIntegerRangeEncoder.decode("000000000011000000000000011000000000000001100000000000000110000")); + } + + @Test + public void testDecode7() throws DecodingException { + Assertions.assertEquals(Arrays.asList(12, 24, 48, 49), FixedIntegerRangeEncoder + .decode("0000000000110000000000000110000000000000011000100000000001100000000000000110001")); + } + + @Test + public void testDecode8() throws DecodingException { + Assertions.assertEquals(Arrays.asList(2, 6, 8, 12, 18, 23, 24, 25, 37, 42), FixedIntegerRangeEncoder.decode( + "00000000100000000000000000010000000000000001100000000000000100000000000000001100000000000000100101000000000001011100000000000110010000000000010010100000000000101010")); + } + + @Test + public void testDecode9() { try { FixedIntegerRangeEncoder.decode("0011"); Assertions.fail("DecodingException expected"); @@ -81,7 +118,7 @@ public void testDecode6() { } @Test - public void testDecode7() { + public void testDecode10() { try { FixedIntegerRangeEncoder.decode("000000000002"); Assertions.fail("DecodingException expected"); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoderTest.java similarity index 65% rename from iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java rename to iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoderTest.java index b3a8e153..a24cdf12 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/Base64UrlEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoderTest.java @@ -5,36 +5,38 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -public class Base64UrlEncoderTest { +public class TraditionalBase64UrlEncoderTest { + + private TraditionalBase64UrlEncoder base64UrlEncoder = new TraditionalBase64UrlEncoder(); @Test public void testEncode1() throws EncodingException { - Assertions.assertEquals("DBABMAAA", Base64UrlEncoder.encode("0000110000010000000000010011")); + Assertions.assertEquals("DBABMAAA", base64UrlEncoder.encode("0000110000010000000000010011")); } @Test public void testEncode2() throws EncodingException { - Assertions.assertEquals("DBACNYAA", Base64UrlEncoder.encode("000011000001000000000010001101011")); + Assertions.assertEquals("DBACNYAA", base64UrlEncoder.encode("000011000001000000000010001101011")); } @Test public void testEncode3() throws EncodingException { - Assertions.assertEquals("DBABjwAA", Base64UrlEncoder.encode("00001100000100000000000110001111")); + Assertions.assertEquals("DBABjwAA", base64UrlEncoder.encode("00001100000100000000000110001111")); } @Test public void testDecode1() throws DecodingException { - Assertions.assertEquals("000011000001000000000001001100000000000000000000", Base64UrlEncoder.decode("DBABMAAA")); + Assertions.assertEquals("000011000001000000000001001100000000000000000000", base64UrlEncoder.decode("DBABMAAA")); } @Test public void testDecode2() throws DecodingException { - Assertions.assertEquals("000011000001000000000010001101011000000000000000", Base64UrlEncoder.decode("DBACNYAA")); + Assertions.assertEquals("000011000001000000000010001101011000000000000000", base64UrlEncoder.decode("DBACNYAA")); } @Test public void testDecode3() throws DecodingException { - Assertions.assertEquals("000011000001000000000001100011110000000000000000", Base64UrlEncoder.decode("DBABjwAA")); + Assertions.assertEquals("000011000001000000000001100011110000000000000000", base64UrlEncoder.decode("DBABjwAA")); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java index 997941f1..7c83d58b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java @@ -65,14 +65,14 @@ public void testEncode1() throws EncodingException { public void testEncode2() throws EncodingException { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", Arrays.asList(2)); - Assertions.assertEquals("DBABMAAA", headerV1.encode()); + Assertions.assertEquals("DBABMA", headerV1.encode()); } @Test public void testEncode3() throws EncodingException { HeaderV1 headerV1 = new HeaderV1(); - headerV1.setFieldValue("SectionIds", Arrays.asList(2, 7)); - Assertions.assertEquals("DBACMMAA", headerV1.encode()); + headerV1.setFieldValue("SectionIds", Arrays.asList(2, 6)); + Assertions.assertEquals("DBACNYA", headerV1.encode()); } @Test @@ -87,7 +87,7 @@ public void testDecode1() throws DecodingException { @Test public void testDecode2() throws DecodingException { HeaderV1 headerV1 = new HeaderV1(); - headerV1.decode("DBABMAAA"); + headerV1.decode("DBABMA"); Assertions.assertEquals(Arrays.asList(2), headerV1.getFieldValue("SectionIds")); Assertions.assertEquals(headerV1.getFieldValue("Version"), headerV1.getVersion()); Assertions.assertEquals(headerV1.getFieldValue("SectionIds"), headerV1.getSectionsIds()); @@ -96,7 +96,7 @@ public void testDecode2() throws DecodingException { @Test public void testDecode3() throws DecodingException { HeaderV1 headerV1 = new HeaderV1(); - headerV1.decode("BDACNYAA"); + headerV1.decode("DBACNYA"); Assertions.assertEquals(Arrays.asList(2, 6), headerV1.getFieldValue("SectionIds")); Assertions.assertEquals(headerV1.getFieldValue("Version"), headerV1.getVersion()); Assertions.assertEquals(headerV1.getFieldValue("SectionIds"), headerV1.getSectionsIds()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java similarity index 56% rename from iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java rename to iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java index 60b1076d..d1738f1a 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV2Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java @@ -8,129 +8,129 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.TcfCaV2Field; +import com.iab.gpp.encoder.field.TcfCaV1Field; -public class TcfCaV2Test { +public class TcfCaV1Test { @Test public void testEncode1() throws EncodingException { - TcfCaV2 tcfCaV2 = new TcfCaV2(); - Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA", tcfCaV2.encode()); + TcfCaV1 tcfCaV1 = new TcfCaV1(); + Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA", tcfCaV1.encode()); } @Test public void testEncode2() throws EncodingException { - TcfCaV2 tcfCaV2 = new TcfCaV2(); - tcfCaV2.setFieldValue(TcfCaV2Field.CMP_ID, 50); - tcfCaV2.setFieldValue(TcfCaV2Field.CMP_VERSION, 2); - tcfCaV2.setFieldValue(TcfCaV2Field.VENDOR_LIST_VERSION, 413); - tcfCaV2.setFieldValue(TcfCaV2Field.USE_NON_STANDARD_STACKS, true); - tcfCaV2.setFieldValue(TcfCaV2Field.SPECIAL_FEATURE_EXPRESS_CONSENT, + TcfCaV1 tcfCaV1 = new TcfCaV1(); + tcfCaV1.setFieldValue(TcfCaV1Field.CMP_ID, 50); + tcfCaV1.setFieldValue(TcfCaV1Field.CMP_VERSION, 2); + tcfCaV1.setFieldValue(TcfCaV1Field.VENDOR_LIST_VERSION, 413); + tcfCaV1.setFieldValue(TcfCaV1Field.USE_NON_STANDARD_STACKS, true); + tcfCaV1.setFieldValue(TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT, Arrays.asList(false, false, false, false, false, false, true, true, true, true, true, true)); - tcfCaV2.setFieldValue(TcfCaV2Field.PURPOSES_EXPRESS_CONSENT, + tcfCaV1.setFieldValue(TcfCaV1Field.PURPOSES_EXPRESS_CONSENT, Arrays.asList(true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, true, true, false, false, false, false, false, false)); - tcfCaV2.setFieldValue(TcfCaV2Field.PURPOSES_IMPLIED_CONSENT, + tcfCaV1.setFieldValue(TcfCaV1Field.PURPOSES_IMPLIED_CONSENT, Arrays.asList(false, false, false, false, false, false, true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, true, true)); - tcfCaV2.setFieldValue(TcfCaV2Field.VENDOR_EXPRESS_CONSENT, Arrays.asList(12, 24, 48)); - tcfCaV2.setFieldValue(TcfCaV2Field.VENDOR_IMPLIED_CONSENT, Arrays.asList(18, 30)); - tcfCaV2.setFieldValue(TcfCaV2Field.PUB_PURPOSES_EXPRESS_CONSENT, + tcfCaV1.setFieldValue(TcfCaV1Field.VENDOR_EXPRESS_CONSENT, Arrays.asList(12, 24, 48)); + tcfCaV1.setFieldValue(TcfCaV1Field.VENDOR_IMPLIED_CONSENT, Arrays.asList(18, 30)); + tcfCaV1.setFieldValue(TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT, Arrays.asList(true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false)); - tcfCaV2.setFieldValue(TcfCaV2Field.PUB_PURPOSES_IMPLIED_CONSENT, + tcfCaV1.setFieldValue(TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT, Arrays.asList(false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true)); - tcfCaV2.setFieldValue(TcfCaV2Field.NUM_CUSTOM_PURPOSES, 3); - tcfCaV2.setFieldValue(TcfCaV2Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, Arrays.asList(false, true, false)); - tcfCaV2.setFieldValue(TcfCaV2Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, Arrays.asList(true, false, true)); + tcfCaV1.setFieldValue(TcfCaV1Field.NUM_CUSTOM_PURPOSES, 3); + tcfCaV1.setFieldValue(TcfCaV1Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, Arrays.asList(false, true, false)); + tcfCaV1.setFieldValue(TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, Arrays.asList(true, false, true)); - tcfCaV2.setFieldValue(TcfCaV2Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); - tcfCaV2.setFieldValue(TcfCaV2Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); + tcfCaV1.setFieldValue(TcfCaV1Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); + tcfCaV1.setFieldValue(TcfCaV1Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); - Assertions.assertEquals("CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444aoA", tcfCaV2.encode()); + Assertions.assertEquals("CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao", tcfCaV1.encode()); } @Test public void testDecode1() throws DecodingException { - TcfCaV2 tcfCaV2 = new TcfCaV2("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA"); + TcfCaV1 tcfCaV1 = new TcfCaV1("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA"); - Assertions.assertEquals(0, tcfCaV2.getCmpId()); - Assertions.assertEquals(0, tcfCaV2.getCmpVersion()); - Assertions.assertEquals(0, tcfCaV2.getVendorListVersion()); - Assertions.assertEquals(false, tcfCaV2.getUseNonStandardStacks()); + Assertions.assertEquals(0, tcfCaV1.getCmpId()); + Assertions.assertEquals(0, tcfCaV1.getCmpVersion()); + Assertions.assertEquals(0, tcfCaV1.getVendorListVersion()); + Assertions.assertEquals(false, tcfCaV1.getUseNonStandardStacks()); Assertions.assertEquals( Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false), - tcfCaV2.getSpecialFeatureExpressConsent()); + tcfCaV1.getSpecialFeatureExpressConsent()); Assertions .assertEquals( Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), - tcfCaV2.getPurposesExpressConsent()); + tcfCaV1.getPurposesExpressConsent()); Assertions .assertEquals( Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), - tcfCaV2.getPurposesImpliedConsent()); - Assertions.assertEquals(Arrays.asList(), tcfCaV2.getVendorExpressConsent()); - Assertions.assertEquals(Arrays.asList(), tcfCaV2.getVendorImpliedConsent()); + tcfCaV1.getPurposesImpliedConsent()); + Assertions.assertEquals(Arrays.asList(), tcfCaV1.getVendorExpressConsent()); + Assertions.assertEquals(Arrays.asList(), tcfCaV1.getVendorImpliedConsent()); Assertions.assertEquals( Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), - tcfCaV2.getPubPurposesExpressConsent()); + tcfCaV1.getPubPurposesExpressConsent()); Assertions.assertEquals( Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), - tcfCaV2.getPubPurposesImpliedConsent()); - Assertions.assertEquals(0, tcfCaV2.getNumCustomPurposes()); - Assertions.assertEquals(Arrays.asList(), tcfCaV2.getCustomPurposesExpressConsent()); - Assertions.assertEquals(Arrays.asList(), tcfCaV2.getCustomPurposesImpliedConsent()); - Assertions.assertEquals(ZonedDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV2.getCreated()); - Assertions.assertEquals(ZonedDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV2.getLastUpdated()); + tcfCaV1.getPubPurposesImpliedConsent()); + Assertions.assertEquals(0, tcfCaV1.getNumCustomPurposes()); + Assertions.assertEquals(Arrays.asList(), tcfCaV1.getCustomPurposesExpressConsent()); + Assertions.assertEquals(Arrays.asList(), tcfCaV1.getCustomPurposesImpliedConsent()); + Assertions.assertEquals(ZonedDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV1.getCreated()); + Assertions.assertEquals(ZonedDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV1.getLastUpdated()); - Assertions.assertEquals("EN", tcfCaV2.getConsentLanguage()); - Assertions.assertEquals(5, tcfCaV2.getId()); - Assertions.assertEquals(3, tcfCaV2.getPubPurposesSegmentType()); + Assertions.assertEquals("EN", tcfCaV1.getConsentLanguage()); + Assertions.assertEquals(5, tcfCaV1.getId()); + Assertions.assertEquals(3, tcfCaV1.getPubPurposesSegmentType()); } @Test public void testDecode2() throws DecodingException { - TcfCaV2 tcfCaV2 = new TcfCaV2("CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgAMAAwADAAIACQAHg.fHHHA4444aoA"); + TcfCaV1 tcfCaV1 = new TcfCaV1("CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao"); - Assertions.assertEquals(50, tcfCaV2.getCmpId()); - Assertions.assertEquals(2, tcfCaV2.getCmpVersion()); - Assertions.assertEquals(413, tcfCaV2.getVendorListVersion()); - Assertions.assertEquals(true, tcfCaV2.getUseNonStandardStacks()); + Assertions.assertEquals(50, tcfCaV1.getCmpId()); + Assertions.assertEquals(2, tcfCaV1.getCmpVersion()); + Assertions.assertEquals(413, tcfCaV1.getVendorListVersion()); + Assertions.assertEquals(true, tcfCaV1.getUseNonStandardStacks()); Assertions.assertEquals(Arrays.asList(false, false, false, false, false, false, true, true, true, true, true, true), - tcfCaV2.getSpecialFeatureExpressConsent()); + tcfCaV1.getSpecialFeatureExpressConsent()); Assertions.assertEquals(Arrays.asList(true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, true, true, false, false, false, false, false, false), - tcfCaV2.getPurposesExpressConsent()); + tcfCaV1.getPurposesExpressConsent()); Assertions.assertEquals(Arrays.asList(false, false, false, false, false, false, true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, true, true), - tcfCaV2.getPurposesImpliedConsent()); - Assertions.assertEquals(Arrays.asList(12, 24, 48), tcfCaV2.getVendorExpressConsent()); - Assertions.assertEquals(Arrays.asList(18, 30), tcfCaV2.getVendorImpliedConsent()); + tcfCaV1.getPurposesImpliedConsent()); + Assertions.assertEquals(Arrays.asList(12, 24, 48), tcfCaV1.getVendorExpressConsent()); + Assertions.assertEquals(Arrays.asList(18, 30), tcfCaV1.getVendorImpliedConsent()); Assertions .assertEquals( Arrays.asList(true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false), - tcfCaV2.getPubPurposesExpressConsent()); + tcfCaV1.getPubPurposesExpressConsent()); Assertions .assertEquals( Arrays.asList(false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true, false, false, false, true, true, true), - tcfCaV2.getPubPurposesImpliedConsent()); - Assertions.assertEquals(3, tcfCaV2.getNumCustomPurposes()); - Assertions.assertEquals(Arrays.asList(false, true, false), tcfCaV2.getCustomPurposesExpressConsent()); - Assertions.assertEquals(Arrays.asList(true, false, true), tcfCaV2.getCustomPurposesImpliedConsent()); - Assertions.assertEquals(ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV2.getCreated()); - Assertions.assertEquals(ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV2.getLastUpdated()); + tcfCaV1.getPubPurposesImpliedConsent()); + Assertions.assertEquals(3, tcfCaV1.getNumCustomPurposes()); + Assertions.assertEquals(Arrays.asList(false, true, false), tcfCaV1.getCustomPurposesExpressConsent()); + Assertions.assertEquals(Arrays.asList(true, false, true), tcfCaV1.getCustomPurposesImpliedConsent()); + Assertions.assertEquals(ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV1.getCreated()); + Assertions.assertEquals(ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV1.getLastUpdated()); - Assertions.assertEquals("EN", tcfCaV2.getConsentLanguage()); - Assertions.assertEquals(5, tcfCaV2.getId()); - Assertions.assertEquals(3, tcfCaV2.getPubPurposesSegmentType()); + Assertions.assertEquals("EN", tcfCaV1.getConsentLanguage()); + Assertions.assertEquals(5, tcfCaV1.getId()); + Assertions.assertEquals(3, tcfCaV1.getPubPurposesSegmentType()); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java index 6a1b0c64..c8d5cc9a 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java @@ -228,4 +228,114 @@ public void testDecode3() throws DecodingException { tcfEuV2.getVendorsDisclosedSegmentType()); Assertions.assertEquals(tcfEuV2.getFieldValue("VendorsDisclosed"), tcfEuV2.getVendorsDisclosed()); } + + @SuppressWarnings("unchecked") + @Test + public void testDecode4() throws DecodingException { + TcfEuV2 tcfEuV2 = new TcfEuV2( + "CPi8wgAPi8wgAAOACBENCuCoAP_AAEfAACiQJHNd_H__bX9n-f7_6ft0eY1f9_r37uQzDhfNk-8F3L_W_LwX_2E7NF36tq4KmR4ku1LBIUNtHMnUDUmxaokVrzHsak2cpzNKJ_BkknsZe2dYGF9vm5tj-QKZ7_5_d3f52T_9_9v-39z33913v3d93-_13LjdV5_9H_v9fR_b8_Kf9_5-_4v8_____3_e______8AEEggCTDVuIAuxLHAm0DCKBECMKwkKoFABBQDC0QGADg4KdlYBPrCBAAgFAEYEQIcAUYEAgAAAgCQiACQIsEAAAIgEAAIAEQiEABAwCCgAsDAIAAQDQMUQoABAkIMiAiKUwICIEggJbKhBKC6Q0wgCrLACgkRsFAAiAAAUgACAsHAMESAlYsECTFG-QAjBCgFEqFaAGGgAwABBI4RABgACCRwqADAAEEjgA"); + + Assertions.assertEquals(2, tcfEuV2.getFieldValue("Version")); + Assertions.assertEquals(14, tcfEuV2.getFieldValue("CmpId")); + Assertions.assertEquals(2, tcfEuV2.getFieldValue("CmpVersion")); + Assertions.assertEquals(1, tcfEuV2.getFieldValue("ConsentScreen")); + Assertions.assertEquals("EN", tcfEuV2.getFieldValue("ConsentLanguage")); + Assertions.assertEquals(174, tcfEuV2.getFieldValue("VendorListVersion")); + Assertions.assertEquals(2, tcfEuV2.getFieldValue("PolicyVersion")); + Assertions.assertEquals(true, tcfEuV2.getFieldValue("IsServiceSpecific")); + Assertions.assertEquals(false, tcfEuV2.getFieldValue("UseNonStandardStacks")); + + Assertions.assertEquals( + Arrays.asList(true, false, false, false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("SpecialFeatureOptins")); + Assertions + .assertEquals( + Arrays.asList(true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, + false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("PurposeConsents")); + Assertions.assertEquals( + Arrays.asList(false, true, false, false, false, true, true, true, true, true, false, false, false, false, false, + false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("PurposeLegitimateInterests")); + + Assertions.assertEquals(false, tcfEuV2.getFieldValue("PurposeOneTreatment")); + Assertions.assertEquals("US", tcfEuV2.getFieldValue("PublisherCountryCode")); + + Assertions.assertEquals(772, ((List) tcfEuV2.getFieldValue("VendorConsents")).size()); + + Assertions.assertEquals(280, ((List) tcfEuV2.getFieldValue("VendorLegitimateInterests")).size()); + } + + @SuppressWarnings("unchecked") + @Test + public void testDecode5() throws DecodingException { + TcfEuV2 tcfEuV2 = new TcfEuV2( + "CPgA5EAPgA5EAAOACBENCuCoAP_AAEfAACiQI0Nd_H__bX9n-f7_6Pt0cY1f9_r3ruQzDhfFk-8F3L_W3LwX32E7NF36pq4KmR4ku1LBIQFtHMnUDUmxaokVrzHsak2cpyNKI7BkknsZe2dYGF9Pm5lD-QKZ7_5_d3f52T_9_9v-39z339V3v3d93-_12PjdV599H_v9fR_b8_Kf9_5-_4v8___4IQAAAAQQ_AJMNW4gC7EscCbQMIoAQIwrCQqAUAEFAMLRAYAODgpmVgEusIEACAUARgRAhxBRgQCAAACAJCIAJAiwQAIAiAQAAgARAIQAEDAIKACwMAgABANAxACgAECQgyICIpTAgIgSCAlsqEEoKpDTCAKssAKARGwUACIAABSAAICwcAwRICViwQJMUbwAw0AGAAIJHCIAMAAQSOFQAYAAgkcA"); + + Assertions.assertEquals(2, tcfEuV2.getFieldValue("Version")); + Assertions.assertEquals(14, tcfEuV2.getFieldValue("CmpId")); + Assertions.assertEquals(2, tcfEuV2.getFieldValue("CmpVersion")); + Assertions.assertEquals(1, tcfEuV2.getFieldValue("ConsentScreen")); + Assertions.assertEquals("EN", tcfEuV2.getFieldValue("ConsentLanguage")); + Assertions.assertEquals(174, tcfEuV2.getFieldValue("VendorListVersion")); + Assertions.assertEquals(2, tcfEuV2.getFieldValue("PolicyVersion")); + Assertions.assertEquals(true, tcfEuV2.getFieldValue("IsServiceSpecific")); + Assertions.assertEquals(false, tcfEuV2.getFieldValue("UseNonStandardStacks")); + + Assertions.assertEquals( + Arrays.asList(true, false, false, false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("SpecialFeatureOptins")); + Assertions + .assertEquals( + Arrays.asList(true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, + false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("PurposeConsents")); + Assertions.assertEquals( + Arrays.asList(false, true, false, false, false, true, true, true, true, true, false, false, false, false, false, + false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("PurposeLegitimateInterests")); + + Assertions.assertEquals(false, tcfEuV2.getFieldValue("PurposeOneTreatment")); + Assertions.assertEquals("US", tcfEuV2.getFieldValue("PublisherCountryCode")); + + Assertions.assertEquals(693, ((List) tcfEuV2.getFieldValue("VendorConsents")).size()); + + Assertions.assertEquals(254, ((List) tcfEuV2.getFieldValue("VendorLegitimateInterests")).size()); + } + + @Test + public void testDecode6() throws DecodingException { + TcfEuV2 tcfEuV2 = new TcfEuV2("COv_eg6Ov_eg6AOADBENAaCgAP_AAH_AACiQAVEUQQoAIQAqIoghAAQgAA.YAAAAAAAAAAAAAAAAAA"); + + Assertions.assertEquals(2, tcfEuV2.getFieldValue("Version")); + Assertions.assertEquals(14, tcfEuV2.getFieldValue("CmpId")); + Assertions.assertEquals(3, tcfEuV2.getFieldValue("CmpVersion")); + Assertions.assertEquals(1, tcfEuV2.getFieldValue("ConsentScreen")); + Assertions.assertEquals("EN", tcfEuV2.getFieldValue("ConsentLanguage")); + Assertions.assertEquals(26, tcfEuV2.getFieldValue("VendorListVersion")); + Assertions.assertEquals(2, tcfEuV2.getFieldValue("PolicyVersion")); + Assertions.assertEquals(true, tcfEuV2.getFieldValue("IsServiceSpecific")); + Assertions.assertEquals(false, tcfEuV2.getFieldValue("UseNonStandardStacks")); + + Assertions.assertEquals( + Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("SpecialFeatureOptins")); + Assertions + .assertEquals( + Arrays.asList(true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, + false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("PurposeConsents")); + Assertions.assertEquals( + Arrays.asList(false, true, true, true, true, true, true, true, true, true, false, false, false, false, false, + false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("PurposeLegitimateInterests")); + + Assertions.assertEquals(false, tcfEuV2.getFieldValue("PurposeOneTreatment")); + Assertions.assertEquals("US", tcfEuV2.getFieldValue("PublisherCountryCode")); + + Assertions.assertEquals(Arrays.asList(2, 6, 8, 12, 18, 23, 25, 37, 42), tcfEuV2.getFieldValue("VendorConsents")); + + Assertions.assertEquals(Arrays.asList(2, 6, 8, 12, 18, 23, 37, 42), + tcfEuV2.getFieldValue("VendorLegitimateInterests")); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java index 5c66f7b4..1e642d3a 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java @@ -14,13 +14,13 @@ public class UspCaV1Test { public void testEncode1() throws EncodingException { UspCaV1 uspCaV1 = new UspCaV1(); - Assertions.assertEquals("BAAAAAAA.QAAA", uspCaV1.encode()); + Assertions.assertEquals("BAAAAAAA.QA", uspCaV1.encode()); } @Test public void testEncode2() throws EncodingException { UspCaV1 uspCaV1 = new UspCaV1(); - + uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT_NOTICE, 1); uspCaV1.setFieldValue(UspCaV1Field.SHARING_OPT_OUT_NOTICE, 2); uspCaV1.setFieldValue(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); @@ -33,14 +33,14 @@ public void testEncode2() throws EncodingException { uspCaV1.setFieldValue(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); uspCaV1.setFieldValue(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); uspCaV1.setFieldValue(UspCaV1Field.GPC, true); - - Assertions.assertEquals("BbYbGwXY.YAAA", uspCaV1.encode()); + + Assertions.assertEquals("BbYbGwXY.YA", uspCaV1.encode()); } - + @Test public void testEncode3() throws EncodingException { UspCaV1 uspCaV1 = new UspCaV1(); - + uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT_NOTICE, 1); uspCaV1.setFieldValue(UspCaV1Field.SHARING_OPT_OUT_NOTICE, 1); uspCaV1.setFieldValue(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); @@ -53,14 +53,22 @@ public void testEncode3() throws EncodingException { uspCaV1.setFieldValue(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); uspCaV1.setFieldValue(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); uspCaV1.setFieldValue(UspCaV1Field.GPC, true); - - Assertions.assertEquals("BUoAAABQ.YAAA", uspCaV1.encode()); + + Assertions.assertEquals("BUoAAABQ.YA", uspCaV1.encode()); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() throws EncodingException { + + UspCaV1 uspCaV1 = new UspCaV1(); + uspCaV1.setFieldValue(UspCaV1Field.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAAA", uspCaV1.encode()); } - + @Test public void testDecode1() throws DecodingException { - UspCaV1 uspCaV1 = new UspCaV1("BbYbGwXY.YAAA"); - + UspCaV1 uspCaV1 = new UspCaV1("BbYbGwXY.YA"); + Assertions.assertEquals(1, uspCaV1.getSaleOptOutNotice()); Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); Assertions.assertEquals(3, uspCaV1.getSensitiveDataLimitUseNotice()); @@ -74,4 +82,22 @@ public void testDecode1() throws DecodingException { Assertions.assertEquals(2, uspCaV1.getMspaServiceProviderMode()); Assertions.assertEquals(true, uspCaV1.getGpc()); } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UspCaV1 uspCaV1 = new UspCaV1("BbYbGwXY"); + + Assertions.assertEquals(1, uspCaV1.getSaleOptOutNotice()); + Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); + Assertions.assertEquals(3, uspCaV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, uspCaV1.getSaleOptOut()); + Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0), uspCaV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(0, 1), uspCaV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspCaV1.getPersonalDataConsents()); + Assertions.assertEquals(3, uspCaV1.getMspaCoveredTransaction()); + Assertions.assertEquals(1, uspCaV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, uspCaV1.getMspaServiceProviderMode()); + Assertions.assertEquals(false, uspCaV1.getGpcSegmentIncluded()); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java index 296e9aba..91d00952 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java @@ -13,13 +13,13 @@ public class UspCoV1Test { @Test public void testEncode1() throws EncodingException { UspCoV1 uspCoV1 = new UspCoV1(); - Assertions.assertEquals("BAAAAAAA.QAAA", uspCoV1.encode()); + Assertions.assertEquals("BAAAAAA.QA", uspCoV1.encode()); } @Test public void testEncode2() throws EncodingException { UspCoV1 uspCoV1 = new UspCoV1(); - + uspCoV1.setFieldValue(UspCoV1Field.SHARING_NOTICE, 1); uspCoV1.setFieldValue(UspCoV1Field.SALE_OPT_OUT_NOTICE, 2); uspCoV1.setFieldValue(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); @@ -31,24 +31,48 @@ public void testEncode2() throws EncodingException { uspCoV1.setFieldValue(UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); uspCoV1.setFieldValue(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); uspCoV1.setFieldValue(UspCoV1Field.GPC, true); - - Assertions.assertEquals("BbYbG2wA.YAAA", uspCoV1.encode()); + + Assertions.assertEquals("BbYbG2w.YA", uspCoV1.encode()); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() throws EncodingException { + UspCoV1 uspCoV1 = new UspCoV1(); + uspCoV1.setFieldValue(UspCoV1Field.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAA", uspCoV1.encode()); } - + @Test public void testDecode1() throws DecodingException { - UspCoV1 uspCoV1 = new UspCoV1("BbYbG2wA.YAAA"); - - Assertions.assertEquals(1, uspCoV1.getSharingNotice()); - Assertions.assertEquals(2, uspCoV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspCoV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, uspCoV1.getSaleOptOut()); - Assertions.assertEquals(2, uspCoV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2), uspCoV1.getSensitiveDataProcessing()); - Assertions.assertEquals(3, uspCoV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspCoV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspCoV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspCoV1.getMspaServiceProviderMode()); - Assertions.assertEquals(true, uspCoV1.getGpc()); + UspCoV1 uspCoV1 = new UspCoV1("BbYbG2wA.YA"); + + Assertions.assertEquals(1, uspCoV1.getSharingNotice()); + Assertions.assertEquals(2, uspCoV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspCoV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, uspCoV1.getSaleOptOut()); + Assertions.assertEquals(2, uspCoV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2), uspCoV1.getSensitiveDataProcessing()); + Assertions.assertEquals(3, uspCoV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspCoV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspCoV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspCoV1.getMspaServiceProviderMode()); + Assertions.assertEquals(true, uspCoV1.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UspCoV1 uspCoV1 = new UspCoV1("BbYbG2wA"); + + Assertions.assertEquals(1, uspCoV1.getSharingNotice()); + Assertions.assertEquals(2, uspCoV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspCoV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, uspCoV1.getSaleOptOut()); + Assertions.assertEquals(2, uspCoV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2), uspCoV1.getSensitiveDataProcessing()); + Assertions.assertEquals(3, uspCoV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspCoV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspCoV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspCoV1.getMspaServiceProviderMode()); + Assertions.assertEquals(false, uspCoV1.getGpcSegmentIncluded()); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java index 4a94a683..bb10e025 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java @@ -13,13 +13,13 @@ public class UspCtV1Test { @Test public void testEncode1() throws EncodingException { UspCtV1 uspCtV1 = new UspCtV1(); - Assertions.assertEquals("BAAAAAAA.QAAA", uspCtV1.encode()); + Assertions.assertEquals("BAAAAAAA.QA", uspCtV1.encode()); } @Test public void testEncode2() throws EncodingException { UspCtV1 uspCtV1 = new UspCtV1(); - + uspCtV1.setFieldValue(UspCtV1Field.SHARING_NOTICE, 1); uspCtV1.setFieldValue(UspCtV1Field.SALE_OPT_OUT_NOTICE, 2); uspCtV1.setFieldValue(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); @@ -31,24 +31,48 @@ public void testEncode2() throws EncodingException { uspCtV1.setFieldValue(UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); uspCtV1.setFieldValue(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); uspCtV1.setFieldValue(UspCtV1Field.GPC, true); - - Assertions.assertEquals("BbYbG22w.YAAA", uspCtV1.encode()); + + Assertions.assertEquals("BbYbG22w.YA", uspCtV1.encode()); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() throws EncodingException { + UspCtV1 uspCtV1 = new UspCtV1(); + uspCtV1.setFieldValue(UspCtV1Field.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAAA", uspCtV1.encode()); } - + @Test public void testDecode1() throws DecodingException { UspCtV1 uspCtV1 = new UspCtV1("BbYbG22w.YAAA"); - - Assertions.assertEquals(1, uspCtV1.getSharingNotice()); - Assertions.assertEquals(2, uspCtV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspCtV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, uspCtV1.getSaleOptOut()); - Assertions.assertEquals(2, uspCtV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspCtV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(1, 2, 3), uspCtV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspCtV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspCtV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspCtV1.getMspaServiceProviderMode()); - Assertions.assertEquals(true, uspCtV1.getGpc()); + + Assertions.assertEquals(1, uspCtV1.getSharingNotice()); + Assertions.assertEquals(2, uspCtV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspCtV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, uspCtV1.getSaleOptOut()); + Assertions.assertEquals(2, uspCtV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspCtV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(1, 2, 3), uspCtV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspCtV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspCtV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspCtV1.getMspaServiceProviderMode()); + Assertions.assertEquals(true, uspCtV1.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UspCtV1 uspCtV1 = new UspCtV1("BbYbG22w"); + + Assertions.assertEquals(1, uspCtV1.getSharingNotice()); + Assertions.assertEquals(2, uspCtV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspCtV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, uspCtV1.getSaleOptOut()); + Assertions.assertEquals(2, uspCtV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspCtV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(1, 2, 3), uspCtV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspCtV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspCtV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspCtV1.getMspaServiceProviderMode()); + Assertions.assertEquals(false, uspCtV1.getGpcSegmentIncluded()); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java index e65d830b..fa647c2f 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java @@ -14,13 +14,13 @@ public class UspNatV1Test { public void testEncode1() throws EncodingException { UspNatV1 uspNatV1 = new UspNatV1(); - Assertions.assertEquals("BAAAAAAAAAAA.QAAA", uspNatV1.encode()); + Assertions.assertEquals("BAAAAAAAAAA.QA", uspNatV1.encode()); } @Test public void testEncode2() throws EncodingException { UspNatV1 uspNatV1 = new UspNatV1(); - + uspNatV1.setFieldValue(UspNatV1Field.SHARING_NOTICE, 1); uspNatV1.setFieldValue(UspNatV1Field.SALE_OPT_OUT_NOTICE, 2); uspNatV1.setFieldValue(UspNatV1Field.SHARING_OPT_OUT_NOTICE, 3); @@ -37,14 +37,14 @@ public void testEncode2() throws EncodingException { uspNatV1.setFieldValue(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); uspNatV1.setFieldValue(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); uspNatV1.setFieldValue(UspNatV1Field.GPC, true); - - Assertions.assertEquals("BbbbGxsbFbAA.YAAA", uspNatV1.encode()); + + Assertions.assertEquals("BbbbGxsbFbA.YA", uspNatV1.encode()); } - + @Test public void testEncode3() throws EncodingException { UspNatV1 uspNatV1 = new UspNatV1(); - + uspNatV1.setFieldValue(UspNatV1Field.SHARING_NOTICE, 1); uspNatV1.setFieldValue(UspNatV1Field.SALE_OPT_OUT_NOTICE, 1); uspNatV1.setFieldValue(UspNatV1Field.SHARING_OPT_OUT_NOTICE, 1); @@ -61,14 +61,22 @@ public void testEncode3() throws EncodingException { uspNatV1.setFieldValue(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); uspNatV1.setFieldValue(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); uspNatV1.setFieldValue(UspNatV1Field.GPC, true); - - Assertions.assertEquals("BVQVAAAAAUAA.YAAA", uspNatV1.encode()); + + Assertions.assertEquals("BVQVAAAAAUA.YA", uspNatV1.encode()); + } + + @Test + public void testEncodeWithGpcSegmentIncluded() throws EncodingException { + + UspNatV1 uspNatV1 = new UspNatV1(); + uspNatV1.setFieldValue(UspNatV1Field.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAAAAAA", uspNatV1.encode()); } - + @Test - public void testDecodde1() throws DecodingException { - UspNatV1 uspNatV1 = new UspNatV1("BbbbGxsbFbAA.YAAA"); - + public void testDecode1() throws DecodingException { + UspNatV1 uspNatV1 = new UspNatV1("BbbbGxsbFbA.YA"); + Assertions.assertEquals(1, uspNatV1.getSharingNotice()); Assertions.assertEquals(2, uspNatV1.getSaleOptOutNotice()); Assertions.assertEquals(3, uspNatV1.getSharingOptOutNotice()); @@ -86,4 +94,26 @@ public void testDecodde1() throws DecodingException { Assertions.assertEquals(3, uspNatV1.getMspaServiceProviderMode()); Assertions.assertEquals(true, uspNatV1.getGpc()); } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UspNatV1 uspNatV1 = new UspNatV1("BbbbGxsbFbA"); + + Assertions.assertEquals(1, uspNatV1.getSharingNotice()); + Assertions.assertEquals(2, uspNatV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspNatV1.getSharingOptOutNotice()); + Assertions.assertEquals(1, uspNatV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(2, uspNatV1.getSensitiveDataProcessingOptOutNotice()); + Assertions.assertEquals(3, uspNatV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, uspNatV1.getSaleOptOut()); + Assertions.assertEquals(2, uspNatV1.getSharingOptOut()); + Assertions.assertEquals(3, uspNatV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3), uspNatV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(0, 1), uspNatV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspNatV1.getPersonalDataConsents()); + Assertions.assertEquals(1, uspNatV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspNatV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspNatV1.getMspaServiceProviderMode()); + Assertions.assertEquals(false, uspNatV1.getGpcSegmentIncluded()); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java index e7962f94..3c3312f5 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java @@ -19,7 +19,7 @@ public void testEncode1() throws EncodingException { @Test public void testEncode2() throws EncodingException { UspUtV1 uspUtV1 = new UspUtV1(); - + uspUtV1.setFieldValue(UspUtV1Field.SHARING_NOTICE, 1); uspUtV1.setFieldValue(UspUtV1Field.SALE_OPT_OUT_NOTICE, 2); uspUtV1.setFieldValue(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); @@ -31,23 +31,23 @@ public void testEncode2() throws EncodingException { uspUtV1.setFieldValue(UspUtV1Field.MSPA_COVERED_TRANSACTION, 1); uspUtV1.setFieldValue(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); uspUtV1.setFieldValue(UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - - Assertions.assertEquals("BbWGxvbA", uspUtV1.encode()); + + Assertions.assertEquals("BbWGxvbA", uspUtV1.encode()); } - + @Test public void testDecode1() throws DecodingException { UspUtV1 uspUtV1 = new UspUtV1("BbWGxvbA"); - - Assertions.assertEquals(1, uspUtV1.getSharingNotice()); - Assertions.assertEquals(2, uspUtV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspUtV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, uspUtV1.getSaleOptOut()); - Assertions.assertEquals(2, uspUtV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspUtV1.getSensitiveDataProcessing()); - Assertions.assertEquals(3, uspUtV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspUtV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspUtV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspUtV1.getMspaServiceProviderMode()); + + Assertions.assertEquals(1, uspUtV1.getSharingNotice()); + Assertions.assertEquals(2, uspUtV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspUtV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, uspUtV1.getSaleOptOut()); + Assertions.assertEquals(2, uspUtV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspUtV1.getSensitiveDataProcessing()); + Assertions.assertEquals(3, uspUtV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspUtV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspUtV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspUtV1.getMspaServiceProviderMode()); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1LegacyTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1LegacyTest.java deleted file mode 100644 index a15bf88d..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1LegacyTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.iab.gpp.encoder.section; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.EncodingException; - -public class UspV1LegacyTest { - - @Test - public void testEncode1() throws EncodingException { - UspV1Legacy uspv1 = new UspV1Legacy(); - Assertions.assertEquals("1---", uspv1.encode()); - } - - @Test - public void testEncode2() throws EncodingException { - UspV1Legacy uspv1 = new UspV1Legacy(); - uspv1.setFieldValue("Notice", "Y"); - uspv1.setFieldValue("OptOutSale", "N"); - uspv1.setFieldValue("LspaCovered", "N"); - - Assertions.assertEquals("1YNN", uspv1.encode()); - } - - @Test - public void testEncode3() throws EncodingException { - UspV1Legacy uspv1 = new UspV1Legacy(); - uspv1.setFieldValue("Version", 2); - uspv1.setFieldValue("Notice", "N"); - uspv1.setFieldValue("OptOutSale", "Y"); - uspv1.setFieldValue("LspaCovered", "Y"); - - Assertions.assertEquals("2NYY", uspv1.encode()); - } - - @Test - public void testDecode1() throws EncodingException { - UspV1Legacy uspv1 = new UspV1Legacy("1NYN"); - Assertions.assertEquals(1, uspv1.getFieldValue("Version")); - Assertions.assertEquals("N", uspv1.getFieldValue("Notice")); - Assertions.assertEquals("Y", uspv1.getFieldValue("OptOutSale")); - Assertions.assertEquals("N", uspv1.getFieldValue("LspaCovered")); - - Assertions.assertEquals(uspv1.getFieldValue("Version"), uspv1.getVersion()); - Assertions.assertEquals(uspv1.getFieldValue("Notice"), uspv1.getNotice()); - Assertions.assertEquals(uspv1.getFieldValue("OptOutSale"), uspv1.getOptOutSale()); - Assertions.assertEquals(uspv1.getFieldValue("LspaCovered"), uspv1.getLspaCovered()); - } - - @Test - public void testDecode2() throws EncodingException { - UspV1Legacy uspv1 = new UspV1Legacy("2YNY"); - Assertions.assertEquals(2, uspv1.getFieldValue("Version")); - Assertions.assertEquals("Y", uspv1.getFieldValue("Notice")); - Assertions.assertEquals("N", uspv1.getFieldValue("OptOutSale")); - Assertions.assertEquals("Y", uspv1.getFieldValue("LspaCovered")); - - Assertions.assertEquals(uspv1.getFieldValue("Version"), uspv1.getVersion()); - Assertions.assertEquals(uspv1.getFieldValue("Notice"), uspv1.getNotice()); - Assertions.assertEquals(uspv1.getFieldValue("OptOutSale"), uspv1.getOptOutSale()); - Assertions.assertEquals(uspv1.getFieldValue("LspaCovered"), uspv1.getLspaCovered()); - } - -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java index 3dd091f6..228b346f 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java @@ -2,7 +2,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; public class UspV1Test { @@ -10,31 +9,37 @@ public class UspV1Test { @Test public void testEncode1() throws EncodingException { UspV1 uspv1 = new UspV1(); - uspv1.setFieldValue("Notice", 1); - uspv1.setFieldValue("OptOutSale", 2); - uspv1.setFieldValue("LspaCovered", 3); - - Assertions.assertEquals("000001011011", uspv1.encodeToBitString()); + Assertions.assertEquals("1---", uspv1.encode()); } @Test public void testEncode2() throws EncodingException { UspV1 uspv1 = new UspV1(); - uspv1.setFieldValue("Notice", 1); - uspv1.setFieldValue("OptOutSale", 2); - uspv1.setFieldValue("LspaCovered", 3); + uspv1.setFieldValue("Notice", "Y"); + uspv1.setFieldValue("OptOutSale", "N"); + uspv1.setFieldValue("LspaCovered", "N"); - Assertions.assertEquals("BbAA", uspv1.encode()); + Assertions.assertEquals("1YNN", uspv1.encode()); } @Test - public void testdecode1() throws DecodingException { + public void testEncode3() throws EncodingException { UspV1 uspv1 = new UspV1(); - uspv1.decodeFromBitString("000001011011"); + uspv1.setFieldValue("Version", 2); + uspv1.setFieldValue("Notice", "N"); + uspv1.setFieldValue("OptOutSale", "Y"); + uspv1.setFieldValue("LspaCovered", "Y"); - Assertions.assertEquals(1, uspv1.getFieldValue("Notice")); - Assertions.assertEquals(2, uspv1.getFieldValue("OptOutSale")); - Assertions.assertEquals(3, uspv1.getFieldValue("LspaCovered")); + Assertions.assertEquals("2NYY", uspv1.encode()); + } + + @Test + public void testDecode1() throws EncodingException { + UspV1 uspv1 = new UspV1("1NYN"); + Assertions.assertEquals(1, uspv1.getFieldValue("Version")); + Assertions.assertEquals("N", uspv1.getFieldValue("Notice")); + Assertions.assertEquals("Y", uspv1.getFieldValue("OptOutSale")); + Assertions.assertEquals("N", uspv1.getFieldValue("LspaCovered")); Assertions.assertEquals(uspv1.getFieldValue("Version"), uspv1.getVersion()); Assertions.assertEquals(uspv1.getFieldValue("Notice"), uspv1.getNotice()); @@ -43,15 +48,17 @@ public void testdecode1() throws DecodingException { } @Test - public void testDecode2() throws DecodingException { - UspV1 uspv1 = new UspV1("BbAA"); - Assertions.assertEquals(1, uspv1.getFieldValue("Notice")); - Assertions.assertEquals(2, uspv1.getFieldValue("OptOutSale")); - Assertions.assertEquals(3, uspv1.getFieldValue("LspaCovered")); + public void testDecode2() throws EncodingException { + UspV1 uspv1 = new UspV1("2YNY"); + Assertions.assertEquals(2, uspv1.getFieldValue("Version")); + Assertions.assertEquals("Y", uspv1.getFieldValue("Notice")); + Assertions.assertEquals("N", uspv1.getFieldValue("OptOutSale")); + Assertions.assertEquals("Y", uspv1.getFieldValue("LspaCovered")); Assertions.assertEquals(uspv1.getFieldValue("Version"), uspv1.getVersion()); Assertions.assertEquals(uspv1.getFieldValue("Notice"), uspv1.getNotice()); Assertions.assertEquals(uspv1.getFieldValue("OptOutSale"), uspv1.getOptOutSale()); Assertions.assertEquals(uspv1.getFieldValue("LspaCovered"), uspv1.getLspaCovered()); } + } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java index 9d620951..c15f4246 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java @@ -13,13 +13,13 @@ public class UspVaV1Test { @Test public void testEncode1() throws EncodingException { UspVaV1 uspVaV1 = new UspVaV1(); - Assertions.assertEquals("BAAAAAAA", uspVaV1.encode()); + Assertions.assertEquals("BAAAAAA", uspVaV1.encode()); } @Test public void testEncode2() throws EncodingException { UspVaV1 uspVaV1 = new UspVaV1(); - + uspVaV1.setFieldValue(UspVaV1Field.SHARING_NOTICE, 1); uspVaV1.setFieldValue(UspVaV1Field.SALE_OPT_OUT_NOTICE, 2); uspVaV1.setFieldValue(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); @@ -30,23 +30,23 @@ public void testEncode2() throws EncodingException { uspVaV1.setFieldValue(UspVaV1Field.MSPA_COVERED_TRANSACTION, 1); uspVaV1.setFieldValue(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); uspVaV1.setFieldValue(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - - Assertions.assertEquals("BbYbG9sA", uspVaV1.encode()); + + Assertions.assertEquals("BbYbG9s", uspVaV1.encode()); } - + @Test public void testDecode1() throws DecodingException { - UspVaV1 uspVaV1 = new UspVaV1("BbYbG9sA"); - - Assertions.assertEquals(1, uspVaV1.getSharingNotice()); - Assertions.assertEquals(2, uspVaV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspVaV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, uspVaV1.getSaleOptOut()); - Assertions.assertEquals(2, uspVaV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspVaV1.getSensitiveDataProcessing()); - Assertions.assertEquals(3, uspVaV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspVaV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspVaV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspVaV1.getMspaServiceProviderMode()); + UspVaV1 uspVaV1 = new UspVaV1("BbYbG9s"); + + Assertions.assertEquals(1, uspVaV1.getSharingNotice()); + Assertions.assertEquals(2, uspVaV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, uspVaV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, uspVaV1.getSaleOptOut()); + Assertions.assertEquals(2, uspVaV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspVaV1.getSensitiveDataProcessing()); + Assertions.assertEquals(3, uspVaV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, uspVaV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, uspVaV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, uspVaV1.getMspaServiceProviderMode()); } } diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index 6764dd30..a0b3d28f 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.1.0-SNAPSHOT + 3.0.4-SNAPSHOT iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.1.0-SNAPSHOT + 3.0.4-SNAPSHOT diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index 5fcbce60..f156674e 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.0-SNAPSHOT + 3.0.4-SNAPSHOT iabgpp-extras diff --git a/pom.xml b/pom.xml index 7547ebfe..ce9ce0c3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.1.0-SNAPSHOT + 3.0.4-SNAPSHOT IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From 1663a068929f223d27960adead3d4f138a4e52d0 Mon Sep 17 00:00:00 2001 From: chuff Date: Wed, 11 Jan 2023 20:03:06 -0700 Subject: [PATCH 12/41] Update dependencies. Fix bitfield cast. (#20) * Exception handling * compressed base64urlencoder for all non-tcfeuv2 segments * Revert uspv1 to original encoding * Rename tcfcav2 to tcfcav1 * update readme for tcfcav2 -> tcfcav1 and uspv1 changes * optional gpc segments * update readme with GpcSegmentIncluded fields * fix vendor list encoding / decoding * formatting * 3.0.3 * version bump * fix bitfield data type * update jackson version * update junit * 3.0.4 * 3.0.5-SNAPSHOT * 3.0.5 * 3.0.6-SNAPSHOT * 3.0.6 * 3.0.7-SNAPSHOT * 3.0.7 * 3.0.8-SNAPSHOT Co-authored-by: chad --- iabgpp-encoder/pom.xml | 20 ++++- .../com/iab/gpp/encoder/section/TcfCaV1.java | 20 ++--- .../com/iab/gpp/encoder/section/TcfEuV2.java | 20 ++--- iabgpp-extras-jackson/pom.xml | 30 ++++++-- .../gpp/extras/jackson/cmp/CmpListTest.java | 20 ++--- .../iab/gpp/extras/jackson/cmp/CmpTest.java | 30 ++++---- .../gpp/extras/jackson/gvl/FeatureTest.java | 24 +++--- .../iab/gpp/extras/jackson/gvl/GvlTest.java | 34 ++++----- .../gpp/extras/jackson/gvl/OverflowTest.java | 16 ++-- .../gpp/extras/jackson/gvl/PurposeTest.java | 26 +++---- .../jackson/gvl/SpecialFeatureTest.java | 24 +++--- .../jackson/gvl/SpecialPurposeTest.java | 28 +++---- .../iab/gpp/extras/jackson/gvl/StackTest.java | 32 ++++---- .../gpp/extras/jackson/gvl/VendorTest.java | 76 +++++++++---------- iabgpp-extras/pom.xml | 20 ++++- pom.xml | 2 +- 16 files changed, 230 insertions(+), 192 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index cc430d85..d3ddc08f 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.0.4-SNAPSHOT + 3.0.8-SNAPSHOT iabgpp-encoder @@ -17,11 +17,27 @@ org.junit.jupiter junit-jupiter-engine - 5.9.0 + 5.9.2 test + + + + maven-surefire-plugin + 2.22.2 + + + org.junit.platform + junit-platform-surefire-provider + 1.3.2 + + + + + + release diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java index 3afec30d..b22dee66 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java @@ -224,18 +224,18 @@ public Boolean getUseNonStandardStacks() { } @SuppressWarnings("unchecked") - public List getSpecialFeatureExpressConsent() { - return (List) this.fields.get(TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT).getValue(); + public List getSpecialFeatureExpressConsent() { + return (List) this.fields.get(TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT).getValue(); } @SuppressWarnings("unchecked") - public List getPurposesExpressConsent() { - return (List) this.fields.get(TcfCaV1Field.PURPOSES_EXPRESS_CONSENT).getValue(); + public List getPurposesExpressConsent() { + return (List) this.fields.get(TcfCaV1Field.PURPOSES_EXPRESS_CONSENT).getValue(); } @SuppressWarnings("unchecked") - public List getPurposesImpliedConsent() { - return (List) this.fields.get(TcfCaV1Field.PURPOSES_IMPLIED_CONSENT).getValue(); + public List getPurposesImpliedConsent() { + return (List) this.fields.get(TcfCaV1Field.PURPOSES_IMPLIED_CONSENT).getValue(); } @SuppressWarnings("unchecked") @@ -253,13 +253,13 @@ public Integer getPubPurposesSegmentType() { } @SuppressWarnings("unchecked") - public List getPubPurposesExpressConsent() { - return (List) this.fields.get(TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT).getValue(); + public List getPubPurposesExpressConsent() { + return (List) this.fields.get(TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT).getValue(); } @SuppressWarnings("unchecked") - public List getPubPurposesImpliedConsent() { - return (List) this.fields.get(TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT).getValue(); + public List getPubPurposesImpliedConsent() { + return (List) this.fields.get(TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT).getValue(); } public Integer getNumCustomPurposes() { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java index 1b1b2489..5ef06409 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java @@ -276,18 +276,18 @@ public Boolean getUseNonStandardStacks() { } @SuppressWarnings("unchecked") - public List getSpecialFeatureOptins() { - return (List) this.fields.get(TcfEuV2Field.SPECIAL_FEATURE_OPTINS).getValue(); + public List getSpecialFeatureOptins() { + return (List) this.fields.get(TcfEuV2Field.SPECIAL_FEATURE_OPTINS).getValue(); } @SuppressWarnings("unchecked") - public List getPurposeConsents() { - return (List) this.fields.get(TcfEuV2Field.PURPOSE_CONSENTS).getValue(); + public List getPurposeConsents() { + return (List) this.fields.get(TcfEuV2Field.PURPOSE_CONSENTS).getValue(); } @SuppressWarnings("unchecked") - public List getPurposeLegitimateInterests() { - return (List) this.fields.get(TcfEuV2Field.PURPOSE_LEGITIMATE_INTERESTS).getValue(); + public List getPurposeLegitimateInterests() { + return (List) this.fields.get(TcfEuV2Field.PURPOSE_LEGITIMATE_INTERESTS).getValue(); } public Boolean getPurposeOneTreatment() { @@ -318,13 +318,13 @@ public Integer getPublisherPurposesSegmentType() { } @SuppressWarnings("unchecked") - public List getPublisherConsents() { - return (List) this.fields.get(TcfEuV2Field.PUBLISHER_CONSENTS).getValue(); + public List getPublisherConsents() { + return (List) this.fields.get(TcfEuV2Field.PUBLISHER_CONSENTS).getValue(); } @SuppressWarnings("unchecked") - public List getPublisherLegitimateInterests() { - return (List) this.fields.get(TcfEuV2Field.PUBLISHER_LEGITIMATE_INTERESTS).getValue(); + public List getPublisherLegitimateInterests() { + return (List) this.fields.get(TcfEuV2Field.PUBLISHER_LEGITIMATE_INTERESTS).getValue(); } public Integer getNumCustomPurposes() { diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index a0b3d28f..47cef939 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.0.4-SNAPSHOT + 3.0.8-SNAPSHOT iabgpp-extras-jackson @@ -15,32 +15,48 @@ - junit - junit - 4.13.2 + org.junit.jupiter + junit-jupiter-engine + 5.9.2 test com.iabgpp iabgpp-extras - 3.0.4-SNAPSHOT + 3.0.8-SNAPSHOT com.fasterxml.jackson.core jackson-databind - 2.10.3 + 2.14.1 com.fasterxml.jackson.datatype jackson-datatype-jsr310 - 2.10.3 + 2.14.1 + + + + maven-surefire-plugin + 2.22.2 + + + org.junit.platform + junit-platform-surefire-provider + 1.3.2 + + + + + + release diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpListTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpListTest.java index 98ca8447..671a5321 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpListTest.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpListTest.java @@ -1,5 +1,11 @@ package com.iab.gpp.extras.jackson.cmp; +import java.io.IOException; +import java.time.Instant; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + /*- * #%L * IAB TCF Java CMP List Jackson @@ -21,20 +27,14 @@ */ import com.iab.gpp.extras.cmp.CmpList; -import com.iab.gpp.extras.jackson.TestUtil; import com.iab.gpp.extras.jackson.Loader; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.IOException; -import java.time.Instant; +import com.iab.gpp.extras.jackson.TestUtil; public class CmpListTest { private static CmpList cmpList; - @BeforeClass + @BeforeAll public static void setUpBeforeClass() throws IOException { Loader loader = new Loader(); cmpList = loader.cmpList(TestUtil.getCmpList()); @@ -42,11 +42,11 @@ public static void setUpBeforeClass() throws IOException { @Test public void getLastUpdated() { - Assert.assertEquals(Instant.parse("2020-04-09T17:03:06Z"), cmpList.getLastUpdated()); + Assertions.assertEquals(Instant.parse("2020-04-09T17:03:06Z"), cmpList.getLastUpdated()); } @Test public void getCmps() { - Assert.assertEquals(12, cmpList.getCmps().size()); + Assertions.assertEquals(12, cmpList.getCmps().size()); } } \ No newline at end of file diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpTest.java index d6f54381..93b17cfa 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpTest.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpTest.java @@ -1,5 +1,11 @@ package com.iab.gpp.extras.jackson.cmp; +import java.io.IOException; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + /*- * #%L * IAB TCF Java CMP List Jackson @@ -21,14 +27,8 @@ */ import com.iab.gpp.extras.cmp.Cmp; -import com.iab.gpp.extras.jackson.TestUtil; import com.iab.gpp.extras.jackson.Loader; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.IOException; -import java.util.List; +import com.iab.gpp.extras.jackson.TestUtil; public class CmpTest { @@ -37,7 +37,7 @@ public class CmpTest { private static final int CMP_ID_SELECTED_FOR_TEST = 3; private static final int DELETED_CMP_ID_SELECTED_FOR_TEST = 23; - @BeforeClass + @BeforeAll public static void setupBeforeClass() throws IOException { Loader loader = new Loader(); List cmps = loader.cmpList(TestUtil.getCmpList()).getCmps(); @@ -48,29 +48,29 @@ public static void setupBeforeClass() throws IOException { @Test public void getId() { - Assert.assertEquals(3, cmpThree.getId()); + Assertions.assertEquals(3, cmpThree.getId()); } @Test public void getName() { String name = "LiveRamp"; - Assert.assertEquals(name, cmpThree.getName()); + Assertions.assertEquals(name, cmpThree.getName()); } @Test public void isCommercial() { - Assert.assertTrue(cmpThree.isCommercial()); + Assertions.assertTrue(cmpThree.isCommercial()); } @Test public void getDeletedDate() { - Assert.assertNull(cmpThree.getDeletedDate().orElse(null)); - Assert.assertNotNull(cmpTwentyThree.getDeletedDate().orElse(null)); + Assertions.assertNull(cmpThree.getDeletedDate().orElse(null)); + Assertions.assertNotNull(cmpTwentyThree.getDeletedDate().orElse(null)); } @Test public void isDeleted() { - Assert.assertFalse(cmpThree.isDeleted()); - Assert.assertTrue(cmpTwentyThree.isDeleted()); + Assertions.assertFalse(cmpThree.isDeleted()); + Assertions.assertTrue(cmpTwentyThree.isDeleted()); } } \ No newline at end of file diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/FeatureTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/FeatureTest.java index 261ee812..5b74f5f7 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/FeatureTest.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/FeatureTest.java @@ -1,5 +1,11 @@ package com.iab.gpp.extras.jackson.gvl; +import java.io.IOException; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + /*- * #%L * IAB TCF Java GVL Jackson @@ -21,21 +27,15 @@ */ import com.iab.gpp.extras.gvl.Feature; -import com.iab.gpp.extras.jackson.TestUtil; import com.iab.gpp.extras.jackson.Loader; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.IOException; -import java.util.List; +import com.iab.gpp.extras.jackson.TestUtil; public class FeatureTest { private static Feature featureTwo; private static final int FEATURE_ID_SELECTED_FOR_TEST = 2; - @BeforeClass + @BeforeAll public static void setupBeforeClass() throws IOException { Loader loader = new Loader(); List features = loader.globalVendorList(TestUtil.getGlobalVendorList()).getFeatures(); @@ -44,26 +44,26 @@ public static void setupBeforeClass() throws IOException { @Test public void testGetId() { - Assert.assertEquals(2, featureTwo.getId()); + Assertions.assertEquals(2, featureTwo.getId()); } @Test public void testGetName() { String expectedName = "Link different devices"; - Assert.assertEquals(expectedName, featureTwo.getName()); + Assertions.assertEquals(expectedName, featureTwo.getName()); } @Test public void testGetDescription() { String expectedDescription = "Different devices can be determined as belonging to you or your household in support of one or more of purposes."; - Assert.assertEquals(expectedDescription, featureTwo.getDescription()); + Assertions.assertEquals(expectedDescription, featureTwo.getDescription()); } @Test public void testGetDescriptionLegal() { String expectedDescriptionLegal = "Vendors can:\n* Deterministically determine that two or more devices belong to the same user or household\n* Probabilistically determine that two or more devices belong to the same user or household\n* Actively scan device characteristics for identification for probabilistic identification if users have allowed vendors to actively scan device characteristics for identification (Special Feature 2)"; - Assert.assertEquals(expectedDescriptionLegal, featureTwo.getDescriptionLegal()); + Assertions.assertEquals(expectedDescriptionLegal, featureTwo.getDescriptionLegal()); } } diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlTest.java index 2ffeae12..5d590d55 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlTest.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlTest.java @@ -25,19 +25,17 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; - -import com.iab.gpp.extras.jackson.TestUtil; -import com.iab.gpp.extras.jackson.Loader; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import com.iab.gpp.extras.gvl.Gvl; +import com.iab.gpp.extras.jackson.Loader; +import com.iab.gpp.extras.jackson.TestUtil; public class GvlTest { private static Gvl gvl; - @BeforeClass + @BeforeAll public static void setUpBeforeClass() throws IOException { Loader loader = new Loader(); gvl = loader.globalVendorList(TestUtil.getGlobalVendorList()); @@ -45,17 +43,17 @@ public static void setUpBeforeClass() throws IOException { @Test public void testGetGvlSpecificationVersion() { - Assert.assertEquals(2, gvl.getGvlSpecificationVersion()); + Assertions.assertEquals(2, gvl.getGvlSpecificationVersion()); } @Test public void testGetVendorListVersion() { - Assert.assertEquals(26, gvl.getVendorListVersion()); + Assertions.assertEquals(26, gvl.getVendorListVersion()); } @Test public void testGetTcfPolicyVersion() { - Assert.assertEquals(2, gvl.getTcfPolicyVersion()); + Assertions.assertEquals(2, gvl.getTcfPolicyVersion()); } @Test @@ -63,36 +61,36 @@ public void testGetLastUpdated() throws ParseException { SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); parser.setTimeZone(TimeZone.getTimeZone("GMT")); Date parsed = parser.parse("2020-02-20T16:05:20"); - Assert.assertEquals(parsed.toInstant(), gvl.getLastUpdated()); + Assertions.assertEquals(parsed.toInstant(), gvl.getLastUpdated()); } @Test public void testGetPurposes() { - Assert.assertEquals(10, gvl.getPurposes().size()); + Assertions.assertEquals(10, gvl.getPurposes().size()); } @Test public void testGetSpecialPurposes() { - Assert.assertEquals(2, gvl.getSpecialPurposes().size()); + Assertions.assertEquals(2, gvl.getSpecialPurposes().size()); } @Test public void testGetFeatures() { - Assert.assertEquals(3, gvl.getFeatures().size()); + Assertions.assertEquals(3, gvl.getFeatures().size()); } @Test public void testGetSpecialFeatures() { - Assert.assertEquals(2, gvl.getSpecialFeatures().size()); + Assertions.assertEquals(2, gvl.getSpecialFeatures().size()); } @Test public void testGetStacks() { - Assert.assertEquals(37, gvl.getStacks().size()); + Assertions.assertEquals(37, gvl.getStacks().size()); } @Test public void testGetVendors() { - Assert.assertEquals(3, gvl.getVendors().size()); + Assertions.assertEquals(3, gvl.getVendors().size()); } } diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/OverflowTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/OverflowTest.java index ea7b188e..3d9ad22b 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/OverflowTest.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/OverflowTest.java @@ -21,22 +21,20 @@ */ import java.util.List; - -import com.iab.gpp.extras.jackson.TestUtil; -import com.iab.gpp.extras.jackson.Loader; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import com.iab.gpp.extras.gvl.Overflow; import com.iab.gpp.extras.gvl.Vendor; +import com.iab.gpp.extras.jackson.Loader; +import com.iab.gpp.extras.jackson.TestUtil; public class OverflowTest { private static Overflow vendorEightOverflow; private static final int VENDOR_ID_SELECTED_FOR_TEST = 8; - @BeforeClass + @BeforeAll public static void setUpBeforeClass() throws Exception { Loader loader = new Loader(); List vendors = loader.globalVendorList(TestUtil.getGlobalVendorList()).getVendors(); @@ -47,6 +45,6 @@ public static void setUpBeforeClass() throws Exception { @Test public void getHttpGetLimit() { - Assert.assertEquals(32, vendorEightOverflow.getHttpGetLimit()); + Assertions.assertEquals(32, vendorEightOverflow.getHttpGetLimit()); } } diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/PurposeTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/PurposeTest.java index a75bf04b..f5957354 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/PurposeTest.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/PurposeTest.java @@ -22,21 +22,19 @@ import java.io.IOException; import java.util.List; - -import com.iab.gpp.extras.jackson.TestUtil; -import com.iab.gpp.extras.jackson.Loader; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import com.iab.gpp.extras.gvl.Purpose; +import com.iab.gpp.extras.jackson.Loader; +import com.iab.gpp.extras.jackson.TestUtil; public class PurposeTest { private static Purpose purposeTen; private static final int PURPOSE_SELECTED_FOR_TEST = 10; - @BeforeClass + @BeforeAll public static void setUpBeforeClass() throws IOException { Loader loader = new Loader(); List purposes = loader.globalVendorList(TestUtil.getGlobalVendorList()).getPurposes(); @@ -45,36 +43,36 @@ public static void setUpBeforeClass() throws IOException { @Test public void testGetId() { - Assert.assertEquals(10, purposeTen.getId()); + Assertions.assertEquals(10, purposeTen.getId()); } @Test public void testGetName() { String expectedName = "Develop and improve products"; - Assert.assertEquals(expectedName, purposeTen.getName()); + Assertions.assertEquals(expectedName, purposeTen.getName()); } @Test public void testGetDescription() { String expectedDescription = "Your data can be used to improve existing systems and software, and to develop new products"; - Assert.assertEquals(expectedDescription, purposeTen.getDescription()); + Assertions.assertEquals(expectedDescription, purposeTen.getDescription()); } @Test public void testGetDescriptionLegal() { String expectedDescriptionLegal = "To develop new products and improve products vendors can:\n* Use information to improve their existing products with new features and to develop new products\n* Create new models and algorithms through machine learning\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose"; - Assert.assertEquals(expectedDescriptionLegal, purposeTen.getDescriptionLegal()); + Assertions.assertEquals(expectedDescriptionLegal, purposeTen.getDescriptionLegal()); } @Test public void testGetConsentable() { - Assert.assertTrue(purposeTen.getConsentable()); + Assertions.assertTrue(purposeTen.getConsentable()); } @Test public void testGetRightToObject() { - Assert.assertFalse(purposeTen.getRightToObject()); + Assertions.assertFalse(purposeTen.getRightToObject()); } } diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialFeatureTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialFeatureTest.java index 362d6c75..005f58ae 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialFeatureTest.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialFeatureTest.java @@ -21,22 +21,20 @@ */ import java.util.List; - -import com.iab.gpp.extras.jackson.TestUtil; -import com.iab.gpp.extras.jackson.Loader; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import com.iab.gpp.extras.gvl.SpecialFeature; +import com.iab.gpp.extras.jackson.Loader; +import com.iab.gpp.extras.jackson.TestUtil; public class SpecialFeatureTest { private static SpecialFeature specialFeatureOne; private final static int SPECIAL_FEAUTRE_ID_SELECTED_FOR_TEST = 1; - @Before - public void setUp() throws Exception { + @BeforeAll + public static void setUp() throws Exception { Loader loader = new Loader(); List specialFeatures = loader.globalVendorList(TestUtil.getGlobalVendorList()).getSpecialFeatures(); specialFeatureOne = @@ -48,26 +46,26 @@ public void setUp() throws Exception { @Test public void testGetId() { - Assert.assertEquals(1, specialFeatureOne.getId()); + Assertions.assertEquals(1, specialFeatureOne.getId()); } @Test public void testGetName() { String expectedName = "Use precise geolocation data"; - Assert.assertEquals(expectedName, specialFeatureOne.getName()); + Assertions.assertEquals(expectedName, specialFeatureOne.getName()); } @Test public void testGetDescription() { String expectedDescription = "Your precise geolocation data can be used in support of one or more purposes. This means your location can be accurate to within several meters."; - Assert.assertEquals(expectedDescription, specialFeatureOne.getDescription()); + Assertions.assertEquals(expectedDescription, specialFeatureOne.getDescription()); } @Test public void testGetDescriptionLegal() { String expectedDescriptionLegal = "Vendors can:\n* Collect and process precise geolocation data in support of one or more purposes.\nN.B. Precise geolocation means that there are no restrictions on the precision of a user’s location; this can be accurate to within several meters."; - Assert.assertEquals(expectedDescriptionLegal, specialFeatureOne.getDescriptionLegal()); + Assertions.assertEquals(expectedDescriptionLegal, specialFeatureOne.getDescriptionLegal()); } } diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialPurposeTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialPurposeTest.java index 3ec1e289..3f250276 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialPurposeTest.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialPurposeTest.java @@ -1,5 +1,11 @@ package com.iab.gpp.extras.jackson.gvl; +import java.io.IOException; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + /*- * #%L * IAB TCF Java GVL Jackson @@ -21,21 +27,15 @@ */ import com.iab.gpp.extras.gvl.SpecialPurpose; -import com.iab.gpp.extras.jackson.TestUtil; import com.iab.gpp.extras.jackson.Loader; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.IOException; -import java.util.List; +import com.iab.gpp.extras.jackson.TestUtil; public class SpecialPurposeTest { private static SpecialPurpose specialPurposeOne; private static final int SPECIAL_PURPOSE_SELECTED_FOR_TEST = 1; - @BeforeClass + @BeforeAll public static void setupBeforeClass() throws IOException { Loader loader = new Loader(); List specialPurposes = loader.globalVendorList(TestUtil.getGlobalVendorList()).getSpecialPurposes(); @@ -48,36 +48,36 @@ public static void setupBeforeClass() throws IOException { @Test public void testGetId() { - Assert.assertEquals(1, specialPurposeOne.getId()); + Assertions.assertEquals(1, specialPurposeOne.getId()); } @Test public void testGetName() { String expectedName = "Ensure security, prevent fraud, and debug"; - Assert.assertEquals(expectedName, specialPurposeOne.getName()); + Assertions.assertEquals(expectedName, specialPurposeOne.getName()); } @Test public void testGetDescription() { String expectedDescription = "Your data can be used to monitor for and prevent fraudulent activity, and ensure systems and processes work properly and securely."; - Assert.assertEquals(expectedDescription, specialPurposeOne.getDescription()); + Assertions.assertEquals(expectedDescription, specialPurposeOne.getDescription()); } @Test public void testGetDescriptionLegal() { String expectedDescriptionLegal = "To ensure security, prevent fraud and debug vendors can:\n* Ensure data are securely transmitted\n* Detect and prevent malicious, fraudulent, invalid, or illegal activity.\n* Ensure correct and efficient operation of systems and processes, including to monitor and enhance the performance of systems and processes engaged in permitted purposes\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose."; - Assert.assertEquals(expectedDescriptionLegal, specialPurposeOne.getDescriptionLegal()); + Assertions.assertEquals(expectedDescriptionLegal, specialPurposeOne.getDescriptionLegal()); } @Test public void testGetConsentable() { - Assert.assertTrue(specialPurposeOne.getConsentable()); + Assertions.assertTrue(specialPurposeOne.getConsentable()); } @Test public void testGetRightToObject() { - Assert.assertFalse(specialPurposeOne.getRightToObject()); + Assertions.assertFalse(specialPurposeOne.getRightToObject()); } } diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/StackTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/StackTest.java index 5a5f6b5f..a353268a 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/StackTest.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/StackTest.java @@ -1,5 +1,11 @@ package com.iab.gpp.extras.jackson.gvl; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + /*- * #%L * IAB TCF Java GVL Jackson @@ -21,21 +27,15 @@ */ import com.iab.gpp.extras.gvl.Stack; -import com.iab.gpp.extras.jackson.TestUtil; import com.iab.gpp.extras.jackson.Loader; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.util.Arrays; -import java.util.List; +import com.iab.gpp.extras.jackson.TestUtil; public class StackTest { private static Stack stackTwenty; private final static int STACK_ID_SELECTED_FOR_TEST = 20; - @BeforeClass + @BeforeAll public static void setUpBeforeClass() throws Exception { Loader loader = new Loader(); List stacks = loader.globalVendorList(TestUtil.getGlobalVendorList()).getStacks(); @@ -44,32 +44,32 @@ public static void setUpBeforeClass() throws Exception { @Test public void testGetId() { - Assert.assertEquals(20, stackTwenty.getId()); + Assertions.assertEquals(20, stackTwenty.getId()); } @Test public void testGetSpecialFeatures() { - Assert.assertNotNull(stackTwenty.getSpecialFeatures()); - Assert.assertEquals(0, stackTwenty.getSpecialFeatures().size()); + Assertions.assertNotNull(stackTwenty.getSpecialFeatures()); + Assertions.assertEquals(0, stackTwenty.getSpecialFeatures().size()); } @Test public void testGetPurposes() { - Assert.assertNotNull(stackTwenty.getPurposes()); - Assert.assertEquals(4, stackTwenty.getPurposes().size()); - Assert.assertEquals(Arrays.asList(7, 8, 9, 10), stackTwenty.getPurposes()); + Assertions.assertNotNull(stackTwenty.getPurposes()); + Assertions.assertEquals(4, stackTwenty.getPurposes().size()); + Assertions.assertEquals(Arrays.asList(7, 8, 9, 10), stackTwenty.getPurposes()); } @Test public void testGetName() { String expectedName = "Ad and content measurement, audience insights, and product development"; - Assert.assertEquals(expectedName, stackTwenty.getName()); + Assertions.assertEquals(expectedName, stackTwenty.getName()); } @Test public void testGetDescription() { String expectedDescription = "Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software. Insights about the audiences who saw the ads and content can be derived."; - Assert.assertEquals(expectedDescription, stackTwenty.getDescription()); + Assertions.assertEquals(expectedDescription, stackTwenty.getDescription()); } } diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/VendorTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/VendorTest.java index b906ec93..57000bbb 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/VendorTest.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/VendorTest.java @@ -22,11 +22,9 @@ import java.time.Instant; import java.util.Arrays; - -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import com.iab.gpp.extras.gvl.Gvl; import com.iab.gpp.extras.gvl.Vendor; import com.iab.gpp.extras.jackson.Loader; @@ -38,7 +36,7 @@ public class VendorTest { private static Vendor vendorTwo; private static final int VENDOR_ID_SELECTED_FOR_TEST = 8; - @BeforeClass + @BeforeAll public static void setUpBeforeClass() throws Exception { Loader loader = new Loader(); Gvl gvl = loader.globalVendorList(TestUtil.getGlobalVendorList()); @@ -48,114 +46,114 @@ public static void setUpBeforeClass() throws Exception { @Test public void testGetId() { - Assert.assertEquals(8, vendorEight.getId()); + Assertions.assertEquals(8, vendorEight.getId()); } @Test public void testGetName() { String expectedName = "Emerse Sverige AB"; - Assert.assertEquals(expectedName, vendorEight.getName()); + Assertions.assertEquals(expectedName, vendorEight.getName()); } @Test public void testGetPurposes() { - Assert.assertNotNull(vendorEight.getPurposes()); - Assert.assertEquals(3, vendorEight.getPurposes().size()); - Assert.assertEquals(Arrays.asList(1, 3, 4), vendorEight.getPurposes()); + Assertions.assertNotNull(vendorEight.getPurposes()); + Assertions.assertEquals(3, vendorEight.getPurposes().size()); + Assertions.assertEquals(Arrays.asList(1, 3, 4), vendorEight.getPurposes()); } @Test public void testGetLegIntPurposes() { - Assert.assertNotNull(vendorEight.getLegIntPurposes()); - Assert.assertEquals(4, vendorEight.getLegIntPurposes().size()); - Assert.assertEquals(Arrays.asList(2, 7, 8, 9), vendorEight.getLegIntPurposes()); + Assertions.assertNotNull(vendorEight.getLegIntPurposes()); + Assertions.assertEquals(4, vendorEight.getLegIntPurposes().size()); + Assertions.assertEquals(Arrays.asList(2, 7, 8, 9), vendorEight.getLegIntPurposes()); } @Test public void testGetFlexiblePurposes() { - Assert.assertNotNull(vendorEight.getFlexiblePurposes()); - Assert.assertEquals(2, vendorEight.getFlexiblePurposes().size()); - Assert.assertEquals(Arrays.asList(2, 9), vendorEight.getFlexiblePurposes()); + Assertions.assertNotNull(vendorEight.getFlexiblePurposes()); + Assertions.assertEquals(2, vendorEight.getFlexiblePurposes().size()); + Assertions.assertEquals(Arrays.asList(2, 9), vendorEight.getFlexiblePurposes()); } @Test public void testGetSpecialPurposes() { - Assert.assertNotNull(vendorEight.getSpecialPurposes()); - Assert.assertEquals(2, vendorEight.getSpecialPurposes().size()); - Assert.assertEquals(Arrays.asList(1, 2), vendorEight.getSpecialPurposes()); + Assertions.assertNotNull(vendorEight.getSpecialPurposes()); + Assertions.assertEquals(2, vendorEight.getSpecialPurposes().size()); + Assertions.assertEquals(Arrays.asList(1, 2), vendorEight.getSpecialPurposes()); } @Test public void testGetFeatures() { - Assert.assertNotNull(vendorEight.getFeatures()); - Assert.assertEquals(2, vendorEight.getFeatures().size()); - Assert.assertEquals(Arrays.asList(1, 2), vendorEight.getFeatures()); + Assertions.assertNotNull(vendorEight.getFeatures()); + Assertions.assertEquals(2, vendorEight.getFeatures().size()); + Assertions.assertEquals(Arrays.asList(1, 2), vendorEight.getFeatures()); } @Test public void testGetSpecialFeatures() { - Assert.assertNotNull(vendorEight.getSpecialFeatures()); - Assert.assertEquals(0, vendorEight.getSpecialFeatures().size()); + Assertions.assertNotNull(vendorEight.getSpecialFeatures()); + Assertions.assertEquals(0, vendorEight.getSpecialFeatures().size()); } @Test public void testGetPolicyUrl() { String expectedPolicyUrl = "https://www.emerse.com/privacy-policy/"; - Assert.assertEquals(expectedPolicyUrl, vendorEight.getPolicyUrl()); + Assertions.assertEquals(expectedPolicyUrl, vendorEight.getPolicyUrl()); } @Test public void testGetDeletedDate() { - Assert.assertEquals(Instant.parse("2020-06-28T00:00:00Z"), vendorEight.getDeletedDate().get()); + Assertions.assertEquals(Instant.parse("2020-06-28T00:00:00Z"), vendorEight.getDeletedDate().get()); } @Test public void testGetOverflow() { - Assert.assertNotNull(vendorEight.getOverflow()); + Assertions.assertNotNull(vendorEight.getOverflow()); } @Test public void testIsDeleted() { - Assert.assertTrue(vendorEight.isDeleted()); + Assertions.assertTrue(vendorEight.isDeleted()); } @Test public void testCookieMaxAgeSeconds() { long expectedCookieMaxAgeSeconds = 31557600000L; - Assert.assertTrue(vendorEight.getCookieMaxAgeSeconds().isPresent()); - Assert.assertEquals(expectedCookieMaxAgeSeconds, vendorEight.getCookieMaxAgeSeconds().get().longValue()); + Assertions.assertTrue(vendorEight.getCookieMaxAgeSeconds().isPresent()); + Assertions.assertEquals(expectedCookieMaxAgeSeconds, vendorEight.getCookieMaxAgeSeconds().get().longValue()); } @Test public void testUsesCookies() { - Assert.assertTrue(vendorEight.getUsesCookies()); + Assertions.assertTrue(vendorEight.getUsesCookies()); } @Test public void testCookieRefresh() { - Assert.assertFalse(vendorEight.getHasCookieRefresh()); + Assertions.assertFalse(vendorEight.getHasCookieRefresh()); } @Test public void testUsesNonCookieAccess() { - Assert.assertTrue(vendorEight.getUsesNonCookieAccess()); + Assertions.assertTrue(vendorEight.getUsesNonCookieAccess()); } @Test public void testNullDeviceStorageDisclosureUrl() { - Assert.assertFalse(vendorEight.getDeviceStorageDisclosureUrl().isPresent()); + Assertions.assertFalse(vendorEight.getDeviceStorageDisclosureUrl().isPresent()); } @Test public void testNullCookieMaxAgeSeconds() { - Assert.assertFalse(vendorTwo.getUsesCookies()); - Assert.assertFalse(vendorTwo.getCookieMaxAgeSeconds().isPresent()); + Assertions.assertFalse(vendorTwo.getUsesCookies()); + Assertions.assertFalse(vendorTwo.getCookieMaxAgeSeconds().isPresent()); } @Test public void testDeviceStorageDisclosureUrl() { String expectedDeviceStorageDisclosureUrl = "https://privacy.blismedia.com/.well-known/deviceStorage.json"; - Assert.assertTrue(vendorTwo.getDeviceStorageDisclosureUrl().isPresent()); - Assert.assertEquals(expectedDeviceStorageDisclosureUrl, vendorTwo.getDeviceStorageDisclosureUrl().get()); + Assertions.assertTrue(vendorTwo.getDeviceStorageDisclosureUrl().isPresent()); + Assertions.assertEquals(expectedDeviceStorageDisclosureUrl, vendorTwo.getDeviceStorageDisclosureUrl().get()); } } diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index f156674e..bf1979a0 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,13 +7,29 @@ com.iabgpp iabgpp-core - 3.0.4-SNAPSHOT + 3.0.8-SNAPSHOT iabgpp-extras jar - + + + + maven-surefire-plugin + 2.22.2 + + + org.junit.platform + junit-platform-surefire-provider + 1.3.2 + + + + + + + release diff --git a/pom.xml b/pom.xml index ce9ce0c3..dbd2062f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.0.4-SNAPSHOT + 3.0.8-SNAPSHOT IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From 2d39d9648443b92a572c447b015c4307822b0e09 Mon Sep 17 00:00:00 2001 From: chuff Date: Fri, 20 Jan 2023 11:15:01 -0700 Subject: [PATCH 13/41] Dedupe and sort lists. Added InvalidFieldError. (#24) * fix optimized fix range decoder * fix optimized fibonacci fix range decoder * 3.0.8 * 3.0.9-SNAPSHOT * 3.0.9 * 3.0.10-SNAPSHOT * dedup and sort lists * formatting * 3.0.10 * 3.0.11-SNAPSHOT * 3.0.12-SNAPSHOT * 3.0.11-SNAPSHOT * 3.0.10 * 3.0.11-SNAPSHOT * 3.0.10 * 3.0.11-SNAPSHOT * cleanup Co-authored-by: chad --- iabgpp-encoder/pom.xml | 2 +- .../java/com/iab/gpp/encoder/GppModel.java | 19 ++-- .../AbstractEncodableBitStringDataType.java | 6 +- .../encoder/datatype/EncodableBoolean.java | 5 +- .../encoder/datatype/EncodableDatetime.java | 5 +- .../datatype/EncodableFibonacciInteger.java | 5 +- .../EncodableFibonacciIntegerRange.java | 18 +++- .../datatype/EncodableFixedBitfield.java | 36 ++++++-- .../datatype/EncodableFixedInteger.java | 5 +- .../datatype/EncodableFixedIntegerList.java | 26 +++++- .../datatype/EncodableFixedIntegerRange.java | 17 +++- .../EncodableFixedNullableBitfield.java | 34 ------- .../datatype/EncodableFixedString.java | 5 +- .../datatype/EncodableFlexibleBitfield.java | 25 +++++- .../EncodableOptimizedFibonacciRange.java | 19 +++- .../EncodableOptimizedFixedRange.java | 20 ++++- .../gpp/encoder/error/DecodingException.java | 8 ++ .../gpp/encoder/error/EncodingException.java | 8 ++ .../encoder/error/InvalidFieldException.java | 18 ++++ .../AbstractEncodableBitStringSection.java | 11 +-- ...actEncodableSegmentedBitStringSection.java | 15 ++-- .../gpp/encoder/section/EncodableSection.java | 3 +- .../com/iab/gpp/encoder/section/TcfCaV1.java | 28 ++++-- .../com/iab/gpp/encoder/section/TcfEuV2.java | 28 ++++-- .../com/iab/gpp/encoder/section/UspV1.java | 26 +++--- .../com/iab/gpp/encoder/GppModelTest.java | 88 +++++++++++++++++-- .../EncodableFixedIntegerRangeTest.java | 36 ++++++++ .../EncodableOptimizedFixedRangeTest.java | 38 ++++++++ .../iab/gpp/encoder/section/HeaderV1Test.java | 13 +-- .../iab/gpp/encoder/section/TcfCaV1Test.java | 9 +- .../iab/gpp/encoder/section/TcfEuV2Test.java | 20 +++-- .../iab/gpp/encoder/section/UspCaV1Test.java | 7 +- .../iab/gpp/encoder/section/UspCoV1Test.java | 5 +- .../iab/gpp/encoder/section/UspCtV1Test.java | 5 +- .../iab/gpp/encoder/section/UspNatV1Test.java | 7 +- .../iab/gpp/encoder/section/UspUtV1Test.java | 3 +- .../iab/gpp/encoder/section/UspV1Test.java | 10 ++- .../iab/gpp/encoder/section/UspVaV1Test.java | 25 +++--- iabgpp-extras-jackson/pom.xml | 4 +- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 41 files changed, 501 insertions(+), 165 deletions(-) delete mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedNullableBitfield.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/InvalidFieldException.java diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index d3ddc08f..e1a96cd4 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.0.8-SNAPSHOT + 3.0.11-SNAPSHOT iabgpp-encoder diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index 12ae0c49..2e4d27c8 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -7,6 +7,7 @@ import java.util.stream.Collectors; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.section.EncodableSection; import com.iab.gpp.encoder.section.HeaderV1; import com.iab.gpp.encoder.section.Sections; @@ -33,11 +34,11 @@ public GppModel(String encodedString) throws DecodingException { } } - public void setFieldValue(int sectionId, String fieldName, Object value) { + public void setFieldValue(int sectionId, String fieldName, Object value) throws InvalidFieldException { setFieldValue(Sections.SECTION_ID_NAME_MAP.get(sectionId), fieldName, value); } - public void setFieldValue(String sectionName, String fieldName, Object value) { + public void setFieldValue(String sectionName, String fieldName, Object value) throws InvalidFieldException { EncodableSection section = null; if (!this.sections.containsKey(sectionName)) { if (sectionName.equals(TcfCaV1.NAME)) { @@ -75,7 +76,7 @@ public void setFieldValue(String sectionName, String fieldName, Object value) { if (section != null) { section.setFieldValue(fieldName, value); } else { - throw new Error(sectionName + " not found"); + throw new InvalidFieldException(sectionName + "." + fieldName + " not found"); } } @@ -113,7 +114,11 @@ public boolean hasSection(String sectionName) { public HeaderV1 getHeader() { HeaderV1 header = new HeaderV1(); - header.setFieldValue("SectionIds", this.getSectionIds()); + try { + header.setFieldValue("SectionIds", this.getSectionIds()); + } catch (InvalidFieldException e) { + + } return header; } @@ -204,7 +209,11 @@ public String encode() throws EncodingException { } HeaderV1 header = new HeaderV1(); - header.setFieldValue("SectionIds", this.getSectionIds()); + try { + header.setFieldValue("SectionIds", this.getSectionIds()); + } catch (InvalidFieldException e) { + throw new EncodingException(e); + } encodedSections.add(0, header.encode()); String encodedString = encodedSections.stream().collect(Collectors.joining("~")); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java index d8c3dcfc..27359760 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java @@ -6,14 +6,10 @@ public abstract class AbstractEncodableBitStringDataType { protected T value; - public AbstractEncodableBitStringDataType() { + protected AbstractEncodableBitStringDataType() { } - public AbstractEncodableBitStringDataType(T value) { - this.value = value; - } - public boolean hasValue() { return this.value != null; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java index bdb29bb1..09d47ac7 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java @@ -6,12 +6,13 @@ public class EncodableBoolean extends AbstractEncodableBitStringDataType { - public EncodableBoolean() { + protected EncodableBoolean() { super(); } public EncodableBoolean(Boolean value) { - super(value); + super(); + setValue(value); } public String encode() throws EncodingException { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java index ad42a95a..f146d0aa 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java @@ -6,12 +6,13 @@ public class EncodableDatetime extends AbstractEncodableBitStringDataType { - public EncodableDatetime() { + protected EncodableDatetime() { super(); } public EncodableDatetime(ZonedDateTime value) { - super(value); + super(); + setValue(value); } public String encode() { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java index b9d9187e..5d4e1783 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java @@ -5,12 +5,13 @@ public class EncodableFibonacciInteger extends AbstractEncodableBitStringDataType { - public EncodableFibonacciInteger() { + protected EncodableFibonacciInteger() { super(); } public EncodableFibonacciInteger(Integer value) { - super(value); + super(); + setValue(value); } public String encode() { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java index e0ec7c64..eaff0382 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java @@ -1,18 +1,21 @@ package com.iab.gpp.encoder.datatype; +import java.util.ArrayList; import java.util.List; +import java.util.TreeSet; import com.iab.gpp.encoder.datatype.encoder.FibonacciIntegerRangeEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; import com.iab.gpp.encoder.error.DecodingException; public class EncodableFibonacciIntegerRange extends AbstractEncodableBitStringDataType> { - public EncodableFibonacciIntegerRange() { + protected EncodableFibonacciIntegerRange() { super(); } public EncodableFibonacciIntegerRange(List value) { - super(value); + super(); + setValue(value); } public String encode() { @@ -36,4 +39,15 @@ public String substring(String bitString, int fromIndex) throws DecodingExceptio } return bitString.substring(fromIndex, index); } + + @SuppressWarnings("unchecked") + @Override + public void setValue(Object value) { + super.setValue(new ArrayList<>(new TreeSet<>((List) value))); + } + + @Override + public List getValue() { + return new ArrayList<>(super.getValue()); + } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java index 581d5ff1..e0ae9b8e 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java @@ -1,5 +1,6 @@ package com.iab.gpp.encoder.datatype; +import java.util.ArrayList; import java.util.List; import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; import com.iab.gpp.encoder.error.DecodingException; @@ -7,20 +8,21 @@ public class EncodableFixedBitfield extends AbstractEncodableBitStringDataType> { - private int bitStringLength; + private int numElements; - public EncodableFixedBitfield(int bitStringLength) { + protected EncodableFixedBitfield(int numElements) { super(); - this.bitStringLength = bitStringLength; + this.numElements = numElements; } - public EncodableFixedBitfield(int bitStringLength, List value) { - super(value); - this.bitStringLength = bitStringLength; + public EncodableFixedBitfield(List value) { + super(); + this.numElements = value.size(); + setValue(value); } public String encode() throws EncodingException { - return FixedBitfieldEncoder.encode(this.value, this.bitStringLength); + return FixedBitfieldEncoder.encode(this.value, this.numElements); } public void decode(String bitString) throws DecodingException { @@ -29,6 +31,24 @@ public void decode(String bitString) throws DecodingException { public String substring(String bitString, int fromIndex) { // TODO: validate - return bitString.substring(fromIndex, fromIndex + this.bitStringLength); + return bitString.substring(fromIndex, fromIndex + this.numElements); + } + + @SuppressWarnings("unchecked") + @Override + public void setValue(Object value) { + List v = new ArrayList<>((List) value); + for (int i = v.size(); i < numElements; i++) { + v.add(false); + } + if (v.size() > numElements) { + v = v.subList(0, numElements); + } + super.setValue(v); + } + + @Override + public List getValue() { + return new ArrayList<>(super.getValue()); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java index 90340f29..8b0fcb7e 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java @@ -7,14 +7,15 @@ public class EncodableFixedInteger extends AbstractEncodableBitStringDataType value) { - super(value); + super(); this.elementBitStringLength = elementBitStringLength; this.numElements = value.size(); + setValue(value); } public String encode() throws EncodingException { @@ -34,4 +36,22 @@ public String substring(String bitString, int fromIndex) { // TODO: validate return bitString.substring(fromIndex, fromIndex + (this.elementBitStringLength * numElements)); } + + @SuppressWarnings("unchecked") + @Override + public void setValue(Object value) { + List v = new ArrayList<>((List) value); + for (int i = v.size(); i < numElements; i++) { + v.add(0); + } + if (v.size() > numElements) { + v = v.subList(0, numElements); + } + super.setValue(v); + } + + @Override + public List getValue() { + return new ArrayList<>(super.getValue()); + } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java index 84409d9c..e43751af 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java @@ -1,18 +1,21 @@ package com.iab.gpp.encoder.datatype; +import java.util.ArrayList; import java.util.List; +import java.util.TreeSet; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerRangeEncoder; import com.iab.gpp.encoder.error.DecodingException; public class EncodableFixedIntegerRange extends AbstractEncodableBitStringDataType> { - public EncodableFixedIntegerRange() { + protected EncodableFixedIntegerRange() { super(); } public EncodableFixedIntegerRange(List value) { - super(value); + super(); + setValue(value); } public String encode() { @@ -37,4 +40,14 @@ public String substring(String bitString, int fromIndex) throws DecodingExceptio return bitString.substring(fromIndex, index); } + @SuppressWarnings("unchecked") + @Override + public void setValue(Object value) { + super.setValue(new ArrayList<>(new TreeSet<>((List) value))); + } + + @Override + public List getValue() { + return new ArrayList<>(super.getValue()); + } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedNullableBitfield.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedNullableBitfield.java deleted file mode 100644 index 12a8fc1c..00000000 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedNullableBitfield.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.iab.gpp.encoder.datatype; - -import java.util.List; -import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; - -public class EncodableFixedNullableBitfield extends AbstractEncodableBitStringDataType> { - - private int bitStringLength; - - public EncodableFixedNullableBitfield(int bitStringLength) { - super(); - this.bitStringLength = bitStringLength; - } - - public EncodableFixedNullableBitfield(int bitStringLength, List value) { - super(value); - this.bitStringLength = bitStringLength; - } - - public String encode() throws EncodingException { - return FixedBitfieldEncoder.encode(this.value, this.bitStringLength); - } - - public void decode(String bitString) throws DecodingException { - this.value = FixedBitfieldEncoder.decode(bitString); - } - - public String substring(String bitString, int fromIndex) { - // TODO: validate - return bitString.substring(fromIndex, fromIndex + this.bitStringLength); - } -} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java index 8ae8035b..ed736fc2 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java @@ -8,14 +8,15 @@ public class EncodableFixedString extends AbstractEncodableBitStringDataType value) { - super(value); + super(); this.getLengthSupplier = getLengthSupplier; + this.setValue(value); } public String encode() throws EncodingException { @@ -32,4 +34,23 @@ public String substring(String bitString, int fromIndex) { // TODO: validate return bitString.substring(fromIndex, fromIndex + this.getLengthSupplier.getAsInt()); } + + @SuppressWarnings("unchecked") + @Override + public void setValue(Object value) { + int numElements = this.getLengthSupplier.getAsInt(); + List v = new ArrayList<>((List) value); + for (int i = v.size(); i < numElements; i++) { + v.add(false); + } + if (v.size() > numElements) { + v = v.subList(0, numElements); + } + super.setValue(v); + } + + @Override + public List getValue() { + return new ArrayList<>(super.getValue()); + } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java index 37630a8b..d32dcc49 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.TreeSet; import com.iab.gpp.encoder.datatype.encoder.FibonacciIntegerRangeEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; @@ -10,12 +11,13 @@ public class EncodableOptimizedFibonacciRange extends AbstractEncodableBitStringDataType> { - public EncodableOptimizedFibonacciRange() { + protected EncodableOptimizedFibonacciRange() { super(); } public EncodableOptimizedFibonacciRange(List value) { - super(value); + super(); + setValue(value); } public String encode() throws EncodingException { @@ -61,10 +63,21 @@ public void decode(String bitString) throws DecodingException { public String substring(String bitString, int fromIndex) throws DecodingException { int max = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 16)); if (bitString.charAt(fromIndex + 16) == '1') { - return (bitString.substring(fromIndex, 17) + return (bitString.substring(fromIndex, fromIndex + 17) + new EncodableFibonacciIntegerRange().substring(bitString, fromIndex + 17)); } else { return bitString.substring(fromIndex, fromIndex + 17 + max); } } + + @SuppressWarnings("unchecked") + @Override + public void setValue(Object value) { + super.setValue(new ArrayList<>(new TreeSet<>((List) value))); + } + + @Override + public List getValue() { + return new ArrayList<>(super.getValue()); + } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java index a08428c6..d3250f07 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.TreeSet; import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerRangeEncoder; @@ -10,12 +11,13 @@ public class EncodableOptimizedFixedRange extends AbstractEncodableBitStringDataType> { - public EncodableOptimizedFixedRange() { + protected EncodableOptimizedFixedRange() { super(); } public EncodableOptimizedFixedRange(List value) { - super(value); + super(); + setValue(value); } public String encode() throws EncodingException { @@ -62,9 +64,21 @@ public void decode(String bitString) throws DecodingException { public String substring(String bitString, int fromIndex) throws DecodingException { int max = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 16)); if (bitString.charAt(fromIndex + 16) == '1') { - return bitString.substring(fromIndex, 17) + new EncodableFixedIntegerRange().substring(bitString, fromIndex + 17); + return bitString.substring(fromIndex, fromIndex + 17) + + new EncodableFixedIntegerRange().substring(bitString, fromIndex + 17); } else { return bitString.substring(fromIndex, fromIndex + 17 + max); } } + + @SuppressWarnings("unchecked") + @Override + public void setValue(Object value) { + super.setValue(new ArrayList<>(new TreeSet<>((List) value))); + } + + @Override + public List getValue() { + return new ArrayList<>(super.getValue()); + } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/DecodingException.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/DecodingException.java index 9ea130c1..91c29b2f 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/DecodingException.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/DecodingException.java @@ -7,4 +7,12 @@ public class DecodingException extends Exception { public DecodingException(String msg) { super(msg); } + + public DecodingException(Exception e) { + super(e); + } + + public DecodingException(String msg, Exception e) { + super(msg, e); + } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/EncodingException.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/EncodingException.java index 57ec5efb..2c7f80ad 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/EncodingException.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/EncodingException.java @@ -7,4 +7,12 @@ public class EncodingException extends Exception { public EncodingException(String msg) { super(msg); } + + public EncodingException(Exception e) { + super(e); + } + + public EncodingException(String msg, Exception e) { + super(msg, e); + } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/InvalidFieldException.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/InvalidFieldException.java new file mode 100644 index 00000000..5b1e1aa9 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/InvalidFieldException.java @@ -0,0 +1,18 @@ +package com.iab.gpp.encoder.error; + +public class InvalidFieldException extends Exception { + + private static final long serialVersionUID = 2098268445119981680L; + + public InvalidFieldException(String msg) { + super(msg); + } + + public InvalidFieldException(Exception e) { + super(e); + } + + public InvalidFieldException(String msg, Exception e) { + super(msg, e); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableBitStringSection.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableBitStringSection.java index e5648f6c..5b8f0b7c 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableBitStringSection.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableBitStringSection.java @@ -1,9 +1,10 @@ package com.iab.gpp.encoder.section; import java.util.Map; +import com.iab.gpp.encoder.datatype.AbstractEncodableBitStringDataType; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.datatype.AbstractEncodableBitStringDataType; +import com.iab.gpp.encoder.error.InvalidFieldException; public abstract class AbstractEncodableBitStringSection implements EncodableSection { protected Map> fields; @@ -24,11 +25,11 @@ public Object getFieldValue(String fieldName) { } @Override - public void setFieldValue(String fieldName, Object value) { + public void setFieldValue(String fieldName, Object value) throws InvalidFieldException { if (this.fields.containsKey(fieldName)) { this.fields.get(fieldName).setValue(value); } else { - throw new Error(fieldName + " not found"); + throw new InvalidFieldException(fieldName + " not found"); } } @@ -44,7 +45,7 @@ public String encodeToBitString() throws EncodingException { AbstractEncodableBitStringDataType field = this.fields.get(fieldName); bitString += field.encode(); } else { - throw new Error("Field not found: '" + fieldName + "'"); + throw new EncodingException("Field not found: '" + fieldName + "'"); } } @@ -61,7 +62,7 @@ public void decodeFromBitString(String bitString) throws DecodingException { field.decode(substring); index += substring.length(); } else { - throw new Error("Field not found: '" + fieldName + "'"); + throw new DecodingException("Field not found: '" + fieldName + "'"); } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java index c64b45e7..d9339189 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java @@ -3,9 +3,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import com.iab.gpp.encoder.datatype.AbstractEncodableBitStringDataType; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.datatype.AbstractEncodableBitStringDataType; +import com.iab.gpp.encoder.error.InvalidFieldException; public abstract class AbstractEncodableSegmentedBitStringSection implements EncodableSection { protected Map> fields; @@ -26,11 +27,11 @@ public Object getFieldValue(String fieldName) { } @Override - public void setFieldValue(String fieldName, Object value) { + public void setFieldValue(String fieldName, Object value) throws InvalidFieldException { if (this.fields.containsKey(fieldName)) { this.fields.get(fieldName).setValue(value); } else { - throw new Error(fieldName + " not found"); + throw new InvalidFieldException(fieldName + " not found"); } } @@ -49,10 +50,10 @@ public List encodeSegmentsToBitStrings() throws EncodingException { AbstractEncodableBitStringDataType field = this.fields.get(fieldName); segmentBitString += field.encode(); } catch (Exception e) { - throw new Error("Unable to encode " + fieldName, e); + throw new EncodingException("Unable to encode " + fieldName, e); } } else { - throw new Error("Field not found: '" + fieldName + "'"); + throw new EncodingException("Field not found: '" + fieldName + "'"); } } segmentBitStrings.add(segmentBitString); @@ -75,10 +76,10 @@ public void decodeSegmentsFromBitStrings(List segmentBitStrings) throws field.decode(substring); index += substring.length(); } catch (Exception e) { - throw new Error("Unable to decode " + fieldName, e); + throw new DecodingException("Unable to decode " + fieldName, e); } } else { - throw new Error("Field not found: '" + fieldName + "'"); + throw new DecodingException("Field not found: '" + fieldName + "'"); } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/EncodableSection.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/EncodableSection.java index 9891c5a6..a547e6d3 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/EncodableSection.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/EncodableSection.java @@ -2,6 +2,7 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; public interface EncodableSection { @@ -13,7 +14,7 @@ public interface EncodableSection { Object getFieldValue(String fieldName); - void setFieldValue(String fieldName, Object value); + void setFieldValue(String fieldName, Object value) throws InvalidFieldException; String encode() throws EncodingException; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java index b22dee66..5ff63ada 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java @@ -19,6 +19,7 @@ import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfCaV1Field; public class TcfCaV1 extends AbstractEncodableSegmentedBitStringSection { @@ -43,10 +44,12 @@ public TcfCaV1(String encodedString) throws DecodingException { private void initFields() { fields = new HashMap<>(); + ZonedDateTime date = ZonedDateTime.now(); + // core section fields.put(TcfCaV1Field.VERSION, new EncodableFixedInteger(6, TcfCaV1.VERSION)); - fields.put(TcfCaV1Field.CREATED, new EncodableDatetime()); - fields.put(TcfCaV1Field.LAST_UPDATED, new EncodableDatetime()); + fields.put(TcfCaV1Field.CREATED, new EncodableDatetime(date)); + fields.put(TcfCaV1Field.LAST_UPDATED, new EncodableDatetime(date)); fields.put(TcfCaV1Field.CMP_ID, new EncodableFixedInteger(12, 0)); fields.put(TcfCaV1Field.CMP_VERSION, new EncodableFixedInteger(12, 0)); fields.put(TcfCaV1Field.CONSENT_SCREEN, new EncodableFixedInteger(6, 0)); @@ -54,16 +57,25 @@ private void initFields() { fields.put(TcfCaV1Field.VENDOR_LIST_VERSION, new EncodableFixedInteger(12, 0)); fields.put(TcfCaV1Field.TCF_POLICY_VERSION, new EncodableFixedInteger(6, 2)); fields.put(TcfCaV1Field.USE_NON_STANDARD_STACKS, new EncodableBoolean(false)); - fields.put(TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT, new EncodableFixedBitfield(12, new ArrayList<>())); - fields.put(TcfCaV1Field.PURPOSES_EXPRESS_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); - fields.put(TcfCaV1Field.PURPOSES_IMPLIED_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); + fields.put(TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT, new EncodableFixedBitfield( + Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfCaV1Field.PURPOSES_EXPRESS_CONSENT, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfCaV1Field.PURPOSES_IMPLIED_CONSENT, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); fields.put(TcfCaV1Field.VENDOR_EXPRESS_CONSENT, new EncodableOptimizedFixedRange(new ArrayList<>())); fields.put(TcfCaV1Field.VENDOR_IMPLIED_CONSENT, new EncodableOptimizedFixedRange(new ArrayList<>())); // publisher purposes segment fields.put(TcfCaV1Field.PUB_PURPOSES_SEGMENT_TYPE, new EncodableFixedInteger(3, 3)); - fields.put(TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); - fields.put(TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT, new EncodableFixedBitfield(24, new ArrayList<>())); + fields.put(TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); EncodableFixedInteger numCustomPurposes = new EncodableFixedInteger(6, 0); fields.put(TcfCaV1Field.NUM_CUSTOM_PURPOSES, numCustomPurposes); @@ -162,7 +174,7 @@ public void decode(String encodedSection) throws DecodingException { } @Override - public void setFieldValue(String fieldName, Object value) { + public void setFieldValue(String fieldName, Object value) throws InvalidFieldException { super.setFieldValue(fieldName, value); if (!fieldName.equals(TcfCaV1Field.CREATED) && !fieldName.equals(TcfCaV1Field.LAST_UPDATED)) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java index 5ef06409..625121bd 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java @@ -20,6 +20,7 @@ import com.iab.gpp.encoder.datatype.encoder.TraditionalBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfEuV2Field; public class TcfEuV2 extends AbstractEncodableSegmentedBitStringSection { @@ -44,10 +45,12 @@ public TcfEuV2(String encodedString) throws DecodingException { private void initFields() { fields = new HashMap<>(); + ZonedDateTime date = ZonedDateTime.now(); + // core section fields.put(TcfEuV2Field.VERSION, new EncodableFixedInteger(6, TcfEuV2.VERSION)); - fields.put(TcfEuV2Field.CREATED, new EncodableDatetime()); - fields.put(TcfEuV2Field.LAST_UPDATED, new EncodableDatetime()); + fields.put(TcfEuV2Field.CREATED, new EncodableDatetime(date)); + fields.put(TcfEuV2Field.LAST_UPDATED, new EncodableDatetime(date)); fields.put(TcfEuV2Field.CMP_ID, new EncodableFixedInteger(12, 0)); fields.put(TcfEuV2Field.CMP_VERSION, new EncodableFixedInteger(12, 0)); fields.put(TcfEuV2Field.CONSENT_SCREEN, new EncodableFixedInteger(6, 0)); @@ -56,9 +59,14 @@ private void initFields() { fields.put(TcfEuV2Field.POLICY_VERSION, new EncodableFixedInteger(6, 2)); fields.put(TcfEuV2Field.IS_SERVICE_SPECIFIC, new EncodableBoolean(false)); fields.put(TcfEuV2Field.USE_NON_STANDARD_STACKS, new EncodableBoolean(false)); - fields.put(TcfEuV2Field.SPECIAL_FEATURE_OPTINS, new EncodableFixedBitfield(12, new ArrayList<>())); - fields.put(TcfEuV2Field.PURPOSE_CONSENTS, new EncodableFixedBitfield(24, new ArrayList<>())); - fields.put(TcfEuV2Field.PURPOSE_LEGITIMATE_INTERESTS, new EncodableFixedBitfield(24, new ArrayList<>())); + fields.put(TcfEuV2Field.SPECIAL_FEATURE_OPTINS, new EncodableFixedBitfield( + Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfEuV2Field.PURPOSE_CONSENTS, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfEuV2Field.PURPOSE_LEGITIMATE_INTERESTS, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); fields.put(TcfEuV2Field.PURPOSE_ONE_TREATMENT, new EncodableBoolean(false)); fields.put(TcfEuV2Field.PUBLISHER_COUNTRY_CODE, new EncodableFixedString(2, "AA")); fields.put(TcfEuV2Field.VENDOR_CONSENTS, new EncodableOptimizedFixedRange(new ArrayList<>())); @@ -68,8 +76,12 @@ private void initFields() { // publisher purposes segment fields.put(TcfEuV2Field.PUBLISHER_PURPOSES_SEGMENT_TYPE, new EncodableFixedInteger(3, 3)); - fields.put(TcfEuV2Field.PUBLISHER_CONSENTS, new EncodableFixedBitfield(24, new ArrayList<>())); - fields.put(TcfEuV2Field.PUBLISHER_LEGITIMATE_INTERESTS, new EncodableFixedBitfield(24, new ArrayList<>())); + fields.put(TcfEuV2Field.PUBLISHER_CONSENTS, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfEuV2Field.PUBLISHER_LEGITIMATE_INTERESTS, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); EncodableFixedInteger numCustomPurposes = new EncodableFixedInteger(6, 0); fields.put(TcfEuV2Field.NUM_CUSTOM_PURPOSES, numCustomPurposes); @@ -210,7 +222,7 @@ public void decode(String encodedSection) throws DecodingException { } @Override - public void setFieldValue(String fieldName, Object value) { + public void setFieldValue(String fieldName, Object value) throws InvalidFieldException { super.setFieldValue(fieldName, value); if (!fieldName.equals(TcfEuV2Field.CREATED) && !fieldName.equals(TcfEuV2Field.LAST_UPDATED)) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java index c267b8d5..cdb20122 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java @@ -2,6 +2,9 @@ import java.util.HashMap; import java.util.Map; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UspV1LegacyField; public class UspV1 implements EncodableSection { @@ -15,7 +18,7 @@ public UspV1() { initFields(); } - public UspV1(String encodedString) { + public UspV1(String encodedString) throws DecodingException { initFields(); if (encodedString != null && encodedString.length() > 0) { @@ -46,16 +49,16 @@ public Object getFieldValue(String fieldName) { } @Override - public void setFieldValue(String fieldName, Object value) { + public void setFieldValue(String fieldName, Object value) throws InvalidFieldException { if (this.fields.containsKey(fieldName)) { this.fields.put(fieldName, value); } else { - throw new Error(fieldName + " not found"); + throw new InvalidFieldException(fieldName + " not found"); } } @Override - public String encode() { + public String encode() throws EncodingException { String str = ""; str += this.getFieldValue(UspV1LegacyField.VERSION); str += this.getFieldValue(UspV1LegacyField.NOTICE); @@ -65,12 +68,15 @@ public String encode() { } @Override - public void decode(String encodedString) { - // TODO: validate - this.setFieldValue(UspV1LegacyField.VERSION, Integer.parseInt(String.valueOf(encodedString.charAt(0)))); - this.setFieldValue(UspV1LegacyField.NOTICE, String.valueOf(encodedString.charAt(1))); - this.setFieldValue(UspV1LegacyField.OPT_OUT_SALE, String.valueOf(encodedString.charAt(2))); - this.setFieldValue(UspV1LegacyField.LSPA_COVERED, String.valueOf(encodedString.charAt(3))); + public void decode(String encodedString) throws DecodingException { + try { + this.setFieldValue(UspV1LegacyField.VERSION, Integer.parseInt(String.valueOf(encodedString.charAt(0)))); + this.setFieldValue(UspV1LegacyField.NOTICE, String.valueOf(encodedString.charAt(1))); + this.setFieldValue(UspV1LegacyField.OPT_OUT_SALE, String.valueOf(encodedString.charAt(2))); + this.setFieldValue(UspV1LegacyField.LSPA_COVERED, String.valueOf(encodedString.charAt(3))); + } catch (InvalidFieldException e) { + throw new DecodingException(e); + } } @Override diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 9fdb9f1c..856b06d3 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -4,10 +4,12 @@ import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfCaV1Field; import com.iab.gpp.encoder.field.TcfEuV2Field; import com.iab.gpp.encoder.field.UspCaV1Field; @@ -57,7 +59,7 @@ public void testEncodeDefault() throws EncodingException { } @Test - public void testEncodeDefaultAll() throws EncodingException { + public void testEncodeDefaultAll() throws EncodingException, InvalidFieldException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); @@ -104,7 +106,7 @@ public void testEncodeDefaultAll() throws EncodingException { } @Test - public void testEncodeUspv1() throws EncodingException { + public void testEncodeUspv1() throws EncodingException, InvalidFieldException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -144,7 +146,7 @@ public void testEncodeUspv1() throws EncodingException { } @Test - public void testEncodeTcfEuV2() throws EncodingException { + public void testEncodeTcfEuV2() throws EncodingException, InvalidFieldException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -194,7 +196,7 @@ public void testEncodeTcfEuV2() throws EncodingException { } @Test - public void testEncodeUspV1AndTcfEuV2() throws EncodingException { + public void testEncodeUspV1AndTcfEuV2() throws EncodingException, InvalidFieldException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); @@ -239,7 +241,7 @@ public void testEncodeUspV1AndTcfEuV2() throws EncodingException { } @Test - public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() throws EncodingException { + public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() throws EncodingException, InvalidFieldException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -583,4 +585,80 @@ public void testDecodeUspv1AndTcfEuV2AndTcfCaV1() throws DecodingException { Assertions.assertEquals(3, tcfCaV1Section.getPubPurposesSegmentType()); } + @Test + public void testEncode1() throws EncodingException, InvalidFieldException { + GppModel gppModel = new GppModel(); + + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(28)); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); + + Assertions.assertEquals("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAOAAAABAAAAA.QAAA.IAAA", gppModel.encode()); + } + + @Test + public void testEncode2() throws EncodingException, InvalidFieldException { + GppModel gppModel = new GppModel(); + + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(29)); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); + + Assertions.assertEquals("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAOwAQAOgAAAA.QAAA.IAAA", gppModel.encode()); + } + + @Test + public void testEncode3() throws EncodingException, InvalidFieldException { + GppModel gppModel = new GppModel(); + + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(1, 173, 722)); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); + + Assertions.assertEquals("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAFpQAwAAgCtAWkAAAAAAA.QAAA.IAAA", + gppModel.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + GppModel gppModel = new GppModel("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAOAAAABAAAAA.QAAA.IAAA"); + Assertions.assertEquals(Arrays.asList(28), gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS)); + } + + @Test + public void testDecode2() throws DecodingException { + GppModel gppModel = new GppModel("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAOwAQAOgAAAA.QAAA.IAAA"); + Assertions.assertEquals(Arrays.asList(29), gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS)); + } + + @Test + public void testDecode3() throws DecodingException { + GppModel gppModel = new GppModel("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAFpQAwAAgCtAWkAAAAAAA.QAAA.IAAA"); + Assertions.assertEquals(Arrays.asList(1, 173, 722), + gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS)); + } + + @Test + public void testConsistency() throws InvalidFieldException, EncodingException, DecodingException { + GppModel fromObjectModel = new GppModel(); + + fromObjectModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.PURPOSE_CONSENTS, + new ArrayList<>(List.of(true, true, true, true, true, true, true, true, true, true))); + fromObjectModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, + new ArrayList<>(List.of(32, 128, 81, 210, 755, 21, 173, 238))); + + Assertions.assertEquals(fromObjectModel.getSection(TcfEuV2.NAME).encode(), + fromObjectModel.getSection(TcfEuV2.NAME).encode()); + Assertions.assertEquals(fromObjectModel.encode(), fromObjectModel.encode()); + + GppModel decodedModel = new GppModel(fromObjectModel.encode()); + + Assertions.assertEquals( + new ArrayList<>(List.of(true, true, true, true, true, true, true, true, true, true, false, false, false, false, + false, false, false, false, false, false, false, false, false, false)), + decodedModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.PURPOSE_CONSENTS)); + Assertions.assertEquals(new ArrayList<>(List.of(21, 32, 81, 128, 173, 210, 238, 755)), + decodedModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS)); + + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java index 51d71a2f..51a16c39 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java @@ -1,5 +1,6 @@ package com.iab.gpp.encoder.datatype; +import java.util.Arrays; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; @@ -13,4 +14,39 @@ public void testSubstring1() throws DecodingException { 1)); } + @Test + public void testSubstring2() throws DecodingException { + Assertions.assertEquals("00000000000100000000000011101", new EncodableFixedIntegerRange().substring( + "000010001111010010000110111111111100000000001111010010000110111111111100000000000000000000000000000000000000000100001101000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110110000000000010000000000001110100000000000000000000000000000", + 230)); + } + + @Test + public void testEncode1() { + EncodableFixedIntegerRange encodableFixedIntegerRange = new EncodableFixedIntegerRange(); + encodableFixedIntegerRange.setValue(Arrays.asList(28)); + Assertions.assertEquals("00000000000100000000000011100", encodableFixedIntegerRange.encode()); + } + + @Test + public void testEncode2() { + EncodableFixedIntegerRange encodableFixedIntegerRange = new EncodableFixedIntegerRange(); + encodableFixedIntegerRange.setValue(Arrays.asList(29)); + Assertions.assertEquals("00000000000100000000000011101", encodableFixedIntegerRange.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + EncodableFixedIntegerRange encodableFixedIntegerRange = new EncodableFixedIntegerRange(); + encodableFixedIntegerRange.decode("00000000000100000000000011100"); + Assertions.assertEquals(Arrays.asList(28), encodableFixedIntegerRange.getValue()); + } + + @Test + public void testDecode2() throws DecodingException { + EncodableFixedIntegerRange encodableFixedIntegerRange = new EncodableFixedIntegerRange(); + encodableFixedIntegerRange.decode("00000000000100000000000011101"); + Assertions.assertEquals(Arrays.asList(29), encodableFixedIntegerRange.getValue()); + } + } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java index f1075faf..73af6f6e 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java @@ -23,6 +23,18 @@ public void testEncode2() throws EncodingException { Assertions.assertEquals("00000000000111100000000000000000001000000000001", encodableOptimizedFixedRange.encode()); } + @Test + public void testEncode3() throws EncodingException { + encodableOptimizedFixedRange.setValue(Arrays.asList(28)); + Assertions.assertEquals("000000000001110000000000000000000000000000001", encodableOptimizedFixedRange.encode()); + } + + @Test + public void testEncode4() throws EncodingException { + encodableOptimizedFixedRange.setValue(Arrays.asList(29)); + Assertions.assertEquals("0000000000011101100000000000100000000000011101", encodableOptimizedFixedRange.encode()); + } + @Test public void testDecode1() throws DecodingException { encodableOptimizedFixedRange.decode("00000000001100000000000000001000000000001000000000000000000000001"); @@ -34,4 +46,30 @@ public void testDecode2() throws DecodingException { encodableOptimizedFixedRange.decode("00000000000111100000000000000000001000000000001"); Assertions.assertEquals(Arrays.asList(18, 30), encodableOptimizedFixedRange.getValue()); } + + @Test + public void testDecode3() throws DecodingException { + encodableOptimizedFixedRange.decode("000000000001110000000000000000000000000000001"); + Assertions.assertEquals(Arrays.asList(28), encodableOptimizedFixedRange.getValue()); + } + + @Test + public void testDecode4() throws DecodingException { + encodableOptimizedFixedRange.decode("0000000000011101100000000000100000000000011101"); + Assertions.assertEquals(Arrays.asList(29), encodableOptimizedFixedRange.getValue()); + } + + @Test + public void testSubstring1() throws DecodingException { + Assertions.assertEquals("000000000001110000000000000000000000000000001", encodableOptimizedFixedRange.substring( + "000010001111010010000110111111111100000000001111010010000110111111111100000000000000000000000000000000000000000100001101000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000001000000000000000000000000000000", + 213)); + } + + @Test + public void testSubstring2() throws DecodingException { + Assertions.assertEquals("0000000000011101100000000000100000000000011101", encodableOptimizedFixedRange.substring( + "000010001111010010000110111111111100000000001111010010000110111111111100000000000000000000000000000000000000000100001101000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110110000000000010000000000001110100000000000000000000000000000", + 213)); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java index 7c83d58b..4c74ec5a 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java @@ -6,25 +6,26 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; public class HeaderV1Test { @Test - public void testEncodeToBitString1() throws EncodingException { + public void testEncodeToBitString1() throws EncodingException, InvalidFieldException { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", new ArrayList<>()); Assertions.assertEquals("000011000001000000000000", headerV1.encodeToBitString()); } @Test - public void testEncodeToBitString2() throws EncodingException { + public void testEncodeToBitString2() throws EncodingException, InvalidFieldException { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", Arrays.asList(2)); Assertions.assertEquals("0000110000010000000000010011", headerV1.encodeToBitString()); } @Test - public void testEncodeToBitString3() throws EncodingException { + public void testEncodeToBitString3() throws EncodingException, InvalidFieldException { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", Arrays.asList(2, 6)); Assertions.assertEquals("000011000001000000000010001101011", headerV1.encodeToBitString()); @@ -55,21 +56,21 @@ public void testDecodeFromBitString3() throws DecodingException { } @Test - public void testEncode1() throws EncodingException { + public void testEncode1() throws EncodingException, InvalidFieldException { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", new ArrayList<>()); Assertions.assertEquals("DBAA", headerV1.encode()); } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException, InvalidFieldException { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", Arrays.asList(2)); Assertions.assertEquals("DBABMA", headerV1.encode()); } @Test - public void testEncode3() throws EncodingException { + public void testEncode3() throws EncodingException, InvalidFieldException { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", Arrays.asList(2, 6)); Assertions.assertEquals("DBACNYA", headerV1.encode()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java index d1738f1a..fdb14e04 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java @@ -8,19 +8,22 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfCaV1Field; public class TcfCaV1Test { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() throws EncodingException, InvalidFieldException { TcfCaV1 tcfCaV1 = new TcfCaV1(); - Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA", tcfCaV1.encode()); + tcfCaV1.setFieldValue(TcfCaV1Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); + tcfCaV1.setFieldValue(TcfCaV1Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); + Assertions.assertEquals("CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA", tcfCaV1.encode()); } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException, InvalidFieldException { TcfCaV1 tcfCaV1 = new TcfCaV1(); tcfCaV1.setFieldValue(TcfCaV1Field.CMP_ID, 50); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java index c8d5cc9a..20eb2a7b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java @@ -8,18 +8,21 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfEuV2Field; public class TcfEuV2Test { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() throws EncodingException, InvalidFieldException { TcfEuV2 tcfEuV2 = new TcfEuV2(); - Assertions.assertEquals("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", tcfEuV2.encode()); + tcfEuV2.setFieldValue(TcfEuV2Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); + tcfEuV2.setFieldValue(TcfEuV2Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); + Assertions.assertEquals("CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA", tcfEuV2.encode()); } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException, InvalidFieldException { TcfEuV2 tcfEuV2 = new TcfEuV2(); tcfEuV2.setFieldValue(TcfEuV2Field.IS_SERVICE_SPECIFIC, true); tcfEuV2.setFieldValue(TcfEuV2Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); @@ -60,8 +63,15 @@ public void testDecode1() throws DecodingException { Assertions.assertEquals(Arrays.asList(), tcfEuV2.getVendorLegitimateInterests()); Assertions.assertEquals(Arrays.asList(), tcfEuV2.getPublisherRestrictions()); Assertions.assertEquals(3, tcfEuV2.getPublisherPurposesSegmentType()); - Assertions.assertEquals(Arrays.asList(), tcfEuV2.getPublisherConsents()); - Assertions.assertEquals(Arrays.asList(), tcfEuV2.getPublisherLegitimateInterests()); + Assertions + .assertEquals( + Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false), + tcfEuV2.getPublisherConsents()); + Assertions.assertEquals( + Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false), + tcfEuV2.getPublisherLegitimateInterests()); Assertions.assertEquals(0, tcfEuV2.getNumCustomPurposes()); Assertions.assertEquals(Arrays.asList(), tcfEuV2.getPublisherCustomConsents()); Assertions.assertEquals(Arrays.asList(), tcfEuV2.getPublisherCustomLegitimateInterests()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java index 1e642d3a..0848536b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UspCaV1Field; public class UspCaV1Test { @@ -18,7 +19,7 @@ public void testEncode1() throws EncodingException { } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException, InvalidFieldException { UspCaV1 uspCaV1 = new UspCaV1(); uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT_NOTICE, 1); @@ -38,7 +39,7 @@ public void testEncode2() throws EncodingException { } @Test - public void testEncode3() throws EncodingException { + public void testEncode3() throws EncodingException, InvalidFieldException { UspCaV1 uspCaV1 = new UspCaV1(); uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT_NOTICE, 1); @@ -58,7 +59,7 @@ public void testEncode3() throws EncodingException { } @Test - public void testEncodeWithGpcSegmentExcluded() throws EncodingException { + public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { UspCaV1 uspCaV1 = new UspCaV1(); uspCaV1.setFieldValue(UspCaV1Field.GPC_SEGMENT_INCLUDED, false); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java index 91d00952..05559ca9 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UspCoV1Field; public class UspCoV1Test { @@ -17,7 +18,7 @@ public void testEncode1() throws EncodingException { } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException, InvalidFieldException { UspCoV1 uspCoV1 = new UspCoV1(); uspCoV1.setFieldValue(UspCoV1Field.SHARING_NOTICE, 1); @@ -36,7 +37,7 @@ public void testEncode2() throws EncodingException { } @Test - public void testEncodeWithGpcSegmentExcluded() throws EncodingException { + public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { UspCoV1 uspCoV1 = new UspCoV1(); uspCoV1.setFieldValue(UspCoV1Field.GPC_SEGMENT_INCLUDED, false); Assertions.assertEquals("BAAAAAA", uspCoV1.encode()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java index bb10e025..efc382f8 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UspCtV1Field; public class UspCtV1Test { @@ -17,7 +18,7 @@ public void testEncode1() throws EncodingException { } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException, InvalidFieldException { UspCtV1 uspCtV1 = new UspCtV1(); uspCtV1.setFieldValue(UspCtV1Field.SHARING_NOTICE, 1); @@ -36,7 +37,7 @@ public void testEncode2() throws EncodingException { } @Test - public void testEncodeWithGpcSegmentExcluded() throws EncodingException { + public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { UspCtV1 uspCtV1 = new UspCtV1(); uspCtV1.setFieldValue(UspCtV1Field.GPC_SEGMENT_INCLUDED, false); Assertions.assertEquals("BAAAAAAA", uspCtV1.encode()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java index fa647c2f..b70e07c9 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UspNatV1Field; public class UspNatV1Test { @@ -18,7 +19,7 @@ public void testEncode1() throws EncodingException { } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException, InvalidFieldException { UspNatV1 uspNatV1 = new UspNatV1(); uspNatV1.setFieldValue(UspNatV1Field.SHARING_NOTICE, 1); @@ -42,7 +43,7 @@ public void testEncode2() throws EncodingException { } @Test - public void testEncode3() throws EncodingException { + public void testEncode3() throws EncodingException, InvalidFieldException { UspNatV1 uspNatV1 = new UspNatV1(); uspNatV1.setFieldValue(UspNatV1Field.SHARING_NOTICE, 1); @@ -66,7 +67,7 @@ public void testEncode3() throws EncodingException { } @Test - public void testEncodeWithGpcSegmentIncluded() throws EncodingException { + public void testEncodeWithGpcSegmentIncluded() throws EncodingException, InvalidFieldException { UspNatV1 uspNatV1 = new UspNatV1(); uspNatV1.setFieldValue(UspNatV1Field.GPC_SEGMENT_INCLUDED, false); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java index 3c3312f5..5bad0d1f 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UspUtV1Field; public class UspUtV1Test { @@ -17,7 +18,7 @@ public void testEncode1() throws EncodingException { } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException, InvalidFieldException { UspUtV1 uspUtV1 = new UspUtV1(); uspUtV1.setFieldValue(UspUtV1Field.SHARING_NOTICE, 1); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java index 228b346f..13eb280d 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java @@ -2,7 +2,9 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; public class UspV1Test { @@ -13,7 +15,7 @@ public void testEncode1() throws EncodingException { } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() throws EncodingException, InvalidFieldException { UspV1 uspv1 = new UspV1(); uspv1.setFieldValue("Notice", "Y"); uspv1.setFieldValue("OptOutSale", "N"); @@ -23,7 +25,7 @@ public void testEncode2() throws EncodingException { } @Test - public void testEncode3() throws EncodingException { + public void testEncode3() throws EncodingException, InvalidFieldException { UspV1 uspv1 = new UspV1(); uspv1.setFieldValue("Version", 2); uspv1.setFieldValue("Notice", "N"); @@ -34,7 +36,7 @@ public void testEncode3() throws EncodingException { } @Test - public void testDecode1() throws EncodingException { + public void testDecode1() throws DecodingException, InvalidFieldException { UspV1 uspv1 = new UspV1("1NYN"); Assertions.assertEquals(1, uspv1.getFieldValue("Version")); Assertions.assertEquals("N", uspv1.getFieldValue("Notice")); @@ -48,7 +50,7 @@ public void testDecode1() throws EncodingException { } @Test - public void testDecode2() throws EncodingException { + public void testDecode2() throws DecodingException, InvalidFieldException { UspV1 uspv1 = new UspV1("2YNY"); Assertions.assertEquals(2, uspv1.getFieldValue("Version")); Assertions.assertEquals("Y", uspv1.getFieldValue("Notice")); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java index c15f4246..a8f38633 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UspVaV1Field; public class UspVaV1Test { @@ -20,16 +21,20 @@ public void testEncode1() throws EncodingException { public void testEncode2() throws EncodingException { UspVaV1 uspVaV1 = new UspVaV1(); - uspVaV1.setFieldValue(UspVaV1Field.SHARING_NOTICE, 1); - uspVaV1.setFieldValue(UspVaV1Field.SALE_OPT_OUT_NOTICE, 2); - uspVaV1.setFieldValue(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); - uspVaV1.setFieldValue(UspVaV1Field.SALE_OPT_OUT, 1); - uspVaV1.setFieldValue(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - uspVaV1.setFieldValue(UspVaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); - uspVaV1.setFieldValue(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); - uspVaV1.setFieldValue(UspVaV1Field.MSPA_COVERED_TRANSACTION, 1); - uspVaV1.setFieldValue(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - uspVaV1.setFieldValue(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + try { + uspVaV1.setFieldValue(UspVaV1Field.SHARING_NOTICE, 1); + uspVaV1.setFieldValue(UspVaV1Field.SALE_OPT_OUT_NOTICE, 2); + uspVaV1.setFieldValue(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + uspVaV1.setFieldValue(UspVaV1Field.SALE_OPT_OUT, 1); + uspVaV1.setFieldValue(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + uspVaV1.setFieldValue(UspVaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); + uspVaV1.setFieldValue(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + uspVaV1.setFieldValue(UspVaV1Field.MSPA_COVERED_TRANSACTION, 1); + uspVaV1.setFieldValue(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + uspVaV1.setFieldValue(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + } catch (InvalidFieldException e) { + throw new EncodingException(e); + } Assertions.assertEquals("BbYbG9s", uspVaV1.encode()); } diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index 47cef939..ff4d7860 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.0.8-SNAPSHOT + 3.0.11-SNAPSHOT iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.0.8-SNAPSHOT + 3.0.11-SNAPSHOT diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index bf1979a0..35fda85f 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.0.8-SNAPSHOT + 3.0.11-SNAPSHOT iabgpp-extras diff --git a/pom.xml b/pom.xml index dbd2062f..bad74e4c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.0.8-SNAPSHOT + 3.0.11-SNAPSHOT IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From fe36352714278e4b52634720f3a4ed90f74d24e4 Mon Sep 17 00:00:00 2001 From: Guofang Li Date: Tue, 29 Aug 2023 06:06:44 -0700 Subject: [PATCH 14/41] issue 26: wrong version number for TcfCaV1 (#27) Co-authored-by: Guofang Li --- .../com/iab/gpp/encoder/section/TcfCaV1.java | 2 +- .../com/iab/gpp/encoder/GppModelTest.java | 20 +++++++++---------- .../iab/gpp/encoder/section/TcfCaV1Test.java | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java index 5ff63ada..ec3b4891 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java @@ -24,7 +24,7 @@ public class TcfCaV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 5; - public static int VERSION = 2; + public static int VERSION = 1; public static String NAME = "tcfcav1"; private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 856b06d3..9b474e7f 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -100,7 +100,7 @@ public void testEncodeDefaultAll() throws EncodingException, InvalidFieldExcepti String gppString = gppModel.encode(); Assertions.assertEquals( - "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAAA.QA~BAAAAAAA.QA~BAAAAAA~BAAAAAA.QA~BAAAAAAA~BAAAAAAA.QA", + "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAAA.QA~BAAAAAAA.QA~BAAAAAA~BAAAAAA.QA~BAAAAAAA~BAAAAAAA.QA", gppString); } @@ -327,7 +327,7 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() throws EncodingException, Inva String gppString = gppModel.encode(); Assertions.assertEquals( - "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao~1YNN", + "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao~1YNN", gppString); Assertions.assertEquals(4, gppString.split("~").length); @@ -360,7 +360,7 @@ public void testDecodeDefaults() throws DecodingException { @Test public void testDecodeDefaultsAll() throws DecodingException { String gppString = - "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAAA.QA~BAAAAAAA.QA~BAAAAAA~BAAAAAA.QA~BAAAAAAA~BAAAAAAA.QA"; + "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAAA.QA~BAAAAAAA.QA~BAAAAAA~BAAAAAA.QA~BAAAAAAA~BAAAAAAA.QA"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); @@ -507,7 +507,7 @@ public void testDecodeUspv1AndTcfEuV2() throws DecodingException { @Test public void testDecodeUspv1AndTcfEuV2AndTcfCaV1() throws DecodingException { String gppString = - "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao~1YNN"; + "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao~1YNN"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(2, 5, 6), gppModel.getSectionIds()); @@ -590,8 +590,8 @@ public void testEncode1() throws EncodingException, InvalidFieldException { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(28)); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.LAST_UPDATED, utcDateTime); Assertions.assertEquals("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAOAAAABAAAAA.QAAA.IAAA", gppModel.encode()); } @@ -601,8 +601,8 @@ public void testEncode2() throws EncodingException, InvalidFieldException { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(29)); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.LAST_UPDATED, utcDateTime); Assertions.assertEquals("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAOwAQAOgAAAA.QAAA.IAAA", gppModel.encode()); } @@ -612,8 +612,8 @@ public void testEncode3() throws EncodingException, InvalidFieldException { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(1, 173, 722)); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); - gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.CREATED, utcDateTime); + gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.LAST_UPDATED, utcDateTime); Assertions.assertEquals("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAFpQAwAAgCtAWkAAAAAAA.QAAA.IAAA", gppModel.encode()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java index fdb14e04..49b204d2 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java @@ -19,7 +19,7 @@ public void testEncode1() throws EncodingException, InvalidFieldException { TcfCaV1 tcfCaV1 = new TcfCaV1(); tcfCaV1.setFieldValue(TcfCaV1Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); tcfCaV1.setFieldValue(TcfCaV1Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); - Assertions.assertEquals("CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA", tcfCaV1.encode()); + Assertions.assertEquals("BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA", tcfCaV1.encode()); } @Test @@ -53,7 +53,7 @@ public void testEncode2() throws EncodingException, InvalidFieldException { tcfCaV1.setFieldValue(TcfCaV1Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); tcfCaV1.setFieldValue(TcfCaV1Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); - Assertions.assertEquals("CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao", tcfCaV1.encode()); + Assertions.assertEquals("BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao", tcfCaV1.encode()); } @Test From b4ce06d986cbb7ba38395a397911a6c8f2c689d7 Mon Sep 17 00:00:00 2001 From: Bryan DeLong Date: Tue, 29 Aug 2023 09:07:05 -0400 Subject: [PATCH 15/41] Removes duplicate section in the GppModel.decodeSection if tree as UspV1 was in the list twice. (#30) --- iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index 2e4d27c8..dcbf3555 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -289,9 +289,6 @@ public void decodeSection(String sectionName, String encodedString) throws Decod } else if (sectionName.equals(UspV1.NAME)) { section = new UspV1(); this.sections.put(UspV1.NAME, section); - } else if (sectionName.equals(UspV1.NAME)) { - section = new UspV1(); - this.sections.put(UspV1.NAME, section); } else if (sectionName.equals(UspNatV1.NAME)) { section = new UspNatV1(); this.sections.put(UspNatV1.NAME, section); From 58fd339afaddaa0acd979f8ee234de1e4d86e7a6 Mon Sep 17 00:00:00 2001 From: chuff Date: Wed, 30 Aug 2023 11:56:19 -0600 Subject: [PATCH 16/41] Updating GVL code as V3 and adding some comments (#32) * https://github.com/IABTechLab/iabgpp-java/issues/29 https://github.com/IABTechLab/iabgpp-java/issues/26 * Removes duplicate section in the GppModel.decodeSection * Rename multistate usp* to us* * fix tcfcav1 policy version * vendor list 2.2 * lazy decoding * cleanup lazy decoding * Updating GVL code as V3 and adding some comments; also removing GPPModel LazyDecoding feature; also keeping the TCF policy version as 2 for Canada. * 3.1.0 * 3.1.1-SNAPSHOT --------- Co-authored-by: chad Co-authored-by: srini81 --- README.md | 170 +- iabgpp-encoder/pom.xml | 9 +- .../java/com/iab/gpp/encoder/GppModel.java | 144 +- .../encoder/error/LazyDecodingException.java | 18 + .../{UspCaV1Field.java => UsCaV1Field.java} | 2 +- .../{UspCoV1Field.java => UsCoV1Field.java} | 2 +- .../{UspCtV1Field.java => UsCtV1Field.java} | 2 +- .../{UspNatV1Field.java => UsNatV1Field.java} | 2 +- .../{UspUtV1Field.java => UsUtV1Field.java} | 2 +- .../{UspVaV1Field.java => UsVaV1Field.java} | 2 +- .../com/iab/gpp/encoder/section/Sections.java | 12 +- .../section/{UspCaV1.java => UsCaV1.java} | 106 +- .../section/{UspCoV1.java => UsCoV1.java} | 102 +- .../section/{UspCtV1.java => UsCtV1.java} | 102 +- .../com/iab/gpp/encoder/section/UsNatV1.java | 233 + .../com/iab/gpp/encoder/section/UsUtV1.java | 141 + .../com/iab/gpp/encoder/section/UsVaV1.java | 135 + .../com/iab/gpp/encoder/section/UspNatV1.java | 234 - .../com/iab/gpp/encoder/section/UspUtV1.java | 141 - .../com/iab/gpp/encoder/section/UspVaV1.java | 135 - .../com/iab/gpp/encoder/GppModelTest.java | 112 +- .../iab/gpp/encoder/section/UsCaV1Test.java | 104 + .../iab/gpp/encoder/section/UsCoV1Test.java | 79 + .../iab/gpp/encoder/section/UsCtV1Test.java | 79 + .../iab/gpp/encoder/section/UsNatV1Test.java | 120 + .../iab/gpp/encoder/section/UsUtV1Test.java | 54 + .../iab/gpp/encoder/section/UsVaV1Test.java | 57 + .../iab/gpp/encoder/section/UspCaV1Test.java | 104 - .../iab/gpp/encoder/section/UspCoV1Test.java | 79 - .../iab/gpp/encoder/section/UspCtV1Test.java | 79 - .../iab/gpp/encoder/section/UspNatV1Test.java | 120 - .../iab/gpp/encoder/section/UspUtV1Test.java | 54 - .../iab/gpp/encoder/section/UspVaV1Test.java | 57 - iabgpp-extras-jackson/pom.xml | 11 +- .../com/iab/gpp/extras/jackson/Loader.java | 117 +- .../com/iab/gpp/extras/jackson/cmp/Cmp.java | 103 +- .../iab/gpp/extras/jackson/cmp/CmpList.java | 60 +- .../gpp/extras/jackson/gvl/DataCategory.java} | 56 +- .../gpp/extras/jackson/gvl/DataRetention.java | 64 + .../iab/gpp/extras/jackson/gvl/Feature.java | 94 +- .../com/iab/gpp/extras/jackson/gvl/Gvl.java | 272 +- .../iab/gpp/extras/jackson/gvl/Overflow.java | 20 +- .../iab/gpp/extras/jackson/gvl/Purpose.java | 138 +- .../com/iab/gpp/extras/jackson/gvl/Stack.java | 100 +- .../iab/gpp/extras/jackson/gvl/Vendor.java | 429 +- .../iab/gpp/extras/jackson/gvl/VendorUrl.java | 64 + .../gpp/extras/jackson/cmp/CmpListTest.java | 63 +- .../iab/gpp/extras/jackson/cmp/CmpTest.java | 76 - .../gpp/extras/jackson/gvl/FeatureTest.java | 69 - .../iab/gpp/extras/jackson/gvl/GvlTest.java | 96 - .../iab/gpp/extras/jackson/gvl/GvlV2Test.java | 121 + .../iab/gpp/extras/jackson/gvl/GvlV3Test.java | 169 + .../gpp/extras/jackson/gvl/OverflowTest.java | 50 - .../gpp/extras/jackson/gvl/PurposeTest.java | 78 - .../jackson/gvl/SpecialFeatureTest.java | 71 - .../jackson/gvl/SpecialPurposeTest.java | 83 - .../iab/gpp/extras/jackson/gvl/StackTest.java | 75 - .../gpp/extras/jackson/gvl/VendorTest.java | 159 - .../src/test/resources/gvl.json | 664 - .../vendorlist/v2/vendor-list-v51.json | 1 + .../resources/vendorlist/v2/vendor-list.json | 1 + .../vendorlist/v3.0/vendor-list.json | 20907 ++++++++++++++++ iabgpp-extras/pom.xml | 9 +- .../main/java/com/iab/gpp/extras/cmp/Cmp.java | 69 +- .../java/com/iab/gpp/extras/cmp/CmpList.java | 38 +- .../com/iab/gpp/extras/gvl/DataCategory.java | 29 + .../com/iab/gpp/extras/gvl/DataRetention.java | 53 + .../java/com/iab/gpp/extras/gvl/Feature.java | 64 +- .../main/java/com/iab/gpp/extras/gvl/Gvl.java | 143 +- .../java/com/iab/gpp/extras/gvl/Overflow.java | 12 +- .../java/com/iab/gpp/extras/gvl/Purpose.java | 86 +- .../java/com/iab/gpp/extras/gvl/Stack.java | 60 +- .../java/com/iab/gpp/extras/gvl/Vendor.java | 291 +- .../com/iab/gpp/extras/gvl/VendorUrl.java | 51 + pom.xml | 2 +- 75 files changed, 24072 insertions(+), 3838 deletions(-) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/LazyDecodingException.java rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UspCaV1Field.java => UsCaV1Field.java} (97%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UspCoV1Field.java => UsCoV1Field.java} (97%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UspCtV1Field.java => UsCtV1Field.java} (97%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UspNatV1Field.java => UsNatV1Field.java} (97%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UspUtV1Field.java => UsUtV1Field.java} (97%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UspVaV1Field.java => UsVaV1Field.java} (96%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/{UspCaV1.java => UsCaV1.java} (53%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/{UspCoV1.java => UsCoV1.java} (54%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/{UspCtV1.java => UsCtV1.java} (55%) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNatV1.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUtV1.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVaV1.java delete mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java delete mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java delete mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java rename iabgpp-extras-jackson/src/{test/java/com/iab/gpp/extras/jackson/TestUtil.java => main/java/com/iab/gpp/extras/jackson/gvl/DataCategory.java} (51%) create mode 100644 iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/DataRetention.java create mode 100644 iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/VendorUrl.java delete mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpTest.java delete mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/FeatureTest.java delete mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlTest.java create mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV2Test.java create mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV3Test.java delete mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/OverflowTest.java delete mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/PurposeTest.java delete mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialFeatureTest.java delete mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialPurposeTest.java delete mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/StackTest.java delete mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/VendorTest.java delete mode 100644 iabgpp-extras-jackson/src/test/resources/gvl.json create mode 100644 iabgpp-extras-jackson/src/test/resources/vendorlist/v2/vendor-list-v51.json create mode 120000 iabgpp-extras-jackson/src/test/resources/vendorlist/v2/vendor-list.json create mode 100644 iabgpp-extras-jackson/src/test/resources/vendorlist/v3.0/vendor-list.json create mode 100644 iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/DataCategory.java create mode 100644 iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/DataRetention.java create mode 100644 iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/VendorUrl.java diff --git a/README.md b/README.md index 9bd93b05..5c6f166d 100644 --- a/README.md +++ b/README.md @@ -171,89 +171,89 @@ CmpList cmpList = loader.cmpList(cmpListContent); |uspv1|6|Notice|2 bit int| |uspv1|6|OptOutSale|2 bit int| |uspv1|6|LspaCovered|2 bit int| -|uspnatv1|7|Version|6 bit int. Value is 1| -|uspnatv1|7|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|SharingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|SensitiveDataProcessingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|SensitiveDataLimitUseNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|SharingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|SensitiveDataProcessing|2 bit int list of size 12. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|KnownChildSensitiveDataConsents|2 bit int list of size 2. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|PersonalDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspnatv1|7|GpcSegmentType|2 bit int. Value is 1| -|uspnatv1|7|GpcSegmentIncluded|Boolean. Default value is true| -|uspnatv1|7|Gpc|Boolean| -|uspcav1|8|Version|6 bit int. Value is 1| -|uspcav1|8|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcav1|8|SharingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcav1|8|SensitiveDataLimitUseNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcav1|8|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcav1|8|SharingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcav1|8|SensitiveDataProcessing|2 bit int list of size 9. 0=Not applicable, 1=Yes, 2=No| -|uspcav1|8|KnownChildSensitiveDataConsents|2 bit int list of size 2. 0=Not applicable, 1=Yes, 2=No| -|uspcav1|8|PersonalDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcav1|8|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcav1|8|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcav1|8|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcav1|8|GpcSegmentType|2 bit int. Value is 1| -|uspcav1|8|GpcSegmentIncluded|Boolean. Default value is true| -|uspcav1|8|Gpc|Boolean| -|uspvav1|9|Version|6 bit int. Value is 1| -|uspvav1|9|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspvav1|9|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspvav1|9|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspvav1|9|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspvav1|9|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspvav1|9|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| -|uspvav1|9|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspvav1|9|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspvav1|9|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspvav1|9|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcov1|10|Version|6 bit int. Value is 1| -|uspcov1|10|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcov1|10|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcov1|10|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcov1|10|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcov1|10|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcov1|10|SensitiveDataProcessing|2 bit int list of size 7. 0=Not applicable, 1=Yes, 2=No| -|uspcov1|10|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcov1|10|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcov1|10|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcov1|10|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspcov1|10|GpcSegmentType|2 bit int. Value is 1| -|uspcov1|10|GpcSegmentIncluded|Boolean. Default value is true| -|uspcov1|10|Gpc|Boolean| -|usputv1|11|Version|6 bit int. Value is 1| -|usputv1|11|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usputv1|11|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usputv1|11|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usputv1|11|SensitiveDataProcessingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usputv1|11|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usputv1|11|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usputv1|11|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| -|usputv1|11|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usputv1|11|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usputv1|11|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usputv1|11|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspctv1|12|Version|6 bit int. Value is 1| -|uspctv1|12|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspctv1|12|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspctv1|12|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspctv1|12|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspctv1|12|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspctv1|12|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| -|uspctv1|12|KnownChildSensitiveDataConsents|2 bit int list of size 3. 0=Not applicable, 1=Yes, 2=No| -|uspctv1|12|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspctv1|12|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspctv1|12|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uspctv1|12|GpcSegmentType|2 bit int. Value is 1| -|uspctv1|12|GpcSegmentIncluded|Boolean. Default value is true| -|uspctv1|12|Gpc|Boolean| +|usnatv1|7|Version|6 bit int. Value is 1| +|usnatv1|7|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|SharingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|SensitiveDataProcessingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|SensitiveDataLimitUseNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|SharingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|SensitiveDataProcessing|2 bit int list of size 12. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|KnownChildSensitiveDataConsents|2 bit int list of size 2. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|PersonalDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnatv1|7|GpcSegmentType|2 bit int. Value is 1| +|usnatv1|7|GpcSegmentIncluded|Boolean. Default value is true| +|usnatv1|7|Gpc|Boolean| +|uscav1|8|Version|6 bit int. Value is 1| +|uscav1|8|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscav1|8|SharingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscav1|8|SensitiveDataLimitUseNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscav1|8|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscav1|8|SharingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscav1|8|SensitiveDataProcessing|2 bit int list of size 9. 0=Not applicable, 1=Yes, 2=No| +|uscav1|8|KnownChildSensitiveDataConsents|2 bit int list of size 2. 0=Not applicable, 1=Yes, 2=No| +|uscav1|8|PersonalDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscav1|8|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscav1|8|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscav1|8|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscav1|8|GpcSegmentType|2 bit int. Value is 1| +|uscav1|8|GpcSegmentIncluded|Boolean. Default value is true| +|uscav1|8|Gpc|Boolean| +|usvav1|9|Version|6 bit int. Value is 1| +|usvav1|9|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usvav1|9|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usvav1|9|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usvav1|9|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usvav1|9|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usvav1|9|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| +|usvav1|9|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usvav1|9|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usvav1|9|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usvav1|9|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscov1|10|Version|6 bit int. Value is 1| +|uscov1|10|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscov1|10|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscov1|10|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscov1|10|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscov1|10|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscov1|10|SensitiveDataProcessing|2 bit int list of size 7. 0=Not applicable, 1=Yes, 2=No| +|uscov1|10|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscov1|10|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscov1|10|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscov1|10|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|uscov1|10|GpcSegmentType|2 bit int. Value is 1| +|uscov1|10|GpcSegmentIncluded|Boolean. Default value is true| +|uscov1|10|Gpc|Boolean| +|usutv1|11|Version|6 bit int. Value is 1| +|usutv1|11|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usutv1|11|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usutv1|11|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usutv1|11|SensitiveDataProcessingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usutv1|11|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usutv1|11|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usutv1|11|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| +|usutv1|11|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usutv1|11|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usutv1|11|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usutv1|11|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usctv1|12|Version|6 bit int. Value is 1| +|usctv1|12|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usctv1|12|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usctv1|12|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usctv1|12|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usctv1|12|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usctv1|12|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| +|usctv1|12|KnownChildSensitiveDataConsents|2 bit int list of size 3. 0=Not applicable, 1=Yes, 2=No| +|usctv1|12|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usctv1|12|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usctv1|12|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usctv1|12|GpcSegmentType|2 bit int. Value is 1| +|usctv1|12|GpcSegmentIncluded|Boolean. Default value is true| +|usctv1|12|Gpc|Boolean| diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index e1a96cd4..b6690766 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.0.11-SNAPSHOT + 3.1.1-SNAPSHOT iabgpp-encoder @@ -27,13 +27,6 @@ maven-surefire-plugin 2.22.2 - - - org.junit.platform - junit-platform-surefire-provider - 1.3.2 - - diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index dcbf3555..626fb82a 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -13,13 +13,13 @@ import com.iab.gpp.encoder.section.Sections; import com.iab.gpp.encoder.section.TcfCaV1; import com.iab.gpp.encoder.section.TcfEuV2; -import com.iab.gpp.encoder.section.UspCaV1; -import com.iab.gpp.encoder.section.UspCoV1; -import com.iab.gpp.encoder.section.UspCtV1; -import com.iab.gpp.encoder.section.UspNatV1; -import com.iab.gpp.encoder.section.UspUtV1; +import com.iab.gpp.encoder.section.UsCaV1; +import com.iab.gpp.encoder.section.UsCoV1; +import com.iab.gpp.encoder.section.UsCtV1; +import com.iab.gpp.encoder.section.UsNatV1; +import com.iab.gpp.encoder.section.UsUtV1; import com.iab.gpp.encoder.section.UspV1; -import com.iab.gpp.encoder.section.UspVaV1; +import com.iab.gpp.encoder.section.UsVaV1; public class GppModel { private Map sections = new HashMap<>(); @@ -50,24 +50,24 @@ public void setFieldValue(String sectionName, String fieldName, Object value) th } else if (sectionName.equals(UspV1.NAME)) { section = new UspV1(); this.sections.put(UspV1.NAME, section); - } else if (sectionName.equals(UspNatV1.NAME)) { - section = new UspNatV1(); - this.sections.put(UspNatV1.NAME, section); - } else if (sectionName.equals(UspCaV1.NAME)) { - section = new UspCaV1(); - this.sections.put(UspCaV1.NAME, section); - } else if (sectionName.equals(UspVaV1.NAME)) { - section = new UspVaV1(); - this.sections.put(UspVaV1.NAME, section); - } else if (sectionName.equals(UspCoV1.NAME)) { - section = new UspCoV1(); - this.sections.put(UspCoV1.NAME, section); - } else if (sectionName.equals(UspUtV1.NAME)) { - section = new UspUtV1(); - this.sections.put(UspUtV1.NAME, section); - } else if (sectionName.equals(UspCtV1.NAME)) { - section = new UspCtV1(); - this.sections.put(UspCtV1.NAME, section); + } else if (sectionName.equals(UsNatV1.NAME)) { + section = new UsNatV1(); + this.sections.put(UsNatV1.NAME, section); + } else if (sectionName.equals(UsCaV1.NAME)) { + section = new UsCaV1(); + this.sections.put(UsCaV1.NAME, section); + } else if (sectionName.equals(UsVaV1.NAME)) { + section = new UsVaV1(); + this.sections.put(UsVaV1.NAME, section); + } else if (sectionName.equals(UsCoV1.NAME)) { + section = new UsCoV1(); + this.sections.put(UsCoV1.NAME, section); + } else if (sectionName.equals(UsUtV1.NAME)) { + section = new UsUtV1(); + this.sections.put(UsUtV1.NAME, section); + } else if (sectionName.equals(UsCtV1.NAME)) { + section = new UsCtV1(); + this.sections.put(UsCtV1.NAME, section); } } else { section = this.sections.get(sectionName); @@ -160,28 +160,28 @@ public UspV1 getUspV1Section() { return (UspV1) getSection(UspV1.NAME); } - public UspNatV1 getUspNatV1Section() { - return (UspNatV1) getSection(UspNatV1.NAME); + public UsNatV1 getUspNatV1Section() { + return (UsNatV1) getSection(UsNatV1.NAME); } - public UspCaV1 getUspCaV1Section() { - return (UspCaV1) getSection(UspCaV1.NAME); + public UsCaV1 getUspCaV1Section() { + return (UsCaV1) getSection(UsCaV1.NAME); } - public UspVaV1 getUspVaV1Section() { - return (UspVaV1) getSection(UspVaV1.NAME); + public UsVaV1 getUspVaV1Section() { + return (UsVaV1) getSection(UsVaV1.NAME); } - public UspCoV1 getUspCoV1Section() { - return (UspCoV1) getSection(UspCoV1.NAME); + public UsCoV1 getUspCoV1Section() { + return (UsCoV1) getSection(UsCoV1.NAME); } - public UspUtV1 getUspUtV1Section() { - return (UspUtV1) getSection(UspUtV1.NAME); + public UsUtV1 getUspUtV1Section() { + return (UsUtV1) getSection(UsUtV1.NAME); } - public UspCtV1 getUspCtV1Section() { - return (UspCtV1) getSection(UspCtV1.NAME); + public UsCtV1 getUspCtV1Section() { + return (UsCtV1) getSection(UsCtV1.NAME); } public List getSectionIds() { @@ -239,24 +239,24 @@ public void decode(String str) throws DecodingException { } else if (sectionIds.get(i).equals(UspV1.ID)) { UspV1 section = new UspV1(encodedSections[i + 1]); this.sections.put(UspV1.NAME, section); - } else if (sectionIds.get(i).equals(UspCaV1.ID)) { - UspCaV1 section = new UspCaV1(encodedSections[i + 1]); - this.sections.put(UspCaV1.NAME, section); - } else if (sectionIds.get(i).equals(UspNatV1.ID)) { - UspNatV1 section = new UspNatV1(encodedSections[i + 1]); - this.sections.put(UspNatV1.NAME, section); - } else if (sectionIds.get(i).equals(UspVaV1.ID)) { - UspVaV1 section = new UspVaV1(encodedSections[i + 1]); - this.sections.put(UspVaV1.NAME, section); - } else if (sectionIds.get(i).equals(UspCoV1.ID)) { - UspCoV1 section = new UspCoV1(encodedSections[i + 1]); - this.sections.put(UspCoV1.NAME, section); - } else if (sectionIds.get(i).equals(UspUtV1.ID)) { - UspUtV1 section = new UspUtV1(encodedSections[i + 1]); - this.sections.put(UspUtV1.NAME, section); - } else if (sectionIds.get(i).equals(UspCtV1.ID)) { - UspCtV1 section = new UspCtV1(encodedSections[i + 1]); - this.sections.put(UspCtV1.NAME, section); + } else if (sectionIds.get(i).equals(UsCaV1.ID)) { + UsCaV1 section = new UsCaV1(encodedSections[i + 1]); + this.sections.put(UsCaV1.NAME, section); + } else if (sectionIds.get(i).equals(UsNatV1.ID)) { + UsNatV1 section = new UsNatV1(encodedSections[i + 1]); + this.sections.put(UsNatV1.NAME, section); + } else if (sectionIds.get(i).equals(UsVaV1.ID)) { + UsVaV1 section = new UsVaV1(encodedSections[i + 1]); + this.sections.put(UsVaV1.NAME, section); + } else if (sectionIds.get(i).equals(UsCoV1.ID)) { + UsCoV1 section = new UsCoV1(encodedSections[i + 1]); + this.sections.put(UsCoV1.NAME, section); + } else if (sectionIds.get(i).equals(UsUtV1.ID)) { + UsUtV1 section = new UsUtV1(encodedSections[i + 1]); + this.sections.put(UsUtV1.NAME, section); + } else if (sectionIds.get(i).equals(UsCtV1.ID)) { + UsCtV1 section = new UsCtV1(encodedSections[i + 1]); + this.sections.put(UsCtV1.NAME, section); } } } @@ -289,24 +289,24 @@ public void decodeSection(String sectionName, String encodedString) throws Decod } else if (sectionName.equals(UspV1.NAME)) { section = new UspV1(); this.sections.put(UspV1.NAME, section); - } else if (sectionName.equals(UspNatV1.NAME)) { - section = new UspNatV1(); - this.sections.put(UspNatV1.NAME, section); - } else if (sectionName.equals(UspCaV1.NAME)) { - section = new UspCaV1(); - this.sections.put(UspCaV1.NAME, section); - } else if (sectionName.equals(UspVaV1.NAME)) { - section = new UspVaV1(); - this.sections.put(UspVaV1.NAME, section); - } else if (sectionName.equals(UspCoV1.NAME)) { - section = new UspCoV1(); - this.sections.put(UspCoV1.NAME, section); - } else if (sectionName.equals(UspUtV1.NAME)) { - section = new UspUtV1(); - this.sections.put(UspUtV1.NAME, section); - } else if (sectionName.equals(UspCtV1.NAME)) { - section = new UspCtV1(); - this.sections.put(UspCtV1.NAME, section); + } else if (sectionName.equals(UsNatV1.NAME)) { + section = new UsNatV1(); + this.sections.put(UsNatV1.NAME, section); + } else if (sectionName.equals(UsCaV1.NAME)) { + section = new UsCaV1(); + this.sections.put(UsCaV1.NAME, section); + } else if (sectionName.equals(UsVaV1.NAME)) { + section = new UsVaV1(); + this.sections.put(UsVaV1.NAME, section); + } else if (sectionName.equals(UsCoV1.NAME)) { + section = new UsCoV1(); + this.sections.put(UsCoV1.NAME, section); + } else if (sectionName.equals(UsUtV1.NAME)) { + section = new UsUtV1(); + this.sections.put(UsUtV1.NAME, section); + } else if (sectionName.equals(UsCtV1.NAME)) { + section = new UsCtV1(); + this.sections.put(UsCtV1.NAME, section); } } else { section = this.sections.get(sectionName); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/LazyDecodingException.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/LazyDecodingException.java new file mode 100644 index 00000000..070a02d8 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/LazyDecodingException.java @@ -0,0 +1,18 @@ +package com.iab.gpp.encoder.error; + +public class LazyDecodingException extends DecodingException { + + private static final long serialVersionUID = 2098268445119981680L; + + public LazyDecodingException(String msg) { + super(msg); + } + + public LazyDecodingException(Exception e) { + super(e); + } + + public LazyDecodingException(String msg, Exception e) { + super(msg, e); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaV1Field.java similarity index 97% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaV1Field.java index 12b30576..0c139803 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCaV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaV1Field.java @@ -1,6 +1,6 @@ package com.iab.gpp.encoder.field; -public class UspCaV1Field { +public class UsCaV1Field { public static String VERSION = "Version"; public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoV1Field.java similarity index 97% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoV1Field.java index 21265235..8bcce1a3 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCoV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoV1Field.java @@ -1,6 +1,6 @@ package com.iab.gpp.encoder.field; -public class UspCoV1Field { +public class UsCoV1Field { public static String VERSION = "Version"; public static String SHARING_NOTICE = "SharingNotice"; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtV1Field.java similarity index 97% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtV1Field.java index 56bdb071..ba7b9b07 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspCtV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtV1Field.java @@ -1,6 +1,6 @@ package com.iab.gpp.encoder.field; -public class UspCtV1Field { +public class UsCtV1Field { public static String VERSION = "Version"; public static String SHARING_NOTICE = "SharingNotice"; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatV1Field.java similarity index 97% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatV1Field.java index 8707a5e3..5a023e8f 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspNatV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatV1Field.java @@ -1,6 +1,6 @@ package com.iab.gpp.encoder.field; -public class UspNatV1Field { +public class UsNatV1Field { public static String VERSION = "Version"; public static String SHARING_NOTICE = "SharingNotice"; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspUtV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtV1Field.java similarity index 97% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspUtV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtV1Field.java index 0ceffa78..7a649e90 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspUtV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtV1Field.java @@ -1,6 +1,6 @@ package com.iab.gpp.encoder.field; -public class UspUtV1Field { +public class UsUtV1Field { public static String VERSION = "Version"; public static String SHARING_NOTICE = "SharingNotice"; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspVaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaV1Field.java similarity index 96% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspVaV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaV1Field.java index ceca6a1e..6125d171 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspVaV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaV1Field.java @@ -1,6 +1,6 @@ package com.iab.gpp.encoder.field; -public class UspVaV1Field { +public class UsVaV1Field { public static String VERSION = "Version"; public static String SHARING_NOTICE = "SharingNotice"; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java index f98a74a3..15647355 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java @@ -18,12 +18,12 @@ public class Sections { SECTION_ID_NAME_MAP.put(TcfEuV2.ID, TcfEuV2.NAME); SECTION_ID_NAME_MAP.put(TcfCaV1.ID, TcfCaV1.NAME); SECTION_ID_NAME_MAP.put(UspV1.ID, UspV1.NAME); - SECTION_ID_NAME_MAP.put(UspNatV1.ID, UspNatV1.NAME); - SECTION_ID_NAME_MAP.put(UspCaV1.ID, UspCaV1.NAME); - SECTION_ID_NAME_MAP.put(UspVaV1.ID, UspVaV1.NAME); - SECTION_ID_NAME_MAP.put(UspCoV1.ID, UspCoV1.NAME); - SECTION_ID_NAME_MAP.put(UspUtV1.ID, UspUtV1.NAME); - SECTION_ID_NAME_MAP.put(UspCtV1.ID, UspCtV1.NAME); + SECTION_ID_NAME_MAP.put(UsNatV1.ID, UsNatV1.NAME); + SECTION_ID_NAME_MAP.put(UsCaV1.ID, UsCaV1.NAME); + SECTION_ID_NAME_MAP.put(UsVaV1.ID, UsVaV1.NAME); + SECTION_ID_NAME_MAP.put(UsCoV1.ID, UsCoV1.NAME); + SECTION_ID_NAME_MAP.put(UsUtV1.ID, UsUtV1.NAME); + SECTION_ID_NAME_MAP.put(UsCtV1.ID, UsCtV1.NAME); SECTION_ORDER = new ArrayList(SECTION_ID_NAME_MAP.keySet()).stream().sorted() .map(id -> SECTION_ID_NAME_MAP.get(id)).collect(Collectors.toList()); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCaV1.java similarity index 53% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCaV1.java index 7ee91b01..de88746f 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCaV1.java @@ -12,21 +12,21 @@ import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.UspCaV1Field; +import com.iab.gpp.encoder.field.UsCaV1Field; import com.iab.gpp.encoder.field.UspV1Field; -public class UspCaV1 extends AbstractEncodableSegmentedBitStringSection { +public class UsCaV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 8; public static int VERSION = 1; - public static String NAME = "uspcav1"; + public static String NAME = "uscav1"; private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - public UspCaV1() { + public UsCaV1() { initFields(); } - public UspCaV1(String encodedString) throws DecodingException { + public UsCaV1(String encodedString) throws DecodingException { initFields(); if (encodedString != null && encodedString.length() > 0) { @@ -37,44 +37,44 @@ public UspCaV1(String encodedString) throws DecodingException { private void initFields() { fields = new HashMap<>(); - fields.put(UspCaV1Field.VERSION, new EncodableFixedInteger(6, UspCaV1.VERSION)); - fields.put(UspCaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspCaV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspCaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspCaV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspCaV1Field.SENSITIVE_DATA_PROCESSING, + fields.put(UsCaV1Field.VERSION, new EncodableFixedInteger(6, UsCaV1.VERSION)); + fields.put(UsCaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); - fields.put(UspCaV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UspCaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); + fields.put(UsCaV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); // gpc segment - fields.put(UspCaV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UspCaV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UspCaV1Field.GPC, new EncodableBoolean(false)); + fields.put(UsCaV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsCaV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsCaV1Field.GPC, new EncodableBoolean(false)); //@formatter:off String[] coreSegment = new String[] { - UspCaV1Field.VERSION, - UspCaV1Field.SALE_OPT_OUT_NOTICE, - UspCaV1Field.SHARING_OPT_OUT_NOTICE, - UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, - UspCaV1Field.SALE_OPT_OUT, - UspCaV1Field.SHARING_OPT_OUT, - UspCaV1Field.SENSITIVE_DATA_PROCESSING, - UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UspCaV1Field.PERSONAL_DATA_CONSENTS, - UspCaV1Field.MSPA_COVERED_TRANSACTION, - UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, - UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE + UsCaV1Field.VERSION, + UsCaV1Field.SALE_OPT_OUT_NOTICE, + UsCaV1Field.SHARING_OPT_OUT_NOTICE, + UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, + UsCaV1Field.SALE_OPT_OUT, + UsCaV1Field.SHARING_OPT_OUT, + UsCaV1Field.SENSITIVE_DATA_PROCESSING, + UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsCaV1Field.PERSONAL_DATA_CONSENTS, + UsCaV1Field.MSPA_COVERED_TRANSACTION, + UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE }; String[] gpcSegment = new String[] { - UspCaV1Field.GPC_SEGMENT_TYPE, - UspCaV1Field.GPC + UsCaV1Field.GPC_SEGMENT_TYPE, + UsCaV1Field.GPC }; segments = new String[][] { @@ -92,7 +92,7 @@ public String encode() throws EncodingException { encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); if (segmentBitStrings.size() >= 2) { - Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).getValue(); + Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).getValue(); if (gpcSegmentIncluded) { encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); } @@ -131,17 +131,17 @@ public void decode(String encodedSection) throws DecodingException { } } this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); - this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); + this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); } @Override public int getId() { - return UspCaV1.ID; + return UsCaV1.ID; } @Override public String getName() { - return UspCaV1.NAME; + return UsCaV1.NAME; } public Integer getVersion() { @@ -149,60 +149,60 @@ public Integer getVersion() { } public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UspCaV1Field.SALE_OPT_OUT_NOTICE).getValue(); + return (Integer) this.fields.get(UsCaV1Field.SALE_OPT_OUT_NOTICE).getValue(); } public Integer getSensitiveDataLimitUseNotice() { - return (Integer) this.fields.get(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE).getValue(); + return (Integer) this.fields.get(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE).getValue(); } public Integer getSharingOptOutNotice() { - return (Integer) this.fields.get(UspCaV1Field.SHARING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.fields.get(UsCaV1Field.SHARING_OPT_OUT_NOTICE).getValue(); } public Integer getSaleOptOut() { - return (Integer) this.fields.get(UspCaV1Field.SALE_OPT_OUT).getValue(); + return (Integer) this.fields.get(UsCaV1Field.SALE_OPT_OUT).getValue(); } public Integer getSharingOptOut() { - return (Integer) this.fields.get(UspCaV1Field.SHARING_OPT_OUT).getValue(); + return (Integer) this.fields.get(UsCaV1Field.SHARING_OPT_OUT).getValue(); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspCaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + return (List) this.fields.get(UsCaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); } @SuppressWarnings("unchecked") public List getKnownChildSensitiveDataConsents() { - return (List) this.fields.get(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + return (List) this.fields.get(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); } public Integer getPersonalDataConsents() { - return (Integer) this.fields.get(UspCaV1Field.PERSONAL_DATA_CONSENTS).getValue(); + return (Integer) this.fields.get(UsCaV1Field.PERSONAL_DATA_CONSENTS).getValue(); } public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UspCaV1Field.MSPA_COVERED_TRANSACTION).getValue(); + return (Integer) this.fields.get(UsCaV1Field.MSPA_COVERED_TRANSACTION).getValue(); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + return (Integer) this.fields.get(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); } public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + return (Integer) this.fields.get(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); } - public Boolean getGpcSegmentType() { - return (Boolean) this.fields.get(UspCaV1Field.GPC_SEGMENT_TYPE).getValue(); + public Integer getGpcSegmentType() { + return (Integer) this.fields.get(UsCaV1Field.GPC_SEGMENT_TYPE).getValue(); } public Boolean getGpcSegmentIncluded() { - return (Boolean) this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).getValue(); + return (Boolean) this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).getValue(); } public Boolean getGpc() { - return (Boolean) this.fields.get(UspCaV1Field.GPC).getValue(); + return (Boolean) this.fields.get(UsCaV1Field.GPC).getValue(); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCoV1.java similarity index 54% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCoV1.java index d68723f9..05b2f9d6 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCoV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCoV1.java @@ -12,22 +12,22 @@ import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.UspCaV1Field; -import com.iab.gpp.encoder.field.UspCoV1Field; +import com.iab.gpp.encoder.field.UsCaV1Field; +import com.iab.gpp.encoder.field.UsCoV1Field; import com.iab.gpp.encoder.field.UspV1Field; -public class UspCoV1 extends AbstractEncodableSegmentedBitStringSection { +public class UsCoV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 10; public static int VERSION = 1; - public static String NAME = "uspcov1"; + public static String NAME = "uscov1"; private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - public UspCoV1() { + public UsCoV1() { initFields(); } - public UspCoV1(String encodedString) throws DecodingException { + public UsCoV1(String encodedString) throws DecodingException { initFields(); if (encodedString != null && encodedString.length() > 0) { @@ -38,43 +38,43 @@ public UspCoV1(String encodedString) throws DecodingException { private void initFields() { fields = new HashMap<>(); - fields.put(UspCoV1Field.VERSION, new EncodableFixedInteger(6, UspCoV1.VERSION)); - fields.put(UspCoV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspCoV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspCoV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspCoV1Field.SENSITIVE_DATA_PROCESSING, + fields.put(UsCoV1Field.VERSION, new EncodableFixedInteger(6, UsCoV1.VERSION)); + fields.put(UsCoV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0))); - fields.put(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UspCoV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); // gpc segment - fields.put(UspCoV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UspCoV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UspCoV1Field.GPC, new EncodableBoolean(false)); + fields.put(UsCoV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsCoV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsCoV1Field.GPC, new EncodableBoolean(false)); //@formatter:off String[] coreSegment = new String[] { - UspCoV1Field.VERSION, - UspCoV1Field.SHARING_NOTICE, - UspCoV1Field.SALE_OPT_OUT_NOTICE, - UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UspCoV1Field.SALE_OPT_OUT, - UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT, - UspCoV1Field.SENSITIVE_DATA_PROCESSING, - UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UspCoV1Field.MSPA_COVERED_TRANSACTION, - UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE, - UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE + UsCoV1Field.VERSION, + UsCoV1Field.SHARING_NOTICE, + UsCoV1Field.SALE_OPT_OUT_NOTICE, + UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsCoV1Field.SALE_OPT_OUT, + UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, + UsCoV1Field.SENSITIVE_DATA_PROCESSING, + UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsCoV1Field.MSPA_COVERED_TRANSACTION, + UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE }; String[] gpcSegment = new String[] { - UspCoV1Field.GPC_SEGMENT_TYPE, - UspCoV1Field.GPC + UsCoV1Field.GPC_SEGMENT_TYPE, + UsCoV1Field.GPC }; segments = new String[][] { @@ -92,7 +92,7 @@ public String encode() throws EncodingException { encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); if (segmentBitStrings.size() >= 2) { - Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UspCoV1Field.GPC_SEGMENT_INCLUDED).getValue(); + Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UsCoV1Field.GPC_SEGMENT_INCLUDED).getValue(); if (gpcSegmentIncluded) { encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); } @@ -130,17 +130,17 @@ public void decode(String encodedSection) throws DecodingException { } } this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); - this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); + this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); } @Override public int getId() { - return UspCoV1.ID; + return UsCoV1.ID; } @Override public String getName() { - return UspCoV1.NAME; + return UsCoV1.NAME; } public Integer getVersion() { @@ -148,55 +148,55 @@ public Integer getVersion() { } public Integer getSharingNotice() { - return (Integer) this.fields.get(UspCoV1Field.SHARING_NOTICE).getValue(); + return (Integer) this.fields.get(UsCoV1Field.SHARING_NOTICE).getValue(); } public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UspCoV1Field.SALE_OPT_OUT_NOTICE).getValue(); + return (Integer) this.fields.get(UsCoV1Field.SALE_OPT_OUT_NOTICE).getValue(); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.fields.get(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.fields.get(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); } public Integer getSaleOptOut() { - return (Integer) this.fields.get(UspCoV1Field.SALE_OPT_OUT).getValue(); + return (Integer) this.fields.get(UsCoV1Field.SALE_OPT_OUT).getValue(); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.fields.get(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + return (Integer) this.fields.get(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspCoV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + return (List) this.fields.get(UsCoV1Field.SENSITIVE_DATA_PROCESSING).getValue(); } public Integer getKnownChildSensitiveDataConsents() { - return (Integer) this.fields.get(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + return (Integer) this.fields.get(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); } public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UspCoV1Field.MSPA_COVERED_TRANSACTION).getValue(); + return (Integer) this.fields.get(UsCoV1Field.MSPA_COVERED_TRANSACTION).getValue(); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + return (Integer) this.fields.get(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); } public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + return (Integer) this.fields.get(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); } - public Boolean getGpcSegmentType() { - return (Boolean) this.fields.get(UspCoV1Field.GPC_SEGMENT_TYPE).getValue(); + public Integer getGpcSegmentType() { + return (Integer) this.fields.get(UsCoV1Field.GPC_SEGMENT_TYPE).getValue(); } public Boolean getGpcSegmentIncluded() { - return (Boolean) this.fields.get(UspCoV1Field.GPC_SEGMENT_INCLUDED).getValue(); + return (Boolean) this.fields.get(UsCoV1Field.GPC_SEGMENT_INCLUDED).getValue(); } public Boolean getGpc() { - return (Boolean) this.fields.get(UspCoV1Field.GPC).getValue(); + return (Boolean) this.fields.get(UsCoV1Field.GPC).getValue(); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCtV1.java similarity index 55% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCtV1.java index 58738fc6..9df3e780 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspCtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCtV1.java @@ -12,22 +12,22 @@ import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.UspCaV1Field; -import com.iab.gpp.encoder.field.UspCtV1Field; +import com.iab.gpp.encoder.field.UsCaV1Field; +import com.iab.gpp.encoder.field.UsCtV1Field; import com.iab.gpp.encoder.field.UspV1Field; -public class UspCtV1 extends AbstractEncodableSegmentedBitStringSection { +public class UsCtV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 12; public static int VERSION = 1; - public static String NAME = "uspctv1"; + public static String NAME = "usctv1"; private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - public UspCtV1() { + public UsCtV1() { initFields(); } - public UspCtV1(String encodedString) throws DecodingException { + public UsCtV1(String encodedString) throws DecodingException { initFields(); if (encodedString != null && encodedString.length() > 0) { @@ -38,43 +38,43 @@ public UspCtV1(String encodedString) throws DecodingException { private void initFields() { fields = new HashMap<>(); - fields.put(UspCtV1Field.VERSION, new EncodableFixedInteger(6, UspCtV1.VERSION)); - fields.put(UspCtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspCtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspCtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspCtV1Field.SENSITIVE_DATA_PROCESSING, + fields.put(UsCtV1Field.VERSION, new EncodableFixedInteger(6, UsCtV1.VERSION)); + fields.put(UsCtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + fields.put(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0))); - fields.put(UspCtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); // gpc segment - fields.put(UspCtV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UspCtV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UspCtV1Field.GPC, new EncodableBoolean(false)); + fields.put(UsCtV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsCtV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsCtV1Field.GPC, new EncodableBoolean(false)); //@formatter:off String[] coreSegment = new String[] { - UspCtV1Field.VERSION, - UspCtV1Field.SHARING_NOTICE, - UspCtV1Field.SALE_OPT_OUT_NOTICE, - UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UspCtV1Field.SALE_OPT_OUT, - UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT, - UspCtV1Field.SENSITIVE_DATA_PROCESSING, - UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UspCtV1Field.MSPA_COVERED_TRANSACTION, - UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE, - UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE + UsCtV1Field.VERSION, + UsCtV1Field.SHARING_NOTICE, + UsCtV1Field.SALE_OPT_OUT_NOTICE, + UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsCtV1Field.SALE_OPT_OUT, + UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, + UsCtV1Field.SENSITIVE_DATA_PROCESSING, + UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsCtV1Field.MSPA_COVERED_TRANSACTION, + UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE }; String[] gpcSegment = new String[] { - UspCtV1Field.GPC_SEGMENT_TYPE, - UspCtV1Field.GPC + UsCtV1Field.GPC_SEGMENT_TYPE, + UsCtV1Field.GPC }; segments = new String[][] { @@ -92,7 +92,7 @@ public String encode() throws EncodingException { encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); if (segmentBitStrings.size() >= 2) { - Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UspCtV1Field.GPC_SEGMENT_INCLUDED).getValue(); + Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UsCtV1Field.GPC_SEGMENT_INCLUDED).getValue(); if (gpcSegmentIncluded) { encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); } @@ -130,17 +130,17 @@ public void decode(String encodedSection) throws DecodingException { } } this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); - this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); + this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); } @Override public int getId() { - return UspCtV1.ID; + return UsCtV1.ID; } @Override public String getName() { - return UspCtV1.NAME; + return UsCtV1.NAME; } public Integer getVersion() { @@ -148,56 +148,56 @@ public Integer getVersion() { } public Integer getSharingNotice() { - return (Integer) this.fields.get(UspCtV1Field.SHARING_NOTICE).getValue(); + return (Integer) this.fields.get(UsCtV1Field.SHARING_NOTICE).getValue(); } public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UspCtV1Field.SALE_OPT_OUT_NOTICE).getValue(); + return (Integer) this.fields.get(UsCtV1Field.SALE_OPT_OUT_NOTICE).getValue(); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.fields.get(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.fields.get(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); } public Integer getSaleOptOut() { - return (Integer) this.fields.get(UspCtV1Field.SALE_OPT_OUT).getValue(); + return (Integer) this.fields.get(UsCtV1Field.SALE_OPT_OUT).getValue(); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.fields.get(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + return (Integer) this.fields.get(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspCtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + return (List) this.fields.get(UsCtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); } @SuppressWarnings("unchecked") public List getKnownChildSensitiveDataConsents() { - return (List) this.fields.get(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + return (List) this.fields.get(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); } public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UspCtV1Field.MSPA_COVERED_TRANSACTION).getValue(); + return (Integer) this.fields.get(UsCtV1Field.MSPA_COVERED_TRANSACTION).getValue(); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + return (Integer) this.fields.get(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); } public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + return (Integer) this.fields.get(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); } - public Boolean getGpcSegmentType() { - return (Boolean) this.fields.get(UspCtV1Field.GPC_SEGMENT_TYPE).getValue(); + public Integer getGpcSegmentType() { + return (Integer) this.fields.get(UsCtV1Field.GPC_SEGMENT_TYPE).getValue(); } public Boolean getGpcSegmentIncluded() { - return (Boolean) this.fields.get(UspCtV1Field.GPC_SEGMENT_INCLUDED).getValue(); + return (Boolean) this.fields.get(UsCtV1Field.GPC_SEGMENT_INCLUDED).getValue(); } public Boolean getGpc() { - return (Boolean) this.fields.get(UspCtV1Field.GPC).getValue(); + return (Boolean) this.fields.get(UsCtV1Field.GPC).getValue(); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNatV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNatV1.java new file mode 100644 index 00000000..6cd943d9 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNatV1.java @@ -0,0 +1,233 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UsCaV1Field; +import com.iab.gpp.encoder.field.UsNatV1Field; +import com.iab.gpp.encoder.field.UspV1Field; + +public class UsNatV1 extends AbstractEncodableSegmentedBitStringSection { + public static int ID = 7; + public static int VERSION = 1; + public static String NAME = "usnatv1"; + + private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); + + public UsNatV1() { + initFields(); + } + + public UsNatV1(String encodedString) throws DecodingException { + initFields(); + + if (encodedString != null && encodedString.length() > 0) { + this.decode(encodedString); + } + } + + private void initFields() { + fields = new HashMap<>(); + + fields.put(UsNatV1Field.VERSION, new EncodableFixedInteger(6, UsNatV1.VERSION)); + fields.put(UsNatV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); + fields.put(UsNatV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + + // gpc segment + fields.put(UsNatV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsNatV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsNatV1Field.GPC, new EncodableBoolean(false)); + + + //@formatter:off + String[] coreSegment = new String[] { + UsNatV1Field.VERSION, + UsNatV1Field.SHARING_NOTICE, + UsNatV1Field.SALE_OPT_OUT_NOTICE, + UsNatV1Field.SHARING_OPT_OUT_NOTICE, + UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, + UsNatV1Field.SALE_OPT_OUT, + UsNatV1Field.SHARING_OPT_OUT, + UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, + UsNatV1Field.SENSITIVE_DATA_PROCESSING, + UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsNatV1Field.PERSONAL_DATA_CONSENTS, + UsNatV1Field.MSPA_COVERED_TRANSACTION, + UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE + }; + + String[] gpcSegment = new String[] { + UsNatV1Field.GPC_SEGMENT_TYPE, + UsNatV1Field.GPC + }; + + segments = new String[][] { + coreSegment, + gpcSegment + }; + //@formatter:on + } + + @Override + public String encode() throws EncodingException { + List segmentBitStrings = this.encodeSegmentsToBitStrings(); + List encodedSegments = new ArrayList<>(); + if (segmentBitStrings.size() >= 1) { + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); + + if (segmentBitStrings.size() >= 2) { + Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UsNatV1Field.GPC_SEGMENT_INCLUDED).getValue(); + if (gpcSegmentIncluded) { + encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); + } + } + } + + return encodedSegments.stream().collect(Collectors.joining(".")); + } + + @Override + public void decode(String encodedSection) throws DecodingException { + String[] encodedSegments = encodedSection.split("\\."); + String[] segmentBitStrings = new String[2]; + boolean gpcSegmentIncluded = false; + for (int i = 0; i < encodedSegments.length; i++) { + /** + * first char will contain 6 bits, we only need the first 2. There is no segment type for the CORE + * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on + * a maximum of encoding version 2 the first 2 bits in the core segment will evaluate to 0. + */ + String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); + switch (segmentBitString.substring(0, 2)) { + case "00": { + segmentBitStrings[0] = segmentBitString; + break; + } + case "01": { + gpcSegmentIncluded = true; + segmentBitStrings[1] = segmentBitString; + break; + } + default: { + throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); + } + } + } + this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); + this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); + } + + @Override + public int getId() { + return UsNatV1.ID; + } + + @Override + public String getName() { + return UsNatV1.NAME; + } + + public Integer getVersion() { + return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + } + + public Integer getSharingNotice() { + return (Integer) this.fields.get(UsNatV1Field.SHARING_NOTICE).getValue(); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.fields.get(UsNatV1Field.SALE_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSharingOptOutNotice() { + return (Integer) this.fields.get(UsNatV1Field.SHARING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.fields.get(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSensitiveDataProcessingOptOutNotice() { + return (Integer) this.fields.get(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSensitiveDataLimitUseNotice() { + return (Integer) this.fields.get(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE).getValue(); + } + + public Integer getSaleOptOut() { + return (Integer) this.fields.get(UsNatV1Field.SALE_OPT_OUT).getValue(); + } + + public Integer getSharingOptOut() { + return (Integer) this.fields.get(UsNatV1Field.SHARING_OPT_OUT).getValue(); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.fields.get(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UsNatV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + } + + @SuppressWarnings("unchecked") + public List getKnownChildSensitiveDataConsents() { + return (List) this.fields.get(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + } + + public Integer getPersonalDataConsents() { + return (Integer) this.fields.get(UsNatV1Field.PERSONAL_DATA_CONSENTS).getValue(); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.fields.get(UsNatV1Field.MSPA_COVERED_TRANSACTION).getValue(); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.fields.get(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.fields.get(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + } + + public Integer getGpcSegmentType() { + return (Integer) this.fields.get(UsNatV1Field.GPC_SEGMENT_TYPE).getValue(); + } + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.fields.get(UsNatV1Field.GPC_SEGMENT_INCLUDED).getValue(); + } + + public Boolean getGpc() { + return (Boolean) this.fields.get(UsNatV1Field.GPC).getValue(); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUtV1.java new file mode 100644 index 00000000..9bd56c35 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUtV1.java @@ -0,0 +1,141 @@ +package com.iab.gpp.encoder.section; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UsUtV1Field; +import com.iab.gpp.encoder.field.UspV1Field; + +public class UsUtV1 extends AbstractEncodableBitStringSection { + public static int ID = 11; + public static int VERSION = 1; + public static String NAME = "usutv1"; + + private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); + + public UsUtV1() { + initFields(); + } + + public UsUtV1(String encodedString) throws DecodingException { + initFields(); + + if (encodedString != null && encodedString.length() > 0) { + this.decode(encodedString); + } + } + + private void initFields() { + fields = new HashMap<>(); + + fields.put(UsUtV1Field.VERSION, new EncodableFixedInteger(6, UsUtV1.VERSION)); + fields.put(UsUtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + + //@formatter:off + fieldOrder = new String[] { + UsUtV1Field.VERSION, + UsUtV1Field.SHARING_NOTICE, + UsUtV1Field.SALE_OPT_OUT_NOTICE, + UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + UsUtV1Field.SALE_OPT_OUT, + UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, + UsUtV1Field.SENSITIVE_DATA_PROCESSING, + UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsUtV1Field.MSPA_COVERED_TRANSACTION, + UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE + }; + //@formatter:on + } + + @Override + public String encode() throws EncodingException { + String bitString = this.encodeToBitString(); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + public void decode(String encodedString) throws DecodingException { + String bitString = base64UrlEncoder.decode(encodedString); + this.decodeFromBitString(bitString); + } + + @Override + public int getId() { + return UsUtV1.ID; + } + + @Override + public String getName() { + return UsUtV1.NAME; + } + + public Integer getVersion() { + return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + } + + public Integer getSharingNotice() { + return (Integer) this.fields.get(UsUtV1Field.SHARING_NOTICE).getValue(); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.fields.get(UsUtV1Field.SALE_OPT_OUT_NOTICE).getValue(); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.fields.get(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSensitiveDataProcessingOptOutNotice() { + return (Integer) this.fields.get(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSaleOptOut() { + return (Integer) this.fields.get(UsUtV1Field.SALE_OPT_OUT).getValue(); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.fields.get(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UsUtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + } + + public Integer getKnownChildSensitiveDataConsents() { + return (Integer) this.fields.get(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.fields.get(UsUtV1Field.MSPA_COVERED_TRANSACTION).getValue(); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.fields.get(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.fields.get(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVaV1.java new file mode 100644 index 00000000..fdd48f49 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVaV1.java @@ -0,0 +1,135 @@ +package com.iab.gpp.encoder.section; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.UspV1Field; +import com.iab.gpp.encoder.field.UsVaV1Field; + +public class UsVaV1 extends AbstractEncodableBitStringSection { + public static int ID = 9; + public static int VERSION = 1; + public static String NAME = "usvav1"; + + private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); + + public UsVaV1() { + initFields(); + } + + public UsVaV1(String encodedString) throws DecodingException { + initFields(); + + if (encodedString != null && encodedString.length() > 0) { + this.decode(encodedString); + } + } + + private void initFields() { + fields = new HashMap<>(); + + fields.put(UsVaV1Field.VERSION, new EncodableFixedInteger(6, UsVaV1.VERSION)); + fields.put(UsVaV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + + //@formatter:off + fieldOrder = new String[] { + UsVaV1Field.VERSION, + UsVaV1Field.SHARING_NOTICE, + UsVaV1Field.SALE_OPT_OUT_NOTICE, + UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsVaV1Field.SALE_OPT_OUT, + UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, + UsVaV1Field.SENSITIVE_DATA_PROCESSING, + UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsVaV1Field.MSPA_COVERED_TRANSACTION, + UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE + }; + //@formatter:on + } + + @Override + public String encode() throws EncodingException { + String bitString = this.encodeToBitString(); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + public void decode(String encodedString) throws DecodingException { + String bitString = base64UrlEncoder.decode(encodedString); + this.decodeFromBitString(bitString); + } + + @Override + public int getId() { + return UsVaV1.ID; + } + + @Override + public String getName() { + return UsVaV1.NAME; + } + + public Integer getVersion() { + return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + } + + public Integer getSharingNotice() { + return (Integer) this.fields.get(UsVaV1Field.SHARING_NOTICE).getValue(); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.fields.get(UsVaV1Field.SALE_OPT_OUT_NOTICE).getValue(); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.fields.get(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + } + + public Integer getSaleOptOut() { + return (Integer) this.fields.get(UsVaV1Field.SALE_OPT_OUT).getValue(); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.fields.get(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.fields.get(UsVaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + } + + public Integer getKnownChildSensitiveDataConsents() { + return (Integer) this.fields.get(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.fields.get(UsVaV1Field.MSPA_COVERED_TRANSACTION).getValue(); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.fields.get(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.fields.get(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java deleted file mode 100644 index 18e0331a..00000000 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspNatV1.java +++ /dev/null @@ -1,234 +0,0 @@ -package com.iab.gpp.encoder.section; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.stream.Collectors; -import com.iab.gpp.encoder.datatype.EncodableBoolean; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.UspCaV1Field; -import com.iab.gpp.encoder.field.UspNatV1Field; -import com.iab.gpp.encoder.field.UspV1Field; - -public class UspNatV1 extends AbstractEncodableSegmentedBitStringSection { - public static int ID = 7; - public static int VERSION = 1; - public static String NAME = "uspnatv1"; - - private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - - public UspNatV1() { - initFields(); - } - - public UspNatV1(String encodedString) throws DecodingException { - initFields(); - - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } - } - - private void initFields() { - fields = new HashMap<>(); - - fields.put(UspNatV1Field.VERSION, new EncodableFixedInteger(6, UspNatV1.VERSION)); - fields.put(UspNatV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); - fields.put(UspNatV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); - - // gpc segment - fields.put(UspNatV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UspNatV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UspNatV1Field.GPC, new EncodableBoolean(false)); - - - //@formatter:off - String[] coreSegment = new String[] { - UspNatV1Field.VERSION, - UspNatV1Field.SHARING_NOTICE, - UspNatV1Field.SALE_OPT_OUT_NOTICE, - UspNatV1Field.SHARING_OPT_OUT_NOTICE, - UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, - UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, - UspNatV1Field.SALE_OPT_OUT, - UspNatV1Field.SHARING_OPT_OUT, - UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, - UspNatV1Field.SENSITIVE_DATA_PROCESSING, - UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UspNatV1Field.PERSONAL_DATA_CONSENTS, - UspNatV1Field.MSPA_COVERED_TRANSACTION, - UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, - UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE - }; - - String[] gpcSegment = new String[] { - UspNatV1Field.GPC_SEGMENT_TYPE, - UspNatV1Field.GPC - }; - - segments = new String[][] { - coreSegment, - gpcSegment - }; - //@formatter:on - } - - @Override - public String encode() throws EncodingException { - List segmentBitStrings = this.encodeSegmentsToBitStrings(); - List encodedSegments = new ArrayList<>(); - if (segmentBitStrings.size() >= 1) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); - - if (segmentBitStrings.size() >= 2) { - Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UspNatV1Field.GPC_SEGMENT_INCLUDED).getValue(); - if (gpcSegmentIncluded) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); - } - } - } - - return encodedSegments.stream().collect(Collectors.joining(".")); - } - - @Override - public void decode(String encodedSection) throws DecodingException { - String[] encodedSegments = encodedSection.split("\\."); - String[] segmentBitStrings = new String[2]; - boolean gpcSegmentIncluded = false; - for (int i = 0; i < encodedSegments.length; i++) { - /** - * first char will contain 6 bits, we only need the first 2. There is no segment type for the CORE - * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on - * a maximum of encoding version 2 the first 2 bits in the core segment will evaluate to 0. - */ - String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); - switch (segmentBitString.substring(0, 2)) { - case "00": { - segmentBitStrings[0] = segmentBitString; - break; - } - case "01": { - gpcSegmentIncluded = true; - segmentBitStrings[1] = segmentBitString; - break; - } - default: { - throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); - } - } - } - this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); - this.fields.get(UspCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); - } - - @Override - public int getId() { - return UspNatV1.ID; - } - - @Override - public String getName() { - return UspNatV1.NAME; - } - - public Integer getVersion() { - return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); - } - - public Integer getSharingNotice() { - return (Integer) this.fields.get(UspNatV1Field.SHARING_NOTICE).getValue(); - } - - public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UspNatV1Field.SALE_OPT_OUT_NOTICE).getValue(); - } - - public Integer getSharingOptOutNotice() { - return (Integer) this.fields.get(UspNatV1Field.SHARING_OPT_OUT_NOTICE).getValue(); - } - - public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.fields.get(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); - } - - public Integer getSensitiveDataProcessingOptOutNotice() { - return (Integer) this.fields.get(UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE).getValue(); - } - - public Integer getSensitiveDataLimitUseNotice() { - return (Integer) this.fields.get(UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE).getValue(); - } - - public Integer getSaleOptOut() { - return (Integer) this.fields.get(UspNatV1Field.SALE_OPT_OUT).getValue(); - } - - public Integer getSharingOptOut() { - return (Integer) this.fields.get(UspNatV1Field.SHARING_OPT_OUT).getValue(); - } - - public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.fields.get(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); - } - - @SuppressWarnings("unchecked") - public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspNatV1Field.SENSITIVE_DATA_PROCESSING).getValue(); - } - - @SuppressWarnings("unchecked") - public List getKnownChildSensitiveDataConsents() { - return (List) this.fields.get(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); - } - - public Integer getPersonalDataConsents() { - return (Integer) this.fields.get(UspNatV1Field.PERSONAL_DATA_CONSENTS).getValue(); - } - - public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UspNatV1Field.MSPA_COVERED_TRANSACTION).getValue(); - } - - public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); - } - - public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); - } - - public Boolean getGpcSegmentType() { - return (Boolean) this.fields.get(UspNatV1Field.GPC_SEGMENT_TYPE).getValue(); - } - - public Boolean getGpcSegmentIncluded() { - return (Boolean) this.fields.get(UspNatV1Field.GPC_SEGMENT_INCLUDED).getValue(); - } - - public Boolean getGpc() { - return (Boolean) this.fields.get(UspNatV1Field.GPC).getValue(); - } -} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java deleted file mode 100644 index b1e10af0..00000000 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspUtV1.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.iab.gpp.encoder.section; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.UspUtV1Field; -import com.iab.gpp.encoder.field.UspV1Field; - -public class UspUtV1 extends AbstractEncodableBitStringSection { - public static int ID = 11; - public static int VERSION = 1; - public static String NAME = "usputv1"; - - private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - - public UspUtV1() { - initFields(); - } - - public UspUtV1(String encodedString) throws DecodingException { - initFields(); - - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } - } - - private void initFields() { - fields = new HashMap<>(); - - fields.put(UspUtV1Field.VERSION, new EncodableFixedInteger(6, UspUtV1.VERSION)); - fields.put(UspUtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspUtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspUtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspUtV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UspUtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); - - //@formatter:off - fieldOrder = new String[] { - UspUtV1Field.VERSION, - UspUtV1Field.SHARING_NOTICE, - UspUtV1Field.SALE_OPT_OUT_NOTICE, - UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UspUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, - UspUtV1Field.SALE_OPT_OUT, - UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT, - UspUtV1Field.SENSITIVE_DATA_PROCESSING, - UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UspUtV1Field.MSPA_COVERED_TRANSACTION, - UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, - UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE - }; - //@formatter:on - } - - @Override - public String encode() throws EncodingException { - String bitString = this.encodeToBitString(); - String encodedString = base64UrlEncoder.encode(bitString); - return encodedString; - } - - @Override - public void decode(String encodedString) throws DecodingException { - String bitString = base64UrlEncoder.decode(encodedString); - this.decodeFromBitString(bitString); - } - - @Override - public int getId() { - return UspUtV1.ID; - } - - @Override - public String getName() { - return UspUtV1.NAME; - } - - public Integer getVersion() { - return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); - } - - public Integer getSharingNotice() { - return (Integer) this.fields.get(UspUtV1Field.SHARING_NOTICE).getValue(); - } - - public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UspUtV1Field.SALE_OPT_OUT_NOTICE).getValue(); - } - - public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.fields.get(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); - } - - public Integer getSensitiveDataProcessingOptOutNotice() { - return (Integer) this.fields.get(UspUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE).getValue(); - } - - public Integer getSaleOptOut() { - return (Integer) this.fields.get(UspUtV1Field.SALE_OPT_OUT).getValue(); - } - - public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.fields.get(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); - } - - @SuppressWarnings("unchecked") - public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspUtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); - } - - public Integer getKnownChildSensitiveDataConsents() { - return (Integer) this.fields.get(UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); - } - - public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UspUtV1Field.MSPA_COVERED_TRANSACTION).getValue(); - } - - public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); - } - - public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); - } - -} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java deleted file mode 100644 index 475d1f10..00000000 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspVaV1.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.iab.gpp.encoder.section; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.UspV1Field; -import com.iab.gpp.encoder.field.UspVaV1Field; - -public class UspVaV1 extends AbstractEncodableBitStringSection { - public static int ID = 9; - public static int VERSION = 1; - public static String NAME = "uspvav1"; - - private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - - public UspVaV1() { - initFields(); - } - - public UspVaV1(String encodedString) throws DecodingException { - initFields(); - - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } - } - - private void initFields() { - fields = new HashMap<>(); - - fields.put(UspVaV1Field.VERSION, new EncodableFixedInteger(6, UspVaV1.VERSION)); - fields.put(UspVaV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspVaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UspVaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UspVaV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UspVaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); - - //@formatter:off - fieldOrder = new String[] { - UspVaV1Field.VERSION, - UspVaV1Field.SHARING_NOTICE, - UspVaV1Field.SALE_OPT_OUT_NOTICE, - UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UspVaV1Field.SALE_OPT_OUT, - UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT, - UspVaV1Field.SENSITIVE_DATA_PROCESSING, - UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UspVaV1Field.MSPA_COVERED_TRANSACTION, - UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, - UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE - }; - //@formatter:on - } - - @Override - public String encode() throws EncodingException { - String bitString = this.encodeToBitString(); - String encodedString = base64UrlEncoder.encode(bitString); - return encodedString; - } - - @Override - public void decode(String encodedString) throws DecodingException { - String bitString = base64UrlEncoder.decode(encodedString); - this.decodeFromBitString(bitString); - } - - @Override - public int getId() { - return UspVaV1.ID; - } - - @Override - public String getName() { - return UspVaV1.NAME; - } - - public Integer getVersion() { - return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); - } - - public Integer getSharingNotice() { - return (Integer) this.fields.get(UspVaV1Field.SHARING_NOTICE).getValue(); - } - - public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UspVaV1Field.SALE_OPT_OUT_NOTICE).getValue(); - } - - public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.fields.get(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); - } - - public Integer getSaleOptOut() { - return (Integer) this.fields.get(UspVaV1Field.SALE_OPT_OUT).getValue(); - } - - public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.fields.get(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); - } - - @SuppressWarnings("unchecked") - public List getSensitiveDataProcessing() { - return (List) this.fields.get(UspVaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); - } - - public Integer getKnownChildSensitiveDataConsents() { - return (Integer) this.fields.get(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); - } - - public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UspVaV1Field.MSPA_COVERED_TRANSACTION).getValue(); - } - - public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); - } - - public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); - } - -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 9b474e7f..a28858af 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -10,31 +10,32 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.error.LazyDecodingException; import com.iab.gpp.encoder.field.TcfCaV1Field; import com.iab.gpp.encoder.field.TcfEuV2Field; -import com.iab.gpp.encoder.field.UspCaV1Field; -import com.iab.gpp.encoder.field.UspCoV1Field; -import com.iab.gpp.encoder.field.UspCtV1Field; -import com.iab.gpp.encoder.field.UspNatV1Field; -import com.iab.gpp.encoder.field.UspUtV1Field; +import com.iab.gpp.encoder.field.UsCaV1Field; +import com.iab.gpp.encoder.field.UsCoV1Field; +import com.iab.gpp.encoder.field.UsCtV1Field; +import com.iab.gpp.encoder.field.UsNatV1Field; +import com.iab.gpp.encoder.field.UsUtV1Field; import com.iab.gpp.encoder.field.UspV1Field; -import com.iab.gpp.encoder.field.UspVaV1Field; +import com.iab.gpp.encoder.field.UsVaV1Field; import com.iab.gpp.encoder.section.TcfCaV1; import com.iab.gpp.encoder.section.TcfEuV2; -import com.iab.gpp.encoder.section.UspCaV1; -import com.iab.gpp.encoder.section.UspCoV1; -import com.iab.gpp.encoder.section.UspCtV1; -import com.iab.gpp.encoder.section.UspNatV1; -import com.iab.gpp.encoder.section.UspUtV1; +import com.iab.gpp.encoder.section.UsCaV1; +import com.iab.gpp.encoder.section.UsCoV1; +import com.iab.gpp.encoder.section.UsCtV1; +import com.iab.gpp.encoder.section.UsNatV1; +import com.iab.gpp.encoder.section.UsUtV1; import com.iab.gpp.encoder.section.UspV1; -import com.iab.gpp.encoder.section.UspVaV1; +import com.iab.gpp.encoder.section.UsVaV1; public class GppModelTest { private ZonedDateTime utcDateTime = ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")); @Test - public void testEncodeDefault() throws EncodingException { + public void testEncodeDefault() throws EncodingException, LazyDecodingException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -59,18 +60,28 @@ public void testEncodeDefault() throws EncodingException { } @Test - public void testEncodeDefaultAll() throws EncodingException, InvalidFieldException { + public void testDecodingException() { + try { + GppModel gppModel = new GppModel("invalid gpp string"); + Assertions.fail("Expected LazyDecodingException"); + } catch (DecodingException e) { + + } + } + + @Test + public void testEncodeDefaultAll() throws EncodingException, InvalidFieldException, LazyDecodingException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UspNatV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UspCaV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UspVaV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UspCoV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UspUtV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UspCtV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsNatV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsCaV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsVaV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsCoV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsUtV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsCtV1.NAME)); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VERSION, TcfEuV2.VERSION); gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); @@ -79,24 +90,24 @@ public void testEncodeDefaultAll() throws EncodingException, InvalidFieldExcepti gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.CREATED, utcDateTime); gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); gppModel.setFieldValue(UspV1.NAME, UspV1Field.VERSION, UspV1.VERSION); - gppModel.setFieldValue(UspNatV1.NAME, UspNatV1Field.VERSION, UspNatV1.VERSION); - gppModel.setFieldValue(UspCaV1.NAME, UspCaV1Field.VERSION, UspCaV1.VERSION); - gppModel.setFieldValue(UspVaV1.NAME, UspVaV1Field.VERSION, UspVaV1.VERSION); - gppModel.setFieldValue(UspCoV1.NAME, UspCoV1Field.VERSION, UspCoV1.VERSION); - gppModel.setFieldValue(UspUtV1.NAME, UspUtV1Field.VERSION, UspUtV1.VERSION); - gppModel.setFieldValue(UspCtV1.NAME, UspCtV1Field.VERSION, UspCtV1.VERSION); + gppModel.setFieldValue(UsNatV1.NAME, UsNatV1Field.VERSION, UsNatV1.VERSION); + gppModel.setFieldValue(UsCaV1.NAME, UsCaV1Field.VERSION, UsCaV1.VERSION); + gppModel.setFieldValue(UsVaV1.NAME, UsVaV1Field.VERSION, UsVaV1.VERSION); + gppModel.setFieldValue(UsCoV1.NAME, UsCoV1Field.VERSION, UsCoV1.VERSION); + gppModel.setFieldValue(UsUtV1.NAME, UsUtV1Field.VERSION, UsUtV1.VERSION); + gppModel.setFieldValue(UsCtV1.NAME, UsCtV1Field.VERSION, UsCtV1.VERSION); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspNatV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspCaV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspVaV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspCoV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspUtV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspCtV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsNatV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCaV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsVaV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCoV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsUtV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCtV1.NAME)); String gppString = gppModel.encode(); Assertions.assertEquals( @@ -106,7 +117,7 @@ public void testEncodeDefaultAll() throws EncodingException, InvalidFieldExcepti } @Test - public void testEncodeUspv1() throws EncodingException, InvalidFieldException { + public void testEncodeUspv1() throws EncodingException, InvalidFieldException, LazyDecodingException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -146,7 +157,7 @@ public void testEncodeUspv1() throws EncodingException, InvalidFieldException { } @Test - public void testEncodeTcfEuV2() throws EncodingException, InvalidFieldException { + public void testEncodeTcfEuV2() throws EncodingException, InvalidFieldException, LazyDecodingException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -196,7 +207,7 @@ public void testEncodeTcfEuV2() throws EncodingException, InvalidFieldException } @Test - public void testEncodeUspV1AndTcfEuV2() throws EncodingException, InvalidFieldException { + public void testEncodeUspV1AndTcfEuV2() throws EncodingException, InvalidFieldException, LazyDecodingException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); @@ -241,7 +252,8 @@ public void testEncodeUspV1AndTcfEuV2() throws EncodingException, InvalidFieldEx } @Test - public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() throws EncodingException, InvalidFieldException { + public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() + throws EncodingException, InvalidFieldException, LazyDecodingException { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -366,12 +378,12 @@ public void testDecodeDefaultsAll() throws DecodingException { Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspNatV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspCaV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspVaV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspCoV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspUtV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UspCtV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsNatV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCaV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsVaV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCoV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsUtV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCtV1.NAME)); } @Test @@ -586,7 +598,7 @@ public void testDecodeUspv1AndTcfEuV2AndTcfCaV1() throws DecodingException { } @Test - public void testEncode1() throws EncodingException, InvalidFieldException { + public void testEncode1() throws EncodingException, InvalidFieldException, LazyDecodingException { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(28)); @@ -597,7 +609,7 @@ public void testEncode1() throws EncodingException, InvalidFieldException { } @Test - public void testEncode2() throws EncodingException, InvalidFieldException { + public void testEncode2() throws EncodingException, InvalidFieldException, LazyDecodingException { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(29)); @@ -608,7 +620,7 @@ public void testEncode2() throws EncodingException, InvalidFieldException { } @Test - public void testEncode3() throws EncodingException, InvalidFieldException { + public void testEncode3() throws EncodingException, InvalidFieldException, LazyDecodingException { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(1, 173, 722)); @@ -643,9 +655,9 @@ public void testConsistency() throws InvalidFieldException, EncodingException, D GppModel fromObjectModel = new GppModel(); fromObjectModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.PURPOSE_CONSENTS, - new ArrayList<>(List.of(true, true, true, true, true, true, true, true, true, true))); + Arrays.asList(true, true, true, true, true, true, true, true, true, true)); fromObjectModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, - new ArrayList<>(List.of(32, 128, 81, 210, 755, 21, 173, 238))); + Arrays.asList(32, 128, 81, 210, 755, 21, 173, 238)); Assertions.assertEquals(fromObjectModel.getSection(TcfEuV2.NAME).encode(), fromObjectModel.getSection(TcfEuV2.NAME).encode()); @@ -654,10 +666,10 @@ public void testConsistency() throws InvalidFieldException, EncodingException, D GppModel decodedModel = new GppModel(fromObjectModel.encode()); Assertions.assertEquals( - new ArrayList<>(List.of(true, true, true, true, true, true, true, true, true, true, false, false, false, false, - false, false, false, false, false, false, false, false, false, false)), + Arrays.asList(true, true, true, true, true, true, true, true, true, true, false, false, false, false, + false, false, false, false, false, false, false, false, false, false), decodedModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.PURPOSE_CONSENTS)); - Assertions.assertEquals(new ArrayList<>(List.of(21, 32, 81, 128, 173, 210, 238, 755)), + Assertions.assertEquals(Arrays.asList(21, 32, 81, 128, 173, 210, 238, 755), decodedModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java new file mode 100644 index 00000000..1a10fa9e --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java @@ -0,0 +1,104 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.field.UsCaV1Field; + +public class UsCaV1Test { + + @Test + public void testEncode1() throws EncodingException { + + UsCaV1 usCaV1 = new UsCaV1(); + Assertions.assertEquals("BAAAAAAA.QA", usCaV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException, InvalidFieldException { + UsCaV1 usCaV1 = new UsCaV1(); + + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 1); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 2); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0)); + usCaV1.setFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 1)); + usCaV1.setFieldValue(UsCaV1Field.PERSONAL_DATA_CONSENTS, 1); + usCaV1.setFieldValue(UsCaV1Field.MSPA_COVERED_TRANSACTION, 3); + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCaV1.setFieldValue(UsCaV1Field.GPC, true); + + Assertions.assertEquals("BbYbGwXY.YA", usCaV1.encode()); + } + + @Test + public void testEncode3() throws EncodingException, InvalidFieldException { + UsCaV1 usCaV1 = new UsCaV1(); + + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 2); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 2); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0)); + usCaV1.setFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 0)); + usCaV1.setFieldValue(UsCaV1Field.PERSONAL_DATA_CONSENTS, 0); + usCaV1.setFieldValue(UsCaV1Field.MSPA_COVERED_TRANSACTION, 1); + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.GPC, true); + + Assertions.assertEquals("BUoAAABQ.YA", usCaV1.encode()); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { + + UsCaV1 usCaV1 = new UsCaV1(); + usCaV1.setFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAAA", usCaV1.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsCaV1 usCaV1 = new UsCaV1("BbYbGwXY.YA"); + + Assertions.assertEquals(1, usCaV1.getSaleOptOutNotice()); + Assertions.assertEquals(2, usCaV1.getSharingOptOut()); + Assertions.assertEquals(3, usCaV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usCaV1.getSaleOptOut()); + Assertions.assertEquals(2, usCaV1.getSharingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0), usCaV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(0, 1), usCaV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCaV1.getPersonalDataConsents()); + Assertions.assertEquals(3, usCaV1.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usCaV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCaV1.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usCaV1.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsCaV1 usCaV1 = new UsCaV1("BbYbGwXY"); + + Assertions.assertEquals(1, usCaV1.getSaleOptOutNotice()); + Assertions.assertEquals(2, usCaV1.getSharingOptOut()); + Assertions.assertEquals(3, usCaV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usCaV1.getSaleOptOut()); + Assertions.assertEquals(2, usCaV1.getSharingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0), usCaV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(0, 1), usCaV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCaV1.getPersonalDataConsents()); + Assertions.assertEquals(3, usCaV1.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usCaV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCaV1.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usCaV1.getGpcSegmentIncluded()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java new file mode 100644 index 00000000..9c730803 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java @@ -0,0 +1,79 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.field.UsCoV1Field; + +public class UsCoV1Test { + + @Test + public void testEncode1() throws EncodingException { + UsCoV1 usCoV1 = new UsCoV1(); + Assertions.assertEquals("BAAAAAA.QA", usCoV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException, InvalidFieldException { + UsCoV1 usCoV1 = new UsCoV1(); + + usCoV1.setFieldValue(UsCoV1Field.SHARING_NOTICE, 1); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 1); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usCoV1.setFieldValue(UsCoV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2)); + usCoV1.setFieldValue(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + usCoV1.setFieldValue(UsCoV1Field.MSPA_COVERED_TRANSACTION, 1); + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + usCoV1.setFieldValue(UsCoV1Field.GPC, true); + + Assertions.assertEquals("BbYbG2w.YA", usCoV1.encode()); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { + UsCoV1 usCoV1 = new UsCoV1(); + usCoV1.setFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAA", usCoV1.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsCoV1 usCoV1 = new UsCoV1("BbYbG2wA.YA"); + + Assertions.assertEquals(1, usCoV1.getSharingNotice()); + Assertions.assertEquals(2, usCoV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, usCoV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCoV1.getSaleOptOut()); + Assertions.assertEquals(2, usCoV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2), usCoV1.getSensitiveDataProcessing()); + Assertions.assertEquals(3, usCoV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCoV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, usCoV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, usCoV1.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usCoV1.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsCoV1 usCoV1 = new UsCoV1("BbYbG2wA"); + + Assertions.assertEquals(1, usCoV1.getSharingNotice()); + Assertions.assertEquals(2, usCoV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, usCoV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCoV1.getSaleOptOut()); + Assertions.assertEquals(2, usCoV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2), usCoV1.getSensitiveDataProcessing()); + Assertions.assertEquals(3, usCoV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCoV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, usCoV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, usCoV1.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usCoV1.getGpcSegmentIncluded()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java new file mode 100644 index 00000000..2053e24c --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java @@ -0,0 +1,79 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.field.UsCtV1Field; + +public class UsCtV1Test { + + @Test + public void testEncode1() throws EncodingException { + UsCtV1 usCtV1 = new UsCtV1(); + Assertions.assertEquals("BAAAAAAA.QA", usCtV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException, InvalidFieldException { + UsCtV1 usCtV1 = new UsCtV1(); + + usCtV1.setFieldValue(UsCtV1Field.SHARING_NOTICE, 1); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 1); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usCtV1.setFieldValue(UsCtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); + usCtV1.setFieldValue(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); + usCtV1.setFieldValue(UsCtV1Field.MSPA_COVERED_TRANSACTION, 1); + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + usCtV1.setFieldValue(UsCtV1Field.GPC, true); + + Assertions.assertEquals("BbYbG22w.YA", usCtV1.encode()); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { + UsCtV1 usCtV1 = new UsCtV1(); + usCtV1.setFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAAA", usCtV1.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsCtV1 usCtV1 = new UsCtV1("BbYbG22w.YAAA"); + + Assertions.assertEquals(1, usCtV1.getSharingNotice()); + Assertions.assertEquals(2, usCtV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, usCtV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCtV1.getSaleOptOut()); + Assertions.assertEquals(2, usCtV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), usCtV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(1, 2, 3), usCtV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCtV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, usCtV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, usCtV1.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usCtV1.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsCtV1 usCtV1 = new UsCtV1("BbYbG22w"); + + Assertions.assertEquals(1, usCtV1.getSharingNotice()); + Assertions.assertEquals(2, usCtV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, usCtV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCtV1.getSaleOptOut()); + Assertions.assertEquals(2, usCtV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), usCtV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(1, 2, 3), usCtV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCtV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, usCtV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, usCtV1.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usCtV1.getGpcSegmentIncluded()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java new file mode 100644 index 00000000..f0707542 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java @@ -0,0 +1,120 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.field.UsNatV1Field; + +public class UsNatV1Test { + + @Test + public void testEncode1() throws EncodingException { + + UsNatV1 usNatV1 = new UsNatV1(); + Assertions.assertEquals("BAAAAAAAAAA.QA", usNatV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException, InvalidFieldException { + UsNatV1 usNatV1 = new UsNatV1(); + + usNatV1.setFieldValue(UsNatV1Field.SHARING_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 3); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 2); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3)); + usNatV1.setFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 1)); + usNatV1.setFieldValue(UsNatV1Field.PERSONAL_DATA_CONSENTS, 1); + usNatV1.setFieldValue(UsNatV1Field.MSPA_COVERED_TRANSACTION, 1); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + usNatV1.setFieldValue(UsNatV1Field.GPC, true); + + Assertions.assertEquals("BbbbGxsbFbA.YA", usNatV1.encode()); + } + + @Test + public void testEncode3() throws EncodingException, InvalidFieldException { + UsNatV1 usNatV1 = new UsNatV1(); + + usNatV1.setFieldValue(UsNatV1Field.SHARING_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 1); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); + usNatV1.setFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 0)); + usNatV1.setFieldValue(UsNatV1Field.PERSONAL_DATA_CONSENTS, 0); + usNatV1.setFieldValue(UsNatV1Field.MSPA_COVERED_TRANSACTION, 1); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.GPC, true); + + Assertions.assertEquals("BVQVAAAAAUA.YA", usNatV1.encode()); + } + + @Test + public void testEncodeWithGpcSegmentIncluded() throws EncodingException, InvalidFieldException { + + UsNatV1 usNatV1 = new UsNatV1(); + usNatV1.setFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAAAAAA", usNatV1.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsNatV1 usNatV1 = new UsNatV1("BbbbGxsbFbA.YA"); + + Assertions.assertEquals(1, usNatV1.getSharingNotice()); + Assertions.assertEquals(2, usNatV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, usNatV1.getSharingOptOutNotice()); + Assertions.assertEquals(1, usNatV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(2, usNatV1.getSensitiveDataProcessingOptOutNotice()); + Assertions.assertEquals(3, usNatV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usNatV1.getSaleOptOut()); + Assertions.assertEquals(2, usNatV1.getSharingOptOut()); + Assertions.assertEquals(3, usNatV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3), usNatV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(0, 1), usNatV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNatV1.getPersonalDataConsents()); + Assertions.assertEquals(1, usNatV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, usNatV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, usNatV1.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usNatV1.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsNatV1 usNatV1 = new UsNatV1("BbbbGxsbFbA"); + + Assertions.assertEquals(1, usNatV1.getSharingNotice()); + Assertions.assertEquals(2, usNatV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, usNatV1.getSharingOptOutNotice()); + Assertions.assertEquals(1, usNatV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(2, usNatV1.getSensitiveDataProcessingOptOutNotice()); + Assertions.assertEquals(3, usNatV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usNatV1.getSaleOptOut()); + Assertions.assertEquals(2, usNatV1.getSharingOptOut()); + Assertions.assertEquals(3, usNatV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3), usNatV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(0, 1), usNatV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNatV1.getPersonalDataConsents()); + Assertions.assertEquals(1, usNatV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, usNatV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, usNatV1.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usNatV1.getGpcSegmentIncluded()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java new file mode 100644 index 00000000..f26808a6 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java @@ -0,0 +1,54 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.field.UsUtV1Field; + +public class UsUtV1Test { + + @Test + public void testEncode1() throws EncodingException { + UsUtV1 usUtV1 = new UsUtV1(); + Assertions.assertEquals("BAAAAAAA", usUtV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException, InvalidFieldException { + UsUtV1 usUtV1 = new UsUtV1(); + + usUtV1.setFieldValue(UsUtV1Field.SHARING_NOTICE, 1); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 1); + usUtV1.setFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usUtV1.setFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); + usUtV1.setFieldValue(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + usUtV1.setFieldValue(UsUtV1Field.MSPA_COVERED_TRANSACTION, 1); + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + + Assertions.assertEquals("BbWGxvbA", usUtV1.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsUtV1 usUtV1 = new UsUtV1("BbWGxvbA"); + + Assertions.assertEquals(1, usUtV1.getSharingNotice()); + Assertions.assertEquals(2, usUtV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, usUtV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usUtV1.getSaleOptOut()); + Assertions.assertEquals(2, usUtV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), usUtV1.getSensitiveDataProcessing()); + Assertions.assertEquals(3, usUtV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usUtV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, usUtV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, usUtV1.getMspaServiceProviderMode()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java new file mode 100644 index 00000000..e65bec8c --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java @@ -0,0 +1,57 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.field.UsVaV1Field; + +public class UsVaV1Test { + + @Test + public void testEncode1() throws EncodingException { + UsVaV1 usVaV1 = new UsVaV1(); + Assertions.assertEquals("BAAAAAA", usVaV1.encode()); + } + + @Test + public void testEncode2() throws EncodingException { + UsVaV1 usVaV1 = new UsVaV1(); + + try { + usVaV1.setFieldValue(UsVaV1Field.SHARING_NOTICE, 1); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 1); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usVaV1.setFieldValue(UsVaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); + usVaV1.setFieldValue(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + usVaV1.setFieldValue(UsVaV1Field.MSPA_COVERED_TRANSACTION, 1); + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + } catch (InvalidFieldException e) { + throw new EncodingException(e); + } + + Assertions.assertEquals("BbYbG9s", usVaV1.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsVaV1 usVaV1 = new UsVaV1("BbYbG9s"); + + Assertions.assertEquals(1, usVaV1.getSharingNotice()); + Assertions.assertEquals(2, usVaV1.getSaleOptOutNotice()); + Assertions.assertEquals(3, usVaV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usVaV1.getSaleOptOut()); + Assertions.assertEquals(2, usVaV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), usVaV1.getSensitiveDataProcessing()); + Assertions.assertEquals(3, usVaV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usVaV1.getMspaCoveredTransaction()); + Assertions.assertEquals(2, usVaV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(3, usVaV1.getMspaServiceProviderMode()); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java deleted file mode 100644 index 0848536b..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCaV1Test.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; -import com.iab.gpp.encoder.field.UspCaV1Field; - -public class UspCaV1Test { - - @Test - public void testEncode1() throws EncodingException { - - UspCaV1 uspCaV1 = new UspCaV1(); - Assertions.assertEquals("BAAAAAAA.QA", uspCaV1.encode()); - } - - @Test - public void testEncode2() throws EncodingException, InvalidFieldException { - UspCaV1 uspCaV1 = new UspCaV1(); - - uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT_NOTICE, 1); - uspCaV1.setFieldValue(UspCaV1Field.SHARING_OPT_OUT_NOTICE, 2); - uspCaV1.setFieldValue(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); - uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT, 1); - uspCaV1.setFieldValue(UspCaV1Field.SHARING_OPT_OUT, 2); - uspCaV1.setFieldValue(UspCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0)); - uspCaV1.setFieldValue(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 1)); - uspCaV1.setFieldValue(UspCaV1Field.PERSONAL_DATA_CONSENTS, 1); - uspCaV1.setFieldValue(UspCaV1Field.MSPA_COVERED_TRANSACTION, 3); - uspCaV1.setFieldValue(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - uspCaV1.setFieldValue(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - uspCaV1.setFieldValue(UspCaV1Field.GPC, true); - - Assertions.assertEquals("BbYbGwXY.YA", uspCaV1.encode()); - } - - @Test - public void testEncode3() throws EncodingException, InvalidFieldException { - UspCaV1 uspCaV1 = new UspCaV1(); - - uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT_NOTICE, 1); - uspCaV1.setFieldValue(UspCaV1Field.SHARING_OPT_OUT_NOTICE, 1); - uspCaV1.setFieldValue(UspCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - uspCaV1.setFieldValue(UspCaV1Field.SALE_OPT_OUT, 2); - uspCaV1.setFieldValue(UspCaV1Field.SHARING_OPT_OUT, 2); - uspCaV1.setFieldValue(UspCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0)); - uspCaV1.setFieldValue(UspCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 0)); - uspCaV1.setFieldValue(UspCaV1Field.PERSONAL_DATA_CONSENTS, 0); - uspCaV1.setFieldValue(UspCaV1Field.MSPA_COVERED_TRANSACTION, 1); - uspCaV1.setFieldValue(UspCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - uspCaV1.setFieldValue(UspCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - uspCaV1.setFieldValue(UspCaV1Field.GPC, true); - - Assertions.assertEquals("BUoAAABQ.YA", uspCaV1.encode()); - } - - @Test - public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { - - UspCaV1 uspCaV1 = new UspCaV1(); - uspCaV1.setFieldValue(UspCaV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAAAA", uspCaV1.encode()); - } - - @Test - public void testDecode1() throws DecodingException { - UspCaV1 uspCaV1 = new UspCaV1("BbYbGwXY.YA"); - - Assertions.assertEquals(1, uspCaV1.getSaleOptOutNotice()); - Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); - Assertions.assertEquals(3, uspCaV1.getSensitiveDataLimitUseNotice()); - Assertions.assertEquals(1, uspCaV1.getSaleOptOut()); - Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0), uspCaV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(0, 1), uspCaV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspCaV1.getPersonalDataConsents()); - Assertions.assertEquals(3, uspCaV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, uspCaV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, uspCaV1.getMspaServiceProviderMode()); - Assertions.assertEquals(true, uspCaV1.getGpc()); - } - - @Test - public void testDecodeWithGpcSegmentExcluded() throws DecodingException { - UspCaV1 uspCaV1 = new UspCaV1("BbYbGwXY"); - - Assertions.assertEquals(1, uspCaV1.getSaleOptOutNotice()); - Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); - Assertions.assertEquals(3, uspCaV1.getSensitiveDataLimitUseNotice()); - Assertions.assertEquals(1, uspCaV1.getSaleOptOut()); - Assertions.assertEquals(2, uspCaV1.getSharingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0), uspCaV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(0, 1), uspCaV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspCaV1.getPersonalDataConsents()); - Assertions.assertEquals(3, uspCaV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, uspCaV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, uspCaV1.getMspaServiceProviderMode()); - Assertions.assertEquals(false, uspCaV1.getGpcSegmentIncluded()); - } -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java deleted file mode 100644 index 05559ca9..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCoV1Test.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; -import com.iab.gpp.encoder.field.UspCoV1Field; - -public class UspCoV1Test { - - @Test - public void testEncode1() throws EncodingException { - UspCoV1 uspCoV1 = new UspCoV1(); - Assertions.assertEquals("BAAAAAA.QA", uspCoV1.encode()); - } - - @Test - public void testEncode2() throws EncodingException, InvalidFieldException { - UspCoV1 uspCoV1 = new UspCoV1(); - - uspCoV1.setFieldValue(UspCoV1Field.SHARING_NOTICE, 1); - uspCoV1.setFieldValue(UspCoV1Field.SALE_OPT_OUT_NOTICE, 2); - uspCoV1.setFieldValue(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); - uspCoV1.setFieldValue(UspCoV1Field.SALE_OPT_OUT, 1); - uspCoV1.setFieldValue(UspCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - uspCoV1.setFieldValue(UspCoV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2)); - uspCoV1.setFieldValue(UspCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); - uspCoV1.setFieldValue(UspCoV1Field.MSPA_COVERED_TRANSACTION, 1); - uspCoV1.setFieldValue(UspCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - uspCoV1.setFieldValue(UspCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - uspCoV1.setFieldValue(UspCoV1Field.GPC, true); - - Assertions.assertEquals("BbYbG2w.YA", uspCoV1.encode()); - } - - @Test - public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { - UspCoV1 uspCoV1 = new UspCoV1(); - uspCoV1.setFieldValue(UspCoV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAAA", uspCoV1.encode()); - } - - @Test - public void testDecode1() throws DecodingException { - UspCoV1 uspCoV1 = new UspCoV1("BbYbG2wA.YA"); - - Assertions.assertEquals(1, uspCoV1.getSharingNotice()); - Assertions.assertEquals(2, uspCoV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspCoV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, uspCoV1.getSaleOptOut()); - Assertions.assertEquals(2, uspCoV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2), uspCoV1.getSensitiveDataProcessing()); - Assertions.assertEquals(3, uspCoV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspCoV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspCoV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspCoV1.getMspaServiceProviderMode()); - Assertions.assertEquals(true, uspCoV1.getGpc()); - } - - @Test - public void testDecodeWithGpcSegmentExcluded() throws DecodingException { - UspCoV1 uspCoV1 = new UspCoV1("BbYbG2wA"); - - Assertions.assertEquals(1, uspCoV1.getSharingNotice()); - Assertions.assertEquals(2, uspCoV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspCoV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, uspCoV1.getSaleOptOut()); - Assertions.assertEquals(2, uspCoV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2), uspCoV1.getSensitiveDataProcessing()); - Assertions.assertEquals(3, uspCoV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspCoV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspCoV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspCoV1.getMspaServiceProviderMode()); - Assertions.assertEquals(false, uspCoV1.getGpcSegmentIncluded()); - } -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java deleted file mode 100644 index efc382f8..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspCtV1Test.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; -import com.iab.gpp.encoder.field.UspCtV1Field; - -public class UspCtV1Test { - - @Test - public void testEncode1() throws EncodingException { - UspCtV1 uspCtV1 = new UspCtV1(); - Assertions.assertEquals("BAAAAAAA.QA", uspCtV1.encode()); - } - - @Test - public void testEncode2() throws EncodingException, InvalidFieldException { - UspCtV1 uspCtV1 = new UspCtV1(); - - uspCtV1.setFieldValue(UspCtV1Field.SHARING_NOTICE, 1); - uspCtV1.setFieldValue(UspCtV1Field.SALE_OPT_OUT_NOTICE, 2); - uspCtV1.setFieldValue(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); - uspCtV1.setFieldValue(UspCtV1Field.SALE_OPT_OUT, 1); - uspCtV1.setFieldValue(UspCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - uspCtV1.setFieldValue(UspCtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); - uspCtV1.setFieldValue(UspCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); - uspCtV1.setFieldValue(UspCtV1Field.MSPA_COVERED_TRANSACTION, 1); - uspCtV1.setFieldValue(UspCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - uspCtV1.setFieldValue(UspCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - uspCtV1.setFieldValue(UspCtV1Field.GPC, true); - - Assertions.assertEquals("BbYbG22w.YA", uspCtV1.encode()); - } - - @Test - public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { - UspCtV1 uspCtV1 = new UspCtV1(); - uspCtV1.setFieldValue(UspCtV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAAAA", uspCtV1.encode()); - } - - @Test - public void testDecode1() throws DecodingException { - UspCtV1 uspCtV1 = new UspCtV1("BbYbG22w.YAAA"); - - Assertions.assertEquals(1, uspCtV1.getSharingNotice()); - Assertions.assertEquals(2, uspCtV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspCtV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, uspCtV1.getSaleOptOut()); - Assertions.assertEquals(2, uspCtV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspCtV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(1, 2, 3), uspCtV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspCtV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspCtV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspCtV1.getMspaServiceProviderMode()); - Assertions.assertEquals(true, uspCtV1.getGpc()); - } - - @Test - public void testDecodeWithGpcSegmentExcluded() throws DecodingException { - UspCtV1 uspCtV1 = new UspCtV1("BbYbG22w"); - - Assertions.assertEquals(1, uspCtV1.getSharingNotice()); - Assertions.assertEquals(2, uspCtV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspCtV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, uspCtV1.getSaleOptOut()); - Assertions.assertEquals(2, uspCtV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspCtV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(1, 2, 3), uspCtV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspCtV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspCtV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspCtV1.getMspaServiceProviderMode()); - Assertions.assertEquals(false, uspCtV1.getGpcSegmentIncluded()); - } -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java deleted file mode 100644 index b70e07c9..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspNatV1Test.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; -import com.iab.gpp.encoder.field.UspNatV1Field; - -public class UspNatV1Test { - - @Test - public void testEncode1() throws EncodingException { - - UspNatV1 uspNatV1 = new UspNatV1(); - Assertions.assertEquals("BAAAAAAAAAA.QA", uspNatV1.encode()); - } - - @Test - public void testEncode2() throws EncodingException, InvalidFieldException { - UspNatV1 uspNatV1 = new UspNatV1(); - - uspNatV1.setFieldValue(UspNatV1Field.SHARING_NOTICE, 1); - uspNatV1.setFieldValue(UspNatV1Field.SALE_OPT_OUT_NOTICE, 2); - uspNatV1.setFieldValue(UspNatV1Field.SHARING_OPT_OUT_NOTICE, 3); - uspNatV1.setFieldValue(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 2); - uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); - uspNatV1.setFieldValue(UspNatV1Field.SALE_OPT_OUT, 1); - uspNatV1.setFieldValue(UspNatV1Field.SHARING_OPT_OUT, 2); - uspNatV1.setFieldValue(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); - uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3)); - uspNatV1.setFieldValue(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 1)); - uspNatV1.setFieldValue(UspNatV1Field.PERSONAL_DATA_CONSENTS, 1); - uspNatV1.setFieldValue(UspNatV1Field.MSPA_COVERED_TRANSACTION, 1); - uspNatV1.setFieldValue(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - uspNatV1.setFieldValue(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - uspNatV1.setFieldValue(UspNatV1Field.GPC, true); - - Assertions.assertEquals("BbbbGxsbFbA.YA", uspNatV1.encode()); - } - - @Test - public void testEncode3() throws EncodingException, InvalidFieldException { - UspNatV1 uspNatV1 = new UspNatV1(); - - uspNatV1.setFieldValue(UspNatV1Field.SHARING_NOTICE, 1); - uspNatV1.setFieldValue(UspNatV1Field.SALE_OPT_OUT_NOTICE, 1); - uspNatV1.setFieldValue(UspNatV1Field.SHARING_OPT_OUT_NOTICE, 1); - uspNatV1.setFieldValue(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 0); - uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - uspNatV1.setFieldValue(UspNatV1Field.SALE_OPT_OUT, 1); - uspNatV1.setFieldValue(UspNatV1Field.SHARING_OPT_OUT, 1); - uspNatV1.setFieldValue(UspNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - uspNatV1.setFieldValue(UspNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); - uspNatV1.setFieldValue(UspNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 0)); - uspNatV1.setFieldValue(UspNatV1Field.PERSONAL_DATA_CONSENTS, 0); - uspNatV1.setFieldValue(UspNatV1Field.MSPA_COVERED_TRANSACTION, 1); - uspNatV1.setFieldValue(UspNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - uspNatV1.setFieldValue(UspNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - uspNatV1.setFieldValue(UspNatV1Field.GPC, true); - - Assertions.assertEquals("BVQVAAAAAUA.YA", uspNatV1.encode()); - } - - @Test - public void testEncodeWithGpcSegmentIncluded() throws EncodingException, InvalidFieldException { - - UspNatV1 uspNatV1 = new UspNatV1(); - uspNatV1.setFieldValue(UspNatV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAAAAAAA", uspNatV1.encode()); - } - - @Test - public void testDecode1() throws DecodingException { - UspNatV1 uspNatV1 = new UspNatV1("BbbbGxsbFbA.YA"); - - Assertions.assertEquals(1, uspNatV1.getSharingNotice()); - Assertions.assertEquals(2, uspNatV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspNatV1.getSharingOptOutNotice()); - Assertions.assertEquals(1, uspNatV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(2, uspNatV1.getSensitiveDataProcessingOptOutNotice()); - Assertions.assertEquals(3, uspNatV1.getSensitiveDataLimitUseNotice()); - Assertions.assertEquals(1, uspNatV1.getSaleOptOut()); - Assertions.assertEquals(2, uspNatV1.getSharingOptOut()); - Assertions.assertEquals(3, uspNatV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3), uspNatV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(0, 1), uspNatV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspNatV1.getPersonalDataConsents()); - Assertions.assertEquals(1, uspNatV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspNatV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspNatV1.getMspaServiceProviderMode()); - Assertions.assertEquals(true, uspNatV1.getGpc()); - } - - @Test - public void testDecodeWithGpcSegmentExcluded() throws DecodingException { - UspNatV1 uspNatV1 = new UspNatV1("BbbbGxsbFbA"); - - Assertions.assertEquals(1, uspNatV1.getSharingNotice()); - Assertions.assertEquals(2, uspNatV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspNatV1.getSharingOptOutNotice()); - Assertions.assertEquals(1, uspNatV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(2, uspNatV1.getSensitiveDataProcessingOptOutNotice()); - Assertions.assertEquals(3, uspNatV1.getSensitiveDataLimitUseNotice()); - Assertions.assertEquals(1, uspNatV1.getSaleOptOut()); - Assertions.assertEquals(2, uspNatV1.getSharingOptOut()); - Assertions.assertEquals(3, uspNatV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3), uspNatV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(0, 1), uspNatV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspNatV1.getPersonalDataConsents()); - Assertions.assertEquals(1, uspNatV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspNatV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspNatV1.getMspaServiceProviderMode()); - Assertions.assertEquals(false, uspNatV1.getGpcSegmentIncluded()); - } -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java deleted file mode 100644 index 5bad0d1f..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspUtV1Test.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; -import com.iab.gpp.encoder.field.UspUtV1Field; - -public class UspUtV1Test { - - @Test - public void testEncode1() throws EncodingException { - UspUtV1 uspUtV1 = new UspUtV1(); - Assertions.assertEquals("BAAAAAAA", uspUtV1.encode()); - } - - @Test - public void testEncode2() throws EncodingException, InvalidFieldException { - UspUtV1 uspUtV1 = new UspUtV1(); - - uspUtV1.setFieldValue(UspUtV1Field.SHARING_NOTICE, 1); - uspUtV1.setFieldValue(UspUtV1Field.SALE_OPT_OUT_NOTICE, 2); - uspUtV1.setFieldValue(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); - uspUtV1.setFieldValue(UspUtV1Field.SALE_OPT_OUT, 1); - uspUtV1.setFieldValue(UspUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); - uspUtV1.setFieldValue(UspUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - uspUtV1.setFieldValue(UspUtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); - uspUtV1.setFieldValue(UspUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); - uspUtV1.setFieldValue(UspUtV1Field.MSPA_COVERED_TRANSACTION, 1); - uspUtV1.setFieldValue(UspUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - uspUtV1.setFieldValue(UspUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - - Assertions.assertEquals("BbWGxvbA", uspUtV1.encode()); - } - - @Test - public void testDecode1() throws DecodingException { - UspUtV1 uspUtV1 = new UspUtV1("BbWGxvbA"); - - Assertions.assertEquals(1, uspUtV1.getSharingNotice()); - Assertions.assertEquals(2, uspUtV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspUtV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, uspUtV1.getSaleOptOut()); - Assertions.assertEquals(2, uspUtV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspUtV1.getSensitiveDataProcessing()); - Assertions.assertEquals(3, uspUtV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspUtV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspUtV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspUtV1.getMspaServiceProviderMode()); - } -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java deleted file mode 100644 index a8f38633..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspVaV1Test.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; -import com.iab.gpp.encoder.field.UspVaV1Field; - -public class UspVaV1Test { - - @Test - public void testEncode1() throws EncodingException { - UspVaV1 uspVaV1 = new UspVaV1(); - Assertions.assertEquals("BAAAAAA", uspVaV1.encode()); - } - - @Test - public void testEncode2() throws EncodingException { - UspVaV1 uspVaV1 = new UspVaV1(); - - try { - uspVaV1.setFieldValue(UspVaV1Field.SHARING_NOTICE, 1); - uspVaV1.setFieldValue(UspVaV1Field.SALE_OPT_OUT_NOTICE, 2); - uspVaV1.setFieldValue(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); - uspVaV1.setFieldValue(UspVaV1Field.SALE_OPT_OUT, 1); - uspVaV1.setFieldValue(UspVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - uspVaV1.setFieldValue(UspVaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); - uspVaV1.setFieldValue(UspVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); - uspVaV1.setFieldValue(UspVaV1Field.MSPA_COVERED_TRANSACTION, 1); - uspVaV1.setFieldValue(UspVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - uspVaV1.setFieldValue(UspVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - } catch (InvalidFieldException e) { - throw new EncodingException(e); - } - - Assertions.assertEquals("BbYbG9s", uspVaV1.encode()); - } - - @Test - public void testDecode1() throws DecodingException { - UspVaV1 uspVaV1 = new UspVaV1("BbYbG9s"); - - Assertions.assertEquals(1, uspVaV1.getSharingNotice()); - Assertions.assertEquals(2, uspVaV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, uspVaV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, uspVaV1.getSaleOptOut()); - Assertions.assertEquals(2, uspVaV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), uspVaV1.getSensitiveDataProcessing()); - Assertions.assertEquals(3, uspVaV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, uspVaV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, uspVaV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, uspVaV1.getMspaServiceProviderMode()); - } -} diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index ff4d7860..b0aaedfc 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.0.11-SNAPSHOT + 3.1.1-SNAPSHOT iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.0.11-SNAPSHOT + 3.1.1-SNAPSHOT @@ -46,13 +46,6 @@ maven-surefire-plugin 2.22.2 - - - org.junit.platform - junit-platform-surefire-provider - 1.3.2 - - diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/Loader.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/Loader.java index bfd0d16e..158ced93 100644 --- a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/Loader.java +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/Loader.java @@ -22,7 +22,6 @@ import java.io.IOException; import java.io.InputStream; - import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver; @@ -30,6 +29,8 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.iab.gpp.extras.jackson.cmp.Cmp; import com.iab.gpp.extras.jackson.cmp.CmpList; +import com.iab.gpp.extras.jackson.gvl.DataCategory; +import com.iab.gpp.extras.jackson.gvl.DataRetention; import com.iab.gpp.extras.jackson.gvl.Feature; import com.iab.gpp.extras.jackson.gvl.Gvl; import com.iab.gpp.extras.jackson.gvl.Overflow; @@ -38,69 +39,73 @@ import com.iab.gpp.extras.jackson.gvl.SpecialPurpose; import com.iab.gpp.extras.jackson.gvl.Stack; import com.iab.gpp.extras.jackson.gvl.Vendor; +import com.iab.gpp.extras.jackson.gvl.VendorUrl; public class Loader { - private ObjectMapper objectMapper = new ObjectMapper(); + private ObjectMapper objectMapper = new ObjectMapper(); - public Loader() { - SimpleModule module = new SimpleModule(); + public Loader() { + SimpleModule module = new SimpleModule(); - SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver(); - resolver.addMapping(com.iab.gpp.extras.gvl.Gvl.class, Gvl.class); - resolver.addMapping(com.iab.gpp.extras.gvl.Feature.class, Feature.class); - resolver.addMapping(com.iab.gpp.extras.gvl.Overflow.class, Overflow.class); - resolver.addMapping(com.iab.gpp.extras.gvl.Purpose.class, Purpose.class); - resolver.addMapping(com.iab.gpp.extras.gvl.SpecialFeature.class, SpecialFeature.class); - resolver.addMapping(com.iab.gpp.extras.gvl.SpecialPurpose.class, SpecialPurpose.class); - resolver.addMapping(com.iab.gpp.extras.gvl.Stack.class, Stack.class); - resolver.addMapping(com.iab.gpp.extras.gvl.Vendor.class, Vendor.class); + SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver(); + resolver.addMapping(com.iab.gpp.extras.gvl.DataCategory.class, DataCategory.class); + resolver.addMapping(com.iab.gpp.extras.gvl.DataRetention.class, DataRetention.class); + resolver.addMapping(com.iab.gpp.extras.gvl.Gvl.class, Gvl.class); + resolver.addMapping(com.iab.gpp.extras.gvl.Feature.class, Feature.class); + resolver.addMapping(com.iab.gpp.extras.gvl.Overflow.class, Overflow.class); + resolver.addMapping(com.iab.gpp.extras.gvl.Purpose.class, Purpose.class); + resolver.addMapping(com.iab.gpp.extras.gvl.SpecialFeature.class, SpecialFeature.class); + resolver.addMapping(com.iab.gpp.extras.gvl.SpecialPurpose.class, SpecialPurpose.class); + resolver.addMapping(com.iab.gpp.extras.gvl.Stack.class, Stack.class); + resolver.addMapping(com.iab.gpp.extras.gvl.Vendor.class, Vendor.class); + resolver.addMapping(com.iab.gpp.extras.gvl.VendorUrl.class, VendorUrl.class); - resolver.addMapping(com.iab.gpp.extras.cmp.Cmp.class, Cmp.class); - resolver.addMapping(com.iab.gpp.extras.cmp.CmpList.class, CmpList.class); + resolver.addMapping(com.iab.gpp.extras.cmp.Cmp.class, Cmp.class); + resolver.addMapping(com.iab.gpp.extras.cmp.CmpList.class, CmpList.class); - module.setAbstractTypes(resolver); - objectMapper.registerModule(module); - objectMapper.registerModule(new JavaTimeModule()); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - } + module.setAbstractTypes(resolver); + objectMapper.registerModule(module); + objectMapper.registerModule(new JavaTimeModule()); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + } - /** - * Gets the global vendor list json from the specified InputStream - * - * @param content {@link InputStream} of GVL json content - * @return {@link com.iab.gpp.extras.gvl.Gvl} object - */ - public com.iab.gpp.extras.gvl.Gvl globalVendorList(InputStream content) throws IOException { - return objectMapper.readValue(content, com.iab.gpp.extras.gvl.Gvl.class); - } + /** + * Gets the global vendor list json from the specified InputStream + * + * @param content {@link InputStream} of GVL json content + * @return {@link com.iab.gpp.extras.gvl.Gvl} object + */ + public com.iab.gpp.extras.gvl.Gvl globalVendorList(InputStream content) throws IOException { + return objectMapper.readValue(content, com.iab.gpp.extras.gvl.Gvl.class); + } - /** - * Gets the global vendor list json using a json string - * - * @param json the gvl json as a string - * @return {@link com.iab.gpp.extras.gvl.Gvl} object - */ - public com.iab.gpp.extras.gvl.Gvl globalVendorList(String json) throws IOException { - return objectMapper.readValue(json, com.iab.gpp.extras.gvl.Gvl.class); - } + /** + * Gets the global vendor list json using a json string + * + * @param json the gvl json as a string + * @return {@link com.iab.gpp.extras.gvl.Gvl} object + */ + public com.iab.gpp.extras.gvl.Gvl globalVendorList(String json) throws IOException { + return objectMapper.readValue(json, com.iab.gpp.extras.gvl.Gvl.class); + } - /** - * Gets the CMP list from the specified InputStream - * - * @param content {@link InputStream} of CMP List json content - * @return {@link com.iab.gpp.extras.cmp.CmpList} object - */ - public com.iab.gpp.extras.cmp.CmpList cmpList(InputStream content) throws IOException { - return objectMapper.readValue(content, com.iab.gpp.extras.cmp.CmpList.class); - } + /** + * Gets the CMP list from the specified InputStream + * + * @param content {@link InputStream} of CMP List json content + * @return {@link com.iab.gpp.extras.cmp.CmpList} object + */ + public com.iab.gpp.extras.cmp.CmpList cmpList(InputStream content) throws IOException { + return objectMapper.readValue(content, com.iab.gpp.extras.cmp.CmpList.class); + } - /** - * Gets the CMP list from the specified InputStream - * - * @param json the CMP List json as a string - * @return {@link com.iab.gpp.extras.cmp.CmpList} object - */ - public com.iab.gpp.extras.cmp.CmpList cmpList(String json) throws IOException { - return objectMapper.readValue(json, com.iab.gpp.extras.cmp.CmpList.class); - } + /** + * Gets the CMP list from the specified InputStream + * + * @param json the CMP List json as a string + * @return {@link com.iab.gpp.extras.cmp.CmpList} object + */ + public com.iab.gpp.extras.cmp.CmpList cmpList(String json) throws IOException { + return objectMapper.readValue(json, com.iab.gpp.extras.cmp.CmpList.class); + } } diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/cmp/Cmp.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/cmp/Cmp.java index 3603b92c..eefc3bd3 100644 --- a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/cmp/Cmp.java +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/cmp/Cmp.java @@ -27,64 +27,63 @@ public class Cmp implements com.iab.gpp.extras.cmp.Cmp { - private int id; - private String name; + private int id; + private String name; - @JsonProperty("isCommercial") - private boolean isCommercial; + @JsonProperty("isCommercial") + private boolean isCommercial; - private Instant deletedDate; + private Instant deletedDate; - /** - * A CMP id: a numeric ID which is incrementally assigned and never re-used – inactive CMPs are marked as deleted - * - * @return CMP id - */ - @Override - public int getId() { - return this.id; - } + /** + * A CMP id: a numeric ID which is incrementally assigned and never re-used – inactive CMPs are + * marked as deleted + * + * @return CMP id + */ + @Override + public int getId() { + return this.id; + } - /** - * Name of the CMP - * - * @return CMP name - */ - @Override - public String getName() { - return this.name; - } + /** + * Name of the CMP + * + * @return CMP name + */ + @Override + public String getName() { + return this.name; + } - /** - * Whether or not the CMP is a commercial service - * - * @return true, if the CMP is available as a commercial service - */ - @Override - public boolean isCommercial() { - return this.isCommercial; - } + /** + * Whether or not the CMP is a commercial service + * + * @return true, if the CMP is available as a commercial service + */ + @Override + public boolean isCommercial() { + return this.isCommercial; + } - /** - * If available, the date/time after which CMP is considered inactive - * - * @return {@link Optional} time after which CMP is inactive - */ - @Override - public Optional getDeletedDate() { - return Optional.ofNullable(this.deletedDate); - } + /** + * If available, the date/time after which CMP is considered inactive + * + * @return {@link Optional} time after which CMP is inactive + */ + @Override + public Optional getDeletedDate() { + return Optional.ofNullable(this.deletedDate); + } - /** - * Check whether the CMP is deleted - * - * @return true, if the CMP is considered deleted - */ - @Override - public boolean isDeleted() { - return Optional.ofNullable(this.deletedDate) - .map(deleteDate -> !deleteDate.isAfter(Instant.now())) - .orElse(false); - } + /** + * Check whether the CMP is deleted + * + * @return true, if the CMP is considered deleted + */ + @Override + public boolean isDeleted() { + return Optional.ofNullable(this.deletedDate).map(deleteDate -> !deleteDate.isAfter(Instant.now())).orElse(false); + } } diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/cmp/CmpList.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/cmp/CmpList.java index 02a73100..465118ea 100644 --- a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/cmp/CmpList.java +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/cmp/CmpList.java @@ -27,37 +27,37 @@ public class CmpList implements com.iab.gpp.extras.cmp.CmpList { - private Instant lastUpdated; - private Map cmps; + private Instant lastUpdated; + private Map cmps; - /** - * Last Updated Date - * - * @return {@link Instant} time when the record was last updated - */ - @Override - public Instant getLastUpdated() { - return lastUpdated; - } + /** + * Last Updated Date + * + * @return {@link Instant} time when the record was last updated + */ + @Override + public Instant getLastUpdated() { + return lastUpdated; + } - /** - * List of CMPs - * - * @return {@link List} of {@link com.iab.gpp.extras.cmp.Cmp} objects - */ - @Override - public List getCmps() { - return new ArrayList<>(cmps.values()); - } + /** + * List of CMPs + * + * @return {@link List} of {@link com.iab.gpp.extras.cmp.Cmp} objects + */ + @Override + public List getCmps() { + return new ArrayList<>(cmps.values()); + } - /** - * Get the CMP object for a give CMP id - * - * @param cmpId CMP id - * @return {@link com.iab.gpp.extras.cmp.Cmp} object - */ - @Override - public com.iab.gpp.extras.cmp.Cmp getCmp(int cmpId) { - return cmps.get(cmpId); - } + /** + * Get the CMP object for a give CMP id + * + * @param cmpId CMP id + * @return {@link com.iab.gpp.extras.cmp.Cmp} object + */ + @Override + public com.iab.gpp.extras.cmp.Cmp getCmp(int cmpId) { + return cmps.get(cmpId); + } } diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/TestUtil.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/DataCategory.java similarity index 51% rename from iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/TestUtil.java rename to iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/DataCategory.java index 34ec9acb..375c5aea 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/TestUtil.java +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/DataCategory.java @@ -1,17 +1,17 @@ -package com.iab.gpp.extras.jackson; +package com.iab.gpp.extras.jackson.gvl; /*- * #%L - * IAB TCF Java GVL and CMP List Jackson + * IAB TCF Java GVL Jackson * %% * Copyright (C) 2020 IAB Technology Laboratory, Inc * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,20 +20,44 @@ * #L% */ -import com.iab.gpp.extras.jackson.gvl.GvlTest; +/* + * DataCategory + */ +public class DataCategory implements com.iab.gpp.extras.gvl.DataCategory { + + private int id; + private String name; + private String description; + + /** + * A id + * + * @return id + */ + @Override + public Integer getId() { + return id; + } -import java.io.IOException; -import java.io.InputStream; + /** + * Name + * + * @return name + */ + @Override + public String getName() { + return name; + } -public class TestUtil { + /** + * Description + * + * @return description + */ + @Override + public String getDescription() { + return description; + } - public static InputStream getCmpList() throws IOException { - ClassLoader loader = GvlTest.class.getClassLoader(); - return loader.getResourceAsStream("cmpList.json"); - } - public static InputStream getGlobalVendorList() throws IOException { - ClassLoader loader = GvlTest.class.getClassLoader(); - return loader.getResourceAsStream("gvl.json"); - } } diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/DataRetention.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/DataRetention.java new file mode 100644 index 00000000..9bb73c85 --- /dev/null +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/DataRetention.java @@ -0,0 +1,64 @@ +package com.iab.gpp.extras.jackson.gvl; + +import java.util.Map; +import java.util.Optional; + +/*- + * #%L + * IAB TCF Java GVL Jackson + * %% + * Copyright (C) 2020 IAB Technology Laboratory, Inc + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +/* + * DataRetention + */ +public class DataRetention implements com.iab.gpp.extras.gvl.DataRetention { + + private Integer stdRetention; + private Map purposes; + private Map specialPurposes; + + /** + * stdRetention + * + * @return stdRetention + */ + @Override + public Optional getStdRetention() { + return Optional.ofNullable(stdRetention); + } + + /** + * purposes + * + * @return purposes + */ + @Override + public Map getPurposes() { + return purposes; + } + + /** + * specialPurposes + * + * @return specialPurposes + */ + @Override + public Map getSpecialPurposes() { + return specialPurposes; + } +} diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Feature.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Feature.java index e497cee6..0cb75378 100644 --- a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Feature.java +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Feature.java @@ -1,5 +1,8 @@ package com.iab.gpp.extras.jackson.gvl; +import java.util.List; +import java.util.Optional; + /*- * #%L * IAB TCF Java GVL Jackson @@ -25,48 +28,59 @@ */ public class Feature implements com.iab.gpp.extras.gvl.Feature { - private int id; - private String name; - private String description; - private String descriptionLegal; + private int id; + private String name; + private String description; + private String descriptionLegal; + private List illustrations; + + /** + * A feature id + * + * @return feature id + */ + @Override + public int getId() { + return id; + } - /** - * A feature id - * - * @return feature id - */ - @Override - public int getId() { - return id; - } + /** + * Name of the feature + * + * @return feature name string + */ + @Override + public String getName() { + return name; + } - /** - * Name of the feature - * - * @return feature name string - */ - @Override - public String getName() { - return name; - } + /** + * Description of the feature + * + * @return feature description string + */ + @Override + public String getDescription() { + return description; + } - /** - * Description of the feature - * - * @return feature description string - */ - @Override - public String getDescription() { - return description; - } + /** + * Legal description of the feature + * + * @return legal description string + */ + @Override + public Optional getDescriptionLegal() { + return Optional.ofNullable(descriptionLegal); + } - /** - * Legal description of the feature - * - * @return legal description string - */ - @Override - public String getDescriptionLegal() { - return descriptionLegal; - } + /** + * illustrations + * + * @return illustrations + */ + @Override + public Optional> getIllustrations() { + return Optional.ofNullable(illustrations); + } } diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Gvl.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Gvl.java index d58e10dc..2cbcdcc8 100644 --- a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Gvl.java +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Gvl.java @@ -25,141 +25,157 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; - +import java.util.Optional; +import com.iab.gpp.extras.gvl.DataCategory; +import com.iab.gpp.extras.gvl.Feature; import com.iab.gpp.extras.gvl.Purpose; import com.iab.gpp.extras.gvl.SpecialFeature; import com.iab.gpp.extras.gvl.SpecialPurpose; import com.iab.gpp.extras.gvl.Stack; import com.iab.gpp.extras.gvl.Vendor; -import com.iab.gpp.extras.gvl.Feature; public class Gvl implements com.iab.gpp.extras.gvl.Gvl { - private int gvlSpecificationVersion; - private int vendorListVersion; - private int tcfPolicyVersion; - private Instant lastUpdated; - private Map purposes; - private Map specialPurposes; - private Map features; - private Map specialFeatures; - private Map stacks; - private Map vendors; - - /** - * A Global Vendor List Specification Version - * - * @return global vendor list specification version - */ - @Override - public int getGvlSpecificationVersion() { - return gvlSpecificationVersion; - } - - /** - * A Global Vendor List version incremented with each published file change - * - * @return global vendor list version - */ - @Override - public int getVendorListVersion() { - return vendorListVersion; - } - - /** - * A TCF Policy Version. The TCF MO will increment this value whenever a GVL change (such as - * adding a new Purpose or Feature or a change in Purpose wording) legally invalidates existing - * TC Strings and requires CMPs to re-establish transparency and consent from users. TCF Policy - * changes should be relatively infrequent and only occur when necessary to support changes in - * global mandate. If the policy version number in the latest GVL is different from the value in - * your TC String, then you need to re-establish transparency and consent for that user. A - * version 1 format TC String is considered to have a version value of 1. - * - * @return tcf policy version - */ - @Override - public int getTcfPolicyVersion() { - return tcfPolicyVersion; - } - - /** - * Last Updated Date - * - * @return timestamp when the record was last updated - */ - @Override - public Instant getLastUpdated() { - return lastUpdated; - } - - /** - * A list of standard purposes - * - * @return A {@link List} of standard {@link Purpose} objects - */ - @Override - public List getPurposes() { - return new ArrayList<>(purposes.values()); - } - - /** - * A list of special purposes - * - * @return A {@link List} of {@link SpecialPurpose} objects - */ - @Override - public List getSpecialPurposes() { - return new ArrayList<>(specialPurposes.values()); - } - - /** - * A list of standard features - * - * @return A {@link List} of standard {@link Feature} objects - */ - @Override - public List getFeatures() { - return new ArrayList<>(features.values()); - } - - /** - * A list of special features - * - * @return A {@link List} of special {@link SpecialFeature} objects - */ - @Override - public List getSpecialFeatures() { - return new ArrayList<>(specialFeatures.values()); - } - - /** - * A list of stacks - * - * @return A {@link List} of {@link Stack} objects - */ - @Override - public List getStacks() { - return new ArrayList<>(stacks.values()); - } - - /** - * A list of vendors - * - * @return A {@link List} of {@link Vendor} objects - */ - @Override - public List getVendors() { - return new ArrayList<>(vendors.values()); - } - - /** - * Return the vendor object for a given id - * - * @param vendorId vendor id - * @return A {@link Vendor} object - */ - @Override - public Vendor getVendor(int vendorId) { - return vendors.get(vendorId); + private int gvlSpecificationVersion; + private int vendorListVersion; + private int tcfPolicyVersion; + private Instant lastUpdated; + private Map purposes; + private Map specialPurposes; + private Map features; + private Map specialFeatures; + private Map stacks; + private Map vendors; + private Map dataCategories; + + /** + * A Global Vendor List Specification Version + * + * @return global vendor list specification version + */ + @Override + public int getGvlSpecificationVersion() { + return gvlSpecificationVersion; + } + + /** + * A Global Vendor List version incremented with each published file change + * + * @return global vendor list version + */ + @Override + public int getVendorListVersion() { + return vendorListVersion; + } + + /** + * A TCF Policy Version. The TCF MO will increment this value whenever a GVL change (such as adding + * a new Purpose or Feature or a change in Purpose wording) legally invalidates existing TC Strings + * and requires CMPs to re-establish transparency and consent from users. TCF Policy changes should + * be relatively infrequent and only occur when necessary to support changes in global mandate. If + * the policy version number in the latest GVL is different from the value in your TC String, then + * you need to re-establish transparency and consent for that user. A version 1 format TC String is + * considered to have a version value of 1. + * + * @return tcf policy version + */ + @Override + public int getTcfPolicyVersion() { + return tcfPolicyVersion; + } + + /** + * Last Updated Date + * + * @return timestamp when the record was last updated + */ + @Override + public Instant getLastUpdated() { + return lastUpdated; + } + + /** + * A list of standard purposes + * + * @return A {@link List} of standard {@link Purpose} objects + */ + @Override + public List getPurposes() { + return new ArrayList<>(purposes.values()); + } + + /** + * A list of special purposes + * + * @return A {@link List} of {@link SpecialPurpose} objects + */ + @Override + public List getSpecialPurposes() { + return new ArrayList<>(specialPurposes.values()); + } + + /** + * A list of standard features + * + * @return A {@link List} of standard {@link Feature} objects + */ + @Override + public List getFeatures() { + return new ArrayList<>(features.values()); + } + + /** + * A list of special features + * + * @return A {@link List} of special {@link SpecialFeature} objects + */ + @Override + public List getSpecialFeatures() { + return new ArrayList<>(specialFeatures.values()); + } + + /** + * A list of stacks + * + * @return A {@link List} of {@link Stack} objects + */ + @Override + public List getStacks() { + return new ArrayList<>(stacks.values()); + } + + /** + * A list of vendors + * + * @return A {@link List} of {@link Vendor} objects + */ + @Override + public List getVendors() { + return new ArrayList<>(vendors.values()); + } + + /** + * Return the vendor object for a given id + * + * @param vendorId vendor id + * @return A {@link Vendor} object + */ + @Override + public Vendor getVendor(int vendorId) { + return vendors.get(vendorId); + } + + /** + * A list of data categories + * + * @return A {@link List} of {@link DataCategory} objects + */ + @Override + public Optional> getDataCategories() { + if (dataCategories == null) { + return Optional.empty(); + } else { + return Optional.ofNullable(new ArrayList<>(dataCategories.values())); } + } } diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Overflow.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Overflow.java index 075baf01..d837da26 100644 --- a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Overflow.java +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Overflow.java @@ -23,15 +23,15 @@ public class Overflow implements com.iab.gpp.extras.gvl.Overflow { - private int httpGetLimit; + private int httpGetLimit; - /** - * The vendor's http GET request length limit; 32 or 128 are the only supported options - * - * @return vendor's http GET request length limit - */ - @Override - public int getHttpGetLimit() { - return httpGetLimit; - } + /** + * The vendor's http GET request length limit; 32 or 128 are the only supported options + * + * @return vendor's http GET request length limit + */ + @Override + public int getHttpGetLimit() { + return httpGetLimit; + } } diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Purpose.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Purpose.java index b42036db..12919c57 100644 --- a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Purpose.java +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Purpose.java @@ -1,5 +1,8 @@ package com.iab.gpp.extras.jackson.gvl; +import java.util.List; +import java.util.Optional; + /*- * #%L * IAB TCF Java GVL Jackson @@ -25,72 +28,83 @@ */ public class Purpose implements com.iab.gpp.extras.gvl.Purpose { - private int id; - private String name; - private String description; - private String descriptionLegal; - private boolean consentable = true; - private boolean rightToObject = true; + private int id; + private String name; + private String description; + private String descriptionLegal; + private List illustrations; + private boolean consentable = true; + private boolean rightToObject = true; + + /** + * A purpose id + * + * @return purpose id + */ + @Override + public int getId() { + return id; + } - /** - * A purpose id - * - * @return purpose id - */ - @Override - public int getId() { - return id; - } + /** + * Name of the purpose + * + * @return purpose name string + */ + @Override + public String getName() { + return name; + } - /** - * Name of the purpose - * - * @return purpose name string - */ - @Override - public String getName() { - return name; - } + /** + * Description of the purpose + * + * @return purpose description string + */ + @Override + public String getDescription() { + return description; + } - /** - * Description of the purpose - * - * @return purpose description string - */ - @Override - public String getDescription() { - return description; - } + /** + * Legal description of the purpose + * + * @return legal description string + */ + @Override + public Optional getDescriptionLegal() { + return Optional.ofNullable(descriptionLegal); + } - /** - * Legal description of the purpose - * - * @return legal description string - */ - @Override - public String getDescriptionLegal() { - return descriptionLegal; - } + /** + * illustrations + * + * @return illustrations + */ + @Override + public Optional> getIllustrations() { + return Optional.ofNullable(illustrations); + } - /** - * An optional flag where false means CMPs should never afford users the means to provide an - * opt-in consent choice - * - * @return consentable boolean - */ - @Override - public boolean getConsentable() { - return consentable; - } + /** + * An optional flag where false means CMPs should never afford users the means to provide an opt-in + * consent choice + * + * @return consentable boolean + */ + @Override + public boolean getConsentable() { + return consentable; + } - /** - * An optional flag where false means CMPs should never afford users the means to exercise a - * right to object - * - * @return right to object boolean - */ - @Override - public boolean getRightToObject() { - return rightToObject; - } + /** + * An optional flag where false means CMPs should never afford users the means to exercise a right + * to object + * + * @return right to object boolean + */ + @Override + public boolean getRightToObject() { + return rightToObject; + } } diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Stack.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Stack.java index 6f1952f7..b2fb80df 100644 --- a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Stack.java +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Stack.java @@ -28,59 +28,59 @@ */ public class Stack implements com.iab.gpp.extras.gvl.Stack { - private int id; - private List specialFeatures; - private List purposes; - private String name; - private String description; + private int id; + private List specialFeatures; + private List purposes; + private String name; + private String description; - /** - * Stack id - * - * @return stack id - */ - @Override - public int getId() { - return id; - } + /** + * Stack id + * + * @return stack id + */ + @Override + public int getId() { + return id; + } - /** - * A list of special features - * - * @return A {@link List} of special feature ids - */ - @Override - public List getSpecialFeatures() { - return specialFeatures; - } + /** + * A list of special features + * + * @return A {@link List} of special feature ids + */ + @Override + public List getSpecialFeatures() { + return specialFeatures; + } - /** - * A list of purposes - * - * @return A {@link List} of purpose ids - */ - @Override - public List getPurposes() { - return purposes; - } + /** + * A list of purposes + * + * @return A {@link List} of purpose ids + */ + @Override + public List getPurposes() { + return purposes; + } - /** - * Name of the stack - * - * @return stack name string - */ - @Override - public String getName() { - return name; - } + /** + * Name of the stack + * + * @return stack name string + */ + @Override + public String getName() { + return name; + } - /** - * Description of the stack - * - * @return stack description string - */ - @Override - public String getDescription() { - return description; - } + /** + * Description of the stack + * + * @return stack description string + */ + @Override + public String getDescription() { + return description; + } } diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Vendor.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Vendor.java index e0537876..60946b5e 100644 --- a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Vendor.java +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Vendor.java @@ -23,209 +23,236 @@ import java.time.Instant; import java.util.List; import java.util.Optional; - +import com.iab.gpp.extras.gvl.DataRetention; import com.iab.gpp.extras.gvl.Overflow; +import com.iab.gpp.extras.gvl.VendorUrl; public class Vendor implements com.iab.gpp.extras.gvl.Vendor { - private int id; - private String name; - private List purposes; - private List legIntPurposes; - private List flexiblePurposes; - private List specialPurposes; - private List features; - private List specialFeatures; - private String policyUrl; - private Instant deletedDate; - private com.iab.gpp.extras.gvl.Overflow overflow; - private Long cookieMaxAgeSeconds; - private boolean usesCookies; - private boolean cookieRefresh; - private boolean usesNonCookieAccess; - private String deviceStorageDisclosureUrl; - - /** - * A vendor id: a numeric ID which is incrementally assigned and never re-used – deleted Vendors - * are just marked as deleted - * - * @return vendor id - */ - @Override - public int getId() { - return id; - } - - /** - * Name of the vendor - * - * @return vendor name - */ - @Override - public String getName() { - return name; - } - - /** - * List of Purposes for which the vendor is requesting consent - * - * @return A {@link List} of purpose ids that require consent - */ - @Override - public List getPurposes() { - return purposes; - } - - /** - * List of Purposes for which the vendor requires to be transparently disclosed as their - * legitimate interest - * - * @return A {@link List} of purpose ids disclosed as legitimate interests - */ - @Override - public List getLegIntPurposes() { - return legIntPurposes; - } - - /** - * List of purposes where the vendor is flexible regarding the legal basis; they will perform - * the processing based on consent or a legitimate interest. The 'default' is determined by - * which of the other two mutually-exclusive purpose fields is used to declare the purpose for - * the vendor - * - * @return A {@link List} of flexible purpose ids - */ - @Override - public List getFlexiblePurposes() { - return flexiblePurposes; - } - - /** - * List of Special Purposes that the vendor transparently discloses as their legitimate interest - * that a user has no right to object - * - * @return A {@link List} of special purpose ids - */ - @Override - public List getSpecialPurposes() { - return specialPurposes; - } - - /** - * List of Features the vendor uses across Purposes - * - * @return A {@link List} of features - */ - @Override - public List getFeatures() { - return features; - } - - /** - * List of Special Features the vendor uses across Purposes - * - * @return A {@link List} of special features - */ - @Override - public List getSpecialFeatures() { - return specialFeatures; - } - - /** - * GDPR/privacy policy page URL - * - * @return policy url string - */ - @Override - public String getPolicyUrl() { - return policyUrl; - } - - /** - * A date string representing when the vendor is deleted from the GVL - * - * @return date string - */ - @Override - public Optional getDeletedDate() { - return Optional.ofNullable(deletedDate); - } - - /** - * object specifying the vendor's http GET request length limit. It is optional. If a vendor - * entry does not include this attribute then the vendor has no overflow options and none can be - * inferred. - * - * @return A {@link com.iab.gpp.extras.gvl.Overflow} object - */ - @Override - public Optional getOverflow() { - return Optional.ofNullable(overflow); - } - - /** - * A helper method to check if the vendor is deleted based on the current time (UTC) - * - * @return true, if the vendor is deleted - */ - @Override - public boolean isDeleted() { - return Optional.ofNullable(this.deletedDate) - .map(deletedDate -> !deletedDate.isAfter(Instant.now())) - .orElse(false); - } - - /** - * The number of seconds representing the longest potential duration for cookie storage on a device. - * - * @return The number, in seconds, of the longest potential duration for storage on a device, as set when using the - * cookie method of storage. - */ - @Override - public Optional getCookieMaxAgeSeconds() { - return Optional.ofNullable(cookieMaxAgeSeconds); - } - - /** - * This boolean field indicates whether the vendor uses cookie storage (session or otherwise). - * - * @return True indicates cookie storage is used - */ - @Override - public boolean getUsesCookies() { - return usesCookies; - } - - /** - * This boolean field indicates whether any cookies in scope for cookieMaxAgeSeconds are refreshed after being - * initially set. - * - * @return True indicates the vendor refreshes this cookie - */ - @Override - public boolean getHasCookieRefresh() { - return cookieRefresh; - } - - /** - * This true or false field indicates whether the vendor uses other, non-cookie methods of storage or accessing - * information already stored on a user’s device. Examples of non-cookie storage and access may be localStorage, - * indexDB, mobile ad IDs, etc. - * - * @return True indicates non-cookie access is used - */ - @Override - public boolean getUsesNonCookieAccess() { - return usesNonCookieAccess; - } - - /** - * Link to a recommended, vendor-hosted, secure URL for disclosing additional storage information - * - * @return Location of vendor-hosted deviceStorage.json file - */ - @Override - public Optional getDeviceStorageDisclosureUrl() { - return Optional.ofNullable(deviceStorageDisclosureUrl); - } + private int id; + private String name; + private List purposes; + private List legIntPurposes; + private List flexiblePurposes; + private List specialPurposes; + private List features; + private List specialFeatures; + private String policyUrl; + private Instant deletedDate; + private com.iab.gpp.extras.gvl.Overflow overflow; + private Long cookieMaxAgeSeconds; + private Boolean usesCookies; + private Boolean cookieRefresh; + private Boolean usesNonCookieAccess; + private String deviceStorageDisclosureUrl; + private DataRetention dataRetention; + private List urls; + private List dataDeclaration; + + /** + * A vendor id: a numeric ID which is incrementally assigned and never re-used – deleted Vendors are + * just marked as deleted + * + * @return vendor id + */ + @Override + public int getId() { + return id; + } + + /** + * Name of the vendor + * + * @return vendor name + */ + @Override + public String getName() { + return name; + } + + /** + * List of Purposes for which the vendor is requesting consent + * + * @return A {@link List} of purpose ids that require consent + */ + @Override + public List getPurposes() { + return purposes; + } + + /** + * List of Purposes for which the vendor requires to be transparently disclosed as their legitimate + * interest + * + * @return A {@link List} of purpose ids disclosed as legitimate interests + */ + @Override + public List getLegIntPurposes() { + return legIntPurposes; + } + + /** + * List of purposes where the vendor is flexible regarding the legal basis; they will perform the + * processing based on consent or a legitimate interest. The 'default' is determined by which of the + * other two mutually-exclusive purpose fields is used to declare the purpose for the vendor + * + * @return A {@link List} of flexible purpose ids + */ + @Override + public List getFlexiblePurposes() { + return flexiblePurposes; + } + + /** + * List of Special Purposes that the vendor transparently discloses as their legitimate interest + * that a user has no right to object + * + * @return A {@link List} of special purpose ids + */ + @Override + public List getSpecialPurposes() { + return specialPurposes; + } + + /** + * List of Features the vendor uses across Purposes + * + * @return A {@link List} of features + */ + @Override + public List getFeatures() { + return features; + } + + /** + * List of Special Features the vendor uses across Purposes + * + * @return A {@link List} of special features + */ + @Override + public List getSpecialFeatures() { + return specialFeatures; + } + + /** + * GDPR/privacy policy page URL + * + * @return policy url string + */ + @Override + public Optional getPolicyUrl() { + return Optional.ofNullable(policyUrl); + } + + /** + * A date string representing when the vendor is deleted from the GVL + * + * @return date string + */ + @Override + public Optional getDeletedDate() { + return Optional.ofNullable(deletedDate); + } + + /** + * object specifying the vendor's http GET request length limit. It is optional. If a vendor entry + * does not include this attribute then the vendor has no overflow options and none can be inferred. + * + * @return A {@link com.iab.gpp.extras.gvl.Overflow} object + */ + @Override + public Optional getOverflow() { + return Optional.ofNullable(overflow); + } + + /** + * A helper method to check if the vendor is deleted based on the current time (UTC) + * + * @return true, if the vendor is deleted + */ + @Override + public boolean isDeleted() { + return Optional.ofNullable(this.deletedDate).map(deletedDate -> !deletedDate.isAfter(Instant.now())).orElse(false); + } + + /** + * The number of seconds representing the longest potential duration for cookie storage on a device. + * + * @return The number, in seconds, of the longest potential duration for storage on a device, as set + * when using the cookie method of storage. + */ + @Override + public Optional getCookieMaxAgeSeconds() { + return Optional.ofNullable(cookieMaxAgeSeconds); + } + + /** + * This boolean field indicates whether the vendor uses cookie storage (session or otherwise). + * + * @return True indicates cookie storage is used + */ + @Override + public Optional getUsesCookies() { + return Optional.ofNullable(usesCookies); + } + + /** + * This boolean field indicates whether any cookies in scope for cookieMaxAgeSeconds are refreshed + * after being initially set. + * + * @return True indicates the vendor refreshes this cookie + */ + @Override + public Optional getCookieRefresh() { + return Optional.ofNullable(cookieRefresh); + } + + /** + * This true or false field indicates whether the vendor uses other, non-cookie methods of storage + * or accessing information already stored on a user’s device. Examples of non-cookie storage and + * access may be localStorage, indexDB, mobile ad IDs, etc. + * + * @return True indicates non-cookie access is used + */ + @Override + public Optional getUsesNonCookieAccess() { + return Optional.ofNullable(usesNonCookieAccess); + } + + /** + * Link to a recommended, vendor-hosted, secure URL for disclosing additional storage information + * + * @return Location of vendor-hosted deviceStorage.json file + */ + @Override + public Optional getDeviceStorageDisclosureUrl() { + return Optional.ofNullable(deviceStorageDisclosureUrl); + } + + /** + * dataRetention + * + * @return dataRetention + */ + public Optional getDataRetention() { + return Optional.ofNullable(dataRetention); + } + + /** + * urls + * + * @return urls + */ + public Optional> getUrls() { + return Optional.ofNullable(urls); + } + + /** + * dataDeclarations + * + * @return dataDeclarations + */ + public Optional> getDataDeclaration() { + return Optional.ofNullable(dataDeclaration); + } } diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/VendorUrl.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/VendorUrl.java new file mode 100644 index 00000000..cf4d3b86 --- /dev/null +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/VendorUrl.java @@ -0,0 +1,64 @@ +package com.iab.gpp.extras.jackson.gvl; + +import java.util.Optional; + +/*- + * #%L + * IAB TCF Java GVL Jackson + * %% + * Copyright (C) 2020 IAB Technology Laboratory, Inc + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +/* + * DataCategory + */ +public class VendorUrl implements com.iab.gpp.extras.gvl.VendorUrl { + + private String langId; + private String privacy; + private String legIntClaim; + + /** + * langId + * + * @return lang id + */ + @Override + public String getLangId() { + return langId; + } + + /** + * privacy + * + * @return privacy + */ + @Override + public String getPrivacy() { + return privacy; + } + + /** + * legIntClaim + * + * @return legIntClaim + */ + @Override + public Optional getLegIntClaim() { + return Optional.ofNullable(legIntClaim); + } + +} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpListTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpListTest.java index 671a5321..673ad24f 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpListTest.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpListTest.java @@ -5,6 +5,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import com.iab.gpp.extras.cmp.Cmp; /*- * #%L @@ -28,25 +29,55 @@ import com.iab.gpp.extras.cmp.CmpList; import com.iab.gpp.extras.jackson.Loader; -import com.iab.gpp.extras.jackson.TestUtil; public class CmpListTest { - private static CmpList cmpList; + private static CmpList cmpList; + private static Cmp cmpThree; + private static Cmp cmpTwentyThree; - @BeforeAll - public static void setUpBeforeClass() throws IOException { - Loader loader = new Loader(); - cmpList = loader.cmpList(TestUtil.getCmpList()); - } + @BeforeAll + public static void setUpBeforeClass() throws IOException { + cmpList = new Loader().cmpList(CmpListTest.class.getClassLoader().getResourceAsStream("cmpList.json")); + cmpThree = cmpList.getCmps().stream().filter(o -> o.getId() == 3).findFirst().orElse(null); + cmpTwentyThree = cmpList.getCmps().stream().filter(o -> o.getId() == 23).findFirst().orElse(null); + } - @Test - public void getLastUpdated() { - Assertions.assertEquals(Instant.parse("2020-04-09T17:03:06Z"), cmpList.getLastUpdated()); - } + @Test + public void getLastUpdated() { + Assertions.assertEquals(Instant.parse("2020-04-09T17:03:06Z"), cmpList.getLastUpdated()); + } - @Test - public void getCmps() { - Assertions.assertEquals(12, cmpList.getCmps().size()); - } -} \ No newline at end of file + @Test + public void getCmps() { + Assertions.assertEquals(12, cmpList.getCmps().size()); + } + + @Test + public void getId() { + Assertions.assertEquals(3, cmpThree.getId()); + } + + @Test + public void getName() { + String name = "LiveRamp"; + Assertions.assertEquals(name, cmpThree.getName()); + } + + @Test + public void isCommercial() { + Assertions.assertTrue(cmpThree.isCommercial()); + } + + @Test + public void getDeletedDate() { + Assertions.assertNull(cmpThree.getDeletedDate().orElse(null)); + Assertions.assertNotNull(cmpTwentyThree.getDeletedDate().orElse(null)); + } + + @Test + public void isDeleted() { + Assertions.assertFalse(cmpThree.isDeleted()); + Assertions.assertTrue(cmpTwentyThree.isDeleted()); + } +} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpTest.java deleted file mode 100644 index 93b17cfa..00000000 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/cmp/CmpTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.iab.gpp.extras.jackson.cmp; - -import java.io.IOException; -import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -/*- - * #%L - * IAB TCF Java CMP List Jackson - * %% - * Copyright (C) 2020 IAB Technology Laboratory, Inc - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import com.iab.gpp.extras.cmp.Cmp; -import com.iab.gpp.extras.jackson.Loader; -import com.iab.gpp.extras.jackson.TestUtil; - -public class CmpTest { - - private static Cmp cmpThree; - private static Cmp cmpTwentyThree; - private static final int CMP_ID_SELECTED_FOR_TEST = 3; - private static final int DELETED_CMP_ID_SELECTED_FOR_TEST = 23; - - @BeforeAll - public static void setupBeforeClass() throws IOException { - Loader loader = new Loader(); - List cmps = loader.cmpList(TestUtil.getCmpList()).getCmps(); - cmpThree = cmps.stream().filter(o -> o.getId() == CMP_ID_SELECTED_FOR_TEST).findFirst().orElse(null); - cmpTwentyThree = - cmps.stream().filter(o -> o.getId() == DELETED_CMP_ID_SELECTED_FOR_TEST).findFirst().orElse(null); - } - - @Test - public void getId() { - Assertions.assertEquals(3, cmpThree.getId()); - } - - @Test - public void getName() { - String name = "LiveRamp"; - Assertions.assertEquals(name, cmpThree.getName()); - } - - @Test - public void isCommercial() { - Assertions.assertTrue(cmpThree.isCommercial()); - } - - @Test - public void getDeletedDate() { - Assertions.assertNull(cmpThree.getDeletedDate().orElse(null)); - Assertions.assertNotNull(cmpTwentyThree.getDeletedDate().orElse(null)); - } - - @Test - public void isDeleted() { - Assertions.assertFalse(cmpThree.isDeleted()); - Assertions.assertTrue(cmpTwentyThree.isDeleted()); - } -} \ No newline at end of file diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/FeatureTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/FeatureTest.java deleted file mode 100644 index 5b74f5f7..00000000 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/FeatureTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.iab.gpp.extras.jackson.gvl; - -import java.io.IOException; -import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -/*- - * #%L - * IAB TCF Java GVL Jackson - * %% - * Copyright (C) 2020 IAB Technology Laboratory, Inc - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import com.iab.gpp.extras.gvl.Feature; -import com.iab.gpp.extras.jackson.Loader; -import com.iab.gpp.extras.jackson.TestUtil; - -public class FeatureTest { - - private static Feature featureTwo; - private static final int FEATURE_ID_SELECTED_FOR_TEST = 2; - - @BeforeAll - public static void setupBeforeClass() throws IOException { - Loader loader = new Loader(); - List features = loader.globalVendorList(TestUtil.getGlobalVendorList()).getFeatures(); - featureTwo = features.stream().filter(o -> o.getId() == FEATURE_ID_SELECTED_FOR_TEST).findFirst().orElse(null); - } - - @Test - public void testGetId() { - Assertions.assertEquals(2, featureTwo.getId()); - } - - @Test - public void testGetName() { - String expectedName = "Link different devices"; - Assertions.assertEquals(expectedName, featureTwo.getName()); - } - - @Test - public void testGetDescription() { - String expectedDescription = - "Different devices can be determined as belonging to you or your household in support of one or more of purposes."; - Assertions.assertEquals(expectedDescription, featureTwo.getDescription()); - } - - @Test - public void testGetDescriptionLegal() { - String expectedDescriptionLegal = - "Vendors can:\n* Deterministically determine that two or more devices belong to the same user or household\n* Probabilistically determine that two or more devices belong to the same user or household\n* Actively scan device characteristics for identification for probabilistic identification if users have allowed vendors to actively scan device characteristics for identification (Special Feature 2)"; - Assertions.assertEquals(expectedDescriptionLegal, featureTwo.getDescriptionLegal()); - } -} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlTest.java deleted file mode 100644 index 5d590d55..00000000 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.iab.gpp.extras.jackson.gvl; - -/*- - * #%L - * IAB TCF Java GVL Jackson - * %% - * Copyright (C) 2020 IAB Technology Laboratory, Inc - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.io.IOException; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import com.iab.gpp.extras.gvl.Gvl; -import com.iab.gpp.extras.jackson.Loader; -import com.iab.gpp.extras.jackson.TestUtil; - -public class GvlTest { - private static Gvl gvl; - - @BeforeAll - public static void setUpBeforeClass() throws IOException { - Loader loader = new Loader(); - gvl = loader.globalVendorList(TestUtil.getGlobalVendorList()); - } - - @Test - public void testGetGvlSpecificationVersion() { - Assertions.assertEquals(2, gvl.getGvlSpecificationVersion()); - } - - @Test - public void testGetVendorListVersion() { - Assertions.assertEquals(26, gvl.getVendorListVersion()); - } - - @Test - public void testGetTcfPolicyVersion() { - Assertions.assertEquals(2, gvl.getTcfPolicyVersion()); - } - - @Test - public void testGetLastUpdated() throws ParseException { - SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); - parser.setTimeZone(TimeZone.getTimeZone("GMT")); - Date parsed = parser.parse("2020-02-20T16:05:20"); - Assertions.assertEquals(parsed.toInstant(), gvl.getLastUpdated()); - } - - @Test - public void testGetPurposes() { - Assertions.assertEquals(10, gvl.getPurposes().size()); - } - - @Test - public void testGetSpecialPurposes() { - Assertions.assertEquals(2, gvl.getSpecialPurposes().size()); - } - - @Test - public void testGetFeatures() { - Assertions.assertEquals(3, gvl.getFeatures().size()); - } - - @Test - public void testGetSpecialFeatures() { - Assertions.assertEquals(2, gvl.getSpecialFeatures().size()); - } - - @Test - public void testGetStacks() { - Assertions.assertEquals(37, gvl.getStacks().size()); - } - - @Test - public void testGetVendors() { - Assertions.assertEquals(3, gvl.getVendors().size()); - } -} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV2Test.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV2Test.java new file mode 100644 index 00000000..de0531e0 --- /dev/null +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV2Test.java @@ -0,0 +1,121 @@ +package com.iab.gpp.extras.jackson.gvl; + +/*- + * #%L + * IAB TCF Java GVL Jackson + * %% + * Copyright (C) 2020 IAB Technology Laboratory, Inc + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.extras.gvl.Gvl; +import com.iab.gpp.extras.jackson.Loader; + +public class GvlV2Test { + + @Test + public void test() throws IOException { + Gvl gvl = new Loader() + .globalVendorList(GvlV2Test.class.getClassLoader().getResourceAsStream("vendorlist/v2/vendor-list.json")); + Assertions.assertFalse(gvl.getDataCategories().isPresent()); + Assertions.assertEquals(3, gvl.getFeatures().size()); + Assertions.assertEquals(2, gvl.getGvlSpecificationVersion()); + Assertions.assertNotNull(gvl.getLastUpdated()); + Assertions.assertEquals(10, gvl.getPurposes().size()); + Assertions.assertEquals(2, gvl.getSpecialFeatures().size()); + Assertions.assertEquals(2, gvl.getSpecialPurposes().size()); + Assertions.assertEquals(42, gvl.getStacks().size()); + Assertions.assertEquals(2, gvl.getTcfPolicyVersion()); + Assertions.assertEquals(51, gvl.getVendorListVersion()); + Assertions.assertEquals(496, gvl.getVendors().size()); + + Assertions.assertEquals(1, gvl.getPurposes().get(0).getId()); + Assertions.assertEquals("Store and/or access information on a device", gvl.getPurposes().get(0).getName()); + Assertions.assertEquals( + "Cookies, device identifiers, or other information can be stored or accessed on your device for the purposes presented to you.", + gvl.getPurposes().get(0).getDescription()); + Assertions.assertTrue(gvl.getPurposes().get(0).getDescriptionLegal().isPresent()); + Assertions.assertEquals( + "Vendors can:\n* Store and access information on the device such as cookies and device identifiers presented to a user.", + gvl.getPurposes().get(0).getDescriptionLegal().get()); + Assertions.assertFalse(gvl.getPurposes().get(0).getIllustrations().isPresent()); + + Assertions.assertEquals(1, gvl.getSpecialPurposes().get(0).getId()); + Assertions.assertEquals("Ensure security, prevent fraud, and debug", gvl.getSpecialPurposes().get(0).getName()); + Assertions.assertEquals( + "Your data can be used to monitor for and prevent fraudulent activity, and ensure systems and processes work properly and securely.", + gvl.getSpecialPurposes().get(0).getDescription()); + Assertions.assertTrue(gvl.getSpecialPurposes().get(0).getDescriptionLegal().isPresent()); + Assertions.assertEquals( + "To ensure security, prevent fraud and debug vendors can:\n* Ensure data are securely transmitted\n* Detect and prevent malicious, fraudulent, invalid, or illegal activity.\n* Ensure correct and efficient operation of systems and processes, including to monitor and enhance the performance of systems and processes engaged in permitted purposes\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose.", + gvl.getSpecialPurposes().get(0).getDescriptionLegal().get()); + Assertions.assertFalse(gvl.getSpecialPurposes().get(0).getIllustrations().isPresent()); + + Assertions.assertEquals(1, gvl.getFeatures().get(0).getId()); + Assertions.assertEquals("Match and combine offline data sources", gvl.getFeatures().get(0).getName()); + Assertions.assertEquals( + "Data from offline data sources can be combined with your online activity in support of one or more purposes", + gvl.getFeatures().get(0).getDescription()); + Assertions.assertTrue(gvl.getFeatures().get(0).getDescriptionLegal().isPresent()); + Assertions.assertEquals( + "Vendors can:\n* Combine data obtained offline with data collected online in support of one or more Purposes or Special Purposes.", + gvl.getFeatures().get(0).getDescriptionLegal().get()); + Assertions.assertFalse(gvl.getFeatures().get(0).getIllustrations().isPresent()); + + Assertions.assertEquals(1, gvl.getSpecialFeatures().get(0).getId()); + Assertions.assertEquals("Use precise geolocation data", gvl.getSpecialFeatures().get(0).getName()); + Assertions.assertEquals( + "Your precise geolocation data can be used in support of one or more purposes. This means your location can be accurate to within several meters.", + gvl.getSpecialFeatures().get(0).getDescription()); + Assertions.assertTrue(gvl.getSpecialFeatures().get(0).getDescriptionLegal().isPresent()); + Assertions.assertEquals( + "Vendors can:\n* Collect and process precise geolocation data in support of one or more purposes.\nN.B. Precise geolocation means that there are no restrictions on the precision of a user’s location; this can be accurate to within several meters.", + gvl.getSpecialFeatures().get(0).getDescriptionLegal().get()); + Assertions.assertFalse(gvl.getSpecialFeatures().get(0).getIllustrations().isPresent()); + + Assertions.assertEquals(1, gvl.getStacks().get(0).getId()); + Assertions.assertEquals("Precise geolocation data, and identification through device scanning", gvl.getStacks().get(0).getName()); + Assertions.assertEquals("Precise geolocation and information about device characteristics can be used.", gvl.getStacks().get(0).getDescription()); + Assertions.assertTrue(gvl.getStacks().get(0).getPurposes().isEmpty()); + Assertions.assertEquals(Arrays.asList(1, 2), gvl.getStacks().get(0).getSpecialFeatures()); + + Assertions.assertEquals(2, gvl.getStacks().get(1).getId()); + Assertions.assertEquals("Basic ads, and ad measurement", gvl.getStacks().get(1).getName()); + Assertions.assertEquals("Basic ads can be served. Ad performance can be measured.", gvl.getStacks().get(1).getDescription()); + Assertions.assertEquals(Arrays.asList(2, 7), gvl.getStacks().get(1).getPurposes()); + Assertions.assertTrue(gvl.getStacks().get(1).getSpecialFeatures().isEmpty()); + + Assertions.assertEquals(8, gvl.getVendors().get(0).getId()); + Assertions.assertFalse(gvl.getVendors().get(0).getDeletedDate().isPresent()); + Assertions.assertEquals("Emerse Sverige AB", gvl.getVendors().get(0).getName()); + Assertions.assertEquals(Arrays.asList(1, 3, 4), gvl.getVendors().get(0).getPurposes()); + Assertions.assertEquals(Arrays.asList(2, 7, 8, 9), gvl.getVendors().get(0).getLegIntPurposes()); + Assertions.assertEquals(Arrays.asList(2, 9), gvl.getVendors().get(0).getFlexiblePurposes()); + Assertions.assertEquals(Arrays.asList(1, 2), gvl.getVendors().get(0).getSpecialPurposes()); + Assertions.assertEquals(Arrays.asList(1, 2), gvl.getVendors().get(0).getFeatures()); + Assertions.assertTrue(gvl.getVendors().get(0).getSpecialFeatures().isEmpty()); + Assertions.assertTrue(gvl.getVendors().get(0).getPolicyUrl().isPresent()); + Assertions.assertEquals("https://www.emerse.com/privacy-policy/", gvl.getVendors().get(0).getPolicyUrl().get()); + + Assertions.assertEquals(9, gvl.getVendors().get(1).getId()); + Assertions.assertTrue(gvl.getVendors().get(1).getDeletedDate().isPresent()); + } + +} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV3Test.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV3Test.java new file mode 100644 index 00000000..ef880d26 --- /dev/null +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV3Test.java @@ -0,0 +1,169 @@ +package com.iab.gpp.extras.jackson.gvl; + +/*- + * #%L + * IAB TCF Java GVL Jackson + * %% + * Copyright (C) 2020 IAB Technology Laboratory, Inc + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.extras.gvl.Gvl; +import com.iab.gpp.extras.jackson.Loader; + +public class GvlV3Test { + + @Test + public void test() throws IOException { + Gvl gvl = new Loader() + .globalVendorList(GvlV3Test.class.getClassLoader().getResourceAsStream("vendorlist/v3.0/vendor-list.json")); + Assertions.assertTrue(gvl.getDataCategories().isPresent()); + Assertions.assertEquals(3, gvl.getFeatures().size()); + Assertions.assertEquals(3, gvl.getGvlSpecificationVersion()); + Assertions.assertNotNull(gvl.getLastUpdated()); + Assertions.assertEquals(11, gvl.getPurposes().size()); + Assertions.assertEquals(2, gvl.getSpecialFeatures().size()); + Assertions.assertEquals(2, gvl.getSpecialPurposes().size()); + Assertions.assertEquals(43, gvl.getStacks().size()); + Assertions.assertEquals(4, gvl.getTcfPolicyVersion()); + Assertions.assertEquals(7, gvl.getVendorListVersion()); + Assertions.assertEquals(376, gvl.getVendors().size()); + + Assertions.assertEquals(1, gvl.getPurposes().get(0).getId()); + Assertions.assertEquals("Store and/or access information on a device", gvl.getPurposes().get(0).getName()); + Assertions.assertEquals("Cookies, device or similar online identifiers (e.g. login-based identifiers, randomly assigned identifiers, network based identifiers) together with other information (e.g. browser type and information, language, screen size, supported technologies etc.) can be stored or read on your device to recognise it each time it connects to an app or to a website, for one or several of the purposes presented here. ", gvl.getPurposes().get(0).getDescription()); + Assertions.assertFalse(gvl.getPurposes().get(0).getDescriptionLegal().isPresent()); + Assertions.assertTrue(gvl.getPurposes().get(0).getIllustrations().isPresent()); + Assertions.assertEquals(1, gvl.getPurposes().get(0).getIllustrations().get().size()); + + Assertions.assertEquals(1, gvl.getSpecialPurposes().get(0).getId()); + Assertions.assertEquals("Ensure security, prevent and detect fraud, and fix errors\n", gvl.getSpecialPurposes().get(0).getName()); + Assertions.assertEquals("Your data can be used to monitor for and prevent unusual and possibly fraudulent activity (for example, regarding advertising, ad clicks by bots), and ensure systems and processes work properly and securely. It can also be used to correct any problems you, the publisher or the advertiser may encounter in the delivery of content and ads and in your interaction with them.", gvl.getSpecialPurposes().get(0).getDescription()); + Assertions.assertFalse(gvl.getSpecialPurposes().get(0).getDescriptionLegal().isPresent()); + Assertions.assertTrue(gvl.getSpecialPurposes().get(0).getIllustrations().isPresent()); + Assertions.assertEquals(1, gvl.getSpecialPurposes().get(0).getIllustrations().get().size()); + + Assertions.assertEquals(1, gvl.getFeatures().get(0).getId()); + Assertions.assertEquals("Match and combine data from other data sources", gvl.getFeatures().get(0).getName()); + Assertions.assertEquals("Information about your activity on this service may be matched and combined with other information relating to you and originating from various sources (for instance your activity on a separate online service, your use of a loyalty card in-store, or your answers to a survey), in support of the purposes explained in this notice.", gvl.getFeatures().get(0).getDescription()); + Assertions.assertFalse(gvl.getFeatures().get(0).getDescriptionLegal().isPresent()); + Assertions.assertTrue(gvl.getFeatures().get(0).getIllustrations().isPresent()); + Assertions.assertEquals(0, gvl.getFeatures().get(0).getIllustrations().get().size()); + + Assertions.assertEquals(1, gvl.getSpecialFeatures().get(0).getId()); + Assertions.assertEquals("Use precise geolocation data", gvl.getSpecialFeatures().get(0).getName()); + Assertions.assertEquals("With your acceptance, your precise location (within a radius of less than 500 metres) may be used in support of the purposes explained in this notice.", gvl.getSpecialFeatures().get(0).getDescription()); + Assertions.assertFalse(gvl.getSpecialFeatures().get(0).getDescriptionLegal().isPresent()); + Assertions.assertTrue(gvl.getSpecialFeatures().get(0).getIllustrations().isPresent()); + Assertions.assertEquals(0, gvl.getSpecialFeatures().get(0).getIllustrations().get().size()); + + Assertions.assertEquals(1, gvl.getStacks().get(0).getId()); + Assertions.assertEquals("Precise geolocation data, and identification through device scanning", gvl.getStacks().get(0).getName()); + Assertions.assertEquals("Precise geolocation and information about device characteristics can be used.\n\n", gvl.getStacks().get(0).getDescription()); + Assertions.assertTrue(gvl.getStacks().get(0).getPurposes().isEmpty()); + Assertions.assertEquals(Arrays.asList(1, 2), gvl.getStacks().get(0).getSpecialFeatures()); + + Assertions.assertEquals(2, gvl.getStacks().get(1).getId()); + Assertions.assertEquals("Advertising based on limited data and advertising measurement", gvl.getStacks().get(1).getName()); + Assertions.assertEquals("Advertising can be presented based on limited data. Advertising performance can be measured.", gvl.getStacks().get(1).getDescription()); + Assertions.assertEquals(Arrays.asList(2, 7), gvl.getStacks().get(1).getPurposes()); + Assertions.assertTrue(gvl.getStacks().get(1).getSpecialFeatures().isEmpty()); + + Assertions.assertEquals(1, gvl.getDataCategories().get().get(0).getId()); + Assertions.assertEquals("IP addresses", gvl.getDataCategories().get().get(0).getName()); + Assertions.assertEquals("Your IP address is a number assigned by your Internet Service Provider to any Internet connection. It is not always specific to your device and is not always a stable identifier.\nIt is used to route information on the Internet and display online content (including ads) on your connected device.", gvl.getDataCategories().get().get(0).getDescription()); + + Assertions.assertEquals(1, gvl.getVendors().get(0).getId()); + Assertions.assertFalse(gvl.getVendors().get(0).getDeletedDate().isPresent()); + Assertions.assertEquals("Exponential Interactive, Inc d/b/a VDX.tv", gvl.getVendors().get(0).getName()); + Assertions.assertEquals(Arrays.asList(1, 2, 3, 4, 7, 8, 9, 10), gvl.getVendors().get(0).getPurposes()); + Assertions.assertEquals(Collections.emptyList(), gvl.getVendors().get(0).getLegIntPurposes()); + Assertions.assertEquals(Arrays.asList(7, 8, 9, 10), gvl.getVendors().get(0).getFlexiblePurposes()); + Assertions.assertEquals(Arrays.asList(1, 2), gvl.getVendors().get(0).getSpecialPurposes()); + Assertions.assertEquals(Arrays.asList(1, 2, 3), gvl.getVendors().get(0).getFeatures()); + Assertions.assertTrue(gvl.getVendors().get(0).getSpecialFeatures().isEmpty()); + Assertions.assertFalse(gvl.getVendors().get(0).getPolicyUrl().isPresent()); + Assertions.assertTrue(gvl.getVendors().get(0).getCookieMaxAgeSeconds().isPresent()); + Assertions.assertEquals(7776000, gvl.getVendors().get(0).getCookieMaxAgeSeconds().get()); + Assertions.assertTrue(gvl.getVendors().get(0).getUsesCookies().isPresent()); + Assertions.assertTrue(gvl.getVendors().get(0).getUsesCookies().get()); + Assertions.assertTrue(gvl.getVendors().get(0).getCookieRefresh().isPresent()); + Assertions.assertTrue(gvl.getVendors().get(0).getCookieRefresh().get()); + Assertions.assertTrue(gvl.getVendors().get(0).getUsesNonCookieAccess().isPresent()); + Assertions.assertFalse(gvl.getVendors().get(0).getUsesNonCookieAccess().get()); + Assertions.assertTrue(gvl.getVendors().get(0).getDataRetention().isPresent()); + Assertions.assertTrue(gvl.getVendors().get(0).getDataRetention().get().getStdRetention().isPresent()); + Assertions.assertEquals(397, gvl.getVendors().get(0).getDataRetention().get().getStdRetention().get()); + Assertions.assertTrue(gvl.getVendors().get(0).getDataRetention().get().getPurposes().isEmpty()); + Assertions.assertTrue(gvl.getVendors().get(0).getDataRetention().get().getSpecialPurposes().isEmpty()); + Assertions.assertTrue(gvl.getVendors().get(0).getUrls().isPresent()); + Assertions.assertEquals(1, gvl.getVendors().get(0).getUrls().get().size()); + Assertions.assertEquals("en", gvl.getVendors().get(0).getUrls().get().get(0).getLangId()); + Assertions.assertEquals("https://vdx.tv/privacy/", gvl.getVendors().get(0).getUrls().get().get(0).getPrivacy()); + Assertions.assertTrue(gvl.getVendors().get(0).getUrls().get().get(0).getLegIntClaim().isPresent()); + Assertions.assertEquals("https://cdnx.exponential.com/wp-content/uploads/2018/04/Balancing-Assessment-for-Legitimate-Interest-Publishers-v2.pdf", gvl.getVendors().get(0).getUrls().get().get(0).getLegIntClaim().get()); + Assertions.assertTrue(gvl.getVendors().get(0).getDataDeclaration().isPresent()); + Assertions.assertEquals(Arrays.asList(1, 3, 4, 6, 8, 10, 11), gvl.getVendors().get(0).getDataDeclaration().get()); + Assertions.assertTrue(gvl.getVendors().get(0).getDeviceStorageDisclosureUrl().isPresent()); + Assertions.assertEquals("https://vdxtv.expo.workers.dev", gvl.getVendors().get(0).getDeviceStorageDisclosureUrl().get()); + + Assertions.assertEquals(12, gvl.getVendors().get(4).getId()); + Assertions.assertFalse(gvl.getVendors().get(4).getDeletedDate().isPresent()); + Assertions.assertEquals("BeeswaxIO Corporation", gvl.getVendors().get(4).getName()); + Assertions.assertEquals(Arrays.asList(1, 2, 3, 4, 7), gvl.getVendors().get(4).getPurposes()); + Assertions.assertEquals(Collections.emptyList(), gvl.getVendors().get(4).getLegIntPurposes()); + Assertions.assertEquals(Collections.emptyList(), gvl.getVendors().get(4).getFlexiblePurposes()); + Assertions.assertEquals(Arrays.asList(1, 2), gvl.getVendors().get(4).getSpecialPurposes()); + Assertions.assertEquals(Arrays.asList(1, 3), gvl.getVendors().get(4).getFeatures()); + Assertions.assertEquals(Arrays.asList(1), gvl.getVendors().get(4).getSpecialFeatures()); + Assertions.assertFalse(gvl.getVendors().get(4).getPolicyUrl().isPresent()); + Assertions.assertTrue(gvl.getVendors().get(4).getCookieMaxAgeSeconds().isPresent()); + Assertions.assertEquals(34109999, gvl.getVendors().get(4).getCookieMaxAgeSeconds().get()); + Assertions.assertTrue(gvl.getVendors().get(4).getUsesCookies().isPresent()); + Assertions.assertTrue(gvl.getVendors().get(4).getUsesCookies().get()); + Assertions.assertTrue(gvl.getVendors().get(4).getCookieRefresh().isPresent()); + Assertions.assertTrue(gvl.getVendors().get(4).getCookieRefresh().get()); + Assertions.assertTrue(gvl.getVendors().get(4).getUsesNonCookieAccess().isPresent()); + Assertions.assertTrue(gvl.getVendors().get(4).getUsesNonCookieAccess().get()); + Assertions.assertTrue(gvl.getVendors().get(4).getDataRetention().isPresent()); + Assertions.assertTrue(gvl.getVendors().get(4).getDataRetention().get().getStdRetention().isPresent()); + Assertions.assertEquals(0, gvl.getVendors().get(4).getDataRetention().get().getStdRetention().get()); + Assertions.assertEquals(1, gvl.getVendors().get(4).getDataRetention().get().getPurposes().size()); + Assertions.assertEquals(4320, gvl.getVendors().get(4).getDataRetention().get().getPurposes().get(7)); + Assertions.assertEquals(2, gvl.getVendors().get(4).getDataRetention().get().getSpecialPurposes().size()); + Assertions.assertEquals(392, gvl.getVendors().get(4).getDataRetention().get().getSpecialPurposes().get(1)); + Assertions.assertEquals(4320, gvl.getVendors().get(4).getDataRetention().get().getSpecialPurposes().get(2)); + Assertions.assertTrue(gvl.getVendors().get(4).getUrls().isPresent()); + Assertions.assertEquals(1, gvl.getVendors().get(4).getUrls().get().size()); + Assertions.assertEquals("en", gvl.getVendors().get(4).getUrls().get().get(0).getLangId()); + Assertions.assertEquals("https://www.beeswax.com/privacy/", gvl.getVendors().get(4).getUrls().get().get(0).getPrivacy()); + Assertions.assertTrue(gvl.getVendors().get(4).getUrls().get().get(0).getLegIntClaim().isPresent()); + Assertions.assertEquals("https://www.beeswax.com/privacy/", gvl.getVendors().get(4).getUrls().get().get(0).getLegIntClaim().get()); + Assertions.assertTrue(gvl.getVendors().get(4).getDataDeclaration().isPresent()); + Assertions.assertEquals(Arrays.asList(1, 2, 3, 4, 6, 8, 9, 11), gvl.getVendors().get(4).getDataDeclaration().get()); + Assertions.assertTrue(gvl.getVendors().get(4).getDeviceStorageDisclosureUrl().isPresent()); + Assertions.assertEquals("https://beeswax.com/devicedisclosure.json", gvl.getVendors().get(4).getDeviceStorageDisclosureUrl().get()); + + Assertions.assertTrue(gvl.getVendor(26).getCookieRefresh().isPresent()); + Assertions.assertFalse(gvl.getVendor(26).getCookieRefresh().get()); + } + +} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/OverflowTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/OverflowTest.java deleted file mode 100644 index 3d9ad22b..00000000 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/OverflowTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.iab.gpp.extras.jackson.gvl; - -/*- - * #%L - * IAB TCF Java GVL Jackson - * %% - * Copyright (C) 2020 IAB Technology Laboratory, Inc - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import com.iab.gpp.extras.gvl.Overflow; -import com.iab.gpp.extras.gvl.Vendor; -import com.iab.gpp.extras.jackson.Loader; -import com.iab.gpp.extras.jackson.TestUtil; - -public class OverflowTest { - - private static Overflow vendorEightOverflow; - private static final int VENDOR_ID_SELECTED_FOR_TEST = 8; - - @BeforeAll - public static void setUpBeforeClass() throws Exception { - Loader loader = new Loader(); - List vendors = loader.globalVendorList(TestUtil.getGlobalVendorList()).getVendors(); - Vendor vendor = vendors.stream().filter(o -> o.getId() == VENDOR_ID_SELECTED_FOR_TEST).findFirst().orElse(null); - assert vendor != null; - vendorEightOverflow = vendor.getOverflow().get(); - } - - @Test - public void getHttpGetLimit() { - Assertions.assertEquals(32, vendorEightOverflow.getHttpGetLimit()); - } -} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/PurposeTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/PurposeTest.java deleted file mode 100644 index f5957354..00000000 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/PurposeTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.iab.gpp.extras.jackson.gvl; - -/*- - * #%L - * IAB TCF Java GVL Jackson - * %% - * Copyright (C) 2020 IAB Technology Laboratory, Inc - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.io.IOException; -import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import com.iab.gpp.extras.gvl.Purpose; -import com.iab.gpp.extras.jackson.Loader; -import com.iab.gpp.extras.jackson.TestUtil; - -public class PurposeTest { - - private static Purpose purposeTen; - private static final int PURPOSE_SELECTED_FOR_TEST = 10; - - @BeforeAll - public static void setUpBeforeClass() throws IOException { - Loader loader = new Loader(); - List purposes = loader.globalVendorList(TestUtil.getGlobalVendorList()).getPurposes(); - purposeTen = purposes.stream().filter(o -> o.getId() == PURPOSE_SELECTED_FOR_TEST).findFirst().orElse(null); - } - - @Test - public void testGetId() { - Assertions.assertEquals(10, purposeTen.getId()); - } - - @Test - public void testGetName() { - String expectedName = "Develop and improve products"; - Assertions.assertEquals(expectedName, purposeTen.getName()); - } - - @Test - public void testGetDescription() { - String expectedDescription = - "Your data can be used to improve existing systems and software, and to develop new products"; - Assertions.assertEquals(expectedDescription, purposeTen.getDescription()); - } - - @Test - public void testGetDescriptionLegal() { - String expectedDescriptionLegal = - "To develop new products and improve products vendors can:\n* Use information to improve their existing products with new features and to develop new products\n* Create new models and algorithms through machine learning\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose"; - Assertions.assertEquals(expectedDescriptionLegal, purposeTen.getDescriptionLegal()); - } - - @Test - public void testGetConsentable() { - Assertions.assertTrue(purposeTen.getConsentable()); - } - - @Test - public void testGetRightToObject() { - Assertions.assertFalse(purposeTen.getRightToObject()); - } -} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialFeatureTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialFeatureTest.java deleted file mode 100644 index 005f58ae..00000000 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialFeatureTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.iab.gpp.extras.jackson.gvl; - -/*- - * #%L - * IAB TCF Java GVL Jackson - * %% - * Copyright (C) 2020 IAB Technology Laboratory, Inc - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import com.iab.gpp.extras.gvl.SpecialFeature; -import com.iab.gpp.extras.jackson.Loader; -import com.iab.gpp.extras.jackson.TestUtil; - -public class SpecialFeatureTest { - - private static SpecialFeature specialFeatureOne; - private final static int SPECIAL_FEAUTRE_ID_SELECTED_FOR_TEST = 1; - - @BeforeAll - public static void setUp() throws Exception { - Loader loader = new Loader(); - List specialFeatures = loader.globalVendorList(TestUtil.getGlobalVendorList()).getSpecialFeatures(); - specialFeatureOne = - specialFeatures.stream() - .filter(o -> o.getId() == SPECIAL_FEAUTRE_ID_SELECTED_FOR_TEST) - .findFirst() - .orElse(null); - } - - @Test - public void testGetId() { - Assertions.assertEquals(1, specialFeatureOne.getId()); - } - - @Test - public void testGetName() { - String expectedName = "Use precise geolocation data"; - Assertions.assertEquals(expectedName, specialFeatureOne.getName()); - } - - @Test - public void testGetDescription() { - String expectedDescription = - "Your precise geolocation data can be used in support of one or more purposes. This means your location can be accurate to within several meters."; - Assertions.assertEquals(expectedDescription, specialFeatureOne.getDescription()); - } - - @Test - public void testGetDescriptionLegal() { - String expectedDescriptionLegal = - "Vendors can:\n* Collect and process precise geolocation data in support of one or more purposes.\nN.B. Precise geolocation means that there are no restrictions on the precision of a user’s location; this can be accurate to within several meters."; - Assertions.assertEquals(expectedDescriptionLegal, specialFeatureOne.getDescriptionLegal()); - } -} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialPurposeTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialPurposeTest.java deleted file mode 100644 index 3f250276..00000000 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/SpecialPurposeTest.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.iab.gpp.extras.jackson.gvl; - -import java.io.IOException; -import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -/*- - * #%L - * IAB TCF Java GVL Jackson - * %% - * Copyright (C) 2020 IAB Technology Laboratory, Inc - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import com.iab.gpp.extras.gvl.SpecialPurpose; -import com.iab.gpp.extras.jackson.Loader; -import com.iab.gpp.extras.jackson.TestUtil; - -public class SpecialPurposeTest { - - private static SpecialPurpose specialPurposeOne; - private static final int SPECIAL_PURPOSE_SELECTED_FOR_TEST = 1; - - @BeforeAll - public static void setupBeforeClass() throws IOException { - Loader loader = new Loader(); - List specialPurposes = loader.globalVendorList(TestUtil.getGlobalVendorList()).getSpecialPurposes(); - specialPurposeOne = - specialPurposes.stream() - .filter(o -> o.getId() == SPECIAL_PURPOSE_SELECTED_FOR_TEST) - .findFirst() - .orElse(null); - } - - @Test - public void testGetId() { - Assertions.assertEquals(1, specialPurposeOne.getId()); - } - - @Test - public void testGetName() { - String expectedName = "Ensure security, prevent fraud, and debug"; - Assertions.assertEquals(expectedName, specialPurposeOne.getName()); - } - - @Test - public void testGetDescription() { - String expectedDescription = - "Your data can be used to monitor for and prevent fraudulent activity, and ensure systems and processes work properly and securely."; - Assertions.assertEquals(expectedDescription, specialPurposeOne.getDescription()); - } - - @Test - public void testGetDescriptionLegal() { - String expectedDescriptionLegal = - "To ensure security, prevent fraud and debug vendors can:\n* Ensure data are securely transmitted\n* Detect and prevent malicious, fraudulent, invalid, or illegal activity.\n* Ensure correct and efficient operation of systems and processes, including to monitor and enhance the performance of systems and processes engaged in permitted purposes\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose."; - Assertions.assertEquals(expectedDescriptionLegal, specialPurposeOne.getDescriptionLegal()); - } - - @Test - public void testGetConsentable() { - Assertions.assertTrue(specialPurposeOne.getConsentable()); - } - - @Test - public void testGetRightToObject() { - Assertions.assertFalse(specialPurposeOne.getRightToObject()); - } -} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/StackTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/StackTest.java deleted file mode 100644 index a353268a..00000000 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/StackTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.iab.gpp.extras.jackson.gvl; - -import java.util.Arrays; -import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -/*- - * #%L - * IAB TCF Java GVL Jackson - * %% - * Copyright (C) 2020 IAB Technology Laboratory, Inc - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import com.iab.gpp.extras.gvl.Stack; -import com.iab.gpp.extras.jackson.Loader; -import com.iab.gpp.extras.jackson.TestUtil; - -public class StackTest { - - private static Stack stackTwenty; - private final static int STACK_ID_SELECTED_FOR_TEST = 20; - - @BeforeAll - public static void setUpBeforeClass() throws Exception { - Loader loader = new Loader(); - List stacks = loader.globalVendorList(TestUtil.getGlobalVendorList()).getStacks(); - stackTwenty = stacks.stream().filter(o -> o.getId() == STACK_ID_SELECTED_FOR_TEST).findFirst().orElse(null); - } - - @Test - public void testGetId() { - Assertions.assertEquals(20, stackTwenty.getId()); - } - - @Test - public void testGetSpecialFeatures() { - Assertions.assertNotNull(stackTwenty.getSpecialFeatures()); - Assertions.assertEquals(0, stackTwenty.getSpecialFeatures().size()); - } - - @Test - public void testGetPurposes() { - Assertions.assertNotNull(stackTwenty.getPurposes()); - Assertions.assertEquals(4, stackTwenty.getPurposes().size()); - Assertions.assertEquals(Arrays.asList(7, 8, 9, 10), stackTwenty.getPurposes()); - } - - @Test - public void testGetName() { - String expectedName = "Ad and content measurement, audience insights, and product development"; - Assertions.assertEquals(expectedName, stackTwenty.getName()); - } - - @Test - public void testGetDescription() { - String expectedDescription = - "Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software. Insights about the audiences who saw the ads and content can be derived."; - Assertions.assertEquals(expectedDescription, stackTwenty.getDescription()); - } -} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/VendorTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/VendorTest.java deleted file mode 100644 index 57000bbb..00000000 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/VendorTest.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.iab.gpp.extras.jackson.gvl; - -/*- - * #%L - * IAB TCF Java GVL Jackson - * %% - * Copyright (C) 2020 IAB Technology Laboratory, Inc - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.time.Instant; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import com.iab.gpp.extras.gvl.Gvl; -import com.iab.gpp.extras.gvl.Vendor; -import com.iab.gpp.extras.jackson.Loader; -import com.iab.gpp.extras.jackson.TestUtil; - -public class VendorTest { - - private static Vendor vendorEight; - private static Vendor vendorTwo; - private static final int VENDOR_ID_SELECTED_FOR_TEST = 8; - - @BeforeAll - public static void setUpBeforeClass() throws Exception { - Loader loader = new Loader(); - Gvl gvl = loader.globalVendorList(TestUtil.getGlobalVendorList()); - vendorEight = gvl.getVendor(VENDOR_ID_SELECTED_FOR_TEST); - vendorTwo = gvl.getVendor(2); - } - - @Test - public void testGetId() { - Assertions.assertEquals(8, vendorEight.getId()); - } - - @Test - public void testGetName() { - String expectedName = "Emerse Sverige AB"; - Assertions.assertEquals(expectedName, vendorEight.getName()); - } - - @Test - public void testGetPurposes() { - Assertions.assertNotNull(vendorEight.getPurposes()); - Assertions.assertEquals(3, vendorEight.getPurposes().size()); - Assertions.assertEquals(Arrays.asList(1, 3, 4), vendorEight.getPurposes()); - } - - @Test - public void testGetLegIntPurposes() { - Assertions.assertNotNull(vendorEight.getLegIntPurposes()); - Assertions.assertEquals(4, vendorEight.getLegIntPurposes().size()); - Assertions.assertEquals(Arrays.asList(2, 7, 8, 9), vendorEight.getLegIntPurposes()); - } - - @Test - public void testGetFlexiblePurposes() { - Assertions.assertNotNull(vendorEight.getFlexiblePurposes()); - Assertions.assertEquals(2, vendorEight.getFlexiblePurposes().size()); - Assertions.assertEquals(Arrays.asList(2, 9), vendorEight.getFlexiblePurposes()); - } - - @Test - public void testGetSpecialPurposes() { - Assertions.assertNotNull(vendorEight.getSpecialPurposes()); - Assertions.assertEquals(2, vendorEight.getSpecialPurposes().size()); - Assertions.assertEquals(Arrays.asList(1, 2), vendorEight.getSpecialPurposes()); - } - - @Test - public void testGetFeatures() { - Assertions.assertNotNull(vendorEight.getFeatures()); - Assertions.assertEquals(2, vendorEight.getFeatures().size()); - Assertions.assertEquals(Arrays.asList(1, 2), vendorEight.getFeatures()); - } - - @Test - public void testGetSpecialFeatures() { - Assertions.assertNotNull(vendorEight.getSpecialFeatures()); - Assertions.assertEquals(0, vendorEight.getSpecialFeatures().size()); - } - - @Test - public void testGetPolicyUrl() { - String expectedPolicyUrl = "https://www.emerse.com/privacy-policy/"; - Assertions.assertEquals(expectedPolicyUrl, vendorEight.getPolicyUrl()); - } - - @Test - public void testGetDeletedDate() { - Assertions.assertEquals(Instant.parse("2020-06-28T00:00:00Z"), vendorEight.getDeletedDate().get()); - } - - @Test - public void testGetOverflow() { - Assertions.assertNotNull(vendorEight.getOverflow()); - } - - @Test - public void testIsDeleted() { - Assertions.assertTrue(vendorEight.isDeleted()); - } - - @Test - public void testCookieMaxAgeSeconds() { - long expectedCookieMaxAgeSeconds = 31557600000L; - Assertions.assertTrue(vendorEight.getCookieMaxAgeSeconds().isPresent()); - Assertions.assertEquals(expectedCookieMaxAgeSeconds, vendorEight.getCookieMaxAgeSeconds().get().longValue()); - } - - @Test - public void testUsesCookies() { - Assertions.assertTrue(vendorEight.getUsesCookies()); - } - - @Test - public void testCookieRefresh() { - Assertions.assertFalse(vendorEight.getHasCookieRefresh()); - } - - @Test - public void testUsesNonCookieAccess() { - Assertions.assertTrue(vendorEight.getUsesNonCookieAccess()); - } - - @Test - public void testNullDeviceStorageDisclosureUrl() { - Assertions.assertFalse(vendorEight.getDeviceStorageDisclosureUrl().isPresent()); - } - - @Test - public void testNullCookieMaxAgeSeconds() { - Assertions.assertFalse(vendorTwo.getUsesCookies()); - Assertions.assertFalse(vendorTwo.getCookieMaxAgeSeconds().isPresent()); - } - - @Test - public void testDeviceStorageDisclosureUrl() { - String expectedDeviceStorageDisclosureUrl = "https://privacy.blismedia.com/.well-known/deviceStorage.json"; - Assertions.assertTrue(vendorTwo.getDeviceStorageDisclosureUrl().isPresent()); - Assertions.assertEquals(expectedDeviceStorageDisclosureUrl, vendorTwo.getDeviceStorageDisclosureUrl().get()); - } -} diff --git a/iabgpp-extras-jackson/src/test/resources/gvl.json b/iabgpp-extras-jackson/src/test/resources/gvl.json deleted file mode 100644 index 660b47ec..00000000 --- a/iabgpp-extras-jackson/src/test/resources/gvl.json +++ /dev/null @@ -1,664 +0,0 @@ -{ - "gvlSpecificationVersion": 2, - "vendorListVersion": 26, - "tcfPolicyVersion": 2, - "lastUpdated": "2020-02-20T16:05:20Z", - "purposes": { - "1": { - "id": 1, - "name": "Store and/or access information on a device", - "description": "Cookies, device identifiers, or other information can be stored or accessed on your device for the purposes presented to you.", - "descriptionLegal": "Vendors can:\n* Store and access information on the device such as cookies and device identifiers presented to a user." - }, - "2": { - "id": 2, - "name": "Select basic ads", - "description": "Ads can be shown to you based on the content you’re viewing, the app you’re using, your approximate location, or your device type.", - "descriptionLegal": "To do basic ad selection vendors can:\n* Use real-time information about the context in which the ad will be shown, to show the ad, including information about the content and the device, such as: device type and capabilities, user agent, URL, IP address\n* Use a user’s non-precise geolocation data\n* Control the frequency of ads shown to a user.\n* Sequence the order in which ads are shown to a user.\n* Prevent an ad from serving in an unsuitable editorial (brand-unsafe) context\nVendors cannot:\n* Create a personalised ads profile using this information for the selection of future ads.\n* N.B. Non-precise means only an approximate location involving at least a radius of 500 meters is permitted." - }, - "3": { - "id": 3, - "name": "Create a personalised ads profile", - "description": "A profile can be built about you and your interests to show you personalised ads that are relevant to you.", - "descriptionLegal": "To create a personalised ads profile vendors can:\n* Collect information about a user, including a user's activity, interests, demographic information, or location, to create or edit a user profile for use in personalised advertising.\n* Combine this information with other information previously collected, including from across websites and apps, to create or edit a user profile for use in personalised advertising." - }, - "4": { - "id": 4, - "name": "Select personalised ads", - "description": "Personalised ads can be shown to you based on a profile about you.", - "descriptionLegal": "To select personalised ads vendors can:\n* Select personalised ads based on a user profile or other historical user data, including a user’s prior activity, interests, visits to sites or apps, location, or demographic information." - }, - "5": { - "id": 5, - "name": "Create a personalised content profile", - "description": "A profile can be built about you and your interests to show you personalised content that is relevant to you.", - "descriptionLegal": "To create a personalised content profile vendors can:\n* Collect information about a user, including a user's activity, interests, visits to sites or apps, demographic information, or location, to create or edit a user profile for personalising content.\n* Combine this information with other information previously collected, including from across websites and apps, to create or edit a user profile for use in personalising content." - }, - "6": { - "id": 6, - "name": "Select personalised content", - "description": "Personalised content can be shown to you based on a profile about you.", - "descriptionLegal": "To select personalised content vendors can:\n* Select personalised content based on a user profile or other historical user data, including a user’s prior activity, interests, visits to sites or apps, location, or demographic information." - }, - "7": { - "id": 7, - "name": "Measure ad performance", - "description": "The performance and effectiveness of ads that you see or interact with can be measured.", - "descriptionLegal": "To measure ad performance vendors can:\n* Measure whether and how ads were delivered to and interacted with by a user\n* Provide reporting about ads including their effectiveness and performance\n* Provide reporting about users who interacted with ads using data observed during the course of the user's interaction with that ad\n* Provide reporting to publishers about the ads displayed on their property\n* Measure whether an ad is serving in a suitable editorial environment (brand-safe) context\n* Determine the percentage of the ad that had the opportunity to be seen and the duration of that opportunity\n* Combine this information with other information previously collected, including from across websites and apps\nVendors cannot:\n*Apply panel- or similarly-derived audience insights data to ad measurement data without a Legal Basis to apply market research to generate audience insights (Purpose 9)" - }, - "8": { - "id": 8, - "name": "Measure content performance", - "description": "The performance and effectiveness of content that you see or interact with can be measured.", - "descriptionLegal": "To measure content performance vendors can:\n* Measure and report on how content was delivered to and interacted with by users.\n* Provide reporting, using directly measurable or known information, about users who interacted with the content\n* Combine this information with other information previously collected, including from across websites and apps.\nVendors cannot:\n* Measure whether and how ads (including native ads) were delivered to and interacted with by a user.\n* Apply panel- or similarly derived audience insights data to ad measurement data without a Legal Basis to apply market research to generate audience insights (Purpose 9)" - }, - "9": { - "id": 9, - "name": "Apply market research to generate audience insights", - "description": "Market research can be used to learn more about the audiences who visit sites/apps and view ads.", - "descriptionLegal": "To apply market research to generate audience insights vendors can:\n* Provide aggregate reporting to advertisers or their representatives about the audiences reached by their ads, through panel-based and similarly derived insights.\n* Provide aggregate reporting to publishers about the audiences that were served or interacted with content and/or ads on their property by applying panel-based and similarly derived insights.\n* Associate offline data with an online user for the purposes of market research to generate audience insights if vendors have declared to match and combine offline data sources (Feature 1)\n* Combine this information with other information previously collected including from across websites and apps. \nVendors cannot:\n* Measure the performance and effectiveness of ads that a specific user was served or interacted with, without a Legal Basis to measure ad performance.\n* Measure which content a specific user was served and how they interacted with it, without a Legal Basis to measure content performance." - }, - "10": { - "id": 10, - "name": "Develop and improve products", - "description": "Your data can be used to improve existing systems and software, and to develop new products", - "descriptionLegal": "To develop new products and improve products vendors can:\n* Use information to improve their existing products with new features and to develop new products\n* Create new models and algorithms through machine learning\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose", - "consentable": true, - "rightToObject": false - } - }, - "specialPurposes": { - "1": { - "id": 1, - "name": "Ensure security, prevent fraud, and debug", - "description": "Your data can be used to monitor for and prevent fraudulent activity, and ensure systems and processes work properly and securely.", - "descriptionLegal": "To ensure security, prevent fraud and debug vendors can:\n* Ensure data are securely transmitted\n* Detect and prevent malicious, fraudulent, invalid, or illegal activity.\n* Ensure correct and efficient operation of systems and processes, including to monitor and enhance the performance of systems and processes engaged in permitted purposes\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose.", - "consentable": true, - "rightToObject": false - }, - "2": { - "id": 2, - "name": "Technically deliver ads or content", - "description": "Your device can receive and send information that allows you to see and interact with ads and content.", - "descriptionLegal": "To deliver information and respond to technical requests vendors can:\n* Use a user’s IP address to deliver an ad over the internet\n* Respond to a user’s interaction with an ad by sending the user to a landing page\n* Use a user’s IP address to deliver content over the internet\n* Respond to a user’s interaction with content by sending the user to a landing page\n* Use information about the device type and capabilities for delivering ads or content, for example, to deliver the right size ad creative or video file in a format supported by the device\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose" - } - }, - "features": { - "1": { - "id": 1, - "name": "Match and combine offline data sources", - "description": "Data from offline data sources can be combined with your online activity in support of one or more purposes", - "descriptionLegal": "Vendors can:\n* Combine data obtained offline with data collected online in support of one or more Purposes or Special Purposes." - }, - "2": { - "id": 2, - "name": "Link different devices", - "description": "Different devices can be determined as belonging to you or your household in support of one or more of purposes.", - "descriptionLegal": "Vendors can:\n* Deterministically determine that two or more devices belong to the same user or household\n* Probabilistically determine that two or more devices belong to the same user or household\n* Actively scan device characteristics for identification for probabilistic identification if users have allowed vendors to actively scan device characteristics for identification (Special Feature 2)" - }, - "3": { - "id": 3, - "name": "Receive and use automatically-sent device characteristics for identification", - "description": "Your device might be distinguished from other devices based on information it automatically sends, such as IP address or browser type.", - "descriptionLegal": "Vendors can:\n* Create an identifier using data collected automatically from a device for specific characteristics, e.g. IP address, user-agent string.\n* Use such an identifier to attempt to re-identify a device.\nVendors cannot:\n* Create an identifier using data collected via actively scanning a device for specific characteristics, e.g. installed font or screen resolution without users’ separate opt-in to actively scanning device characteristics for identification.\n* Use such an identifier to re-identify a device." - } - }, - "specialFeatures": { - "1": { - "id": 1, - "name": "Use precise geolocation data", - "description": "Your precise geolocation data can be used in support of one or more purposes. This means your location can be accurate to within several meters.", - "descriptionLegal": "Vendors can:\n* Collect and process precise geolocation data in support of one or more purposes.\nN.B. Precise geolocation means that there are no restrictions on the precision of a user’s location; this can be accurate to within several meters." - }, - "2": { - "id": 2, - "name": "Actively scan device characteristics for identification", - "description": "Your device can be identified based on a scan of your device's unique combination of characteristics.", - "descriptionLegal": "Vendors can:\n* Create an identifier using data collected via actively scanning a device for specific characteristics, e.g. installed fonts or screen resolution.\n* Use such an identifier to re-identify a device." - } - }, - "stacks": { - "1": { - "id": 1, - "purposes": [], - "specialFeatures": [ - 1, - 2 - ], - "name": "Precise geolocation data, and identification through device scanning", - "description": "Precise geolocation and information about device characteristics can be used." - }, - "2": { - "id": 2, - "purposes": [ - 2, - 7 - ], - "specialFeatures": [], - "name": "Basic ads, and ad measurement", - "description": "Basic ads can be served. Ad performance can be measured." - }, - "3": { - "id": 3, - "purposes": [ - 2, - 3, - 4 - ], - "specialFeatures": [], - "name": "Personalised ads", - "description": "Ads can be personalised based on a profile. More data can be added to better personalise ads." - }, - "4": { - "id": 4, - "purposes": [ - 2, - 7, - 9 - ], - "specialFeatures": [], - "name": "Basic ads, and ad measurement", - "description": "Basic ads can be served. Ad performance can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "5": { - "id": 5, - "purposes": [ - 2, - 3, - 7 - ], - "specialFeatures": [], - "name": "Basic ads, personalised ads profile, and ad measurement", - "description": "Basic ads can be served. More data can be added to better personalise ads. Ad performance can be measured." - }, - "6": { - "id": 6, - "purposes": [ - 2, - 4, - 7 - ], - "specialFeatures": [], - "name": "Personalised ads display, and measurement", - "description": "Ads can be personalised based on a profile. Ad performance can be measured." - }, - "7": { - "id": 7, - "purposes": [ - 2, - 4, - 7, - 9 - ], - "specialFeatures": [], - "name": "Personalised ads display, ad measurement, and audience insights", - "description": "Ads can be personalised based on a profile. Ad performance can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "8": { - "id": 8, - "purposes": [ - 2, - 3, - 4, - 7 - ], - "specialFeatures": [], - "name": "Personalised ads, and ad measurement", - "description": "Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad performance can be measured." - }, - "9": { - "id": 9, - "purposes": [ - 2, - 3, - 4, - 7, - 9 - ], - "specialFeatures": [], - "name": "Personalised ads, ad measurement, and audience insights", - "description": "Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad performance can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "10": { - "id": 10, - "purposes": [ - 3, - 4 - ], - "specialFeatures": [], - "name": "Personalised ads profile and display", - "description": "Ads can be personalised based on a profile. More data can be added to better personalise ads." - }, - "11": { - "id": 11, - "purposes": [ - 5, - 6 - ], - "specialFeatures": [], - "name": "Personalised content", - "description": "Content can be personalised based on a profile. More data can be added to better personalise content." - }, - "12": { - "id": 12, - "purposes": [ - 6, - 8 - ], - "specialFeatures": [], - "name": "Personalised content display, and content measurement", - "description": "Content can be personalised based on a profile. Content performance can be measured." - }, - "13": { - "id": 13, - "purposes": [ - 6, - 8, - 9 - ], - "specialFeatures": [], - "name": "Personalised content display, content measurement and audience insights", - "description": "Content can be personalised based on a profile. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "14": { - "id": 14, - "purposes": [ - 5, - 6, - 8 - ], - "specialFeatures": [], - "name": "Personalised content, and content measurement", - "description": "Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured." - }, - "15": { - "id": 15, - "purposes": [ - 5, - 6, - 8, - 9 - ], - "specialFeatures": [], - "name": "Personalised content, content measurement and audience insights", - "description": "Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "16": { - "id": 16, - "purposes": [ - 5, - 6, - 8, - 9, - 10 - ], - "specialFeatures": [], - "name": "Personalised content, content measurement, audience insights, and product development", - "description": "Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software" - }, - "17": { - "id": 17, - "purposes": [ - 7, - 8, - 9 - ], - "specialFeatures": [], - "name": "Ad and content measurement, and audience insights", - "description": "Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "18": { - "id": 18, - "purposes": [ - 7, - 8 - ], - "specialFeatures": [], - "name": "Ad and content measurement", - "description": "Ad and content performance can be measured." - }, - "19": { - "id": 19, - "purposes": [ - 7, - 9 - ], - "specialFeatures": [], - "name": "Ad measurement, and audience insights", - "description": "Ad can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "20": { - "id": 20, - "purposes": [ - 7, - 8, - 9, - 10 - ], - "specialFeatures": [], - "name": "Ad and content measurement, audience insights, and product development", - "description": "Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software. Insights about the audiences who saw the ads and content can be derived." - }, - "21": { - "id": 21, - "purposes": [ - 8, - 9, - 10 - ], - "specialFeatures": [], - "name": "Content measurement, audience insights, and product development.", - "description": "Content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software." - }, - "22": { - "id": 22, - "purposes": [ - 8, - 10 - ], - "specialFeatures": [], - "name": "Content measurement, and product development", - "description": "Content performance can be measured. Data can be used to build or improve user experience, systems, and software." - }, - "23": { - "id": 23, - "purposes": [ - 2, - 4, - 6, - 7, - 8 - ], - "specialFeatures": [], - "name": "Personalised ads and content display, ad and content measurement", - "description": "Ads and content can be personalised based on a profile. Ad and content performance can be measured." - }, - "24": { - "id": 24, - "purposes": [ - 2, - 4, - 6, - 7, - 8, - 9 - ], - "specialFeatures": [], - "name": "Personalised ads and content display, ad and content measurement, and audience insights", - "description": "Ads and content can be personalised based on a profile. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software." - }, - "25": { - "id": 25, - "purposes": [ - 2, - 3, - 4, - 5, - 6, - 7, - 8 - ], - "specialFeatures": [], - "name": "Personalised ads and content, ad and content measurement", - "description": "Ads and content can be personalised based on a profile. More data can be added to better personalise ads and content. Ad and content performance can be measured." - }, - "26": { - "id": 26, - "purposes": [ - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9 - ], - "specialFeatures": [], - "name": "Personalised ads and content, ad and content measurement, and audience insights", - "description": "Ads and content can be personalised based on a profile. More data can be added to better personalise ads and content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "27": { - "id": 27, - "purposes": [ - 3, - 5 - ], - "specialFeatures": [], - "name": "Personalised ads, and content profile", - "description": "More data can be added to personalise ads and content." - }, - "28": { - "id": 28, - "purposes": [ - 2, - 4, - 6 - ], - "specialFeatures": [], - "name": "Personalised ads and content display", - "description": "Ads and content can be personalised based on a profile." - }, - "29": { - "id": 29, - "purposes": [ - 2, - 7, - 8, - 9 - ], - "specialFeatures": [], - "name": "Basic ads, ad and content measurement, and audience insights", - "description": "Basic ads can be served. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "30": { - "id": 30, - "purposes": [ - 2, - 4, - 5, - 6, - 7, - 8, - 9 - ], - "specialFeatures": [], - "name": "Personalised ads display, personalised content, ad and content measurement, and audience insights", - "description": "Ads and content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "31": { - "id": 31, - "purposes": [ - 2, - 4, - 5, - 6, - 7, - 8, - 9, - 10 - ], - "specialFeatures": [], - "name": "Personalised ads display, personalised content, ad and content measurement, audience insights, and product development", - "description": "Ads and content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software." - }, - "32": { - "id": 32, - "purposes": [ - 2, - 5, - 6, - 7, - 8, - 9 - ], - "specialFeatures": [], - "name": "Basic ads, personalised content, ad and content measurement, and audience insights", - "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "33": { - "id": 33, - "purposes": [ - 2, - 5, - 6, - 7, - 8, - 9, - 10 - ], - "specialFeatures": [], - "name": "Basic ads, personalised content, ad and content measurement, audience insights, and product development", - "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software." - }, - "34": { - "id": 34, - "purposes": [ - 2, - 5, - 6, - 8, - 9 - ], - "specialFeatures": [], - "name": "Basic ads, personalised content, content measurement, and audience insights", - "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." - }, - "35": { - "id": 35, - "purposes": [ - 2, - 5, - 6, - 8, - 9, - 10 - ], - "specialFeatures": [], - "name": "Basic ads, personalised content, content measurement, audience insights, and product development", - "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software." - }, - "36": { - "id": 36, - "purposes": [ - 2, - 5, - 6, - 7 - ], - "specialFeatures": [], - "name": "Basic ads, personalised content, and ad measurement", - "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad performance can be measured." - }, - "37": { - "id": 37, - "purposes": [ - 2, - 5, - 6, - 7, - 10 - ], - "specialFeatures": [], - "name": "Basic ads, personalised content, ad measurement, and product development", - "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad performance can be measured. Data can be used to build or improve user experience, systems, and software." - } - }, - "vendors": { - "512": { - "id": 512, - "name": "PubNative GmbH", - "purposes": [ - 1, - 2, - 3, - 4, - 4, - 7, - 8, - 10 - ], - "legIntPurposes": [], - "flexiblePurposes": [], - "specialPurposes": [], - "features": [ - 3 - ], - "specialFeatures": [ - 2 - ], - "policyUrl": "https://pubnative.net/privacy-notice/", - "deletedDate": "2019-02-28T00:00:00Z", - "cookieMaxAgeSeconds": null, - "usesCookies": false, - "cookieRefresh": false, - "usesNonCookieAccess": false - }, - "8": { - "id": 8, - "name": "Emerse Sverige AB", - "purposes": [ - 1, - 3, - 4 - ], - "legIntPurposes": [ - 2, - 7, - 8, - 9 - ], - "flexiblePurposes": [ - 2, - 9 - ], - "specialPurposes": [ - 1, - 2 - ], - "features": [ - 1, - 2 - ], - "specialFeatures": [], - "policyUrl": "https://www.emerse.com/privacy-policy/", - "deletedDate": "2020-06-28T00:00:00Z", - "overflow": { - "httpGetLimit": 32 - }, - "cookieMaxAgeSeconds": 31557600000, - "usesCookies": true, - "cookieRefresh": false, - "usesNonCookieAccess": true - }, - "2": { - "id": 2, - "name": "Captify Technologies Limited", - "purposes": [ - 1, - 2, - 3, - 4 - ], - "legIntPurposes": [ - 7, - 9, - 10 - ], - "flexiblePurposes": [ - 2 - ], - "specialPurposes": [ ], - "features": [ - 2 - ], - "specialFeatures": [ ], - "policyUrl": "http://www.captify.co.uk/privacy-policy/", - "cookieMaxAgeSeconds": null, - "usesCookies": false, - "cookieRefresh": true, - "usesNonCookieAccess": true, - "deviceStorageDisclosureUrl": "https://privacy.blismedia.com/.well-known/deviceStorage.json" - } - } -} \ No newline at end of file diff --git a/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/vendor-list-v51.json b/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/vendor-list-v51.json new file mode 100644 index 00000000..63ffbf6c --- /dev/null +++ b/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/vendor-list-v51.json @@ -0,0 +1 @@ +{"gvlSpecificationVersion":2,"vendorListVersion":51,"tcfPolicyVersion":2,"lastUpdated":"2020-08-13T16:05:23Z","purposes":{"1":{"id":1,"name":"Store and/or access information on a device","description":"Cookies, device identifiers, or other information can be stored or accessed on your device for the purposes presented to you.","descriptionLegal":"Vendors can:\n* Store and access information on the device such as cookies and device identifiers presented to a user."},"2":{"id":2,"name":"Select basic ads","description":"Ads can be shown to you based on the content you\u2019re viewing, the app you\u2019re using, your approximate location, or your device type.","descriptionLegal":"To do basic ad selection vendors can:\n* Use real-time information about the context in which the ad will be shown, to show the ad, including information about the content and the device, such as: device type and capabilities, user agent, URL, IP address\n* Use a user\u2019s non-precise geolocation data\n* Control the frequency of ads shown to a user.\n* Sequence the order in which ads are shown to a user.\n* Prevent an ad from serving in an unsuitable editorial (brand-unsafe) context\nVendors cannot:\n* Create a personalised ads profile using this information for the selection of future ads.\n* N.B. Non-precise means only an approximate location involving at least a radius of 500 meters is permitted."},"3":{"id":3,"name":"Create a personalised ads profile","description":"A profile can be built about you and your interests to show you personalised ads that are relevant to you.","descriptionLegal":"To create a personalised ads profile vendors can:\n* Collect information about a user, including a user's activity, interests, demographic information, or location, to create or edit a user profile for use in personalised advertising.\n* Combine this information with other information previously collected, including from across websites and apps, to create or edit a user profile for use in personalised advertising."},"4":{"id":4,"name":"Select personalised ads","description":"Personalised ads can be shown to you based on a profile about you.","descriptionLegal":"To select personalised ads vendors can:\n* Select personalised ads based on a user profile or other historical user data, including a user\u2019s prior activity, interests, visits to sites or apps, location, or demographic information."},"5":{"id":5,"name":"Create a personalised content profile","description":"A profile can be built about you and your interests to show you personalised content that is relevant to you.","descriptionLegal":"To create a personalised content profile vendors can:\n* Collect information about a user, including a user's activity, interests, visits to sites or apps, demographic information, or location, to create or edit a user profile for personalising content.\n* Combine this information with other information previously collected, including from across websites and apps, to create or edit a user profile for use in personalising content."},"6":{"id":6,"name":"Select personalised content","description":"Personalised content can be shown to you based on a profile about you.","descriptionLegal":"To select personalised content vendors can:\n* Select personalised content based on a user profile or other historical user data, including a user\u2019s prior activity, interests, visits to sites or apps, location, or demographic information."},"7":{"id":7,"name":"Measure ad performance","description":"The performance and effectiveness of ads that you see or interact with can be measured.","descriptionLegal":"To measure ad performance vendors can:\n* Measure whether and how ads were delivered to and interacted with by a user\n* Provide reporting about ads including their effectiveness and performance\n* Provide reporting about users who interacted with ads using data observed during the course of the user's interaction with that ad\n* Provide reporting to publishers about the ads displayed on their property\n* Measure whether an ad is serving in a suitable editorial environment (brand-safe) context\n* Determine the percentage of the ad that had the opportunity to be seen and the duration of that opportunity\n* Combine this information with other information previously collected, including from across websites and apps\nVendors cannot:\n*Apply panel- or similarly-derived audience insights data to ad measurement data without a Legal Basis to apply market research to generate audience insights (Purpose 9)"},"8":{"id":8,"name":"Measure content performance","description":"The performance and effectiveness of content that you see or interact with can be measured.","descriptionLegal":"To measure content performance vendors can:\n* Measure and report on how content was delivered to and interacted with by users.\n* Provide reporting, using directly measurable or known information, about users who interacted with the content\n* Combine this information with other information previously collected, including from across websites and apps.\nVendors cannot:\n* Measure whether and how ads (including native ads) were delivered to and interacted with by a user.\n* Apply panel- or similarly derived audience insights data to ad measurement data without a Legal Basis to apply market research to generate audience insights (Purpose 9)"},"9":{"id":9,"name":"Apply market research to generate audience insights","description":"Market research can be used to learn more about the audiences who visit sites/apps and view ads.","descriptionLegal":"To apply market research to generate audience insights vendors can:\n* Provide aggregate reporting to advertisers or their representatives about the audiences reached by their ads, through panel-based and similarly derived insights.\n* Provide aggregate reporting to publishers about the audiences that were served or interacted with content and/or ads on their property by applying panel-based and similarly derived insights.\n* Associate offline data with an online user for the purposes of market research to generate audience insights if vendors have declared to match and combine offline data sources (Feature 1)\n* Combine this information with other information previously collected including from across websites and apps. \nVendors cannot:\n* Measure the performance and effectiveness of ads that a specific user was served or interacted with, without a Legal Basis to measure ad performance.\n* Measure which content a specific user was served and how they interacted with it, without a Legal Basis to measure content performance."},"10":{"id":10,"name":"Develop and improve products","description":"Your data can be used to improve existing systems and software, and to develop new products","descriptionLegal":"To develop new products and improve products vendors can:\n* Use information to improve their existing products with new features and to develop new products\n* Create new models and algorithms through machine learning\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose"}},"specialPurposes":{"1":{"id":1,"name":"Ensure security, prevent fraud, and debug","description":"Your data can be used to monitor for and prevent fraudulent activity, and ensure systems and processes work properly and securely.","descriptionLegal":"To ensure security, prevent fraud and debug vendors can:\n* Ensure data are securely transmitted\n* Detect and prevent malicious, fraudulent, invalid, or illegal activity.\n* Ensure correct and efficient operation of systems and processes, including to monitor and enhance the performance of systems and processes engaged in permitted purposes\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose."},"2":{"id":2,"name":"Technically deliver ads or content","description":"Your device can receive and send information that allows you to see and interact with ads and content.","descriptionLegal":"To deliver information and respond to technical requests vendors can:\n* Use a user\u2019s IP address to deliver an ad over the internet\n* Respond to a user\u2019s interaction with an ad by sending the user to a landing page\n* Use a user\u2019s IP address to deliver content over the internet\n* Respond to a user\u2019s interaction with content by sending the user to a landing page\n* Use information about the device type and capabilities for delivering ads or content, for example, to deliver the right size ad creative or video file in a format supported by the device\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose"}},"features":{"1":{"id":1,"name":"Match and combine offline data sources","description":"Data from offline data sources can be combined with your online activity in support of one or more purposes","descriptionLegal":"Vendors can:\n* Combine data obtained offline with data collected online in support of one or more Purposes or Special Purposes."},"2":{"id":2,"name":"Link different devices","description":"Different devices can be determined as belonging to you or your household in support of one or more of purposes.","descriptionLegal":"Vendors can:\n* Deterministically determine that two or more devices belong to the same user or household\n* Probabilistically determine that two or more devices belong to the same user or household\n* Actively scan device characteristics for identification for probabilistic identification if users have allowed vendors to actively scan device characteristics for identification (Special Feature 2)"},"3":{"id":3,"name":"Receive and use automatically-sent device characteristics for identification","description":"Your device might be distinguished from other devices based on information it automatically sends, such as IP address or browser type.","descriptionLegal":"Vendors can:\n* Create an identifier using data collected automatically from a device for specific characteristics, e.g. IP address, user-agent string.\n* Use such an identifier to attempt to re-identify a device.\nVendors cannot:\n* Create an identifier using data collected via actively scanning a device for specific characteristics, e.g. installed font or screen resolution without users\u2019 separate opt-in to actively scanning device characteristics for identification.\n* Use such an identifier to re-identify a device."}},"specialFeatures":{"1":{"id":1,"name":"Use precise geolocation data","description":"Your precise geolocation data can be used in support of one or more purposes. This means your location can be accurate to within several meters.","descriptionLegal":"Vendors can:\n* Collect and process precise geolocation data in support of one or more purposes.\nN.B. Precise geolocation means that there are no restrictions on the precision of a user\u2019s location; this can be accurate to within several meters."},"2":{"id":2,"name":"Actively scan device characteristics for identification","description":"Your device can be identified based on a scan of your device's unique combination of characteristics.","descriptionLegal":"Vendors can:\n* Create an identifier using data collected via actively scanning a device for specific characteristics, e.g. installed fonts or screen resolution.\n* Use such an identifier to re-identify a device."}},"stacks":{"1":{"id":1,"purposes":[],"specialFeatures":[1,2],"name":"Precise geolocation data, and identification through device scanning","description":"Precise geolocation and information about device characteristics can be used."},"2":{"id":2,"purposes":[2,7],"specialFeatures":[],"name":"Basic ads, and ad measurement","description":"Basic ads can be served. Ad performance can be measured."},"3":{"id":3,"purposes":[2,3,4],"specialFeatures":[],"name":"Personalised ads","description":"Ads can be personalised based on a profile. More data can be added to better personalise ads."},"4":{"id":4,"purposes":[2,7,9],"specialFeatures":[],"name":"Basic ads, ad measurement, and audience insights","description":"Basic ads can be served. Ad performance can be measured. Insights about the audiences who saw the ads and content can be derived."},"5":{"id":5,"purposes":[2,3,7],"specialFeatures":[],"name":"Basic ads, personalised ads profile, and ad measurement","description":"Basic ads can be served. More data can be added to better personalise ads. Ad performance can be measured."},"6":{"id":6,"purposes":[2,4,7],"specialFeatures":[],"name":"Personalised ads display and ad measurement","description":"Ads can be personalised based on a profile. Ad performance can be measured."},"7":{"id":7,"purposes":[2,4,7,9],"specialFeatures":[],"name":"Personalised ads display, ad measurement, and audience insights","description":"Ads can be personalised based on a profile. Ad performance can be measured. Insights about the audiences who saw the ads and content can be derived."},"8":{"id":8,"purposes":[2,3,4,7],"specialFeatures":[],"name":"Personalised ads, and ad measurement","description":"Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad performance can be measured."},"9":{"id":9,"purposes":[2,3,4,7,9],"specialFeatures":[],"name":"Personalised ads, ad measurement, and audience insights","description":"Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad performance can be measured. Insights about the audiences who saw the ads and content can be derived."},"10":{"id":10,"purposes":[3,4],"specialFeatures":[],"name":"Personalised ads profile and display","description":"Ads can be personalised based on a profile. More data can be added to better personalise ads."},"11":{"id":11,"purposes":[5,6],"specialFeatures":[],"name":"Personalised content","description":"Content can be personalised based on a profile. More data can be added to better personalise content."},"12":{"id":12,"purposes":[6,8],"specialFeatures":[],"name":"Personalised content display, and content measurement","description":"Content can be personalised based on a profile. Content performance can be measured."},"13":{"id":13,"purposes":[6,8,9],"specialFeatures":[],"name":"Personalised content display, content measurement and audience insights","description":"Content can be personalised based on a profile. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived."},"14":{"id":14,"purposes":[5,6,8],"specialFeatures":[],"name":"Personalised content, and content measurement","description":"Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured."},"15":{"id":15,"purposes":[5,6,8,9],"specialFeatures":[],"name":"Personalised content, content measurement and audience insights","description":"Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived."},"16":{"id":16,"purposes":[5,6,8,9,10],"specialFeatures":[],"name":"Personalised content, content measurement, audience insights, and product development","description":"Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software"},"17":{"id":17,"purposes":[7,8,9],"specialFeatures":[],"name":"Ad and content measurement, and audience insights","description":"Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived."},"18":{"id":18,"purposes":[7,8],"specialFeatures":[],"name":"Ad and content measurement","description":"Ad and content performance can be measured."},"19":{"id":19,"purposes":[7,9],"specialFeatures":[],"name":"Ad measurement, and audience insights","description":"Ad can be measured. Insights about the audiences who saw the ads and content can be derived."},"20":{"id":20,"purposes":[7,8,9,10],"specialFeatures":[],"name":"Ad and content measurement, audience insights, and product development","description":"Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software. Insights about the audiences who saw the ads and content can be derived."},"21":{"id":21,"purposes":[8,9,10],"specialFeatures":[],"name":"Content measurement, audience insights, and product development.","description":"Content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software."},"22":{"id":22,"purposes":[8,10],"specialFeatures":[],"name":"Content measurement, and product development","description":"Content performance can be measured. Data can be used to build or improve user experience, systems, and software."},"23":{"id":23,"purposes":[2,4,6,7,8],"specialFeatures":[],"name":"Personalised ads and content display, ad and content measurement","description":"Ads and content can be personalised based on a profile. Ad and content performance can be measured."},"24":{"id":24,"purposes":[2,4,6,7,8,9],"specialFeatures":[],"name":"Personalised ads and content display, ad and content measurement, and audience insights","description":"Ads and content can be personalised based on a profile. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software."},"25":{"id":25,"purposes":[2,3,4,5,6,7,8],"specialFeatures":[],"name":"Personalised ads and content, ad and content measurement","description":"Ads and content can be personalised based on a profile. More data can be added to better personalise ads and content. Ad and content performance can be measured."},"26":{"id":26,"purposes":[2,3,4,5,6,7,8,9],"specialFeatures":[],"name":"Personalised ads and content, ad and content measurement, and audience insights","description":"Ads and content can be personalised based on a profile. More data can be added to better personalise ads and content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived."},"27":{"id":27,"purposes":[3,5],"specialFeatures":[],"name":"Personalised ads, and content profile","description":"More data can be added to personalise ads and content."},"28":{"id":28,"purposes":[2,4,6],"specialFeatures":[],"name":"Personalised ads and content display","description":"Ads and content can be personalised based on a profile."},"29":{"id":29,"purposes":[2,7,8,9],"specialFeatures":[],"name":"Basic ads, ad and content measurement, and audience insights","description":"Basic ads can be served. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived."},"30":{"id":30,"purposes":[2,4,5,6,7,8,9],"specialFeatures":[],"name":"Personalised ads display, personalised content, ad and content measurement, and audience insights","description":"Ads and content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived."},"31":{"id":31,"purposes":[2,4,5,6,7,8,9,10],"specialFeatures":[],"name":"Personalised ads display, personalised content, ad and content measurement, audience insights, and product development","description":"Ads and content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software."},"32":{"id":32,"purposes":[2,5,6,7,8,9],"specialFeatures":[],"name":"Basic ads, personalised content, ad and content measurement, and audience insights","description":"Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived."},"33":{"id":33,"purposes":[2,5,6,7,8,9,10],"specialFeatures":[],"name":"Basic ads, personalised content, ad and content measurement, audience insights, and product development","description":"Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software."},"34":{"id":34,"purposes":[2,5,6,8,9],"specialFeatures":[],"name":"Basic ads, personalised content, content measurement, and audience insights","description":"Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived."},"35":{"id":35,"purposes":[2,5,6,8,9,10],"specialFeatures":[],"name":"Basic ads, personalised content, content measurement, audience insights, and product development","description":"Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software."},"36":{"id":36,"purposes":[2,5,6,7],"specialFeatures":[],"name":"Basic ads, personalised content, and ad measurement","description":"Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad performance can be measured."},"37":{"id":37,"purposes":[2,5,6,7,10],"specialFeatures":[],"name":"Basic ads, personalised content, ad measurement, and product development","description":"Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad performance can be measured. Data can be used to build or improve user experience, systems, and software."},"38":{"id":38,"purposes":[2,3,4,7,10],"specialFeatures":[],"name":"Personalised ads, ad measurement, and product development","description":"Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad performance can be measured. Data can be used to build or improve user experience, systems, and software."},"39":{"id":39,"purposes":[2,3,4,7,9,10],"specialFeatures":[],"name":"Personalised ads, ad measurement, audience insights and product development","description":"Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems and software."},"40":{"id":40,"purposes":[2,3,4,7,8,9,10],"specialFeatures":[],"name":"Personalised ads, ad and content measurement, audience insights and product development","description":"Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad and content performance can be measured. Insights about audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems and software."},"41":{"id":41,"purposes":[2,3,4,6,7,8,9,10],"specialFeatures":[],"name":"Personalised ads, personalised content display, ad and content measurement, audience insights and product development","description":"Ads and content can be personalised based on a profile. More data can be added to better personalise ads. Ad and content performance can be measured. Insights about audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems and software."},"42":{"id":42,"purposes":[2,3,4,5,6,7,8,9,10],"specialFeatures":[],"name":"Personalised ads and content, ad and content measurement, audience insights and product development","description":"Ads and content can be personalised based on a profile. More data can be added to better personalise ads and content. Ad and content performance can be measured. Insights about audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems and software."}},"vendors":{"8":{"id":8,"name":"Emerse Sverige AB","purposes":[1,3,4],"legIntPurposes":[2,7,8,9],"flexiblePurposes":[2,9],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.emerse.com/privacy-policy/"},"9":{"id":9,"name":"AdMaxim Inc.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"http://www.admaxim.com/admaxim-privacy-policy/","deletedDate":"2020-06-17T00:00:00Z"},"12":{"id":12,"name":"BeeswaxIO Corporation","purposes":[1,2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,3],"specialFeatures":[1],"policyUrl":"https://www.beeswax.com/privacy/"},"28":{"id":28,"name":"TripleLift, Inc.","purposes":[1],"legIntPurposes":[2,7,9,10],"flexiblePurposes":[2,7,9,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://triplelift.com/privacy/","overflow":{"httpGetLimit":32}},"25":{"id":25,"name":"Verizon Media EMEA Limited","purposes":[1,3,4,5,6],"legIntPurposes":[2,7,8,9,10],"flexiblePurposes":[2,7,8,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.verizonmedia.com/policies/ie/en/verizonmedia/privacy/index.html"},"26":{"id":26,"name":"Venatus Media Limited","purposes":[1,2,3,4,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[],"policyUrl":"https://www.venatusmedia.com/privacy/"},"1":{"id":1,"name":"Exponential Interactive, Inc d/b/a VDX.tv","purposes":[1,2,3,4,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,8,9,10],"specialPurposes":[1,2],"features":[1,3],"specialFeatures":[],"policyUrl":"https://vdx.tv/privacy/"},"6":{"id":6,"name":"AdSpirit GmbH","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,9],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"http://www.adspirit.de/privacy","overflow":{"httpGetLimit":32}},"30":{"id":30,"name":"BidTheatre AB","purposes":[1,3,4],"legIntPurposes":[2],"flexiblePurposes":[2],"specialPurposes":[1,2],"features":[2],"specialFeatures":[],"policyUrl":"https://www.bidtheatre.com/privacy-policy"},"24":{"id":24,"name":"Epsilon","purposes":[1,2,3,4,5,6,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.conversantmedia.eu/legal/privacy-policy"},"39":{"id":39,"name":"ADITION technologies AG","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.adition.com/datenschutz"},"11":{"id":11,"name":"Quantcast International Limited","purposes":[1,3,4],"legIntPurposes":[2,7,8,9,10],"flexiblePurposes":[2,3,4,7,8,9,10],"specialPurposes":[1,2],"features":[1,3],"specialFeatures":[],"policyUrl":"https://www.quantcast.com/privacy/"},"15":{"id":15,"name":"Adikteev","purposes":[1,3,4,5,6,8,9,10],"legIntPurposes":[2,7],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2],"specialFeatures":[],"policyUrl":"https://www.adikteev.com/privacy-policy-eng/"},"4":{"id":4,"name":"Roq.ad Inc.","purposes":[1,2,3,4,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2,3],"specialFeatures":[1],"policyUrl":"https://www.roq.ad/privacy-policy"},"7":{"id":7,"name":"Vibrant Media Limited","purposes":[1,3,4,5,6,7,8],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.vibrantmedia.com/en/privacy-policy/"},"2":{"id":2,"name":"Captify Technologies Limited","purposes":[1,2,3,4],"legIntPurposes":[7,9,10],"flexiblePurposes":[2],"specialPurposes":[],"features":[2],"specialFeatures":[],"policyUrl":"http://www.captify.co.uk/privacy-policy/"},"37":{"id":37,"name":"NEURAL.ONE","purposes":[1,2,3,4,5,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://web.neural.one/privacy-policy/"},"13":{"id":13,"name":"Sovrn Holdings Inc","purposes":[1,2,3,5,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.sovrn.com/sovrn-privacy/"},"34":{"id":34,"name":"NEORY GmbH","purposes":[1,3,4,5,6,9],"legIntPurposes":[2,7,8],"flexiblePurposes":[2,3,4,5,6,7,8,9],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.neory.com/privacy.html","overflow":{"httpGetLimit":128}},"32":{"id":32,"name":"Xandr, Inc.","purposes":[1,3,4],"legIntPurposes":[2,7,10],"flexiblePurposes":[2,7,10],"specialPurposes":[1,2],"features":[2],"specialFeatures":[1],"policyUrl":"https://www.xandr.com/privacy/platform-privacy-policy/"},"10":{"id":10,"name":"Index Exchange, Inc. ","purposes":[1,2,7],"legIntPurposes":[],"flexiblePurposes":[2,7],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.indexexchange.com/privacy"},"57":{"id":57,"name":"ADARA MEDIA UNLIMITED","purposes":[1,2,3,4],"legIntPurposes":[7,9,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://adara.com/privacy-promise/"},"63":{"id":63,"name":"Avocet Systems Limited","purposes":[1,2,3,4,5,6],"legIntPurposes":[7,8,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://avocet.io/privacy-portal"},"51":{"id":51,"name":"xAd, Inc. dba GroundTruth","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.groundtruth.com/privacy-policy/"},"49":{"id":49,"name":"TRADELAB","purposes":[1,2,3,4,5,6],"legIntPurposes":[7,8,9,10],"flexiblePurposes":[7,8,9,10],"specialPurposes":[],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://tradelab.com/en/privacy/","overflow":{"httpGetLimit":32}},"45":{"id":45,"name":"Smart Adserver","purposes":[1,2,4,7],"legIntPurposes":[],"flexiblePurposes":[2,7],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://smartadserver.com/end-user-privacy-policy/"},"52":{"id":52,"name":"The Rubicon Project, Inc. ","purposes":[1],"legIntPurposes":[2,7,10],"flexiblePurposes":[2,7,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"http://www.rubiconproject.com/rubicon-project-yield-optimization-privacy-policy/","overflow":{"httpGetLimit":128}},"71":{"id":71,"name":"Roku Advertising Services","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://docs.roku.com/published/userprivacypolicy/en/us"},"79":{"id":79,"name":"MediaMath, Inc.","purposes":[1,3,4],"legIntPurposes":[2,7,10],"flexiblePurposes":[2,3,4,7,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"http://www.mediamath.com/privacy-policy/"},"91":{"id":91,"name":"Criteo SA","purposes":[1,2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.criteo.com/privacy/"},"85":{"id":85,"name":"Crimtan Holdings Limited","purposes":[1,3,4],"legIntPurposes":[2,7,8,9,10],"flexiblePurposes":[2,7,8,9,10],"specialPurposes":[1,2],"features":[1,3],"specialFeatures":[1],"policyUrl":"https://crimtan.com/privacy/"},"16":{"id":16,"name":"RTB House S.A.","purposes":[1,2,3,4,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1],"features":[],"specialFeatures":[],"policyUrl":"https://www.rtbhouse.com/privacy-center/services-privacy-policy/"},"86":{"id":86,"name":"Scene Stealer Limited","purposes":[1],"legIntPurposes":[2,3,4,7,10],"flexiblePurposes":[2,3,4,7],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://scenestealer.tv/privacy-policy/"},"94":{"id":94,"name":"Blis Media Limited","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"http://www.blis.com/privacy/"},"73":{"id":73,"name":"Simplifi Holdings Inc.","purposes":[1,2,3,4,7,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4],"specialPurposes":[],"features":[2],"specialFeatures":[1],"policyUrl":"https://simpli.fi/site-privacy-policy/"},"33":{"id":33,"name":"ShareThis, Inc","purposes":[1,3,5,6],"legIntPurposes":[9,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://sharethis.com/privacy/"},"20":{"id":20,"name":"N Technologies Inc.","purposes":[1,3,4],"legIntPurposes":[2,5,6,7,8,9,10],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[2],"specialFeatures":[1],"policyUrl":"https://n.rich/privacy-notice"},"53":{"id":53,"name":"Sirdata","purposes":[1,2,3,4,5,6,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.sirdata.com/privacy/"},"69":{"id":69,"name":"OpenX","purposes":[1],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.openx.com/legal/privacy-policy/"},"98":{"id":98,"name":"GroupM UK Limited","purposes":[1,2,3,4,5,6],"legIntPurposes":[7,8,9,10],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.groupm.com/privacy-notice"},"62":{"id":62,"name":"Justpremium BV","purposes":[1,4,5,10],"legIntPurposes":[2,7],"flexiblePurposes":[2,4,7,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://justpremium.com/privacy-policy/"},"36":{"id":36,"name":"RhythmOne DBA Unruly Group Ltd","purposes":[1,2,3,4,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.rhythmone.com/privacy-policy"},"80":{"id":80,"name":"Sharethrough, Inc","purposes":[1,2,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[2,4,7,9,10],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://platform-cdn.sharethrough.com/privacy-policy"},"23":{"id":23,"name":"Amobee, Inc. ","purposes":[1,2,3,4],"legIntPurposes":[7,9,10],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.amobee.com/trust/privacy-guidelines"},"67":{"id":67,"name":"LifeStreet Corporation","purposes":[1,3,4],"legIntPurposes":[2,5,6,7,8,10],"flexiblePurposes":[2,5,6,7,8,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://lifestreet.com/privacy/"},"68":{"id":68,"name":"Sizmek by Amazon","purposes":[1,3,4],"legIntPurposes":[2,7,9,10],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.sizmek.com/privacy-policy/"},"61":{"id":61,"name":"GumGum, Inc.","purposes":[1,2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://gumgum.com/privacy-policy"},"40":{"id":40,"name":"Active Agent (ADITION technologies AG)","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"http://www.active-agent.com/de/unternehmen/datenschutzerklaerung/"},"76":{"id":76,"name":"PubMatic, Inc.","purposes":[1,3,4],"legIntPurposes":[2,5,6,7,8,9,10],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://pubmatic.com/privacy-policy/"},"89":{"id":89,"name":"Tapad, Inc.","purposes":[1],"legIntPurposes":[10],"flexiblePurposes":[],"specialPurposes":[],"features":[2],"specialFeatures":[],"policyUrl":"https://www.tapad.com/eu-privacy-policy"},"66":{"id":66,"name":"adsquare GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.adsquare.com/privacy"},"41":{"id":41,"name":"Adverline","purposes":[1,2,3,4,5,6,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.adverline.com/privacy/","overflow":{"httpGetLimit":128}},"82":{"id":82,"name":"Smaato, Inc.","purposes":[1,2,3,4,7,9],"legIntPurposes":[10],"flexiblePurposes":[2,7,9,10],"specialPurposes":[1,2],"features":[1,3],"specialFeatures":[1],"policyUrl":"https://www.smaato.com/privacy/"},"60":{"id":60,"name":"Rakuten Marketing LLC","purposes":[1,3,4],"legIntPurposes":[2,7,9,10],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://rakutenadvertising.com/legal-notices/services-privacy-policy/"},"70":{"id":70,"name":"Yieldlab AG","purposes":[1,2,3,4,7,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"http://www.yieldlab.de/meta-navigation/datenschutz/","overflow":{"httpGetLimit":128}},"50":{"id":50,"name":"Adform","purposes":[1,2,3,4,7,10],"legIntPurposes":[],"flexiblePurposes":[2,7,10],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[],"policyUrl":"https://site.adform.com/privacy-center/platform-privacy/product-and-services-privacy-policy/","overflow":{"httpGetLimit":32}},"100":{"id":100,"name":"Fifty Technology Limited","purposes":[1,2,3,4],"legIntPurposes":[7,9,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2,3],"specialFeatures":[],"policyUrl":"https://fifty.io/privacy-policy.php"},"21":{"id":21,"name":"The Trade Desk","purposes":[1,3,4],"legIntPurposes":[2,7,10],"flexiblePurposes":[2,7,10],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://www.thetradedesk.com/general/privacy-policy"},"110":{"id":110,"name":"Dynata LLC","purposes":[1,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.opinionoutpost.co.uk/en-gb/policies/privacy"},"42":{"id":42,"name":"Taboola Europe Limited","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,10],"flexiblePurposes":[2,3,4,5,6,7,8,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.taboola.com/privacy-policy"},"77":{"id":77,"name":"comScore, Inc.","purposes":[1,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[7,8,9,10],"specialPurposes":[1],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.scorecardresearch.com/privacy.aspx?newlanguage=1"},"109":{"id":109,"name":"LoopMe Limited","purposes":[1,2,3,4,5,6,7,8],"legIntPurposes":[9,10],"flexiblePurposes":[9],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://loopme.com/privacy-policy/"},"120":{"id":120,"name":"Eyeota Pte Ltd","purposes":[1,3,5,9,10],"legIntPurposes":[],"flexiblePurposes":[3,5,9,10],"specialPurposes":[1],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.eyeota.com/privacy-center"},"93":{"id":93,"name":"Adloox SA","purposes":[],"legIntPurposes":[7],"flexiblePurposes":[],"specialPurposes":[1],"features":[],"specialFeatures":[],"policyUrl":"http://adloox.com/disclaimer","overflow":{"httpGetLimit":128}},"132":{"id":132,"name":"Teads ","purposes":[1,3,4],"legIntPurposes":[2,7,9,10],"flexiblePurposes":[2,7,9,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.teads.com/privacy-policy/"},"22":{"id":22,"name":"admetrics GmbH","purposes":[2,7,8,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://admetrics.io/en/privacy_policy/"},"102":{"id":102,"name":"Telaria SAS","purposes":[1,2,3,4,5,6],"legIntPurposes":[7,8,9,10],"flexiblePurposes":[5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://telaria.com/privacy-policy/"},"108":{"id":108,"name":"Rich Audience Technologies SL","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://richaudience.com/privacy/"},"18":{"id":18,"name":"Widespace AB","purposes":[1,2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.widespace.com/legal/privacy-policy-notice/"},"122":{"id":122,"name":"Avid Media Ltd","purposes":[1,3,4,5,10],"legIntPurposes":[2,7,8],"flexiblePurposes":[2,7,8],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.avidglobalmedia.eu/privacy-policy.html"},"97":{"id":97,"name":"LiveRamp, Inc.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.liveramp.com/service-privacy-policy/"},"138":{"id":138,"name":"ConnectAd Realtime GmbH","purposes":[1,3,4,5],"legIntPurposes":[2,7],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"http://connectadrealtime.com/privacy/"},"72":{"id":72,"name":"Nano Interactive GmbH","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://www.nanointeractive.com/privacy"},"127":{"id":127,"name":"PIXIMEDIA SAS","purposes":[1,3,4,5,6,9,10],"legIntPurposes":[2,7,8],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://piximedia.com/privacy/","overflow":{"httpGetLimit":128}},"136":{"id":136,"name":"Str\u00f6er SSP GmbH (SSP)","purposes":[1],"legIntPurposes":[2,7,9,10],"flexiblePurposes":[2,7,9,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.stroeer.de/fileadmin/de/Konvergenz_und_Konzepte/Daten_und_Technologien/Stroeer_SSP/Downloads/Datenschutz_Stroeer_SSP.pdf"},"111":{"id":111,"name":"Showheroes SE","purposes":[1,3,4,9,10],"legIntPurposes":[2,7,8],"flexiblePurposes":[2,3,4,7,8,9,10],"specialPurposes":[1,2],"features":[1],"specialFeatures":[],"policyUrl":"https://showheroes.com/privacy/"},"124":{"id":124,"name":"Teemo SA","purposes":[1,2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1],"specialFeatures":[1],"policyUrl":"https://teemo.co/fr/confidentialite/"},"154":{"id":154,"name":"YOC AG","purposes":[1,3,4,10],"legIntPurposes":[2,7],"flexiblePurposes":[2,7],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://yoc.com/privacy/"},"101":{"id":101,"name":"MiQ","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"http://wearemiq.com/privacy-policy/"},"149":{"id":149,"name":"ADman Interactive SLU","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2],"specialPurposes":[],"features":[2,3],"specialFeatures":[],"policyUrl":"https://admanmedia.com/politica.html?setLng=es"},"153":{"id":153,"name":"MADVERTISE MEDIA","purposes":[1,2,3,4,5,6,7,9,10],"legIntPurposes":[],"flexiblePurposes":[5,6,10],"specialPurposes":[2],"features":[],"specialFeatures":[1,2],"policyUrl":"https://madvertise.com/en/gdpr/","overflow":{"httpGetLimit":128}},"157":{"id":157,"name":"Seedtag Advertising S.L","purposes":[1,2,3,4,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.seedtag.com/en/privacy-policy/"},"145":{"id":145,"name":"Snapsort Inc., operating as Sortable","purposes":[1],"legIntPurposes":[2,7,8,9,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://help.sortable.com/help/privacy-policy"},"131":{"id":131,"name":"ID5 Technology SAS","purposes":[1],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[],"policyUrl":"https://www.id5.io/privacy"},"158":{"id":158,"name":"Reveal Mobile, Inc","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"https://revealmobile.com/privacy"},"147":{"id":147,"name":"Adacado Technologies Inc. (DBA Adacado)","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[7,8,9,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.adacado.com/privacy-policy-april-25-2018/"},"130":{"id":130,"name":"NextRoll, Inc.","purposes":[1,2,3,4,5,6,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.nextroll.com/privacy"},"129":{"id":129,"name":"IPONWEB GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.iponweb.com/privacy-policy/"},"128":{"id":128,"name":"BIDSWITCH GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,3],"specialFeatures":[1],"policyUrl":"http://www.bidswitch.com/privacy-policy/"},"168":{"id":168,"name":"EASYmedia GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://login.rtbmarket.com/gdpr"},"164":{"id":164,"name":"Outbrain UK Ltd","purposes":[1],"legIntPurposes":[3,4,5,6,7,8,9,10],"flexiblePurposes":[3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,3],"specialFeatures":[],"policyUrl":"https://www.outbrain.com/legal/privacy#privacy-policy"},"144":{"id":144,"name":"district m inc.","purposes":[1,2,4,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[3],"specialFeatures":[1],"policyUrl":"https://districtm.net/en/page/platforms-data-and-privacy-policy/","overflow":{"httpGetLimit":128}},"163":{"id":163,"name":"Bombora Inc.","purposes":[1,3,8],"legIntPurposes":[7,9,10],"flexiblePurposes":[7,9,10],"specialPurposes":[1],"features":[1,3],"specialFeatures":[],"policyUrl":"https://bombora.com/privacy"},"173":{"id":173,"name":"Yieldmo, Inc.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.yieldmo.com/privacy/"},"88":{"id":88,"name":"TreSensa, Inc.","purposes":[1,3,4],"legIntPurposes":[2,7,10],"flexiblePurposes":[2,3,4,7,10],"specialPurposes":[1,2],"features":[1,3],"specialFeatures":[],"policyUrl":"https://www.tresensa.com/eu-privacy"},"78":{"id":78,"name":"Flashtalking, Inc.","purposes":[1,2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"http://www.flashtalking.com/privacypolicy/"},"59":{"id":59,"name":"Sift Media, Inc","purposes":[2],"legIntPurposes":[],"flexiblePurposes":[2],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.sift.co/privacy"},"114":{"id":114,"name":"Sublime","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"http://ayads.co/privacy.php"},"133":{"id":133,"name":"digitalAudience","purposes":[1,3,5,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2],"specialFeatures":[],"policyUrl":"https://digitalaudience.io/legal/privacy-cookies/"},"14":{"id":14,"name":"Adkernel LLC","purposes":[1,3,4],"legIntPurposes":[2,7,9],"flexiblePurposes":[3,4],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"http://adkernel.com/privacy-policy/","overflow":{"httpGetLimit":32}},"183":{"id":183,"name":"EMX Digital LLC","purposes":[1,3,4,5,6],"legIntPurposes":[2,7,8,9,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://emxdigital.com/privacy/"},"58":{"id":58,"name":"33Across","purposes":[1,2,4,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2],"specialFeatures":[],"policyUrl":"http://www.33across.com/privacy-policy"},"140":{"id":140,"name":"Platform161","purposes":[1,2,3,4,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2,3],"specialFeatures":[1],"policyUrl":"https://platform161.com/cookie-and-privacy-policy/"},"90":{"id":90,"name":"Teroa S.A.","purposes":[1,2,3,4,5,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.e-planning.net/en/privacy.html"},"141":{"id":141,"name":"1020, Inc. dba Placecast and Ericsson Emodo","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.emodoinc.com/privacy-policy/"},"142":{"id":142,"name":"Media.net Advertising FZ-LLC","purposes":[1,3,4],"legIntPurposes":[2,5,6,7,8,9,10],"flexiblePurposes":[5,6,8],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.media.net/en/privacy-policy"},"209":{"id":209,"name":"Delta Projects AB","purposes":[1,2,3,4],"legIntPurposes":[7,10],"flexiblePurposes":[2,7,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://deltaprojects.com/data-collection-policy"},"195":{"id":195,"name":"advanced store GmbH","purposes":[1,3,4],"legIntPurposes":[2],"flexiblePurposes":[2],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://www.advanced-store.com/de/datenschutz/"},"190":{"id":190,"name":"video intelligence AG","purposes":[],"legIntPurposes":[2,7,8,9,10],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.vi.ai/privacy-policy/"},"84":{"id":84,"name":"Semasio GmbH","purposes":[1,3,9,10],"legIntPurposes":[],"flexiblePurposes":[3,9,10],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"http://www.semasio.com/privacy-policy/"},"65":{"id":65,"name":"Location Sciences AI Ltd","purposes":[1,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[7,8],"specialPurposes":[1],"features":[],"specialFeatures":[1],"policyUrl":"https://www.locationsciences.ai/privacy-policy/"},"210":{"id":210,"name":"Zemanta, Inc.","purposes":[1],"legIntPurposes":[3,7,9,10],"flexiblePurposes":[3,7,9,10],"specialPurposes":[1,2],"features":[1],"specialFeatures":[],"policyUrl":"http://www.zemanta.com/legal/privacy"},"200":{"id":200,"name":"Tapjoy, Inc.","purposes":[1],"legIntPurposes":[2,3,4,7],"flexiblePurposes":[2,3,4,7],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.tapjoy.com/legal/#privacy-policy"},"217":{"id":217,"name":"2KDirect, Inc. (dba iPromote)","purposes":[1],"legIntPurposes":[2,3,4,7,9,10],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.ipromote.com/privacy-policy/"},"194":{"id":194,"name":"Rezonence Limited","purposes":[1,3,4,9],"legIntPurposes":[2,7,8,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://rezonence.com/privacy-policy/"},"226":{"id":226,"name":"Publicis Media GmbH","purposes":[1,9],"legIntPurposes":[2,3,4,5,6,7,8,10],"flexiblePurposes":[2,3,4,5,6,7,8,10],"specialPurposes":[],"features":[1],"specialFeatures":[],"policyUrl":"https://www.publicismedia.de/datenschutz/"},"227":{"id":227,"name":"ORTEC B.V.","purposes":[1,2,3,4,5,6,7,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.ortecadscience.com/privacy-policy/"},"205":{"id":205,"name":"Adssets AB","purposes":[1,3,4,5,8,9],"legIntPurposes":[2,7],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"http://adssets.com/policy/"},"179":{"id":179,"name":"Collective Europe Ltd.","purposes":[1,2,3,4,9],"legIntPurposes":[7],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://www.collectiveuk.com/privacy.html","overflow":{"httpGetLimit":128}},"31":{"id":31,"name":"Ogury Ltd.","purposes":[1,3,4,9],"legIntPurposes":[2,7,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2],"specialFeatures":[],"policyUrl":"https://www.ogury.com/privacy-policy/"},"92":{"id":92,"name":"1plusX AG","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,9,10],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.1plusx.com/privacy-policy/"},"155":{"id":155,"name":"AntVoice","purposes":[1,2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://www.antvoice.com/en/privacypolicy/"},"115":{"id":115,"name":"smartclip Europe GmbH","purposes":[1,3,4],"legIntPurposes":[2,7,10],"flexiblePurposes":[2,3,4,7,10],"specialPurposes":[1,2],"features":[2],"specialFeatures":[],"policyUrl":"https://privacy-portal.smartclip.net/","overflow":{"httpGetLimit":32}},"126":{"id":126,"name":"DoubleVerify Inc.\u200b","purposes":[2,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.doubleverify.com/privacy/"},"193":{"id":193,"name":"Mediasmart Mobile S.L.","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"http://mediasmart.io/privacy/"},"213":{"id":213,"name":"emetriq GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[2],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.emetriq.com/datenschutz/"},"244":{"id":244,"name":"Temelio","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://temelio.com/vie-privee"},"224":{"id":224,"name":"adrule mobile GmbH","purposes":[1,2,3,4,5,6,8],"legIntPurposes":[7],"flexiblePurposes":[2,3,4,5,6,7,8],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://www.adrule.net/de/datenschutz/"},"174":{"id":174,"name":"A Million Ads Ltd","purposes":[2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[1],"policyUrl":"https://www.amillionads.com/privacy-policy"},"192":{"id":192,"name":"remerge GmbH","purposes":[1,2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://remerge.io/privacy-policy.html"},"256":{"id":256,"name":"Bounce Exchange, Inc","purposes":[1],"legIntPurposes":[7,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.bouncex.com/privacy/"},"234":{"id":234,"name":"ZBO Media","purposes":[1,3,4,9],"legIntPurposes":[2,7,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1],"specialFeatures":[],"policyUrl":"https://zbo.media/mentions-legales/politique-de-confidentialite-service-publicitaire/"},"246":{"id":246,"name":"Smartology Limited","purposes":[1,3,4,8],"legIntPurposes":[2,7],"flexiblePurposes":[2,7],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.smartology.net/privacy-policy/"},"241":{"id":241,"name":"OneTag Limited","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[7],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.onetag.com/privacy/"},"254":{"id":254,"name":"LiquidM Technology GmbH","purposes":[1,2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://liquidm.com/privacy-policy/"},"215":{"id":215,"name":"ARMIS SAS","purposes":[1,2,7],"legIntPurposes":[10],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://armis.tech/en/armis-personal-data-privacy-policy/"},"167":{"id":167,"name":"Audiens S.r.l.","purposes":[1,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"http://www.audiens.com/privacy"},"240":{"id":240,"name":"7Hops.com Inc. (ZergNet)","purposes":[1],"legIntPurposes":[5,6,8,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://zergnet.com/privacy"},"235":{"id":235,"name":"Bucksense Inc","purposes":[2,3,4,7,9],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,9],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"http://www.bucksense.com/platform-privacy-policy/"},"185":{"id":185,"name":"Bidtellect, Inc","purposes":[1,2,3,4,7,8],"legIntPurposes":[9,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.bidtellect.com/privacy-policy/","overflow":{"httpGetLimit":128}},"211":{"id":211,"name":"AdTheorent, Inc","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"http://adtheorent.com/privacy-policy"},"273":{"id":273,"name":"Bannerflow AB","purposes":[1,4],"legIntPurposes":[2,7],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.bannerflow.com/privacy "},"104":{"id":104,"name":"Sonobi, Inc","purposes":[1,2,3,4],"legIntPurposes":[7,8],"flexiblePurposes":[],"specialPurposes":[2],"features":[1],"specialFeatures":[],"policyUrl":"http://sonobi.com/privacy-policy/"},"162":{"id":162,"name":"Unruly Group Ltd","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://unruly.co/privacy/"},"249":{"id":249,"name":"Spolecznosci Sp. z o.o. Sp. k.","purposes":[1,2,3,4,5,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,7,8,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.spolecznosci.pl/polityka-prywatnosci"},"160":{"id":160,"name":"Netsprint SA","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://netsprint.eu/privacy.html","overflow":{"httpGetLimit":32}},"279":{"id":279,"name":"Mirando GmbH & Co KG","purposes":[1],"legIntPurposes":[2,7],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://wwwmirando.de/datenschutz/"},"255":{"id":255,"name":"Onnetwork Sp. z o.o.","purposes":[1,5,6],"legIntPurposes":[2,7,8],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://www.onnetwork.tv/pp_services.php"},"203":{"id":203,"name":"Revcontent, LLC","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,9,10],"flexiblePurposes":[2,3,4,5,6],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://intercom.help/revcontent2/en/articles/2290675-revcontent-s-privacy-policy"},"274":{"id":274,"name":"Golden Bees","purposes":[1,2,3,4,6,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2],"specialFeatures":[],"policyUrl":"https://www.goldenbees.fr/en/privacy-charter/","overflow":{"httpGetLimit":128}},"280":{"id":280,"name":"Spot.IM LTD","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,9,10],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.spot.im/privacy/"},"239":{"id":239,"name":"Triton Digital Canada Inc.","purposes":[1,3,4,5,6],"legIntPurposes":[2,7,8,9,10],"flexiblePurposes":[2,7,8,9,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.tritondigital.com/privacy-policies"},"177":{"id":177,"name":"plista GmbH","purposes":[1],"legIntPurposes":[7,8,10],"flexiblePurposes":[7,8,10],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://www.plista.com/about/privacy/"},"150":{"id":150,"name":"Inskin Media LTD","purposes":[1,3,4,9,10],"legIntPurposes":[2,7],"flexiblePurposes":[2,7],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"http://www.inskinmedia.com/privacy-policy.html"},"252":{"id":252,"name":"Jaduda GmbH","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,9,10],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.jadudamobile.com/datenschutzerklaerung/"},"248":{"id":248,"name":"Converge-Digital","purposes":[1],"legIntPurposes":[2],"flexiblePurposes":[2],"specialPurposes":[],"features":[3],"specialFeatures":[],"policyUrl":"https://converge-digital.com/privacy-policy/","overflow":{"httpGetLimit":32}},"161":{"id":161,"name":"Smadex SL","purposes":[1,2,3,4,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"http://smadex.com/end-user-privacy-policy/"},"285":{"id":285,"name":"Comcast International France SAS","purposes":[1],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.freewheel.com/privacy-policy"},"228":{"id":228,"name":"McCann Discipline LTD","purposes":[1,2,5,6,7,8],"legIntPurposes":[],"flexiblePurposes":[2,5,6,7,8],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.primis.tech/privacy-policy/"},"299":{"id":299,"name":"AdClear GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[2],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.adclear.de/datenschutzerklaerung/"},"277":{"id":277,"name":"Codewise VL Sp. z o.o. Sp. k","purposes":[1,2,3,4,7,9],"legIntPurposes":[10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://voluumdsp.com/end-user-privacy-policy/"},"259":{"id":259,"name":"ADYOULIKE SA","purposes":[1,3,4],"legIntPurposes":[2,7,8],"flexiblePurposes":[8],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.adyoulike.com/privacy_policy.php"},"289":{"id":289,"name":"mobalo GmbH","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1],"specialFeatures":[1],"policyUrl":"https://www.mobalo.com/en/privacy/"},"272":{"id":272,"name":"A.Mob","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.we-are-adot.com/privacy-policy/"},"253":{"id":253,"name":"Improve Digital BV","purposes":[1,3,4,9],"legIntPurposes":[2,7,10],"flexiblePurposes":[2,7,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.improvedigital.com/platform-privacy-policy","overflow":{"httpGetLimit":128}},"304":{"id":304,"name":"On Device Research Limited","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://s.on-device.com/privacyPolicy"},"314":{"id":314,"name":"Keymantics","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.keymantics.com/assets/privacy-policy.pdf"},"317":{"id":317,"name":"mainADV Srl","purposes":[1,2,3,4,5,6,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://www.mainad.com/privacy-policy/"},"278":{"id":278,"name":"Integral Ad Science, Inc.","purposes":[],"legIntPurposes":[7,10],"flexiblePurposes":[],"specialPurposes":[1],"features":[],"specialFeatures":[],"policyUrl":"https://integralads.com/privacy-policy/"},"315":{"id":315,"name":"Celtra, Inc.","purposes":[1,2,4,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://www.celtra.com/privacy-policy/"},"165":{"id":165,"name":"SpotX, Inc.","purposes":[1,3,4],"legIntPurposes":[2,7,9,10],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.spotx.tv/privacy-policy/","overflow":{"httpGetLimit":32}},"47":{"id":47,"name":"ADMAN - Phaistos Networks, S.A.","purposes":[1,2,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://www.adman.gr/privacy"},"134":{"id":134,"name":"SMARTSTREAM.TV GmbH","purposes":[1],"legIntPurposes":[2,3,4,7,9,10],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.smartstream.tv/en/productprivacy","overflow":{"httpGetLimit":32}},"325":{"id":325,"name":"Knorex","purposes":[1,2,3,4,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.knorex.com/privacy"},"316":{"id":316,"name":"Gamned","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"https://www.gamned.com/privacy-policy/"},"318":{"id":318,"name":"Accorp Sp. z o.o.","purposes":[1,3,4,9],"legIntPurposes":[7,10],"flexiblePurposes":[],"specialPurposes":[],"features":[2],"specialFeatures":[],"policyUrl":"http://www.instytut-pollster.pl/privacy-policy/"},"199":{"id":199,"name":"ADUX","purposes":[1,2,3,4,6,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[1],"policyUrl":"https://www.adux.com/donnees-personelles/"},"294":{"id":294,"name":"Jivox Corporation","purposes":[1,2,3,4,5,7],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,7],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.jivox.com/privacy","overflow":{"httpGetLimit":32}},"143":{"id":143,"name":"Connatix Native Exchange Inc.","purposes":[1,2,4,6,7,8,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[],"policyUrl":"https://connatix.com/privacy-policy/"},"297":{"id":297,"name":"Polar Mobile Group Inc.","purposes":[1,3,4],"legIntPurposes":[2,7,8,10],"flexiblePurposes":[2,7,8,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://privacy.polar.me"},"319":{"id":319,"name":"Clipcentric, Inc.","purposes":[1],"legIntPurposes":[2,7,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://clipcentric.com/privacy.bhtml"},"290":{"id":290,"name":"Readpeak Oy","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"http://readpeak.com/privacy-policy/"},"323":{"id":323,"name":"DAZN Media Services Limited","purposes":[1,3,4,7],"legIntPurposes":[2,8,10],"flexiblePurposes":[8,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.goal.com/en-gb/legal/privacy-policy"},"119":{"id":119,"name":"Fusio by S4M","purposes":[1,3,4,10],"legIntPurposes":[],"flexiblePurposes":[3,4,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"http://www.s4m.io/privacy-policy/"},"302":{"id":302,"name":"Mobile Professionals BV","purposes":[1,2,3,4,5,7,8,9],"legIntPurposes":[],"flexiblePurposes":[3,5,7,8],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"https://mobpro.com/privacy.html"},"212":{"id":212,"name":"usemax advertisement (Emego GmbH)","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,9,10],"flexiblePurposes":[2,3,4,5,6,7,8],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://www.usemax.de/?l=privacy"},"264":{"id":264,"name":"Adobe Advertising Cloud","purposes":[1,2,3,4,10],"legIntPurposes":[7],"flexiblePurposes":[2],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.adobe.com/privacy/experience-cloud.html"},"44":{"id":44,"name":"The ADEX GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://theadex.com/privacy-opt-out/"},"282":{"id":282,"name":"Welect GmbH","purposes":[10],"legIntPurposes":[2,7],"flexiblePurposes":[2],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://www.welect.de/datenschutz"},"238":{"id":238,"name":"StackAdapt","purposes":[1,2,3,4],"legIntPurposes":[7,9,10],"flexiblePurposes":[],"specialPurposes":[2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://www.stackadapt.com/privacy"},"284":{"id":284,"name":"WEBORAMA","purposes":[1,3,4],"legIntPurposes":[2,5,6,7,8,9,10],"flexiblePurposes":[2,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://weborama.com/privacy_en/"},"301":{"id":301,"name":"zeotap GmbH","purposes":[1,3,4,5,6,7,9,10],"legIntPurposes":[],"flexiblePurposes":[3,4,5,6,7,9,10],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://zeotap.com/privacy_policy"},"275":{"id":275,"name":"TabMo SAS","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"http://static.tabmo.io.s3.amazonaws.com/privacy-policy/index.html"},"310":{"id":310,"name":"Adevinta Spain S.L.U.","purposes":[1,2,3,4,9],"legIntPurposes":[7,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.adevinta.com/about/privacy/"},"139":{"id":139,"name":"Permodo GmbH","purposes":[1,2,7,8,10],"legIntPurposes":[],"flexiblePurposes":[2,7,8,10],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://permodo.com/de/privacy.html","overflow":{"httpGetLimit":32}},"262":{"id":262,"name":"Fyber ","purposes":[1,2,3,4,5,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.fyber.com/legal/privacy-policy/"},"331":{"id":331,"name":"ad6media","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,10],"flexiblePurposes":[2,3,4,5,6],"specialPurposes":[1,2],"features":[2,3],"specialFeatures":[1,2],"policyUrl":"https://www.ad6media.fr/privacy"},"345":{"id":345,"name":"The Kantar Group Limited","purposes":[1,2,3,4,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,8,9,10],"specialPurposes":[2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"http://www.kantar.com/cookies-policies"},"270":{"id":270,"name":"Marfeel Solutions, SL","purposes":[1],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.marfeel.com/privacy-policy/"},"333":{"id":333,"name":"InMobi Pte Ltd","purposes":[1,2,3,4,9,10],"legIntPurposes":[],"flexiblePurposes":[9],"specialPurposes":[1],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.inmobi.com/privacy-policy-for-eea"},"202":{"id":202,"name":"Telaria, Inc","purposes":[1,2,3,4,5,6],"legIntPurposes":[7,8,9,10],"flexiblePurposes":[5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://telaria.com/privacy-policy/"},"328":{"id":328,"name":"Gemius SA","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[],"policyUrl":"https://www.gemius.com/cookie-policy.html"},"281":{"id":281,"name":"Wizaly","purposes":[1,7,8,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.wizaly.com/terms-of-use#privacy-policy"},"354":{"id":354,"name":"Apester Ltd","purposes":[2,4],"legIntPurposes":[6,7,8,9,10],"flexiblePurposes":[7],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://apester.com/privacy-policy/"},"359":{"id":359,"name":"AerServ LLC","purposes":[1,2,3,4,9,10],"legIntPurposes":[],"flexiblePurposes":[9],"specialPurposes":[1],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.inmobi.com/privacy-policy-for-eea"},"265":{"id":265,"name":"Instinctive, Inc.","purposes":[1,2,3,4,5,6,7,8],"legIntPurposes":[9,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://instinctive.io/privacy"},"303":{"id":303,"name":"Orion Semantics","purposes":[1,2,3,4,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"http://static.orion-semantics.com/privacy.html"},"83":{"id":83,"name":"Visarity Technologies GmbH","purposes":[2,6,7,8],"legIntPurposes":[],"flexiblePurposes":[2],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://primo.design/docs/PrivacyPolicyPrimo.html"},"343":{"id":343,"name":"DIGITEKA Technologies","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,9,10],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,3],"specialFeatures":[1],"policyUrl":"https://www.ultimedia.com/POLICY.html"},"231":{"id":231,"name":"AcuityAds Inc.","purposes":[1,3,4],"legIntPurposes":[2,7,8,10],"flexiblePurposes":[3,4],"specialPurposes":[1,2],"features":[2],"specialFeatures":[],"policyUrl":"https://privacy.acuityads.com/corporate-privacy-policy.html","overflow":{"httpGetLimit":128}},"216":{"id":216,"name":"Mindlytix SAS","purposes":[1,2,3,5,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1],"features":[1,2],"specialFeatures":[],"policyUrl":"http://mindlytix.com/privacy/"},"360":{"id":360,"name":"Permutive Technologies, Inc.","purposes":[1],"legIntPurposes":[3,5,7,8,9],"flexiblePurposes":[3,5,7,8,9],"specialPurposes":[],"features":[1,2],"specialFeatures":[],"policyUrl":"https://permutive.com/privacy/"},"361":{"id":361,"name":"Permutive Limited","purposes":[1],"legIntPurposes":[3,5,7,8,9],"flexiblePurposes":[3,5,7,8,9],"specialPurposes":[],"features":[1,2],"specialFeatures":[],"policyUrl":"https://permutive.com/privacy/"},"311":{"id":311,"name":"Mobfox US LLC","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://www.mobfox.com/privacy-policy/"},"358":{"id":358,"name":"MGID Inc.","purposes":[2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.mgid.com/privacy-policy"},"152":{"id":152,"name":"Meetrics GmbH","purposes":[1,9],"legIntPurposes":[7],"flexiblePurposes":[7],"specialPurposes":[1],"features":[],"specialFeatures":[],"policyUrl":"https://www.meetrics.com/en/data-privacy/"},"251":{"id":251,"name":"Yieldlove GmbH","purposes":[1],"legIntPurposes":[2,7,10],"flexiblePurposes":[2,7,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://www.yieldlove.com/cookie-policy"},"371":{"id":371,"name":"Seeding Alliance GmbH","purposes":[1,3,4,5,6],"legIntPurposes":[2,7,8,10],"flexiblePurposes":[2,7,8,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://seeding-alliance.de/datenschutz/"},"347":{"id":347,"name":"Ezoic Inc.","purposes":[1,7,8,9],"legIntPurposes":[6,10],"flexiblePurposes":[6,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.ezoic.com/terms/"},"218":{"id":218,"name":"Bigabid Media ltd","purposes":[1,3,4],"legIntPurposes":[2,5,6,7,8,9,10],"flexiblePurposes":[],"specialPurposes":[1],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.bigabid.com/privacy-policy"},"350":{"id":350,"name":"Free Stream Media Corp. dba Samba TV","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://samba.tv/legal/privacy-policy/","overflow":{"httpGetLimit":128}},"351":{"id":351,"name":"Samba TV UK Limited","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://samba.tv/legal/privacy-policy/","overflow":{"httpGetLimit":128}},"380":{"id":380,"name":"Vidoomy Media SL","purposes":[2,3,4,5,6,7,8],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"http://vidoomy.com/privacy-policy.html"},"184":{"id":184,"name":"mediarithmics SAS","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,7],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.mediarithmics.com/en-us/content/privacy-policy"},"368":{"id":368,"name":"VECTAURY","purposes":[1,2,3,4,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.vectaury.io/en/personal-data"},"373":{"id":373,"name":"Nielsen Marketing Cloud","purposes":[1,3,5],"legIntPurposes":[7,8,9,10],"flexiblePurposes":[],"specialPurposes":[1],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"http://www.nielsen.com/us/en/privacy-statement/exelate-privacy-policy.html"},"388":{"id":388,"name":"numberly","purposes":[1,3,4,5,6,9],"legIntPurposes":[2,7,8,10],"flexiblePurposes":[2,7,8,10],"specialPurposes":[1],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://numberly.com/en/privacy/"},"250":{"id":250,"name":"Qriously Ltd","purposes":[2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://www.brandwatch.com/legal/qriously-privacy-notice/"},"223":{"id":223,"name":"Audience Trading Platform Ltd.","purposes":[1],"legIntPurposes":[7,8],"flexiblePurposes":[7,8],"specialPurposes":[],"features":[2],"specialFeatures":[],"policyUrl":"https://atp.io/privacy-policy"},"384":{"id":384,"name":"Pixalate, Inc.","purposes":[],"legIntPurposes":[7,8,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1,2],"policyUrl":"https://pixalate.com/privacypolicy/"},"387":{"id":387,"name":"Triapodi Ltd.","purposes":[2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[],"policyUrl":"https://appreciate.mobi/page.html#/end-user-privacy-policy"},"312":{"id":312,"name":"Exactag GmbH","purposes":[1,3,7,8],"legIntPurposes":[],"flexiblePurposes":[3,7,8],"specialPurposes":[1],"features":[2],"specialFeatures":[],"policyUrl":"https://www.exactag.com/en/data-privacy/","overflow":{"httpGetLimit":128}},"178":{"id":178,"name":"Hybrid Theory","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[7,8,9,10],"specialPurposes":[1],"features":[],"specialFeatures":[],"policyUrl":"https://hybridtheory.com/privacy-policy/"},"377":{"id":377,"name":"AddApptr GmbH","purposes":[1],"legIntPurposes":[7,10],"flexiblePurposes":[7,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://www.addapptr.com/data-privacy"},"382":{"id":382,"name":"The Reach Group GmbH","purposes":[1,3,4,5,6,9],"legIntPurposes":[2,7,8],"flexiblePurposes":[2,3,4,5,6,7,8,9],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://trg.de/en/privacy-statement/","overflow":{"httpGetLimit":128}},"206":{"id":206,"name":"Hybrid Adtech GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://hybrid.ai/data_protection_policy"},"385":{"id":385,"name":"Oracle Data Cloud","purposes":[1,3,5,9,10],"legIntPurposes":[7],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.oracle.com/legal/privacy/marketing-cloud-data-cloud-privacy-policy.html"},"242":{"id":242,"name":"twiago GmbH","purposes":[1,2,3,4,7,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.twiago.com/datenschutz/","overflow":{"httpGetLimit":32}},"402":{"id":402,"name":"Effiliation","purposes":[1,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://inter.effiliation.com/politique-confidentialite.html"},"413":{"id":413,"name":"Eulerian Technologies","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.eulerian.com/en/privacy/"},"415":{"id":415,"name":"Seenthis AB","purposes":[],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://seenthis.co/privacy-notice-2018-04-18.pdf"},"263":{"id":263,"name":"Nativo, Inc.","purposes":[1,3,4],"legIntPurposes":[2,7,9,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2],"specialFeatures":[],"policyUrl":"https://www.nativo.com/interest-based-ads"},"329":{"id":329,"name":"Browsi Mobile Ltd","purposes":[1,7,8],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://gobrowsi.com/browsi-privacy-policy/"},"337":{"id":337,"name":"SheMedia, LLC","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2,3],"specialFeatures":[],"policyUrl":"https://www.shemedia.com/ad-services-privacy-policy"},"422":{"id":422,"name":"Brand Metrics Sweden AB","purposes":[1,6,7,8,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://collector.brandmetrics.com/brandmetrics_privacypolicy.pdf"},"394":{"id":394,"name":"AudienceProject Aps","purposes":[1,3,4,5,6],"legIntPurposes":[2,7,8,9,10],"flexiblePurposes":[2,7,8,9],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[],"policyUrl":"https://privacy.audienceproject.com"},"243":{"id":243,"name":"Cloud Technologies S.A.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.cloudtechnologies.pl/en/internet-advertising-privacy-policy"},"416":{"id":416,"name":"Commanders Act","purposes":[1,2,3,4,5,6,7,8,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.commandersact.com/en/privacy/"},"434":{"id":434,"name":"DynAdmic","purposes":[1,2,4,7],"legIntPurposes":[3,6,8],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,3],"specialFeatures":[1],"policyUrl":"http://eu.dynadmic.com/privacy-policy/"},"435":{"id":435,"name":"SINGLESPOT SAS ","purposes":[1,3,4,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.singlespot.com/privacy_policy?locale=fr"},"409":{"id":409,"name":"Arrivalist Co.","purposes":[1,9],"legIntPurposes":[7,8],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.arrivalist.com/privacy"},"436":{"id":436,"name":"INVIBES GROUP","purposes":[1,3,4,5,6,9],"legIntPurposes":[2,7,8,10],"flexiblePurposes":[2,7,8,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"http://www.invibes.com/terms"},"418":{"id":418,"name":"PROXISTORE","purposes":[1,2,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2],"specialFeatures":[1,2],"policyUrl":"https://www.proxistore.com/common/en/cgv"},"429":{"id":429,"name":"Signals","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://signalsdata.com/platform-cookie-policy/"},"374":{"id":374,"name":"Bmind a Sales Maker Company, S.L.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[],"policyUrl":"http://www.bmind.es/legal-notice/"},"438":{"id":438,"name":"INVIDI technologies AB","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[],"features":[1,2],"specialFeatures":[],"policyUrl":"http://www.invidi.com/wp-content/uploads/2020/02/ad-tech-services-privacy-policy.pdf"},"450":{"id":450,"name":"Neodata Group srl","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.neodatagroup.com/en/security-policy","overflow":{"httpGetLimit":32}},"444":{"id":444,"name":"Playbuzz Ltd (aka EX.CO)","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,9,10],"flexiblePurposes":[2,3,5,6],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://ex.co/privacy-policy/"},"412":{"id":412,"name":"Cxense ASA","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.cxense.com/about-us/privacy-policy"},"455":{"id":455,"name":"GDMServices, Inc. d/b/a FiksuDSP","purposes":[1,2,3,4,10],"legIntPurposes":[7,8],"flexiblePurposes":[2,3,4,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://fiksu.com/privacy-policy/"},"423":{"id":423,"name":"travel audience GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://travelaudience.com/product-privacy-policy/"},"381":{"id":381,"name":"Solocal","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://frontend.adhslx.com/privacy.html?"},"365":{"id":365,"name":"Forensiq LLC","purposes":[],"legIntPurposes":[7],"flexiblePurposes":[],"specialPurposes":[1],"features":[1,3],"specialFeatures":[1],"policyUrl":"https://impact.com/privacy-policy/"},"447":{"id":447,"name":"Adludio Ltd","purposes":[2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1],"specialFeatures":[1],"policyUrl":"https://www.adludio.com/privacy-policy/"},"410":{"id":410,"name":"Adtelligent Inc.","purposes":[1,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://adtelligent.com/privacy-policy/"},"137":{"id":137,"name":"Str\u00f6er SSP GmbH (DSP)","purposes":[1],"legIntPurposes":[2,3,4,7,9,10],"flexiblePurposes":[2,3,4,9],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://www.stroeer.de/fileadmin/de/Konvergenz_und_Konzepte/Daten_und_Technologien/Stroeer_SSP/Downloads/Datenschutz_Stroeer_SSP.pdf"},"466":{"id":466,"name":"TACTIC\u2122 Real-Time Marketing AS","purposes":[],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://tacticrealtime.com/privacy/"},"431":{"id":431,"name":"White Ops, Inc.","purposes":[],"legIntPurposes":[7,9,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,3],"specialFeatures":[2],"policyUrl":"https://www.whiteops.com/privacy"},"336":{"id":336,"name":"Telecoming S.A.","purposes":[2,4],"legIntPurposes":[7,9],"flexiblePurposes":[2,4],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://www.telecoming.com/privacy-policy/","overflow":{"httpGetLimit":128}},"440":{"id":440,"name":"DEFINE MEDIA GMBH","purposes":[1,4],"legIntPurposes":[2,7,9,10],"flexiblePurposes":[2,7,9,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://www.definemedia.de/datenschutz-conative/"},"375":{"id":375,"name":"Affle International","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"https://affle.com/privacy-policy "},"475":{"id":475,"name":"TAPTAP Digital SL","purposes":[1,2,3,4,5,6,7],"legIntPurposes":[8,10],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"http://www.taptapnetworks.com/privacy_policy/"},"448":{"id":448,"name":"Targetspot Belgium SPRL","purposes":[1,2,3,4,7,9],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,9],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"http://marketing.targetspot.com/Targetspot/Legal/TargetSpot%20Privacy%20Policy%20-%20June%202018.pdf","overflow":{"httpGetLimit":128}},"428":{"id":428,"name":"Internet BillBoard a.s.","purposes":[1],"legIntPurposes":[2,3,4,7],"flexiblePurposes":[2,3,4],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://www.ibillboard.com/en/privacy-information/"},"486":{"id":486,"name":"Madington","purposes":[1],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://delivered-by-madington.com/dat-privacy-policy/"},"468":{"id":468,"name":"NeuStar, Inc.","purposes":[1],"legIntPurposes":[3,7,8,9,10],"flexiblePurposes":[7,8,9,10],"specialPurposes":[1],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.home.neustar/privacy"},"293":{"id":293,"name":"SpringServe, LLC","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1],"features":[3],"specialFeatures":[2],"policyUrl":"https://springserve.com/privacy-policy/"},"484":{"id":484,"name":"STRIATUM SAS","purposes":[],"legIntPurposes":[7,10],"flexiblePurposes":[],"specialPurposes":[1],"features":[],"specialFeatures":[],"policyUrl":"https://adledge.com/data-privacy/"},"493":{"id":493,"name":"Carbon (AI) Limited","purposes":[1,2,3,4,5,6,7,8,10],"legIntPurposes":[],"flexiblePurposes":[2,7,8],"specialPurposes":[2],"features":[1,2,3],"specialFeatures":[2],"policyUrl":"https://carbonrmp.com/privacy.html"},"495":{"id":495,"name":"Arcspire Limited","purposes":[2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"https://public.arcspire.io/privacy.pdf","overflow":{"httpGetLimit":128}},"424":{"id":424,"name":"KUPONA GmbH","purposes":[4,7],"legIntPurposes":[],"flexiblePurposes":[4],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.kupona.de/dsgvo/"},"408":{"id":408,"name":"Fidelity Media","purposes":[1,2,7],"legIntPurposes":[],"flexiblePurposes":[2,7],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://fidelity-media.com/privacy-policy/"},"467":{"id":467,"name":"Haensel AMS GmbH","purposes":[1],"legIntPurposes":[7],"flexiblePurposes":[7],"specialPurposes":[],"features":[2],"specialFeatures":[],"policyUrl":"https://haensel-ams.com/data-privacy/"},"488":{"id":488,"name":"Opinary GmbH","purposes":[1],"legIntPurposes":[2,7,8,10],"flexiblePurposes":[2,7,8,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://opinary.com/privacy-policy/"},"490":{"id":490,"name":"PLAYGROUND XYZ EMEA LTD","purposes":[1,2,3,4,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://playground.xyz/privacy"},"491":{"id":491,"name":"Triboo Data Analytics","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.shinystat.com/it/informativa_privacy_generale.html"},"502":{"id":502,"name":"NEXD","purposes":[1,7,10],"legIntPurposes":[9],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://nexd.com/privacy-policy","overflow":{"httpGetLimit":128}},"508":{"id":508,"name":"Lucid Holdings, LLC","purposes":[1,7,8,9],"legIntPurposes":[],"flexiblePurposes":[7,8,9],"specialPurposes":[1],"features":[1,2,3],"specialFeatures":[],"policyUrl":"luc.id/privacy-policy"},"512":{"id":512,"name":"PubNative GmbH","purposes":[1,2,3,4,7,8,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[2],"policyUrl":"https://pubnative.net/privacy-notice/"},"516":{"id":516,"name":"Pexi B.V.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://pexi.nl/privacy-policy/"},"507":{"id":507,"name":"AdsWizz Inc.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.adswizz.com/our-privacy-policy/"},"482":{"id":482,"name":"UberMedia, Inc.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://ubermedia.com/summary-of-privacy-policy/"},"505":{"id":505,"name":"Shopalyst Inc","purposes":[1,7,8],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"https://www.shortlyst.com/eu/privacy_terms.html"},"517":{"id":517,"name":"SunMedia ","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.sunmedia.tv/en/cookies"},"511":{"id":511,"name":"Admixer EU GmbH","purposes":[1,2,3,4,5,7,9],"legIntPurposes":[10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://admixer.com/privacy/","overflow":{"httpGetLimit":128}},"479":{"id":479,"name":"INFINIA MOBILE S.L.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"http://www.infiniamobile.com/privacy_policy"},"509":{"id":509,"name":"ATG Ad Tech Group GmbH","purposes":[2,7],"legIntPurposes":[],"flexiblePurposes":[2,7],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://ad-tech-group.com/privacy-policy/"},"521":{"id":521,"name":"netzeffekt GmbH","purposes":[1,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"https://www.netzeffekt.de/en/imprint"},"524":{"id":524,"name":"The Ozone Project Limited","purposes":[1,2,3,4,5,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2,3],"specialFeatures":[1],"policyUrl":"https://ozoneproject.com/privacy-policy"},"528":{"id":528,"name":"Kayzen","purposes":[1,2,3,4,9,10],"legIntPurposes":[7],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1],"specialFeatures":[],"policyUrl":"https://kayzen.io/data-privacy-policy"},"527":{"id":527,"name":"Jampp LTD","purposes":[1,2,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://jampp.com/privacy.html"},"535":{"id":535,"name":"INNITY","purposes":[1,2,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.innity.com/privacy-policy.php"},"530":{"id":530,"name":"Near Pte Ltd","purposes":[1,2,3,4,5,6,7,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,9,10],"specialPurposes":[],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://near.co/privacy","overflow":{"httpGetLimit":128}},"539":{"id":539,"name":"AdDefend GmbH","purposes":[1],"legIntPurposes":[2,3,4,7],"flexiblePurposes":[2,3,4,7],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.addefend.com/en/privacy-policy/"},"501":{"id":501,"name":"Alliance Gravity Data Media","purposes":[1,2,3,4,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.alliancegravity.com/politiquedeprotectiondesdonneespersonnelles"},"531":{"id":531,"name":"Smartclip Hispania SL","purposes":[1,2,3,4,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2,3],"specialFeatures":[1],"policyUrl":"http://rgpd-smartclip.com/"},"536":{"id":536,"name":"GlobalWebIndex","purposes":[1,7,8,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"http://legal.trendstream.net/non-panellist_privacy_policy"},"544":{"id":544,"name":"Kochava Inc.","purposes":[],"legIntPurposes":[7],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.kochava.com/support-privacy/"},"543":{"id":543,"name":"PaperG, Inc. dba Thunder Industries","purposes":[1,3,4,5,6],"legIntPurposes":[2,7,8],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.makethunder.com/privacy"},"546":{"id":546,"name":"Smart Traffik","purposes":[1,8],"legIntPurposes":[7],"flexiblePurposes":[7,8],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://okube-attribution.com/politique-de-confidentialite/"},"545":{"id":545,"name":"Reignn Platform Ltd","purposes":[1,2,3,4,7,8,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[2],"policyUrl":"http://reignn.com/user-privacy-policy"},"439":{"id":439,"name":"Bit Q Holdings Limited","purposes":[1,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.rippll.com/privacy"},"553":{"id":553,"name":"Adhese","purposes":[1,2,3,4,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://adhese.com/privacy-and-cookie-policy"},"556":{"id":556,"name":"adhood.com","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"http://v3.adhood.com/en/site/politikavekurallar/gizlilik.php?lang=en"},"550":{"id":550,"name":"Happydemics","purposes":[7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,3],"specialFeatures":[],"policyUrl":"https://www.iubenda.com/privacy-policy/69056167/full-legal"},"554":{"id":554,"name":"RMSi Radio Marketing Service interactive GmbH","purposes":[1,3,4],"legIntPurposes":[2,7,9],"flexiblePurposes":[2],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.rms.de/datenschutz/"},"498":{"id":498,"name":"Mediakeys Platform","purposes":[1,6,10],"legIntPurposes":[2,3,4,7,9],"flexiblePurposes":[2,3,4,9],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://drbanner.com/privacypolicy_en/"},"565":{"id":565,"name":"Adobe Audience Manager","purposes":[1,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1],"features":[],"specialFeatures":[],"policyUrl":"https://www.adobe.com/privacy/policy.html"},"571":{"id":571,"name":"ViewPay","purposes":[1,2,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,4,5,6,7,8,9,10],"specialPurposes":[],"features":[3],"specialFeatures":[],"policyUrl":"http://viewpay.tv/mentions-legales/"},"568":{"id":568,"name":"Jointag S.r.l.","purposes":[1,2,3,4,5,6,7,8],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1,2],"policyUrl":"https://www.jointag.com/privacy/kariboo/publisher/third/"},"570":{"id":570,"name":"Czech Publisher Exchange z.s.p.o.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.cpex.cz/pro-uzivatele/ochrana-soukromi/"},"559":{"id":559,"name":"Otto (GmbH & Co KG)","purposes":[1],"legIntPurposes":[2,3,4,7,9,10],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.otto.de/shoppages/service/datenschutz"},"569":{"id":569,"name":"Kairos Fire","purposes":[1,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"https://www.kairosfire.com/privacy"},"577":{"id":577,"name":"Neustar on behalf of The Procter & Gamble Company","purposes":[1,2,3,4,6,9],"legIntPurposes":[5,7,8],"flexiblePurposes":[2,3,4,5,6,7,8,9],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.pg.com/privacy/english/privacy_statement.shtml"},"590":{"id":590,"name":"Sourcepoint Technologies, Inc.","purposes":[],"legIntPurposes":[6,8],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.sourcepoint.com/privacy-policy"},"587":{"id":587,"name":"Localsensor B.V.","purposes":[1,2,3,4,7,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.localsensor.com/privacy.html"},"580":{"id":580,"name":"Goldbach Group AG","purposes":[1],"legIntPurposes":[2,3,4,7,8,9,10],"flexiblePurposes":[2,3,4,7,8,9,10],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://goldbach.com/ch/de/datenschutz"},"593":{"id":593,"name":"Programatica de publicidad S.L.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://datmean.com/politica-privacidad/"},"574":{"id":574,"name":"Realeyes OU","purposes":[1,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1],"specialFeatures":[],"policyUrl":"https://realview.realeyesit.com/privacy"},"598":{"id":598,"name":"audio content & control GmbH","purposes":[1],"legIntPurposes":[2,7,9],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://www.audio-cc.com/audiocc_privacy_policy.pdf"},"596":{"id":596,"name":"InsurAds Technologies SA.","purposes":[1,2,3,4,5,6,9,10],"legIntPurposes":[7,8],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://www.insurads.com/privacy.html"},"549":{"id":549,"name":"Bandsintown Amplified LLC","purposes":[2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"http://corp.bandsintown.com/privacy"},"584":{"id":584,"name":"Dynamic 1001 GmbH","purposes":[1,7,10],"legIntPurposes":[],"flexiblePurposes":[7,10],"specialPurposes":[2],"features":[3],"specialFeatures":[2],"policyUrl":"https://dynamic-tracking.com/Datenschutz.aspx"},"601":{"id":601,"name":"WebAds B.V","purposes":[1,2],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://privacy.webads.eu/"},"599":{"id":599,"name":"Maximus Live LLC","purposes":[],"legIntPurposes":[7,8],"flexiblePurposes":[],"specialPurposes":[1],"features":[],"specialFeatures":[1],"policyUrl":"https://maximusx.com/privacy-policy/"},"606":{"id":606,"name":"Impactify ","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://impactify.io/privacy-policy/"},"602":{"id":602,"name":"Online Solution Int Limited","purposes":[1,2,3,4,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,8,9,10],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://adsafety.net/privacy.html","overflow":{"httpGetLimit":32}},"612":{"id":612,"name":"Adnami Aps","purposes":[],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"www.adnami.io/privacy"},"591":{"id":591,"name":"Consumable, Inc.","purposes":[1,2,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"http://consumable.com/privacy-policy.html"},"614":{"id":614,"name":"Market Resource Partners LLC","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[2],"policyUrl":"https://www.mrpfd.com/privacy-policy/"},"615":{"id":615,"name":"Adsolutions BV","purposes":[],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.adsolutions.com/privacy-policy/"},"607":{"id":607,"name":"ucfunnel Co., Ltd.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2,3],"specialFeatures":[1],"policyUrl":"https://www.ucfunnel.com/privacy-policy"},"609":{"id":609,"name":"Predicio","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"http://www.predic.io/privacy","overflow":{"httpGetLimit":128}},"617":{"id":617,"name":"Onfocus (Adagio)","purposes":[1,2,7,8],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"https://adagio.io/privacy"},"620":{"id":620,"name":"Blue","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,9,10],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[2,3],"specialFeatures":[1],"policyUrl":"http://www.getblue.io/privacy/"},"610":{"id":610,"name":"Azerion Holding B.V.","purposes":[1,3,4,9],"legIntPurposes":[2,5,6,7,8,10],"flexiblePurposes":[2,5,6],"specialPurposes":[1,2],"features":[2,3],"specialFeatures":[1],"policyUrl":"https://azerion.com/business/privacy.html","overflow":{"httpGetLimit":128}},"621":{"id":621,"name":"Seznam.cz, a.s.","purposes":[1,3,4,5,6],"legIntPurposes":[2,7,8,9,10],"flexiblePurposes":[],"specialPurposes":[],"features":[2,3],"specialFeatures":[1,2],"policyUrl":"https://www.seznam.cz/ochranaudaju"},"624":{"id":624,"name":"Norstat AS","purposes":[1,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.norstatpanel.com/en/data-protection"},"95":{"id":95,"name":"Lotame Solutions, inc","purposes":[1,3,5],"legIntPurposes":[7,8,9,10],"flexiblePurposes":[],"specialPurposes":[],"features":[2,3],"specialFeatures":[],"policyUrl":"https://www.lotame.com/about-lotame/privacy/lotame-corporate-websites-privacy-policy/"},"618":{"id":618,"name":"BEINTOO SPA","purposes":[1,2,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1],"specialFeatures":[1],"policyUrl":"http://www.beintoo.com/privacy-cookie-policy/"},"625":{"id":625,"name":"BILENDI SA","purposes":[1,6,7,8,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1],"specialFeatures":[],"policyUrl":"https://www.maximiles.com/privacy-policy"},"628":{"id":628,"name":": Tappx","purposes":[1,2,4,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2],"specialFeatures":[1,2],"policyUrl":"https://www.tappx.com/en/privacy-policy/"},"630":{"id":630,"name":"Contact Impact GmbH","purposes":[1],"legIntPurposes":[2,3,4,7,10],"flexiblePurposes":[2,3,4,7,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://contactimpact.de/privacy"},"626":{"id":626,"name":"Hivestack Inc.","purposes":[1,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"https://hivestack.com/privacy-policy"},"631":{"id":631,"name":"Relay42 Netherlands B.V.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://relay42.com/privacy"},"638":{"id":638,"name":"Passendo Aps","purposes":[1,2,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://passendo.com/users-privacy-policy"},"644":{"id":644,"name":"Gamoshi LTD","purposes":[2,7],"legIntPurposes":[],"flexiblePurposes":[2,7],"specialPurposes":[2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.gamoshi.com/privacy-policy"},"639":{"id":639,"name":"Smile Wanted Group","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[2],"policyUrl":"https://www.smilewanted.com/privacy.php"},"645":{"id":645,"name":"Noster Finance S.L.","purposes":[1,2,3,4,5,6,9,10],"legIntPurposes":[7,8],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.finect.com/terminos-legales/politica-de-cookies"},"653":{"id":653,"name":"Smartme Analytics","purposes":[7,8,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,3],"specialFeatures":[],"policyUrl":"http://smartmeapp.com/info/smartme/aviso_legal.php","deletedDate":"2020-07-03T00:00:00Z"},"613":{"id":613,"name":"Adserve.zone / Artworx AS","purposes":[1],"legIntPurposes":[2,7],"flexiblePurposes":[2],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://adserve.zone/adserveprivacypolicy.html"},"573":{"id":573,"name":"Dailymotion SA","purposes":[1,3,4],"legIntPurposes":[2,5,6,7,8,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2],"specialFeatures":[],"policyUrl":"https://www.dailymotion.com/legal/privacy","overflow":{"httpGetLimit":32}},"652":{"id":652,"name":"Skaze","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"http://www.skaze.fr/rgpd/"},"646":{"id":646,"name":"Notify","purposes":[],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1],"specialFeatures":[],"policyUrl":"https://notify-group.com/en/mentions-legales/"},"648":{"id":648,"name":"TrueData Solutions, Inc.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.truedata.co/privacy-policy/"},"647":{"id":647,"name":"Axel Springer Teaser Ad GmbH","purposes":[1],"legIntPurposes":[2,3,4,7,10],"flexiblePurposes":[2,3,4,7,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.adup-tech.com/privacy"},"659":{"id":659,"name":"Research and Analysis of Media in Sweden AB","purposes":[1],"legIntPurposes":[7,8,9],"flexiblePurposes":[],"specialPurposes":[],"features":[2],"specialFeatures":[],"policyUrl":"https://www2.rampanel.com/privacy-policy/"},"656":{"id":656,"name":"Think Clever Media","purposes":[1,2,3,4,5,6,9],"legIntPurposes":[7,8,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.contentignite.com/privacy-policy/"},"657":{"id":657,"name":"GP One GmbH","purposes":[1],"legIntPurposes":[2,3,4],"flexiblePurposes":[2,3,4],"specialPurposes":[1,2],"features":[],"specialFeatures":[1,2],"policyUrl":"https://www.gsi-one.org/de/privacy-policy.html"},"655":{"id":655,"name":"Sportradar AG","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.sportradar.com/about-us/privacy/"},"662":{"id":662,"name":"SoundCast","purposes":[1,2,3,4,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"https://soundcast.fm/en/data-privacy"},"665":{"id":665,"name":"Digital East GmbH","purposes":[2,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.digitaleast.mobi/en/legal/privacy-policy/"},"650":{"id":650,"name":"Telefonica Investigaci\u00f3n y Desarrollo S.A.U","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"http://www.cognitivemarketing.tid.es/"},"666":{"id":666,"name":"BeOp","purposes":[1,2],"legIntPurposes":[7,8,10],"flexiblePurposes":[2,7,8,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://beop.io/privacy"},"663":{"id":663,"name":"Mobsuccess","purposes":[1,2,3,4,7,9],"legIntPurposes":[],"flexiblePurposes":[2,7],"specialPurposes":[1,2],"features":[1],"specialFeatures":[],"policyUrl":"https://www.mobsuccess.com/en/privacy"},"658":{"id":658,"name":"BLIINK SAS","purposes":[1,2,3,4,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,8,9,10],"specialPurposes":[2],"features":[],"specialFeatures":[1],"policyUrl":"https://bliink.io/privacy-policy"},"667":{"id":667,"name":"Liftoff Mobile, Inc.","purposes":[1,3,4],"legIntPurposes":[2,5,6,7,8,10],"flexiblePurposes":[2,3,4,5,6,7,8,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://liftoff.io/privacy-policy/"},"668":{"id":668,"name":"WhatRocks Inc. ","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2],"specialFeatures":[1,2],"policyUrl":"https://www.whatrocks.co/en/privacy-policy "},"674":{"id":674,"name":"Duration Media, LLC.","purposes":[1,2,3,4,5,6,7,8,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.durationmedia.net/privacy-policy"},"675":{"id":675,"name":"Instreamatic inc.","purposes":[2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[3],"specialFeatures":[],"policyUrl":"http://instreamatic.com/privacy-policy/"},"676":{"id":676,"name":"BusinessClick","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://www.businessclick.com/documents/RegulaminProgramuBusinessClick-2019.pdf"},"672":{"id":672,"name":"Cedato Technologies Ltd","purposes":[1,2],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.cedato.com/privacy-policy/"},"664":{"id":664,"name":"adMarketplace, Inc.","purposes":[1,2,3,4],"legIntPurposes":[7,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.admarketplace.com/privacy-policy/"},"561":{"id":561,"name":"AuDigent","purposes":[1,2,3,4,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2,3],"specialFeatures":[],"policyUrl":"http://audigent.com/platform-privacy-policy"},"682":{"id":682,"name":"Radio Net Media Limited","purposes":[1,2,3,4],"legIntPurposes":[7],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.adtonos.com/service-privacy-policy/","overflow":{"httpGetLimit":128}},"684":{"id":684,"name":"Blue Billywig BV","purposes":[],"legIntPurposes":[7],"flexiblePurposes":[7],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://www.bluebillywig.com/privacy-statement/"},"686":{"id":686,"name":"The MediaGrid Inc.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2],"specialFeatures":[],"policyUrl":"https://www.themediagrid.com/privacy-policy/"},"685":{"id":685,"name":"Arkeero","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://arkeero.com/privacy-2/"},"687":{"id":687,"name":"MISSENA","purposes":[1,2,3,4,5,6,7,8],"legIntPurposes":[],"flexiblePurposes":[2,7],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"http://missena.com/confidentialite/"},"690":{"id":690,"name":"Go.pl sp. z o.o.","purposes":[1,2,3,4],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"https://go.pl/polityka-prywatnosci/"},"691":{"id":691,"name":"Lifesight Pte. Ltd.","purposes":[2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.lifesight.io/privacy-policy/"},"697":{"id":697,"name":"ADWAYS SAS","purposes":[],"legIntPurposes":[7],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://www.adways.com/confidentialite/?lang=en"},"699":{"id":699,"name":"HyperTV Inc.","purposes":[1,2,4,9],"legIntPurposes":[7,10],"flexiblePurposes":[],"specialPurposes":[2],"features":[1],"specialFeatures":[],"policyUrl":"https://www.hypertvx.com/privacy/"},"703":{"id":703,"name":"MindTake Research GmbH","purposes":[1,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1],"features":[2,3],"specialFeatures":[],"policyUrl":"https://www.mindtake.com/en/reppublika-privacy-policy"},"706":{"id":706,"name":"VRTCAL Markets Inc","purposes":[],"legIntPurposes":[2],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://vrtcal.com/docs/PrivacyPolicy-Advertising.pdf"},"681":{"id":681,"name":"MyTraffic","purposes":[1,9],"legIntPurposes":[],"flexiblePurposes":[9],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"https://www.mytraffic.io/en/privacy"},"649":{"id":649,"name":"adality GmbH","purposes":[],"legIntPurposes":[2],"flexiblePurposes":[],"specialPurposes":[],"features":[1],"specialFeatures":[],"policyUrl":"https://adality.de/en/privacy/"},"711":{"id":711,"name":"SITU8ED SA","purposes":[1,3,4,5,6,7,8,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.situ8ed.com/privacy-policy/"},"712":{"id":712,"name":"Inspired Mobile Limited","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://byinspired.com/privacypolicy.pdf"},"688":{"id":688,"name":"Effinity","purposes":[],"legIntPurposes":[2],"flexiblePurposes":[2,7],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.effiliation.com/politique-de-confidentialite/","overflow":{"httpGetLimit":128}},"702":{"id":702,"name":"Kwanko","purposes":[1,2,7,8],"legIntPurposes":[],"flexiblePurposes":[2,7,8],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.kwanko.com/fr/rgpd/"},"714":{"id":714,"name":"Survata Inc.","purposes":[1],"legIntPurposes":[7,9],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.survata.com/respondent-privacy-policy/","overflow":{"httpGetLimit":128}},"713":{"id":713,"name":"Dataseat Ltd","purposes":[2,3,4,5,6,7,8,9],"legIntPurposes":[],"flexiblePurposes":[2,7,8],"specialPurposes":[],"features":[3],"specialFeatures":[],"policyUrl":"https://dataseat.com/privacy-policy"},"716":{"id":716,"name":"OnAudience Ltd","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.onaudience.com/internet-advertising-privacy-policy"},"708":{"id":708,"name":"Dugout Limited ","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://dugout.com/privacy-policy"},"694":{"id":694,"name":"Snapupp Technologies SL","purposes":[2,3,4,5,6,9],"legIntPurposes":[7,8,10],"flexiblePurposes":[10],"specialPurposes":[],"features":[3],"specialFeatures":[],"policyUrl":"https://www.enterprise.noddus.com/privacy-policy","overflow":{"httpGetLimit":128}},"683":{"id":683,"name":"Cookie Market LTD","purposes":[1,3,4,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2,3],"specialFeatures":[1],"policyUrl":"http://cookie.market/privacyPolicy.php"},"720":{"id":720,"name":"AAX LLC","purposes":[1,3,4],"legIntPurposes":[2,7,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://aax.media/privacy/","overflow":{"httpGetLimit":32}},"678":{"id":678,"name":"Axonix LTD","purposes":[2],"legIntPurposes":[7,10],"flexiblePurposes":[2],"specialPurposes":[1,2],"features":[3],"specialFeatures":[1],"policyUrl":"https://axonix.com/privacy-cookie-policy/","overflow":{"httpGetLimit":128}},"719":{"id":719,"name":"Online Advertising Network Sp. z o.o.","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2,3],"specialFeatures":[1],"policyUrl":"https://www.oan.pl/en/privacy-policy"},"707":{"id":707,"name":"Dentsu Aegis Network Italia SpA","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.dentsuaegisnetwork.com/it/it/policies/info-cookie"},"721":{"id":721,"name":"Beaconspark Ltd","purposes":[1,2,3,4,5,7],"legIntPurposes":[6,8],"flexiblePurposes":[2,3,4,5,6,7,8],"specialPurposes":[1,2],"features":[1],"specialFeatures":[],"policyUrl":"https://www.engageya.com/privacy"},"728":{"id":728,"name":"Appier PTE Ltd","purposes":[1,3,4,5,6,9],"legIntPurposes":[2,7,8,10],"flexiblePurposes":[2,7,8,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.appier.com/privacy-policy/"},"729":{"id":729,"name":"Cavai AS & UK ","purposes":[],"legIntPurposes":[7,8],"flexiblePurposes":[7,8],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://cav.ai/privacy-policy/"},"730":{"id":730,"name":"INFOnline GmbH","purposes":[],"legIntPurposes":[8],"flexiblePurposes":[8],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.infonline.de/en/privacy-policy/"},"722":{"id":722,"name":"agof - daily campaign facts","purposes":[1,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1],"features":[],"specialFeatures":[],"policyUrl":"http://www.agof.de/datenschutz/"},"723":{"id":723,"name":"Adzymic Pte Ltd","purposes":[1,2,3,4,7,8],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2],"specialFeatures":[],"policyUrl":"http://www.adzymic.co/privacy","overflow":{"httpGetLimit":128}},"725":{"id":725,"name":"Pubfinity LLC","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2,3],"specialFeatures":[],"policyUrl":"https://pubfinity.com/privacy-policy/","overflow":{"httpGetLimit":128}},"733":{"id":733,"name":"Anzu Virtual Reality LTD","purposes":[1,2,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1],"features":[1],"specialFeatures":[1],"policyUrl":"https://anzu.io/privacy/"},"737":{"id":737,"name":"Monet Engine Inc","purposes":[1,2,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://appmonet.com/privacy-policy/"},"740":{"id":740,"name":"6Sense Insights, Inc.","purposes":[1],"legIntPurposes":[2,3,4,5,7,8,10],"flexiblePurposes":[2,3,4,5,7,8,10],"specialPurposes":[],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://6sense.com/privacy-policy/","overflow":{"httpGetLimit":128}},"744":{"id":744,"name":"Vidazoo Ltd","purposes":[3,4],"legIntPurposes":[2,7,8,10],"flexiblePurposes":[3,4],"specialPurposes":[1,2],"features":[2],"specialFeatures":[2],"policyUrl":"https://vidazoo.gitbook.io/vidazoo-legal/privacy-policy","overflow":{"httpGetLimit":128}},"731":{"id":731,"name":"GeistM Technologies LTD","purposes":[],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.geistm.com/privacy"},"741":{"id":741,"name":"Brand Advance Limited","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2,3],"specialFeatures":[1,2],"policyUrl":"https://www.wearebrandadvance.com/website-privacy-policy"},"735":{"id":735,"name":"Deutsche Post AG","purposes":[1,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1],"specialFeatures":[],"policyUrl":"https://www.deutschepost.de/de/c/consentric/datenschutz.html"},"734":{"id":734,"name":"Cint AB","purposes":[1,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1],"specialFeatures":[],"policyUrl":"https://www.cint.com/participant-privacy-notice"},"709":{"id":709,"name":"NC Audience Exchange, LLC (NewsIQ)","purposes":[1,3,4,5],"legIntPurposes":[2,7,8,9,10],"flexiblePurposes":[2,3,4,5,7,8,9,10],"specialPurposes":[2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.ncaudienceexchange.com/privacy/"},"739":{"id":739,"name":"Blingby LLC","purposes":[1,8,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://blingby.com/privacy"},"727":{"id":727,"name":"Pinpoll GmbH (Private Limited)","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1],"specialFeatures":[],"policyUrl":"https://www.pinpoll.com/#data_protection_declaration"},"732":{"id":732,"name":"Performax.cz, s.r.o.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2],"specialFeatures":[],"policyUrl":"https://reg.tiscali.cz/privacy-policy"},"736":{"id":736,"name":"BidMachine Inc.","purposes":[1,2,3,4,5,6],"legIntPurposes":[7,8,10],"flexiblePurposes":[7,8,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://explorestack.com/privacy-policy/"},"738":{"id":738,"name":"adbility media GmbH","purposes":[2,3,4,9],"legIntPurposes":[7],"flexiblePurposes":[2,3,4,9],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.adbility-media.com/datenschutzerklaerung/"},"742":{"id":742,"name":"Audiencerate LTD","purposes":[1,2,3,5,6],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.audiencerate.com/privacy/"},"743":{"id":743,"name":"MOVIads Sp. z o.o. Sp. k.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2,3],"specialFeatures":[1],"policyUrl":"https://moviads.pl/polityka-prywatnosci/","overflow":{"httpGetLimit":128}},"745":{"id":745,"name":"Justtag Sp. z o.o.","purposes":[1,3,4,9],"legIntPurposes":[7],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://www.justtag.com/pdf/PRIVACY_POLICY_Koalametrics_english.pdf"},"746":{"id":746,"name":"Adxperience SAS","purposes":[4],"legIntPurposes":[2,7],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1],"policyUrl":"https://adxperience.com/privacy-policy/"},"747":{"id":747,"name":"Kairion GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[],"features":[2,3],"specialFeatures":[1,2],"policyUrl":"https://kairion.de/datenschutzbestimmungen/"},"748":{"id":748,"name":"AUDIOMOB LTD","purposes":[1,2,3,4,7,8,9],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,8,9],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://www.audiomob.io/privacy"},"749":{"id":749,"name":"Good-Loop Ltd","purposes":[1,3,4,5,6],"legIntPurposes":[2,7,8,9,10],"flexiblePurposes":[7,8,9,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://doc.good-loop.com/policy/privacy-policy.html"},"750":{"id":750,"name":"THE NEWCO S.R.L.","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://www.thenewco.it/privacy_policy_servizi_prodotti.html"},"751":{"id":751,"name":"Kiosked Ltd","purposes":[],"legIntPurposes":[2,7],"flexiblePurposes":[2,7],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://kiosked.com/privacy-policy/"},"753":{"id":753,"name":"ScaleMonk Inc.","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.scalemonk.com/privacy-policy/index.html"},"754":{"id":754,"name":"DistroScale, Inc.","purposes":[1,2],"legIntPurposes":[],"flexiblePurposes":[2],"specialPurposes":[2],"features":[3],"specialFeatures":[],"policyUrl":"http://www.distroscale.com/privacy-policy/"},"757":{"id":757,"name":"UAB Meazy","purposes":[1,2,3,4,5,7,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://meazy.co/privacy-policy"},"758":{"id":758,"name":"GfK Netherlands B.V.","purposes":[1,7,8,9],"legIntPurposes":[],"flexiblePurposes":[7,8,9],"specialPurposes":[],"features":[1],"specialFeatures":[],"policyUrl":"https://gfkpanel.nl/privacy"},"759":{"id":759,"name":"RevJet","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1],"specialFeatures":[],"policyUrl":"https://www.revjet.com/privacy","overflow":{"httpGetLimit":128}},"760":{"id":760,"name":"VEXPRO TECHNOLOGIES LTD","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[2],"policyUrl":"https://onedash.com/privacy-policy.html"},"761":{"id":761,"name":"Digiseg ApS","purposes":[1,3,5,7,8,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[1],"specialFeatures":[],"policyUrl":"https://digiseg.io/privacy-center/"},"762":{"id":762,"name":"Protected Media LTD","purposes":[1],"legIntPurposes":[3,5,7,8,9,10],"flexiblePurposes":[],"specialPurposes":[1],"features":[3],"specialFeatures":[],"policyUrl":"https://www.protected.media/privacy-policy/"},"764":{"id":764,"name":"Lucidity","purposes":[1,2,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://golucidity.com/privacy-policy/"},"765":{"id":765,"name":"Grabit Interactive Media Inc dba KERV Interctive","purposes":[2,3,4,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2],"specialFeatures":[],"policyUrl":"https://kervit.com/privacy-policy/"},"766":{"id":766,"name":"ADCELL | Firstlead GmbH","purposes":[1,2],"legIntPurposes":[],"flexiblePurposes":[2],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.adcell.de/agb#sector_6"},"767":{"id":767,"name":"Clinch Labs LTD","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1],"policyUrl":"https://clinch.co/pages/privacy.html"},"768":{"id":768,"name":"Global Media & Entertainment Limited","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"http://global.com/privacy-policy/"},"769":{"id":769,"name":"MEDIAMETRIE","purposes":[1,8],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://www.mediametrie.fr/fr/gestion-des-cookies"},"770":{"id":770,"name":"MARKETPERF CORP","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,10],"flexiblePurposes":[2,3,4,5,6],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://www.marketperf.com/assets/images/app/marketperf/pdf/privacy-policy.pdf"},"771":{"id":771,"name":"bam! interactive marketing GmbH ","purposes":[1,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1,2],"policyUrl":"https://bam-interactive.de/privacy-policy/"},"772":{"id":772,"name":"Oracle Data Cloud - Moat","purposes":[],"legIntPurposes":[7,8,10],"flexiblePurposes":[],"specialPurposes":[1],"features":[],"specialFeatures":[],"policyUrl":"https://www.oracle.com/legal/privacy/services-privacy-policy.html"},"773":{"id":773,"name":"360e-com Sp. z o.o.","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"https://www.clickonometrics.com/optout/"},"774":{"id":774,"name":"Wagawin GmbH","purposes":[1],"legIntPurposes":[2,7],"flexiblePurposes":[2],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.wagawin.com/privacy-en/#productprivacy"},"775":{"id":775,"name":"SelectMedia International LTD","purposes":[1,2],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.selectmedia.asia/terms-and-privacy/"},"776":{"id":776,"name":"Mars Media Group","purposes":[2],"legIntPurposes":[],"flexiblePurposes":[2],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"https://pay-per-leads.com/terms"},"777":{"id":777,"name":"One Planet Only","purposes":[1],"legIntPurposes":[2,3,4,7],"flexiblePurposes":[2,3,4,7],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://oneplanetonly.com/files/PRIVACY%20POLICY.pdf","overflow":{"httpGetLimit":32}},"778":{"id":778,"name":"Discover-Tech ltd","purposes":[2,3,4,5,6,7,8,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[1],"policyUrl":"https://discover-tech.io/dsp-privacy-policy/"},"779":{"id":779,"name":"Adtarget Medya A.S.","purposes":[1,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[3],"specialFeatures":[1],"policyUrl":"https://adtarget.com.tr/adtarget-privacy-policy-2020.pdf"},"780":{"id":780,"name":"Aniview LTD","purposes":[1,2,7,8],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"https://www.aniview.com/privacy-policy/"},"781":{"id":781,"name":"FeedAd GmbH","purposes":[1,3,4,5,6,8,9],"legIntPurposes":[2,7,10],"flexiblePurposes":[2,7,10],"specialPurposes":[1,2],"features":[2,3],"specialFeatures":[1,2],"policyUrl":"https://feedad.com/privacy/","overflow":{"httpGetLimit":128}},"782":{"id":782,"name":"AirGrid LTD","purposes":[1,3,5,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[],"specialFeatures":[],"policyUrl":"airgid.io/privacy-policy"},"783":{"id":783,"name":"Audienzz AG","purposes":[1],"legIntPurposes":[2,3,4,5,6,7,8,9,10],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[1],"policyUrl":"https://audienzz.ch/wp-content/uploads/2020/03/AGB_audienzz_2020.pdf"},"784":{"id":784,"name":"Nubo LTD","purposes":[],"legIntPurposes":[2],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.recod3.com/privacypolicy.php"},"785":{"id":785,"name":"agof - daily digital facts","purposes":[1,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1],"features":[],"specialFeatures":[],"policyUrl":"http://www.agof.de/datenschutz/"},"755":{"id":755,"name":"Google Advertising Products","purposes":[1,3,4],"legIntPurposes":[2,5,6,7,9,10],"flexiblePurposes":[2,5,6,7,9,10],"specialPurposes":[1,2],"features":[1,2],"specialFeatures":[],"policyUrl":"https://policies.google.com/privacy"},"786":{"id":786,"name":"TargetVideo GmbH","purposes":[1,2,3,4],"legIntPurposes":[7,8,10],"flexiblePurposes":[2,3,4,7,8,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.target-video.com/datenschutz/"},"787":{"id":787,"name":"Resolution Media M\u00fcnchen GmbH","purposes":[1],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://wwww.nonstoppartner.net"},"788":{"id":788,"name":"Ad Alliance GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2],"specialFeatures":[1],"policyUrl":"https://www.ad-alliance.de/datenschutz/","overflow":{"httpGetLimit":128}},"789":{"id":789,"name":"IP Deutschland GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[],"features":[2],"specialFeatures":[1],"policyUrl":"https://www.ip.de/lp/impressum/datenschutz.cfm","overflow":{"httpGetLimit":32}},"790":{"id":790,"name":"AdGear Technologies, Inc.","purposes":[1,3,4],"legIntPurposes":[2,7,9,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[],"policyUrl":"https://adgear.com/en/privacy"},"791":{"id":791,"name":"Media Square","purposes":[1,2],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[],"specialFeatures":[],"policyUrl":"http://www.mediasquare.fr/e-privacy/"},"792":{"id":792,"name":"BritePool Inc","purposes":[1],"legIntPurposes":[3,7,10],"flexiblePurposes":[3,7,10],"specialPurposes":[1],"features":[1,2],"specialFeatures":[],"policyUrl":"https://britepool.com/gdpr-privacy-notice"},"794":{"id":794,"name":"Kubient Inc. ","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[2,3],"specialFeatures":[1,2],"policyUrl":"https://kubient.com/privacy-policy/"},"795":{"id":795,"name":"Factor Eleven GmbH","purposes":[1,2,3,4,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://www.factor-eleven.de/datenschutz/"},"796":{"id":796,"name":"EASY Marketing GmbH","purposes":[1,7],"legIntPurposes":[],"flexiblePurposes":[7],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://easy-m.de/"},"797":{"id":797,"name":"Artefact Deutschland GmbH","purposes":[1,7],"legIntPurposes":[],"flexiblePurposes":[7],"specialPurposes":[1,2],"features":[2,3],"specialFeatures":[],"policyUrl":"https://aaa.artefact.com/privacy-policy.do"},"798":{"id":798,"name":"Adverticum cPlc.","purposes":[1,2,3,4,5,6,8,9,10],"legIntPurposes":[7],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://adverticum.net/english/privacy-and-data-processing-information/"},"799":{"id":799,"name":"Adpone SL","purposes":[1,2,4,5,7,9],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[2],"features":[2],"specialFeatures":[],"policyUrl":"http://www.adpone.com/privacy-policy/"},"800":{"id":800,"name":"Reppublika- The Research Toolbox GmbH","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[10],"specialPurposes":[1],"features":[2],"specialFeatures":[1],"policyUrl":"https://www.reppublika.com/privacy-policy"},"801":{"id":801,"name":"Bannernow, Inc.","purposes":[1,4],"legIntPurposes":[2,7],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[3],"specialFeatures":[],"policyUrl":"https://bannernow.com/privacy"},"802":{"id":802,"name":"NOW GmbH","purposes":[1,3,4,7],"legIntPurposes":[2,5,6,8,9,10],"flexiblePurposes":[2,3,4,5,6,7,8,9,10],"specialPurposes":[1,2],"features":[1,2,3],"specialFeatures":[1,2],"policyUrl":"https://static.now-services.de/privacy/index.html"},"803":{"id":803,"name":"Click Tech Limited","purposes":[1,2],"legIntPurposes":[3],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[1],"specialFeatures":[],"policyUrl":"https://en.yeahmobi.com/html/privacypolicy/","overflow":{"httpGetLimit":128}},"804":{"id":804,"name":"LinkedIn Ireland Unlimited Company","purposes":[1,3,4],"legIntPurposes":[2,7,10],"flexiblePurposes":[2,3,4,7,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.linkedin.com/legal/privacy-policy"},"805":{"id":805,"name":"LEESTEN INC","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[1,2],"policyUrl":"https://www.leesten.io/privacy-policy"},"807":{"id":807,"name":"Moloco, Inc.","purposes":[1],"legIntPurposes":[2,3,4,7,8,9,10],"flexiblePurposes":[2,3,4,7,8,9,10],"specialPurposes":[1,2],"features":[3],"specialFeatures":[2],"policyUrl":"http://www.molocoads.com/private-policy.html"},"808":{"id":808,"name":"Pure Local Media GmbH","purposes":[],"legIntPurposes":[2,7,10],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://purelocalmedia.de/?page_id=593"},"809":{"id":809,"name":"adnanny.com SLU","purposes":[1,2,3,4,7],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"http://adnanny.com/en/privacy/"},"811":{"id":811,"name":"iPROM","purposes":[1,2,3,4,5,6,7,8,9,10],"legIntPurposes":[],"flexiblePurposes":[],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://iprom.eu/privacy_policy/GDPR"},"793":{"id":793,"name":"Amazon Advertising","purposes":[1,2,3,4,7,9,10],"legIntPurposes":[],"flexiblePurposes":[2,3,4,7,9,10],"specialPurposes":[1,2],"features":[],"specialFeatures":[],"policyUrl":"https://www.amazon.co.uk/gp/help/customer/display.html?nodeId=201909010"}}} \ No newline at end of file diff --git a/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/vendor-list.json b/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/vendor-list.json new file mode 120000 index 00000000..1898b29f --- /dev/null +++ b/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/vendor-list.json @@ -0,0 +1 @@ +vendor-list-v51.json \ No newline at end of file diff --git a/iabgpp-extras-jackson/src/test/resources/vendorlist/v3.0/vendor-list.json b/iabgpp-extras-jackson/src/test/resources/vendorlist/v3.0/vendor-list.json new file mode 100644 index 00000000..9c9e1481 --- /dev/null +++ b/iabgpp-extras-jackson/src/test/resources/vendorlist/v3.0/vendor-list.json @@ -0,0 +1,20907 @@ +{ + "gvlSpecificationVersion": 3, + "vendorListVersion": 7, + "tcfPolicyVersion": 4, + "lastUpdated": "2023-06-29T16:07:26Z", + "purposes": { + "1": { + "id": 1, + "name": "Store and/or access information on a device", + "description": "Cookies, device or similar online identifiers (e.g. login-based identifiers, randomly assigned identifiers, network based identifiers) together with other information (e.g. browser type and information, language, screen size, supported technologies etc.) can be stored or read on your device to recognise it each time it connects to an app or to a website, for one or several of the purposes presented here. ", + "illustrations": [ + "Most purposes explained in this notice rely on the storage or accessing of information from your device when you use an app or visit a website. For example, a vendor or publisher might need to store a cookie on your device during your first visit on a website, to be able to recognise your device during your next visits (by accessing this cookie each time)." + ] + }, + "2": { + "id": 2, + "name": "Use limited data to select advertising", + "description": "Advertising presented to you on this service can be based on limited data, such as the website or app you are using, your non-precise location, your device type or which content you are (or have been) interacting with (for example, to limit the number of times an ad is presented to you).", + "illustrations": [ + "A car manufacturer wants to promote its electric vehicles to environmentally conscious users living in the city after office hours. The advertising is presented on a page with related content (such as an article on climate change actions) after 6:30 p.m. to users whose non-precise location suggests that they are in an urban zone.", + "A large producer of watercolour paints wants to carry out an online advertising campaign for its latest watercolour range, diversifying its audience to reach as many amateur and professional artists as possible and avoiding showing the ad next to mismatched content (for instance, articles about how to paint your house). The number of times that the ad has been presented to you is detected and limited, to avoid presenting it too often." + ] + }, + "3": { + "id": 3, + "name": "Create profiles for personalised advertising", + "description": "Information about your activity on this service (such as forms you submit, content you look at) can be stored and combined with other information about you (for example, information from your previous activity on this service and other websites or apps) or similar users. This is then used to build or improve a profile about you (that might include possible interests and personal aspects). Your profile can be used (also later) to present advertising that appears more relevant based on your possible interests by this and other entities.", + "illustrations": [ + "If you read several articles about the best bike accessories to buy, this information could be used to create a profile about your interest in bike accessories. Such a profile may be used or improved later on, on the same or a different website or app to present you with advertising for a particular bike accessory brand. If you also look at a configurator for a vehicle on a luxury car manufacturer website, this information could be combined with your interest in bikes to refine your profile and make an assumption that you are interested in luxury cycling gear.", + "An apparel company wishes to promote its new line of high-end baby clothes. It gets in touch with an agency that has a network of clients with high income customers (such as high-end supermarkets) and asks the agency to create profiles of young parents or couples who can be assumed to be wealthy and to have a new child, so that these can later be used to present advertising within partner apps based on those profiles." + ] + }, + "4": { + "id": 4, + "name": "Use profiles to select personalised advertising", + "description": "Advertising presented to you on this service can be based on your advertising profiles, which can reflect your activity on this service or other websites or apps (like the forms you submit, content you look at), possible interests and personal aspects.", + "illustrations": [ + "An online retailer wants to advertise a limited sale on running shoes. It wants to target advertising to users who previously looked at running shoes on its mobile app. Tracking technologies might be used to recognise that you have previously used the mobile app to consult running shoes, in order to present you with the corresponding advertisement on the app.", + "A profile created for personalised advertising in relation to a person having searched for bike accessories on a website can be used to present the relevant advertisement for bike accessories on a mobile app of another organisation." + ] + }, + "5": { + "id": 5, + "name": "Create profiles to personalise content", + "description": "Information about your activity on this service (for instance, forms you submit, non-advertising content you look at) can be stored and combined with other information about you (such as your previous activity on this service or other websites or apps) or similar users. This is then used to build or improve a profile about you (which might for example include possible interests and personal aspects). Your profile can be used (also later) to present content that appears more relevant based on your possible interests, such as by adapting the order in which content is shown to you, so that it is even easier for you to find content that matches your interests. \n", + "illustrations": [ + "You read several articles on how to build a treehouse on a social media platform. This information might be added to a profile to mark your interest in content related to outdoors as well as do-it-yourself guides (with the objective of allowing the personalisation of content, so that for example you are presented with more blog posts and articles on treehouses and wood cabins in the future).", + "You have viewed three videos on space exploration across different TV apps. An unrelated news platform with which you have had no contact builds a profile based on that viewing behaviour, marking space exploration as a topic of possible interest for other videos." + ] + }, + "6": { + "id": 6, + "name": "Use profiles to select personalised content", + "description": "Content presented to you on this service can be based on your content personalisation profiles, which can reflect your activity on this or other services (for instance, the forms you submit, content you look at), possible interests and personal aspects, such as by adapting the order in which content is shown to you, so that it is even easier for you to find (non-advertising) content that matches your interests.", + "illustrations": [ + "You read articles on vegetarian food on a social media platform and then use the cooking app of an unrelated company. The profile built about you on the social media platform will be used to present you vegetarian recipes on the welcome screen of the cooking app.", + "You have viewed three videos about rowing across different websites. An unrelated video sharing platform will recommend five other videos on rowing that may be of interest to you when you use your TV app, based on a profile built about you when you visited those different websites to watch online videos." + ] + }, + "7": { + "id": 7, + "name": "Measure advertising performance", + "description": "Information regarding which advertising is presented to you and how you interact with it can be used to determine how well an advert has worked for you or other users and whether the goals of the advertising were reached. For instance, whether you saw an ad, whether you clicked on it, whether it led you to buy a product or visit a website, etc. This is very helpful to understand the relevance of advertising campaigns.", + "illustrations": [ + "You have clicked on an advertisement about a “black Friday” discount by an online shop on the website of a publisher and purchased a product. Your click will be linked to this purchase. Your interaction and that of other users will be measured to know how many clicks on the ad led to a purchase.", + "You are one of very few to have clicked on an advertisement about an “international appreciation day” discount by an online gift shop within the app of a publisher. The publisher wants to have reports to understand how often a specific ad placement within the app, and notably the “international appreciation day” ad, has been viewed or clicked by you and other users, in order to help the publisher and its partners (such as agencies) optimise ad placements." + ] + }, + "8": { + "id": 8, + "name": "Measure content performance", + "description": "Information regarding which content is presented to you and how you interact with it can be used to determine whether the (non-advertising) content e.g. reached its intended audience and matched your interests. For instance, whether you read an article, watch a video, listen to a podcast or look at a product description, how long you spent on this service and the web pages you visit etc. This is very helpful to understand the relevance of (non-advertising) content that is shown to you. \n", + "illustrations": [ + "You have read a blog post about hiking on a mobile app of a publisher and followed a link to a recommended and related post. Your interactions will be recorded as showing that the initial hiking post was useful to you and that it was successful in interesting you in the related post. This will be measured to know whether to produce more posts on hiking in the future and where to place them on the home screen of the mobile app.", + "You were presented a video on fashion trends, but you and several other users stopped watching after 30 seconds. This information is then used to evaluate the right length of future videos on fashion trends." + ] + }, + "9": { + "id": 9, + "name": "Understand audiences through statistics or combinations of data from different sources", + "description": "Reports can be generated based on the combination of data sets (like user profiles, statistics, market research, analytics data) regarding your interactions and those of other users with advertising or (non-advertising) content to identify common characteristics (for instance, to determine which target audiences are more receptive to an ad campaign or to certain contents).", + "illustrations": [ + "The owner of an online bookstore wants commercial reporting showing the proportion of visitors who consulted and left its site without buying, or consulted and bought the last celebrity autobiography of the month, as well as the average age and the male/female distribution of each category. Data relating to your navigation on its site and to your personal characteristics is then used and combined with other such data to produce these statistics.", + "An advertiser wants to better understand the type of audience interacting with its adverts. It calls upon a research institute to compare the characteristics of users who interacted with the ad with typical attributes of users of similar platforms, across different devices. This comparison reveals to the advertiser that its ad audience is mainly accessing the adverts through mobile devices and is likely in the 45-60 age range." + ] + }, + "10": { + "id": 10, + "name": "Develop and improve services", + "description": "Information about your activity on this service, such as your interaction with ads or content, can be very helpful to improve products and services and to build new products and services based on user interactions, the type of audience, etc. This specific purpose does not include the development or improvement of user profiles and identifiers.", + "illustrations": [ + "A technology platform working with a social media provider notices a growth in mobile app users, and sees based on their profiles that many of them are connecting through mobile connections. It uses a new technology to deliver ads that are formatted for mobile devices and that are low-bandwidth, to improve their performance.", + "An advertiser is looking for a way to display ads on a new type of consumer device. It collects information regarding the way users interact with this new kind of device to determine whether it can build a new mechanism for displaying advertising on this type of device." + ] + }, + "11": { + "id": 11, + "name": "Use limited data to select content", + "description": "Content presented to you on this service can be based on limited data, such as the website or app you are using, your non-precise location, your device type, or which content you are (or have been) interacting with (for example, to limit the number of times a video or an article is presented to you).\n", + "illustrations": [ + "A travel magazine has published an article on its website about the new online courses proposed by a language school, to improve travelling experiences abroad. The school’s blog posts are inserted directly at the bottom of the page, and selected on the basis of your non-precise location (for instance, blog posts explaining the course curriculum for different languages than the language of the country you are situated in).\n", + "A sports news mobile app has started a new section of articles covering the most recent football games. Each article includes videos hosted by a separate streaming platform showcasing the highlights of each match. If you fast-forward a video, this information may be used to select a shorter video to play next.\n" + ] + } + }, + "specialPurposes": { + "1": { + "id": 1, + "name": "Ensure security, prevent and detect fraud, and fix errors\n", + "description": "Your data can be used to monitor for and prevent unusual and possibly fraudulent activity (for example, regarding advertising, ad clicks by bots), and ensure systems and processes work properly and securely. It can also be used to correct any problems you, the publisher or the advertiser may encounter in the delivery of content and ads and in your interaction with them.", + "illustrations": [ + "An advertising intermediary delivers ads from various advertisers to its network of partnering websites. It notices a large increase in clicks on ads relating to one advertiser, and uses data regarding the source of the clicks to determine that 80% of the clicks come from bots rather than humans." + ] + }, + "2": { + "id": 2, + "name": "Deliver and present advertising and content", + "description": "Certain information (like an IP address or device capabilities) is used to ensure the technical compatibility of the content or advertising, and to facilitate the transmission of the content or ad to your device.", + "illustrations": [ + "Clicking on a link in an article might normally send you to another page or part of the article. To achieve this, 1°) your browser sends a request to a server linked to the website, 2°) the server answers back (“here is the article you asked for”), using technical information automatically included in the request sent by your device, to properly display the information / images that are part of the article you asked for. Technically, such exchange of information is necessary to deliver the content that appears on your screen." + ] + } + }, + "features": { + "1": { + "id": 1, + "name": "Match and combine data from other data sources", + "description": "Information about your activity on this service may be matched and combined with other information relating to you and originating from various sources (for instance your activity on a separate online service, your use of a loyalty card in-store, or your answers to a survey), in support of the purposes explained in this notice.", + "illustrations": [] + }, + "2": { + "id": 2, + "name": "Link different devices", + "description": "In support of the purposes explained in this notice, your device might be considered as likely linked to other devices that belong to you or your household (for instance because you are logged in to the same service on both your phone and your computer, or because you may use the same Internet connection on both devices).", + "illustrations": [] + }, + "3": { + "id": 3, + "name": "Identify devices based on information transmitted automatically", + "description": "Your device might be distinguished from other devices based on information it automatically sends when accessing the Internet (for instance, the IP address of your Internet connection or the type of browser you are using) in support of the purposes exposed in this notice.", + "illustrations": [] + } + }, + "specialFeatures": { + "1": { + "id": 1, + "name": "Use precise geolocation data", + "description": "With your acceptance, your precise location (within a radius of less than 500 metres) may be used in support of the purposes explained in this notice.", + "illustrations": [] + }, + "2": { + "id": 2, + "name": "Actively scan device characteristics for identification", + "description": "With your acceptance, certain characteristics specific to your device might be requested and used to distinguish it from other devices (such as the installed fonts or plugins, the resolution of your screen) in support of the purposes explained in this notice.", + "illustrations": [] + } + }, + "stacks": { + "1": { + "id": 1, + "purposes": [], + "specialFeatures": [ + 1, + 2 + ], + "name": "Precise geolocation data, and identification through device scanning", + "description": "Precise geolocation and information about device characteristics can be used.\n\n" + }, + "2": { + "id": 2, + "purposes": [ + 2, + 7 + ], + "specialFeatures": [], + "name": "Advertising based on limited data and advertising measurement", + "description": "Advertising can be presented based on limited data. Advertising performance can be measured." + }, + "3": { + "id": 3, + "purposes": [ + 2, + 3, + 4 + ], + "specialFeatures": [], + "name": "Personalised advertising \n", + "description": "Advertising can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised advertising.\n" + }, + "4": { + "id": 4, + "purposes": [ + 2, + 7, + 9 + ], + "specialFeatures": [], + "name": "Advertising based on limited data, advertising measurement, and understanding of the audiences", + "description": "Advertising can be presented based on limited data. Advertising performance can be measured. Reports can be generated based on your activity and those of others." + }, + "5": { + "id": 5, + "purposes": [ + 2, + 3, + 7 + ], + "specialFeatures": [], + "name": "Advertising based on limited data, personalised advertising profile, and advertising measurement\n\n", + "description": "Advertising can be presented based on limited data. Your activity on this service can be used to build or improve a profile about you for personalised advertising. Advertising performance can be measured." + }, + "6": { + "id": 6, + "purposes": [ + 2, + 4, + 7 + ], + "specialFeatures": [], + "name": "Selection of personalised advertising and advertising measurement", + "description": "Advertising can be personalised based on your profile. Advertising performance can be measured." + }, + "7": { + "id": 7, + "purposes": [ + 2, + 4, + 7, + 9 + ], + "specialFeatures": [], + "name": "Selection of personalised advertising, advertising measurement, and audience research", + "description": "Advertising can be personalised based on your profile. Advertising performance can be measured. Reports can be generated based on your activity and those of others." + }, + "8": { + "id": 8, + "purposes": [ + 2, + 3, + 4, + 7 + ], + "specialFeatures": [], + "name": "Personalised advertising and advertising measurement", + "description": "Advertising can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised advertising. Advertising performance can be measured.\n" + }, + "9": { + "id": 9, + "purposes": [ + 2, + 3, + 4, + 7, + 9 + ], + "specialFeatures": [], + "name": "Personalised advertising, advertising measurement, and audience research", + "description": "Advertising can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised advertising. Advertising performance can be measured. Reports can be generated based on your activity and those of others." + }, + "10": { + "id": 10, + "purposes": [ + 3, + 4 + ], + "specialFeatures": [], + "name": "Personalised advertising", + "description": "Advertising can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised advertising." + }, + "11": { + "id": 11, + "purposes": [ + 5, + 6 + ], + "specialFeatures": [], + "name": "Personalised content", + "description": "Content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised content." + }, + "12": { + "id": 12, + "purposes": [ + 6, + 8, + 11 + ], + "specialFeatures": [], + "name": "Selection of personalised content and content measurement", + "description": "Content can be personalised based on your profile. Content performance can be measured.\n" + }, + "13": { + "id": 13, + "purposes": [ + 6, + 8, + 11 + ], + "specialFeatures": [], + "name": "Selection of personalised content, content measurement and audience research\n", + "description": "Content can be personalised based on your profile. Content performance can be measured. Reports can be generated based on your activity and those of others.Content can be personalised based on your profile. Content performance can be measured. Reports can be generated based on your activity and those of others. " + }, + "14": { + "id": 14, + "purposes": [ + 5, + 6, + 8, + 11 + ], + "specialFeatures": [], + "name": "Personalised content and content measurement", + "description": "Content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised content. Content performance can be measured." + }, + "15": { + "id": 15, + "purposes": [ + 5, + 6, + 8, + 9, + 11 + ], + "specialFeatures": [], + "name": "Personalised content, content measurement and audience research", + "description": "Content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised content. Content performance can be measured. Reports can be generated based on your activity and those of others." + }, + "16": { + "id": 16, + "purposes": [ + 5, + 6, + 8, + 9, + 10, + 11 + ], + "specialFeatures": [], + "name": "Personalised content, content measurement, audience research, and services development", + "description": "Content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised content. Content performance can be measured. Reports can be generated based on your activity and those of others. Your activity on this service can help develop and improve products and services." + }, + "17": { + "id": 17, + "purposes": [ + 7, + 8, + 9 + ], + "specialFeatures": [], + "name": "Advertising and content measurement, and audience research", + "description": "Advertising and content performance can be measured. Reports can be generated based on your activity and those of others." + }, + "18": { + "id": 18, + "purposes": [ + 7, + 8 + ], + "specialFeatures": [], + "name": "Advertising and content measurement\n\n", + "description": "Advertising and content performance can be measured." + }, + "19": { + "id": 19, + "purposes": [ + 7, + 9 + ], + "specialFeatures": [], + "name": "Advertising measurement and audience research", + "description": "Advertising can be measured. Reports can be generated based on your activity and those of others." + }, + "20": { + "id": 20, + "purposes": [ + 7, + 8, + 9, + 10 + ], + "specialFeatures": [], + "name": "Advertising and content measurement, audience research, and services development", + "description": "Advertising and content performance can be measured. Your activity on this service can help develop and improve products and services. Reports can be generated based on your activity and those of others. \n" + }, + "21": { + "id": 21, + "purposes": [ + 8, + 9, + 10 + ], + "specialFeatures": [], + "name": "Content measurement, audience research and services development.", + "description": "Content performance can be measured. Reports can be generated based on your activity and those of others. Your activity on this service can help develop and improve products and services." + }, + "22": { + "id": 22, + "purposes": [ + 8, + 10 + ], + "specialFeatures": [], + "name": "Content measurement and services development", + "description": "Content performance can be measured. Your activity on this service can help develop and improve products and services.\n" + }, + "23": { + "id": 23, + "purposes": [ + 2, + 4, + 6, + 7, + 8, + 11 + ], + "specialFeatures": [], + "name": "Selection of personalised advertising and content, advertising and content measurement", + "description": "Advertising and content can be personalised based on your profile. Advertising and content performance can be measured.\n" + }, + "24": { + "id": 24, + "purposes": [ + 2, + 4, + 6, + 7, + 8, + 9, + 11 + ], + "specialFeatures": [], + "name": "Selection of personalised advertising and content, advertising and content measurement, and audience research", + "description": "Advertising and content can be personalised based on your profile. Advertising and content performance can be measured. Reports can be generated based on your activity and those of others. Data can be used to build or improve user experience, systems, and software." + }, + "25": { + "id": 25, + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 11 + ], + "specialFeatures": [], + "name": "Personalised advertising and content, advertising and content measurement", + "description": "Advertising and content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised advertising or content. Advertising and content performance can be measured." + }, + "26": { + "id": 26, + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 11 + ], + "specialFeatures": [], + "name": "Personalised advertising and content, advertising and content measurement, and audience research", + "description": "Advertising and content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised advertising or content. Advertising and content performance can be measured. Reports can be generated based on your activity and those of others. \n" + }, + "27": { + "id": 27, + "purposes": [ + 3, + 5 + ], + "specialFeatures": [], + "name": "Personalised advertising and content profile", + "description": "Your activity on this service can be used to build or improve a profile about you for personalised advertising or content.\n" + }, + "28": { + "id": 28, + "purposes": [ + 2, + 4, + 6, + 11 + ], + "specialFeatures": [], + "name": "Selection of personalised advertising and content", + "description": "Advertising and content can be personalised based on your profile." + }, + "29": { + "id": 29, + "purposes": [ + 2, + 7, + 8, + 9 + ], + "specialFeatures": [], + "name": "Advertising based on limited data, advertising and content measurement, and audience research\n\n", + "description": "Advertising can be presented based on limited data. Advertising and content performance can be measured. Reports can be generated based on your activity and those of others. \n" + }, + "30": { + "id": 30, + "purposes": [ + 2, + 4, + 5, + 6, + 7, + 8, + 9, + 11 + ], + "specialFeatures": [], + "name": "Selection of personalised advertising, personalised content, advertising and content measurement, and audience research\n", + "description": "Advertising and content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised advertising or content. Advertising and content performance can be measured. Reports can be generated based on your activity and those of others." + }, + "31": { + "id": 31, + "purposes": [ + 2, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "specialFeatures": [], + "name": "Selection of personalised advertising, personalised content, advertising and content measurement, audience research, and services development", + "description": "Advertising and content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised content. Advertising and content performance can be measured. Reports can be generated based on your activity and those of others. Your activity on this service can help develop and improve products and services.\n" + }, + "32": { + "id": 32, + "purposes": [ + 2, + 5, + 6, + 7, + 8, + 9, + 11 + ], + "specialFeatures": [], + "name": "Advertising based on limited data, personalised content, advertising and content measurement, and audience research", + "description": "Advertising can be presented based on limited data. Content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised content. Advertising and content performance can be measured. Reports can be generated based on your activity and those of others. \n" + }, + "33": { + "id": 33, + "purposes": [ + 2, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "specialFeatures": [], + "name": "Advertising based on limited data, personalised content, advertising and content measurement, audience research, and services development", + "description": "Advertising can be presented based on limited data. Content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised content. Advertising and content performance can be measured. Reports can be generated based on your activity and those of others. Your activity on this service can help develop and improve products and services." + }, + "34": { + "id": 34, + "purposes": [ + 2, + 5, + 6, + 8, + 9, + 11 + ], + "specialFeatures": [], + "name": "Advertising based on limited data, personalised content, content measurement, and audience research", + "description": "Advertising can be presented based on limited data. Content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised content. Advertising and content performance can be measured. Reports can be generated based on your activity and those of others." + }, + "35": { + "id": 35, + "purposes": [ + 2, + 5, + 6, + 8, + 9, + 10, + 11 + ], + "specialFeatures": [], + "name": "Advertising based on limited data, personalised content, content measurement, audience research and services development", + "description": "Advertising can be presented based on limited data. Content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised content. Content performance can be measured. Reports can be generated based on your activity and those of others. Your activity on this service can help develop and improve products and services.\n" + }, + "36": { + "id": 36, + "purposes": [ + 2, + 5, + 6, + 7, + 11 + ], + "specialFeatures": [], + "name": "Advertising based on limited data, personalised content, and advertising measurement", + "description": "Advertising can be presented based on limited data. Content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised content. Advertising performance can be measured.\n" + }, + "37": { + "id": 37, + "purposes": [ + 2, + 5, + 6, + 7, + 10, + 11 + ], + "specialFeatures": [], + "name": "Advertising based on limited data, personalised content, advertising measurement, and services development", + "description": "Advertising can be presented based on limited data. Content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised content. Advertising performance can be measured. Your activity on this service can help develop and improve products and services.\n" + }, + "38": { + "id": 38, + "purposes": [ + 2, + 3, + 4, + 7, + 10 + ], + "specialFeatures": [], + "name": "Personalised advertising, advertising measurement, and services development", + "description": "Advertising can be personalised based on your profile.Your activity on this service can be used to build or improve a profile about you for personalised advertising. Advertising performance can be measured. Your activity on this service can help develop and improve products and services." + }, + "39": { + "id": 39, + "purposes": [ + 2, + 3, + 4, + 7, + 9, + 10 + ], + "specialFeatures": [], + "name": "Personalised advertising, advertising measurement, audience research and services development", + "description": "Advertising can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised advertising. Advertising performance can be measured. Reports can be generated based on your activity and those of others. Your activity on this service can help develop and improve products and services." + }, + "40": { + "id": 40, + "purposes": [ + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "specialFeatures": [], + "name": "Personalised advertising, advertising and content measurement, audience research and services development", + "description": "Advertising can be personalised based on your profile.Your activity on this service can be used to build or improve a profile about you for personalised advertising. Advertising and content performance can be measured. Reports can be generated based on your activity and those of others. Your activity on this service can help develop and improve products and services.\n" + }, + "41": { + "id": 41, + "purposes": [ + 2, + 3, + 4, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "specialFeatures": [], + "name": "Personalised advertising, selection of personalised content, advertising and content measurement, audience research and services development", + "description": "Advertising and content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised advertising. Advertising and content performance can be measured. Reports can be generated based on your activity and those of others. Your activity on this service can help develop and improve products and services.\n" + }, + "42": { + "id": 42, + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "specialFeatures": [], + "name": "Personalised advertising and content, advertising and content measurement, audience research and services development\n", + "description": "Advertising and content can be personalised based on your profile. Your activity on this service can be used to build or improve a profile about you for personalised advertising and content. Advertising and content performance can be measured. Reports can be generated based on your activity and those of others. Your activity on this service can help develop and improve products and services." + }, + "43": { + "id": 43, + "purposes": [ + 8, + 11 + ], + "specialFeatures": [], + "name": "Content based on limited data and content measurement", + "description": "Content can be selected based on limited data. Content performance can be measured." + } + }, + "dataCategories": { + "1": { + "id": 1, + "name": "IP addresses", + "description": "Your IP address is a number assigned by your Internet Service Provider to any Internet connection. It is not always specific to your device and is not always a stable identifier.\nIt is used to route information on the Internet and display online content (including ads) on your connected device." + }, + "2": { + "id": 2, + "name": "Device characteristics", + "description": "Technical characteristics about the device you are using that are not unique to you, such as the language, the time zone or the operating system." + }, + "3": { + "id": 3, + "name": "Device identifiers", + "description": "A device identifier is a unique string of characters assigned to your device or browser by means of a cookie or other storage technologies. \nIt may be created or accessed to recognise your device e.g. across web pages from the same site or across multiple sites or apps." + }, + "4": { + "id": 4, + "name": "Probabilistic identifiers", + "description": "A probabilistic identifier can be created by combining characteristics associated with your device (the type of browser or operating system used) and the IP address of the Internet connection. If you give your agreement, additional characteristics (e.g. the installed font or screen resolution) can also be combined to improve precision of the probabilistic identifier.\nSuch an identifier is considered \"probabilistic\" because several devices can share the same characteristics and Internet connection. It may be used to recognise your device across e.g. web pages from the same site or across multiple sites or apps." + }, + "5": { + "id": 5, + "name": "Authentication-derived identifiers", + "description": "Where an identifier is created on the basis of authentication data, such as contact details associated with online accounts you have created on websites or apps (e.g. e-mail address, phone number) or customer identifiers (e.g. identifier provided by your telecom operator), that identifier may be used to recognise you across websites, apps and devices when you are logged-in with the same contact details." + }, + "6": { + "id": 6, + "name": "Browsing and interaction data", + "description": "Your online activity such as the websites you visit, apps you are using, the content you search for on this service, or your interactions with content or ads, such as the number of times you have seen a specific content or ad or whether you clicked on it.\n" + }, + "7": { + "id": 7, + "name": "User-provided data", + "description": "The information you may have provided by way of declaration via a form (e.g. feedback, a comment) or when creating an account (e.g. your age, your occupation)." + }, + "8": { + "id": 8, + "name": "Non-precise location data", + "description": "An approximation of your location, expressed as an area with a radius of at least 500 meters. Your approximate location can be deduced from e.g. the IP address of your connection." + }, + "9": { + "id": 9, + "name": "Precise location data", + "description": "Your precise location within a radius of less than 500 meters based on your GPS coordinates. It may be used only with your acceptance." + }, + "10": { + "id": 10, + "name": "Users’ profiles", + "description": "Certain characteristics (e.g. your possible interests, your purchase intentions, your consumer profile) may be inferred or modeled from your previous online activity (e.g. the content you viewed or the service you used, your time spent on various online content and services) or the information you have provided (e.g. your age, your occupation)." + }, + "11": { + "id": 11, + "name": "Privacy choices", + "description": "Your preferences regarding the processing of your data, based on the information you have received." + } + }, + "vendors": { + "1": { + "id": 1, + "name": "Exponential Interactive, Inc d/b/a VDX.tv", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 397, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://vdx.tv/privacy/", + "legIntClaim": "https://cdnx.exponential.com/wp-content/uploads/2018/04/Balancing-Assessment-for-Legitimate-Interest-Publishers-v2.pdf" + } + ], + "dataDeclaration": [ + 1, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://vdxtv.expo.workers.dev" + }, + "2": { + "id": 2, + "name": "Captify Technologies Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.captifytechnologies.com/privacy-notice/", + "legIntClaim": "https://www.captifytechnologies.com/privacy-notice/" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://static.cpx.to/gvl/deviceStorageDisclosure.json" + }, + "6": { + "id": 6, + "name": "AdSpirit GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 60, + "purposes": { + "2": 14, + "7": 14 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://help.adspirit.de/privacy.php", + "legIntClaim": "https://help.adspirit.de/privacy.php" + }, + { + "langId": "de", + "privacy": "https://help.adspirit.de/privacy.php", + "legIntClaim": "https://help.adspirit.de/privacy.php" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://help.adspirit.de/deviceStorage.json" + }, + "8": { + "id": 8, + "name": "Emerse Sverige AB", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9 + ], + "flexiblePurposes": [ + 2, + 9 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.emerse.com/privacy-policy/", + "legIntClaim": "https://www.emerse.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://s3.eu-west-1.amazonaws.com/cors.emerse.com/gdpr-tcf.json" + }, + "12": { + "id": 12, + "name": "BeeswaxIO Corporation", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 34109999, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": { + "7": 4320 + }, + "specialPurposes": { + "1": 392, + "2": 4320 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.beeswax.com/privacy/", + "legIntClaim": "https://www.beeswax.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://beeswax.com/devicedisclosure.json" + }, + "20": { + "id": 20, + "name": "N.Rich Technologies Inc.", + "purposes": [ + 1, + 3, + 4, + 5 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 46656000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 540, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://n.rich/privacy-notice", + "legIntClaim": "https://n.rich/privacy-notice" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://privacy.nrich.ai/.well-known/deviceStorage.json" + }, + "21": { + "id": 21, + "name": "The UK Trade Desk Ltd", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 313536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 99, + "purposes": { + "2": 365, + "4": 132 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.thetradedesk.com/us/privacy", + "legIntClaim": "https://www.thetradedesk.com/us/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": " https://ttd-misc-public-assets.s3.us-west-2.amazonaws.com/deviceStorageDisclosureURL.json" + }, + "26": { + "id": 26, + "name": "Venatus Media Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.venatus.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 8 + ], + "deviceStorageDisclosureUrl": "https://www.venatus.com/tcf-gvl-disclosure.json" + }, + "27": { + "id": 27, + "name": "ADventori SAS", + "purposes": [ + 1, + 2, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 400, + "purposes": { + "2": 90, + "4": 90 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.adventori.com/with-us/legal-notice/", + "legIntClaim": "https://www.adventori.com/with-us/legal-notice/" + } + ], + "dataDeclaration": [ + 1, + 3, + 5, + 6, + 7, + 8 + ], + "deviceStorageDisclosureUrl": "https://adventori.com/.well-known/tcf-adventori-device-storage-disclosure.json" + }, + "29": { + "id": 29, + "name": "ETARGET SE", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 60, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://sk.search.etargetnet.com/policy.html" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://www.etarget.sk/cookies2.json" + }, + "30": { + "id": 30, + "name": "BidTheatre AB", + "purposes": [ + 1, + 3, + 4, + 7 + ], + "legIntPurposes": [ + 2 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 7, + "purposes": { + "3": 60, + "4": 0, + "7": 180 + }, + "specialPurposes": { + "1": 30 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.bidtheatre.com/privacy-policy", + "legIntClaim": "https://www.bidtheatre.com/resource/LIA_ferq.pdf" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.bidtheatre.com/deviceStorage.json" + }, + "31": { + "id": 31, + "name": "Ogury Ltd", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2, + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 182, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 400, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://ogury.com/privacy-policy/", + "legIntClaim": "https://ogury.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://consent-form.ogury.co/disclosure.json" + }, + "32": { + "id": 32, + "name": "Xandr, Inc.", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": { + "2": 180, + "7": 60, + "10": 60 + }, + "specialPurposes": { + "1": 540 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.xandr.com/privacy/platform-privacy-policy/", + "legIntClaim": "https://about.ads.microsoft.com/en-us/solutions/xandr/platform-privacy-policy#p_lt_ctl01_pageplaceholder_p_lt_ctl00_pageplaceholder_p_lt_WebPartZone3_zonePageBody_BingAds_PageContentViewer_PageContentViewerAll_ctl18_ctl00_ColumnsContainer" + }, + { + "langId": "pt", + "privacy": "https://about.ads.microsoft.com/pt-br/solutions/xandr/politica-de-privacidade-da-plataforma", + "legIntClaim": "https://about.ads.microsoft.com/pt-br/solutions/xandr/politica-de-privacidade-da-plataforma#p_lt_ctl01_pageplaceholder_p_lt_ctl00_pageplaceholder_p_lt_WebPartZone3_zonePageBody_BingAds_PageContentViewer_PageContentViewerAll_ctl16_ctl00_ColumnsContainer" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://acdn.adnxs.com/gvl/1d/xandrdevicestoragedisclosures.json" + }, + "33": { + "id": 33, + "name": "ShareThis, Inc", + "purposes": [ + 1, + 3, + 5 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 33696000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://sharethis.com/privacy/" + }, + { + "langId": "fr", + "privacy": "https://pcdn.sharethis.com/wp-content/uploads/2021/11/ShareThis-Privacy-Policy-11.2.21_FR.pdf" + }, + { + "langId": "es", + "privacy": "https://pcdn.sharethis.com/wp-content/uploads/2021/11/ShareThis-Privacy-Policy-11.2.21_ES.pdf" + }, + { + "langId": "it", + "privacy": "https://pcdn.sharethis.com/wp-content/uploads/2021/11/ShareThis-Privacy-Policy-11.2.21_IT.pdf" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://c.sharethis.mgr.consensu.org/disclosures.json" + }, + "34": { + "id": 34, + "name": "NEORY GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.neory.com/privacy.html", + "legIntClaim": "https://www.neory.com/privacy.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://ad.ad-srv.net/privacy/tcf/deviceStorage/6505e3798148a611.json" + }, + "37": { + "id": 37, + "name": "NEURAL.ONE", + "purposes": [ + 1, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://web.neural.one/privacy-policy/", + "legIntClaim": "https://web.neural.one/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://web.neural.one/.well-known/deviceStorage.json" + }, + "39": { + "id": 39, + "name": "ADITION (Virtual Minds GmbH)", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": { + "7": 30, + "9": 7, + "10": 7 + }, + "specialPurposes": { + "1": 3, + "2": 3 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.adition.com/en/privacy-platform", + "legIntClaim": "https://www.adition.com/en/privacy-platform" + }, + { + "langId": "de", + "privacy": "https://www.adition.com/datenschutz-plattform/", + "legIntClaim": "https://www.adition.com/datenschutz-plattform/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://imagesrv.adition.com/tcf/deviceStorage_adition.json" + }, + "40": { + "id": 40, + "name": "Active Agent (Virtual Minds GmbH)", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": { + "7": 30, + "9": 7, + "10": 7 + }, + "specialPurposes": { + "1": 3, + "2": 3 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.adition.com/en/privacy-platform", + "legIntClaim": "https://www.adition.com/en/privacy-platform" + }, + { + "langId": "de", + "privacy": "https://www.adition.com/datenschutz-plattform/", + "legIntClaim": "https://www.adition.com/datenschutz-plattform/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://imagesrv.adition.com/tcf/deviceStorage_activeagent.json" + }, + "44": { + "id": 44, + "name": "Adex (Virtual Minds GmbH)", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://theadex.com/privacy-platform/", + "legIntClaim": "https://theadex.com/privacy-platform/" + }, + { + "langId": "de", + "privacy": "https://theadex.com/datenschutz-plattform/", + "legIntClaim": "https://theadex.com/datenschutz-plattform/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://dmp.theadex.com/.well-known/deviceStorage.json" + }, + "45": { + "id": 45, + "name": "Smart Adserver", + "purposes": [ + 1, + 2, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 34214395, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 40, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://smartadserver.com/end-user-privacy-policy/", + "legIntClaim": "https://smartadserver.com/end-user-privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://apps.smartadserver.com/device-storage-disclosures/equativDeviceStorageDisclosures.json" + }, + "46": { + "id": 46, + "name": "Skimbit Ltd", + "purposes": [], + "legIntPurposes": [ + 7, + 8 + ], + "flexiblePurposes": [ + 7, + 8 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://skimlinks.com/privacy-policies/", + "legIntClaim": "https://skimlinks.com/privacy-policies/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://storage.googleapis.com/skimthru-js/js/skimlinks_tcf_disclosures.json" + }, + "52": { + "id": 52, + "name": "Magnite, Inc. ", + "purposes": [ + 1, + 3, + 4, + 5 + ], + "legIntPurposes": [ + 2, + 7, + 10, + 11 + ], + "flexiblePurposes": [ + 2, + 7, + 10, + 11 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 28, + "purposes": { + "10": 90 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.magnite.com/legal/advertising-technology-privacy-policy/", + "legIntClaim": "https://www.magnite.com/legal/advertising-technology-privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://gdpr.rubiconproject.com/dvplus/devicestoragedisclosure.json" + }, + "53": { + "id": 53, + "name": "Sirdata", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 185, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.sirdata.com/en/Privacy", + "legIntClaim": "https://www.sirdata.com/en/Privacy#legitimateinterest" + }, + { + "langId": "fr", + "privacy": "https://www.sirdata.com/fr/Vie-Privee", + "legIntClaim": "https://www.sirdata.com/fr/Vie-Privee#legitimateinterest" + }, + { + "langId": "bg", + "privacy": "https://www.sirdata.com/en/Privacy-bg", + "legIntClaim": "https://www.sirdata.com/en/Privacy-bg#legitimateinterest" + }, + { + "langId": "zh", + "privacy": "https://www.sirdata.com/en/Privacy-zh", + "legIntClaim": "https://www.sirdata.com/en/Privacy-zh#legitimateinterest" + }, + { + "langId": "cs", + "privacy": "https://www.sirdata.com/en/Privacy-cs", + "legIntClaim": "https://www.sirdata.com/en/Privacy-cs#legitimateinterest" + }, + { + "langId": "da", + "privacy": "https://www.sirdata.com/en/Privacy-da", + "legIntClaim": "https://www.sirdata.com/en/Privacy-da#legitimateinterest" + }, + { + "langId": "nl", + "privacy": "https://www.sirdata.com/en/Privacy-nl", + "legIntClaim": "https://www.sirdata.com/en/Privacy-nl#legitimateinterest" + }, + { + "langId": "et", + "privacy": "https://www.sirdata.com/en/Privacy-et", + "legIntClaim": "https://www.sirdata.com/en/Privacy-et#legitimateinterest" + }, + { + "langId": "fi", + "privacy": "https://www.sirdata.com/en/Privacy-fi", + "legIntClaim": "https://www.sirdata.com/en/Privacy-fi#legitimateinterest" + }, + { + "langId": "de", + "privacy": "https://www.sirdata.com/en/Privacy-de", + "legIntClaim": "https://www.sirdata.com/en/Privacy-de#legitimateinterest" + }, + { + "langId": "el", + "privacy": "https://www.sirdata.com/en/Privacy-el", + "legIntClaim": "https://www.sirdata.com/en/Privacy-el#legitimateinterest" + }, + { + "langId": "hu", + "privacy": "https://www.sirdata.com/en/Privacy-hu", + "legIntClaim": "https://www.sirdata.com/en/Privacy-hu#legitimateinterest" + }, + { + "langId": "it", + "privacy": "https://www.sirdata.com/en/Privacy-it", + "legIntClaim": "https://www.sirdata.com/en/Privacy-it#legitimateinterest" + }, + { + "langId": "ja", + "privacy": "https://www.sirdata.com/en/Privacy-ja", + "legIntClaim": "https://www.sirdata.com/en/Privacy-ja#legitimateinterest" + }, + { + "langId": "lv", + "privacy": "https://www.sirdata.com/en/Privacy-lv", + "legIntClaim": "https://www.sirdata.com/en/Privacy-lv#legitimateinterest" + }, + { + "langId": "lt", + "privacy": "https://www.sirdata.com/en/Privacy-lt", + "legIntClaim": "https://www.sirdata.com/en/Privacy-lt#legitimateinterest" + }, + { + "langId": "no", + "privacy": "https://www.sirdata.com/en/Privacy-no", + "legIntClaim": "https://www.sirdata.com/en/Privacy-no#legitimateinterest" + }, + { + "langId": "pl", + "privacy": "https://www.sirdata.com/en/Privacy-pl", + "legIntClaim": "https://www.sirdata.com/en/Privacy-pl#legitimateinterest" + }, + { + "langId": "pt", + "privacy": "https://www.sirdata.com/en/Privacy-pt-PT", + "legIntClaim": "https://www.sirdata.com/en/Privacy-pt-PT#legitimateinterest" + }, + { + "langId": "ro", + "privacy": "https://www.sirdata.com/en/Privacy-ro", + "legIntClaim": "https://www.sirdata.com/en/Privacy-ro#legitimateinterest" + }, + { + "langId": "ru", + "privacy": "https://www.sirdata.com/en/Privacy-ru", + "legIntClaim": "https://www.sirdata.com/en/Privacy-ru#legitimateinterest" + }, + { + "langId": "sk", + "privacy": "https://www.sirdata.com/en/Privacy-sk", + "legIntClaim": "https://www.sirdata.com/en/Privacy-sk#legitimateinterest" + }, + { + "langId": "sl", + "privacy": "https://www.sirdata.com/en/Privacy-sl", + "legIntClaim": "https://www.sirdata.com/en/Privacy-sl#legitimateinterest" + }, + { + "langId": "es", + "privacy": "https://www.sirdata.com/en/Privacy-es", + "legIntClaim": "https://www.sirdata.com/en/Privacy-es#legitimateinterest" + }, + { + "langId": "sv", + "privacy": "https://www.sirdata.com/en/Privacy-sv", + "legIntClaim": "https://www.sirdata.com/en/Privacy-sv#legitimateinterest" + }, + { + "langId": "tr", + "privacy": "https://www.sirdata.com/en/Privacy-tr", + "legIntClaim": "https://www.sirdata.com/en/Privacy-tr#legitimateinterest" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.sirdata.eu/sirdata_device_storage_disclosure.json" + }, + "57": { + "id": 57, + "name": "RATEGAIN ADARA INC", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "2": 365, + "3": 365, + "4": 365, + "7": 730, + "9": 730, + "10": 730 + }, + "specialPurposes": { + "1": 730, + "2": 365 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://adara.com/privacy-promise/", + "legIntClaim": "https://adara.com/privacy-promise/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://storage.googleapis.com/adara-public/iab/device-storage-disclosure.json" + }, + "61": { + "id": 61, + "name": "GumGum, Inc.", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 400, + "purposes": { + "3": 720, + "4": 720 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.gumgum.com/terms-and-policies/privacy-policy", + "legIntClaim": "https://gumgum.com/terms-and-policies/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://marketing.gumgum.com/devicestoragedisclosures.json" + }, + "62": { + "id": 62, + "name": "Justpremium BV", + "purposes": [ + 1, + 2, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 400, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://justpremium.com/privacy-policy/", + "legIntClaim": "https://justpremium.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.justpremium.com/devicestoragedisclosures.json" + }, + "66": { + "id": 66, + "name": "adsquare GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 400, + "purposes": { + "2": 0, + "11": 0 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://adsquare.com/privacy/", + "legIntClaim": "https://adsquare.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "deviceStorageDisclosureUrl": "https://adsquare.com/deviceStorage.json" + }, + "70": { + "id": 70, + "name": "Yieldlab (Virtual Minds GmbH)", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 4, + "purposes": { + "2": 30, + "3": 30, + "4": 30 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.yieldlab.com/datenschutz/", + "legIntClaim": "https://www.yieldlab.com/datenschutz/" + }, + { + "langId": "en", + "privacy": "https://yieldlab.com/privacy-platform/", + "legIntClaim": "https://yieldlab.com/privacy-platform/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://ad.yieldlab.net/deviceStorage.json" + }, + "75": { + "id": 75, + "name": "M32 Connect Inc", + "purposes": [ + 1, + 2, + 3, + 4, + 8, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://m32connect.com/privacy-consent-management/privacy-cookie-policy/", + "legIntClaim": "https://m32connect.com/privacy-consent-management/privacy-cookie-policy/" + }, + { + "langId": "fr", + "privacy": "https://m32connect.com/fr/vie-privee-et-gestion-du-consentement/politique-de-confidentialite/", + "legIntClaim": "https://m32connect.com/fr/vie-privee-et-gestion-du-consentement/politique-de-confidentialite/" + } + ], + "dataDeclaration": [ + 1, + 2, + 5, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://rdc.m32.media/gdpr/vendors_disclosure.json" + }, + "77": { + "id": 77, + "name": "Comscore B.V.", + "purposes": [ + 1, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 62208000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.scorecardresearch.com/privacy.aspx" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 11 + ], + "deviceStorageDisclosureUrl": "https://census-web.scorecardresearch.com/tcf_vendor_disclosures.json" + }, + "83": { + "id": 83, + "name": "Visarity Technologies GmbH", + "purposes": [], + "legIntPurposes": [ + 8 + ], + "flexiblePurposes": [ + 8 + ], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://primo.design/docs/PrivacyPolicyPrimo.html", + "legIntClaim": "https://primo.design/docs/PrivacyPolicyPrimo.html" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://script.visarity.com/tcf/tcf-visarity.json" + }, + "85": { + "id": 85, + "name": "Crimtan Holdings Limited", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": { + "7": 1095, + "10": 1095 + }, + "specialPurposes": { + "2": 1095 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.crimtan.com/privacy-policy/", + "legIntClaim": "https://www.crimtan.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://a.ctnsnet.com/tcf.json" + }, + "87": { + "id": 87, + "name": "Betgenius Ltd", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://geniussports.com/policies/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://gsm-tcf.s3.eu-west-1.amazonaws.com/gsm-tcf.json" + }, + "90": { + "id": 90, + "name": "Teroa S.A.", + "purposes": [ + 1, + 2, + 7, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 220752000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 3650, + "purposes": { + "2": 0 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.e-planning.net/privacy-policy.html", + "legIntClaim": "https://www.e-planning.net/privacy-policy.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://www.e-planning.net/deviceStorageDisclosureUrl.json" + }, + "92": { + "id": 92, + "name": "1plusX AG", + "purposes": [ + 1, + 3, + 5 + ], + "legIntPurposes": [ + 7, + 8, + 9 + ], + "flexiblePurposes": [ + 7, + 8, + 9 + ], + "specialPurposes": [], + "features": [ + 1, + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.1plusx.com/privacy-policy/", + "legIntClaim": "https://www.1plusx.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://device-storage-disclosure.1plusx.io" + }, + "93": { + "id": 93, + "name": "Adloox SA", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 7 + ], + "flexiblePurposes": [ + 7 + ], + "specialPurposes": [ + 1 + ], + "features": [], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 396, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.adloox.com/legal/privacy-policy", + "legIntClaim": "https://www.adloox.com/legal/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://j.adlooxtracking.com/ads/tcf.json" + }, + "94": { + "id": 94, + "name": "Blis Global Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 34560000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 400, + "purposes": {}, + "specialPurposes": { + "2": 0 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://blis.com/blis-privacy-policy-for-online-advertising-and-related-uses/", + "legIntClaim": "https://blis.com/legitimate-interests-statement/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://privacy.blismedia.com/.well-known/deviceStorage.json" + }, + "100": { + "id": 100, + "name": "Fifty Technology Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 183, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://fifty.io/privacy-policy", + "legIntClaim": "https://fifty.io/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://fifty.io/privacy/deviceStorage.json" + }, + "104": { + "id": 104, + "name": "Sonobi, Inc", + "purposes": [ + 1, + 2, + 3, + 4 + ], + "legIntPurposes": [ + 7, + 8 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 5184000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 548, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://sonobi.com/privacy-policy/", + "legIntClaim": "https://sonobi.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 3, + 8 + ], + "deviceStorageDisclosureUrl": "https://sonobi.com/tcf2-device-storage-disclosure.json" + }, + "108": { + "id": 108, + "name": "Rich Audience Technologies SL", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://richaudience.com/en/privacy/" + }, + { + "langId": "es", + "privacy": "https://richaudience.com/es/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 8 + ], + "deviceStorageDisclosureUrl": "https://cdnj.richaudience.com/52a26ab9400b2a9f5aabfa20acf3196g.json" + }, + "109": { + "id": 109, + "name": "LoopMe Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9 + ], + "legIntPurposes": [ + 10 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 396, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://legal.loopme.com/privacy-center#contract-hyartvn1o", + "legIntClaim": "https://legal.loopme.com/privacy-center#contract-hyartvn1o" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://co.loopme.com/deviceStorageDisclosure.json" + }, + "111": { + "id": 111, + "name": "Showheroes SE", + "purposes": [ + 1, + 3, + 4, + 9, + 10 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 11 + ], + "flexiblePurposes": [ + 2, + 7, + 8 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 33955200, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 393, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://showheroes.com/privacy-policy/", + "legIntClaim": "https://showheroes.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 3, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://static-origin.showheroes.com/gvl_storage_disclosure.json" + }, + "114": { + "id": 114, + "name": "Sublime", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 34164060, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": { + "2": 0, + "7": 365, + "9": 365 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://ayads.co/privacy.php" + } + ], + "dataDeclaration": [ + 1, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://gdpr.ayads.co/cookiepolicy.json" + }, + "115": { + "id": 115, + "name": "smartclip Europe GmbH", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 120, + "purposes": { + "2": 30, + "3": 365, + "4": 365 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://privacy-portal.smartclip.net/de/privacy-policy", + "legIntClaim": "https://privacy-portal.smartclip.net/de/privacy-policy" + }, + { + "langId": "en", + "privacy": "https://privacy-portal.smartclip.net/en/privacy-policy", + "legIntClaim": "https://privacy-portal.smartclip.net/en/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.smartclip.net/iab/deviceStorageDisclosure.json" + }, + "124": { + "id": 124, + "name": "Near Intelligence", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": { + "7": 180 + }, + "specialPurposes": { + "1": 30, + "2": 30 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://near.com/fr/privacy-policy/", + "legIntClaim": "https://near.com/fr/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 9 + ], + "deviceStorageDisclosureUrl": "https://near.com/iab/disclosures.json" + }, + "126": { + "id": 126, + "name": "DoubleVerify Inc.​", + "purposes": [], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 31, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://doubleverify.com/privacy-notice/solutions-privacy-notice", + "legIntClaim": "https://doubleverify.com/privacy-notice/solutions-privacy-notice" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.doubleverify.com/static/Doubleverify_TCF.json" + }, + "131": { + "id": 131, + "name": "ID5 Technology Ltd", + "purposes": [ + 1 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://id5.io/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://id5-sync.com/tcf/disclosures.json" + }, + "132": { + "id": 132, + "name": "Teads France SAS", + "purposes": [ + 1, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [ + 2 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 120, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.teads.com/privacy-policy/", + "legIntClaim": "https://privacy-policy.teads.com/privacy-policy/european-privacy-notice/" + }, + { + "langId": "fr", + "privacy": "https://privacy-policy.teads.com/privacy-policy/privacy-policy-general-notice-fr/", + "legIntClaim": "https://privacy-policy.teads.com/privacy-policy/politique-de-confidentialite-europe/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://iab-cookie-disclosure.teads.tv/deviceStorage.json" + }, + "133": { + "id": 133, + "name": "digitalAudience B.V.", + "purposes": [ + 1, + 3, + 5, + 7, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31557600, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://digitalaudience.io/legal/" + } + ], + "dataDeclaration": [ + 1, + 3, + 5, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://dadocuments.blob.core.windows.net/documents/IAB-dA-Device-Storage-Disclosure-08092022.json" + }, + "134": { + "id": 134, + "name": "SMARTSTREAM.TV GmbH", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.smartstream.tv/en/productprivacy", + "legIntClaim": "https://www.smartstream.tv/en/productprivacy" + }, + { + "langId": "de", + "privacy": "https://www.smartstream.tv/de/produktdatenschutz", + "legIntClaim": "https://www.smartstream.tv/de/produktdatenschutz" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://tcf.adtech.app/gen/deviceStorageDisclosure/stv.json" + }, + "136": { + "id": 136, + "name": "Ströer SSP GmbH (SSP)", + "purposes": [ + 1, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 730, + "purposes": { + "2": 0 + }, + "specialPurposes": { + "1": 183, + "2": 0 + } + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.stroeer.de/ssp-datenschutz", + "legIntClaim": "https://www.stroeer.de/ssp-datenschutz" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.stroeer.de/StroeerSSP_deviceStorage.json" + }, + "137": { + "id": 137, + "name": "OS Data Solutions GmbH & Co. KG", + "purposes": [ + 1, + 3, + 5 + ], + "legIntPurposes": [ + 9, + 10 + ], + "flexiblePurposes": [ + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://osdatasolutions.de/datenschutz/", + "legIntClaim": "https://osdatasolutions.de/datenschutz/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.stroeer.de/StroeerDSP_deviceStorage.json" + }, + "138": { + "id": 138, + "name": "ConnectAd Demand GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 2628000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://connectadrealtime.com/privacy/", + "legIntClaim": "https://connectadrealtime.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 11 + ], + "deviceStorageDisclosureUrl": "https://connectad.io/tcf_storage.json" + }, + "139": { + "id": 139, + "name": "Permodo GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://permodo.com/de/privacy.html", + "legIntClaim": "https://permodo.com/de/privacy.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://tcf.adtech.app/gen/deviceStorageDisclosure/per.json" + }, + "140": { + "id": 140, + "name": "Platform161 B.V.", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 34164000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": { + "3": 390, + "7": 30, + "10": 365 + }, + "specialPurposes": { + "1": 7 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://verve.com/dsp-cookies-privacy/", + "legIntClaim": "https://verve.com/dsp-cookies-privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://static2.creative-serving.com/deviceStorage.json" + }, + "149": { + "id": 149, + "name": "ADman Interactive SLU", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31535998, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "es", + "privacy": "https://admanmedia.com/politica.html", + "legIntClaim": "https://admanmedia.com/politica.html" + } + ], + "dataDeclaration": [ + 2 + ], + "deviceStorageDisclosureUrl": "https://admanmedia.com/deviceStorage.json" + }, + "150": { + "id": 150, + "name": "Inskin Media LTD", + "purposes": [ + 1, + 3, + 4, + 9, + 10 + ], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31622400, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "2": 4320, + "3": 90, + "4": 90, + "7": 4320, + "9": 90, + "10": 4320 + }, + "specialPurposes": { + "1": 90, + "2": 4320 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.inskinmedia.com/privacy-policy.html", + "legIntClaim": "https://www.inskinmedia.com/privacy-policy.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.inskinad.com/deviceStorageDisclosure.json" + }, + "151": { + "id": 151, + "name": "MOOT TECHNOLOGY LTD", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 0, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 390, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://admedo.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://admedo.com/admedo_device_storage_url.json" + }, + "153": { + "id": 153, + "name": "MADVERTISE MEDIA", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 10368000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 120, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://madvertise.com/en/gdpr/", + "legIntClaim": "https://madvertise.com/en/gdpr/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://mobile.mng-ads.com/deviceStorage.json" + }, + "154": { + "id": 154, + "name": "YOC AG", + "purposes": [ + 1, + 3, + 4, + 10 + ], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://yoc.com/privacy/", + "legIntClaim": "https://yoc.com/privacy/" + }, + { + "langId": "de", + "privacy": "https://yoc.com/de/datenschutz/", + "legIntClaim": "https://yoc.com/de/datenschutz/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.yoc.com/visx/sellers/deviceStorage.json" + }, + "155": { + "id": 155, + "name": "AntVoice", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 34819200, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 403, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.antvoice.com/en/privacypolicy/", + "legIntClaim": "https://www.antvoice.com/en/privacypolicy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://av-eu-marketing.storage.googleapis.com/deviceStorage.json" + }, + "156": { + "id": 156, + "name": "Basis Global Technologies, Inc.", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "2": 0, + "3": 180, + "4": 180, + "7": 35, + "10": 540 + }, + "specialPurposes": { + "1": 540, + "2": 0 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://privacy.basis.net/", + "legIntClaim": "https://privacy.basis.net/#gdpr" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://privacy.basis.net/devicestorage.json" + }, + "160": { + "id": 160, + "name": "Audience Solutions S.A.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "pl", + "privacy": "https://audience-solutions.com/privacy.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://audience-solutions.com/.well-known/deviceStorage.json" + }, + "161": { + "id": 161, + "name": "SMADEX, S.L.U.", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://smadex.com/privacy-policy/", + "legIntClaim": "https://smadex.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://statics.smadex.com/tcf-storage.json" + }, + "163": { + "id": 163, + "name": "Bombora Inc.", + "purposes": [ + 1, + 3 + ], + "legIntPurposes": [ + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 7, + 9, + 10 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://bombora.com/privacy", + "legIntClaim": "https://bombora.com/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 8, + 10 + ], + "deviceStorageDisclosureUrl": "https://ml314.com/deviceStorage.json" + }, + "164": { + "id": 164, + "name": "Outbrain UK Ltd", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 396, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.outbrain.com/privacy", + "legIntClaim": "https://www.outbrain.com/privacy" + }, + { + "langId": "fr", + "privacy": "https://www.outbrain.com/privacy/fr", + "legIntClaim": "https://www.outbrain.com/privacy/fr" + }, + { + "langId": "de", + "privacy": "https://www.outbrain.com/privacy/de/", + "legIntClaim": "https://www.outbrain.com/privacy/de/" + }, + { + "langId": "it", + "privacy": "https://www.outbrain.com/privacy/it/", + "legIntClaim": "https://www.outbrain.com/privacy/it/" + }, + { + "langId": "ja", + "privacy": "https://www.outbrain.com/privacy/jp/", + "legIntClaim": "https://www.outbrain.com/privacy/jp/" + }, + { + "langId": "nl", + "privacy": "https://www.outbrain.com/privacy/nl/", + "legIntClaim": "https://www.outbrain.com/privacy/nl/" + }, + { + "langId": "pt", + "privacy": "https://www.outbrain.com/privacy/pt/", + "legIntClaim": "https://www.outbrain.com/privacy/pt/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.outbrain.com/privacy/wp-json/privacy/v2/devicestorage.json" + }, + "173": { + "id": 173, + "name": "Yieldmo, Inc.", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 390, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.yieldmo.com/privacy/", + "legIntClaim": "https://www.yieldmo.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://s3.amazonaws.com/devicestoragedisclosureurl.yieldmo.com/deviceStorage.json" + }, + "185": { + "id": 185, + "name": "Bidtellect, Inc", + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 28, + "purposes": { + "5": 365, + "6": 365 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.bidtellect.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 10 + ], + "deviceStorageDisclosureUrl": "https://cdn.bttrack.com/iab/deviceStorageDisclosure.json" + }, + "190": { + "id": 190, + "name": "video intelligence AG", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.vi.ai/legal/privacy-policy/", + "legIntClaim": "https://www.vi.ai/legal/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.vi.ai/deviceStorage.json" + }, + "195": { + "id": 195, + "name": "advanced store GmbH", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 60, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.advanced-store.com/de/datenschutz/", + "legIntClaim": "https://www.advanced-store.com/de/datenschutz/" + }, + { + "langId": "en", + "privacy": "https://www.advanced-store.com/en/data-privacy/", + "legIntClaim": "https://www.advanced-store.com/en/data-privacy/" + } + ], + "dataDeclaration": [ + 3 + ], + "deviceStorageDisclosureUrl": "https://ad4m.at/.well-known/deviceStorage.json" + }, + "206": { + "id": 206, + "name": "Hybrid Adtech GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://hybrid.ai/data_protection_policy", + "legIntClaim": "https://hybrid.ai/data_protection_policy" + } + ], + "dataDeclaration": [ + 2, + 3 + ], + "deviceStorageDisclosureUrl": "https://st.hybrid.ai/policy/deviceStorage.json" + }, + "209": { + "id": 209, + "name": "Delta Projects AB", + "purposes": [ + 1, + 2, + 3, + 4 + ], + "legIntPurposes": [ + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 547, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://deltaprojects.com/data-collection-policy", + "legIntClaim": "https://deltaprojects.com/data-collection-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.de17a.com/policy/deviceStorage.json" + }, + "210": { + "id": 210, + "name": "Zemanta Inc.", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.zemanta.com/privacy/", + "legIntClaim": "https://www.zemanta.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.zemanta.com/wp-content/uploads/2022/06/deviceStorage.json" + }, + "211": { + "id": 211, + "name": "AdTheorent, Inc", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 63071995, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://adtheorent.com/privacy-policy", + "legIntClaim": "https://adtheorent.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://public-cdn.adtheorent.com/iab/AdTheorent-IAB-TCFv2-deviceStorageDisclosure.json" + }, + "215": { + "id": 215, + "name": "ARMIS SAS", + "purposes": [ + 1, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 33696000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "7": 180 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://armis.tech/en/armis-personal-data-privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 8 + ], + "deviceStorageDisclosureUrl": "https://armis-rgpd-acotedemoi.acotedemoi.com/" + }, + "216": { + "id": 216, + "name": "Mindlytix SAS", + "purposes": [ + 1, + 2, + 3, + 5, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 5356800, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 185, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://mindlytix.com/privacy/", + "legIntClaim": "https://mindlytix.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://mindlytix.com/tcf/tcf.json" + }, + "226": { + "id": 226, + "name": "Publicis Media GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.publicismedia.de/datenschutz/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.vtracy.de/iab/deviceStorage.json" + }, + "227": { + "id": 227, + "name": "Opt Out Advertising B.V. ", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31622400, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": { + "1": 30 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://optoutadvertising.com/privacy-policy/", + "legIntClaim": "https://optoutadvertising.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://adserving.optoutadvertising.com/dsd" + }, + "228": { + "id": 228, + "name": "M.D. Primis Technologies Ltd.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 7, + 8, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 2160000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.primis.tech/privacy-policy/", + "legIntClaim": "https://www.primis.tech/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.primis.tech/deviceStorage.json" + }, + "231": { + "id": 231, + "name": "AcuityAds Inc.", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://privacy.acuityads.com/corporate-privacy-policy.html", + "legIntClaim": "https://privacy.acuityads.com/corporate-privacy-policy.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://privacy.acuityads.com/deviceStorageDisclosure.json" + }, + "237": { + "id": 237, + "name": "VGI CTV, Inc", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://verve.com/privacy-policy/index.html", + "legIntClaim": "https://verve.com/website-privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://lkqd.com/disclosures.json" + }, + "241": { + "id": 241, + "name": "OneTag Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 34160000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 548, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.onetag.com/privacy/", + "legIntClaim": "https://www.onetag.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://onetag-cdn.com/privacy/tcf_storage.json" + }, + "242": { + "id": 242, + "name": "twiago GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 60, + "purposes": { + "7": 14 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://a.twiago.com/privacy.php", + "legIntClaim": "https://a.twiago.com/privacy.php" + }, + { + "langId": "en", + "privacy": "https://a.twiago.com/privacy.php", + "legIntClaim": "https://a.twiago.com/privacy.php" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://control.twiago.com/deviceStorage.json" + }, + "244": { + "id": 244, + "name": "Ermes", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 33696000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 395, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.ermes.ai/politique-de-confidentialite/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://tag.leadplace.fr/consents/consents.json" + }, + "246": { + "id": 246, + "name": "Smartology Limited", + "purposes": [ + 1, + 3, + 4, + 8 + ], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": { + "3": 0, + "4": 0 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.smartology.net/privacy-policy/", + "legIntClaim": "https://www.smartology.net/legitimate-interest-assessments/" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://www.smartology.net/deviceStorageDisclosure.json" + }, + "248": { + "id": 248, + "name": "Converge-Digital", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://converge-digital.com/privacy-policy/", + "legIntClaim": "https://converge-digital.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2 + ], + "deviceStorageDisclosureUrl": "https://data.converge-digital.com/deviceStorage.json" + }, + "251": { + "id": 251, + "name": "Yieldlove GmbH", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "2": 7, + "7": 0, + "10": 183 + }, + "specialPurposes": { + "1": 183, + "2": 7 + } + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.yieldlove.com/de-de/datenschutz/", + "legIntClaim": "https://www.yieldlove.com/de-de/datenschutz/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn-a.yieldlove.com/deviceStorage.json" + }, + "252": { + "id": 252, + "name": "Jaduda GmbH", + "purposes": [ + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": { + "2": 3650 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.splicky.com/en/web/privacy-delivery", + "legIntClaim": "https://splicky.com/en/web/privacy-policy/legitimate-interests" + }, + { + "langId": "de", + "privacy": "https://www.splicky.com/de/web/privacy-delivery", + "legIntClaim": "https://splicky.com/de/web/privacy-policy/legitimate-interests" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn-global.splicky.com/devicestorage.json" + }, + "253": { + "id": 253, + "name": "Improve Digital", + "purposes": [ + 1, + 3, + 4, + 9 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.improvedigital.com/platform-privacy-policy", + "legIntClaim": "https://www.improvedigital.com/platform-privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://sellers.improvedigital.com/tcf-cookies.json" + }, + "254": { + "id": 254, + "name": "LiquidM Technology GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 14, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://liquidm.com/privacy-policy/", + "legIntClaim": "https://liquidm.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://liquidm.com/disclosures.json" + }, + "255": { + "id": 255, + "name": "Onnetwork Sp. z o.o.", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8 + ], + "flexiblePurposes": [ + 2, + 7, + 8 + ], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 4320000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": { + "5": 30, + "6": 30 + }, + "specialPurposes": { + "2": 30 + } + }, + "urls": [ + { + "langId": "pl", + "privacy": "https://www.onnetwork.tv/pp_services.php#pl", + "legIntClaim": "https://www.onnetwork.tv/pp_services.php#pl" + }, + { + "langId": "en", + "privacy": "https://www.onnetwork.tv/pp_services.php#en", + "legIntClaim": "https://www.onnetwork.tv/pp_services.php#en" + } + ], + "dataDeclaration": [ + 10 + ], + "deviceStorageDisclosureUrl": "https://video.onnetwork.tv/vendor255.json" + }, + "259": { + "id": 259, + "name": "ADYOULIKE SA", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 60, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.adyoulike.com/pages/privacy", + "legIntClaim": "https://www.adyoulike.com/pages/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://adyoulike.com/deviceStorageDisclosureURL.json" + }, + "270": { + "id": 270, + "name": "Marfeel Solutions, SL", + "purposes": [ + 1 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.marfeel.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 8 + ], + "deviceStorageDisclosureUrl": "https://live.mrf.io/statics/marfeel/resources/lib/deviceStorage/touch.json" + }, + "272": { + "id": 272, + "name": "A.Mob", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 34128000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 395, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.we-are-adot.com/privacy-policy/" + }, + { + "langId": "en", + "privacy": "https://we-are-adot.com/en/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://adserver.adotmob.com/tcf/tcf.json" + }, + "274": { + "id": 274, + "name": "Golden Bees", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://applies.goldenbees.fr/privacyPolicy/fr", + "legIntClaim": "https://applies.goldenbees.fr/privacyPolicy/fr" + } + ], + "dataDeclaration": [ + 2 + ], + "deviceStorageDisclosureUrl": "https://cdn.goldenbees.fr/proxy?url=http%3A%2F%2Fstatic.goldenbees.fr%2Fcdn%2Fjs%2Fcmp%2FdeviceStorage.json&attachment=0" + }, + "279": { + "id": 279, + "name": "Mirando GmbH & Co KG", + "purposes": [], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://get.mirando.de/download/gdpr.php", + "legIntClaim": "https://get.mirando.de/download/gdpr.php" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://get.mirando.de/download/gdpr.php" + }, + "281": { + "id": 281, + "name": "Wizaly", + "purposes": [ + 1, + 7, + 8, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 7, + 8, + 9 + ], + "specialPurposes": [], + "features": [ + 1, + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 1095, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.wizaly.com/terms-of-use#privacy-policy", + "legIntClaim": "https://www.wizaly.com/terms-of-use#privacy-policy" + }, + { + "langId": "fr", + "privacy": "https://www.wizaly.fr/mentions-legales#politique-de-confidentialite", + "legIntClaim": "https://www.wizaly.fr/mentions-legales#politique-de-confidentialite" + } + ], + "dataDeclaration": [ + 1, + 2, + 5, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://t.wizaly.com/iab-tcf-vendor-device-storage-and-operational-disclosures.json" + }, + "282": { + "id": 282, + "name": "Welect GmbH", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 1209600, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.welect.de/datenschutz", + "legIntClaim": "https://www.welect.de/datenschutz" + }, + { + "langId": "en", + "privacy": "https://www.de.welect.de/en/privacy-policy/", + "legIntClaim": "https://www.de.welect.de/en/privacy-policy/" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://www.welect.de/deviceStorage.json" + }, + "284": { + "id": 284, + "name": "Weborama", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 10 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 11 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 33955200, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 395, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://weborama.com/respect-de-la-vie-privee-2-2/", + "legIntClaim": "https://weborama.com/politique-de-confidentialite/#interet-legitime-weborama" + }, + { + "langId": "en", + "privacy": "https://weborama.com/en/privacy-2/", + "legIntClaim": "https://weborama.com/en/privacy-2/#legitimate-interest" + }, + { + "langId": "it", + "privacy": "https://weborama.com/it/privacy-3/", + "legIntClaim": "https://weborama.com/it/privacy-3/#interesse-legittimo" + }, + { + "langId": "es", + "privacy": "https://weborama.com/es/privacidad/", + "legIntClaim": "https://weborama.com/it/privacy-3/#interesse-legittimo" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://weborama.com/deviceStorage.json" + }, + "285": { + "id": 285, + "name": "Comcast International France SAS", + "purposes": [ + 1, + 2, + 4 + ], + "legIntPurposes": [ + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 15768000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 547, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.freewheel.com/privacy-policy", + "legIntClaim": "https://www.freewheel.com/privacy-policy#tab2_section2_4" + }, + { + "langId": "nl", + "privacy": "https://www.freewheel.com/privacy-policy/nl", + "legIntClaim": "https://www.freewheel.com/privacy-policy/nl#tab2_section2_4" + }, + { + "langId": "fr", + "privacy": "https://www.freewheel.com/privacy-policy/fr", + "legIntClaim": "https://www.freewheel.com/privacy-policy/fr#tab2_section2_4" + }, + { + "langId": "it", + "privacy": "https://www.freewheel.com/privacy-policy/it", + "legIntClaim": "https://www.freewheel.com/privacy-policy/it#tab2_section2_4" + }, + { + "langId": "es", + "privacy": "https://www.freewheel.com/privacy-policy/es", + "legIntClaim": "https://www.freewheel.com/privacy-policy/es#tab2_section2_4" + }, + { + "langId": "de", + "privacy": "https://www.freewheel.com/privacy-policy/de", + "legIntClaim": "https://www.freewheel.com/privacy-policy/de#tab2_section2_4" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://iab.fwmrm.net/g/devicedisclosure.json" + }, + "290": { + "id": 290, + "name": "Readpeak Oy", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 180, + "purposes": { + "7": 4320, + "10": 4320 + }, + "specialPurposes": { + "2": 4320 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.readpeak.com/terms/readpeak-privacy-policy", + "legIntClaim": "https://www.readpeak.com/terms/legitimate-interest-assessment-lia" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://static.readpeak.com/tcf/deviceStorage.json" + }, + "294": { + "id": 294, + "name": "Jivox Corporation", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.jivox.com/privacy", + "legIntClaim": "https://www.jivox.com/privacy" + } + ], + "dataDeclaration": [ + 1, + 3, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.jivox.com/files/privacy/deviceStorage.json" + }, + "301": { + "id": 301, + "name": "zeotap GmbH", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://zeotap.com/product-privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://spl.zeotap.com/assets/iab-disclosure.json" + }, + "304": { + "id": 304, + "name": "On Device Research Limited", + "purposes": [ + 1, + 2, + 3 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://s.on-device.com/privacyPolicy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 9 + ], + "deviceStorageDisclosureUrl": "https://on-device.com/deviceStorage.json" + }, + "311": { + "id": 311, + "name": "Mobfox US LLC", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 1209600, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": { + "1": 365 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.mobfox.com/privacy-policy/", + "legIntClaim": "https://www.mobfox.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 8, + 9 + ], + "deviceStorageDisclosureUrl": "https://www.mobfox.com/disclosures.json" + }, + "312": { + "id": 312, + "name": "Exactag GmbH", + "purposes": [ + 1, + 7, + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 2 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 210, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://exactag.com/privacy-policy/", + "legIntClaim": "https://exactag.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 2, + 3, + 5, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.exactag.com/.well-known/deviceStorage.json" + }, + "314": { + "id": 314, + "name": "Keymantics", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.kmtx.com/privacy/", + "legIntClaim": "https://www.kmtx.com/privacy/" + } + ], + "dataDeclaration": [ + 2, + 6 + ], + "deviceStorageDisclosureUrl": "https://cdn.keymantics.com/.well-known/deviceStorage.json" + }, + "318": { + "id": 318, + "name": "Accorp Sp. z o.o.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 720, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://instytut-pollster.pl/privacy-policy/index.html", + "legIntClaim": "https://instytut-pollster.pl/privacy-policy/index.html" + }, + { + "langId": "pl", + "privacy": "https://instytut-pollster.pl/privacy-policy/index.html", + "legIntClaim": "https://instytut-pollster.pl/privacy-policy/index.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://content.pollster.pl/deviceStorage" + }, + "321": { + "id": 321, + "name": "Ziff Davis LLC", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 9 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 1080, + "purposes": { + "2": 360, + "3": 360, + "4": 360, + "5": 360, + "6": 360 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.ziffdavis.com/privacy-policy", + "legIntClaim": "https://www.ziffdavis.com/privacy-policy#lawful" + }, + { + "langId": "fr", + "privacy": "https://www.ziffdavis.com/privacy-policy-f/", + "legIntClaim": "https://www.ziffdavis.com/privacy-policy-f/#lawful" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://static.ziffdavis.com/jst/zdcookiedisclosure.json" + }, + "323": { + "id": 323, + "name": "Footballco Media Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 34190000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.goal.com/en-gb/legal/privacy-policy" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://www.footballco.com/gvl-device-storage.json" + }, + "325": { + "id": 325, + "name": "Knorex", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 63071999, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.knorex.com/privacy", + "legIntClaim": "https://www.knorex.com/privacy" + } + ], + "dataDeclaration": [ + 3, + 4, + 7, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.brand-display.com/gvl/deviceStorageDisclosure.json" + }, + "326": { + "id": 326, + "name": "AdTiming Technology Company Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.adtiming.com/en/privacypolicy.html", + "legIntClaim": "https://www.adtiming.com/en/privacypolicy.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6 + ], + "deviceStorageDisclosureUrl": "https://img.adtiming.com/webrt/AdTiming.TCFv2.json" + }, + "328": { + "id": 328, + "name": "Gemius SA", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 157680000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 1096, + "purposes": { + "3": 1, + "4": 30, + "8": 1827, + "10": 1827 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.gemius.com/privacy-policy.html" + } + ], + "dataDeclaration": [ + 2, + 3, + 6, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://gemius.com/Gemius_SA_Vendor_Device_Storage.json" + }, + "329": { + "id": 329, + "name": "Browsi", + "purposes": [ + 1, + 7, + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "7": 730, + "8": 400 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://browsi.com/privacy-policy-2/" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.browsiprod.com/ads/tcf.json" + }, + "331": { + "id": 331, + "name": "ad6media", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.ad6media.fr/privacy", + "legIntClaim": "https://www.ad6media.fr/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10 + ], + "deviceStorageDisclosureUrl": "https://www.ad6media.fr/tcf.json" + }, + "333": { + "id": 333, + "name": "InMobi Pte Ltd", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 9, + 10 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": { + "2": 0, + "3": 395, + "4": 395 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.inmobi.com/privacy-policy-for-eea", + "legIntClaim": "https://www.inmobi.com/privacy-policy-for-eea" + }, + { + "langId": "pt", + "privacy": "https://www.inmobi.com/privacy-policy-por", + "legIntClaim": "https://www.inmobi.com/privacy-policy-por" + }, + { + "langId": "es", + "privacy": "https://www.inmobi.com/privacy-policy-es", + "legIntClaim": "https://www.inmobi.com/privacy-policy-es" + } + ], + "dataDeclaration": [ + 1, + 3, + 8, + 9 + ], + "deviceStorageDisclosureUrl": "https://publisher.inmobi.com/public/disclosure" + }, + "336": { + "id": 336, + "name": "Telecoming S.A.", + "purposes": [], + "legIntPurposes": [ + 2, + 7, + 9 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 3650, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.telecoming.com/privacy-policy/", + "legIntClaim": "https://www.telecoming.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 3, + 4 + ], + "deviceStorageDisclosureUrl": "https://telecoming.rtb.lynxio.org/deviceStorageDisclosureURL.json" + }, + "337": { + "id": 337, + "name": "SheMedia, LLC", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.shemedia.com/ad-services-privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://ads.shemedia.com/static/tcfdisclosures.json" + }, + "345": { + "id": 345, + "name": "The Kantar Group Limited", + "purposes": [ + 1, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 78892380, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.kantar.com/cookies-policies" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://secure.insightexpressai.com/DeviceStorageDisclosure.json" + }, + "347": { + "id": 347, + "name": "Ezoic Inc.", + "purposes": [ + 1, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 220752000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.ezoic.com/terms/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://privacy.ezodn.com/storage_disclosure.json" + }, + "350": { + "id": 350, + "name": "Samba TV, Inc.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 33696000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "2": 395, + "3": 395, + "4": 395, + "5": 395, + "6": 395, + "7": 1125, + "8": 1125, + "9": 1125, + "10": 1125 + }, + "specialPurposes": { + "1": 1125 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "ar", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "bg", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "bs", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "ca", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "cs", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "da", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "de", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "el", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "es", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "et", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "fi", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "fr", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "hr", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "hu", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "it", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "ja", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "lt", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "lv", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "nl", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "no", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "pl", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "pt", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "ro", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "ru", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "sk", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "sl", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "sv", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "tr", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "zh", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + }, + { + "langId": "sr - cyrl", + "privacy": "https://samba.tv/legal/privacy-policy/", + "legIntClaim": "https://samba.tv/legal/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://ads.samba.tv/disclosures.json" + }, + "351": { + "id": 351, + "name": "Samba TV UK Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 33696000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "2": 395, + "3": 395, + "4": 395, + "5": 395, + "6": 395, + "7": 1125, + "8": 1125, + "9": 1125, + "10": 1125 + }, + "specialPurposes": { + "1": 1125 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "ar", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "bg", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "bs", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "ca", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "cs", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "da", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "de", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "el", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "es", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "et", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "fi", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "fr", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "hu", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "it", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "ja", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "lt", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "lv", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "nl", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "no", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "pl", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "pt", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "ro", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "sr - cyrl", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "ru", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "sk", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "sl", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "sv", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "tr", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + }, + { + "langId": "zh", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy1" + }, + { + "langId": "hr", + "privacy": "https://samba.tv/users/privacy-policy", + "legIntClaim": "https://samba.tv/users/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://pixel.mtrcs.samba.tv/disclosures.json" + }, + "358": { + "id": 358, + "name": "MGID Inc.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.mgid.com/privacy-policy", + "legIntClaim": "https://www.mgid.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.mgid.com/assets/devicestorage.json" + }, + "368": { + "id": 368, + "name": "VECTAURY", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.mobsuccess.com/en/privacy", + "legIntClaim": "https://www.mobsuccess.com/en/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.mobsuccess.com/deviceStorage.json" + }, + "371": { + "id": 371, + "name": "Seeding Alliance GmbH", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://seeding-alliance.de/datenschutz/", + "legIntClaim": "https://seeding-alliance.de/datenschutz/" + } + ], + "dataDeclaration": [ + 1, + 2 + ], + "deviceStorageDisclosureUrl": "https://c.nativendo.de/cdn/asset/tcf/purpose-specific-storage-and-access-information.json" + }, + "373": { + "id": 373, + "name": "Nielsen Media Research Ltd.", + "purposes": [ + 1, + 3 + ], + "legIntPurposes": [ + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 10368000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 396, + "purposes": { + "3": 45 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.nielsen.com/us/en/legal/privacy-statement/nielsen-marketing-cloud-privacy-notice/", + "legIntClaim": "https://www.nielsen.com/us/en/legal/privacy-statement/nielsen-marketing-cloud-privacy-notice/" + }, + { + "langId": "de", + "privacy": "https://www.nielsen.com/us/en/legal/privacy-statement/nielsen-marketing-cloud-privacy-notice/", + "legIntClaim": "https://www.nielsen.com/us/en/legal/privacy-statement/nielsen-marketing-cloud-privacy-notice/" + }, + { + "langId": "fr", + "privacy": "https://www.nielsen.com/us/en/legal/privacy-statement/nielsen-marketing-cloud-privacy-notice/", + "legIntClaim": "https://www.nielsen.com/us/en/legal/privacy-statement/nielsen-marketing-cloud-privacy-notice/" + }, + { + "langId": "it", + "privacy": "https://www.nielsen.com/us/en/legal/privacy-statement/nielsen-marketing-cloud-privacy-notice/", + "legIntClaim": "https://www.nielsen.com/us/en/legal/privacy-statement/nielsen-marketing-cloud-privacy-notice/" + }, + { + "langId": "es", + "privacy": "https://www.nielsen.com/us/en/legal/privacy-statement/nielsen-marketing-cloud-privacy-notice/", + "legIntClaim": "https://www.nielsen.com/us/en/legal/privacy-statement/nielsen-marketing-cloud-privacy-notice/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://iab-privacy-disclosure.exelator.com/.json" + }, + "375": { + "id": 375, + "name": "RevX", + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://revx.io/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://storage.googleapis.com/revx-product/privacy/tcf/deviceStorage/device_storage_disclosure.json" + }, + "377": { + "id": 377, + "name": "AddApptr GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 9 + ], + "legIntPurposes": [ + 7, + 10 + ], + "flexiblePurposes": [ + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.gravite.net/data-privacy", + "legIntClaim": "https://www.gravite.net/data-privacy" + }, + { + "langId": "de", + "privacy": "https://www.gravite.net/data-privacy", + "legIntClaim": "https://www.gravite.net/data-privacy" + } + ], + "dataDeclaration": [ + 2, + 3, + 6, + 9 + ], + "deviceStorageDisclosureUrl": "https://addapptr.com/tcfDeviceStorageDisclosures.json" + }, + "381": { + "id": 381, + "name": "Solocal SA", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 7, + 9, + 10 + ], + "legIntPurposes": [ + 2, + 8 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 34164000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "2": 0, + "3": 91, + "4": 91, + "5": 91, + "6": 91, + "7": 4320, + "8": 4320, + "9": 4320, + "10": 4320 + }, + "specialPurposes": { + "1": 372 + } + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.solocal.com/protection-de-la-vie-privee", + "legIntClaim": "https://www.solocal.com/protection-de-la-vie-privee" + } + ], + "dataDeclaration": [ + 2, + 3, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://prd-cdn.adhslx.com/ui/login/assets/tcf/tcf-registration.json" + }, + "382": { + "id": 382, + "name": "The Reach Group GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://trg.de/en/privacy-statement/", + "legIntClaim": "https://trg.de/en/privacy-statement/" + }, + { + "langId": "de", + "privacy": "https://trg.de/datenschutzerklarung/", + "legIntClaim": "https://trg.de/datenschutzerklarung/" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://hal9000.redintelligence.net/privacy/tcf/deviceStorage/2723ad85dc4fd6c3.json" + }, + "388": { + "id": 388, + "name": "Numberly", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 183, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://numberly.com/en/privacy/" + }, + { + "langId": "fr", + "privacy": "https://numberly.com/fr/privacy-fr/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://dco.mmtro.com/a?tagid=6575638-eec14e25c2d8ce8f341c134e24e9de46&campid=0&banid=2712&output=json" + }, + "394": { + "id": 394, + "name": "AudienceProject Aps", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 1826, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://privacy.audienceproject.com", + "legIntClaim": "https://privacy.audienceproject.com/en-GB/for-users/privacy-policy#transparency-and-consent-framework-tcf" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://sak.userreport.com/tcf.json" + }, + "410": { + "id": 410, + "name": "Adtelligent Inc.", + "purposes": [ + 1, + 2, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 8035200, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": { + "2": 0 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://adtelligent.com/privacy-policy/", + "legIntClaim": "https://adtelligent.com/tos/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://adtelligent.com/.well-known/deviceStorage.json" + }, + "412": { + "id": 412, + "name": "Piano Software Inc.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 8, + 9, + 11 + ], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 1096, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.piano.io/privacy-policy", + "legIntClaim": "https://www.piano.io/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.cxense.com/.well-known/deviceStorage.json" + }, + "413": { + "id": 413, + "name": "Eulerian Technologies", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 33696000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.eulerian.com/en/privacy/" + }, + { + "langId": "fr", + "privacy": "https://www.eulerian.com/vie-privee" + }, + { + "langId": "es", + "privacy": "https://www.eulerian.com/es/privacidad" + }, + { + "langId": "it", + "privacy": "https://www.eulerian.com/it/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 7 + ], + "deviceStorageDisclosureUrl": "https://eu.euleriancdn.net/ea-rt/tcfDeviceStorage.json" + }, + "416": { + "id": 416, + "name": "Commanders Act", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": { + "7": 730, + "10": 30 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.commandersact.com/en/privacy/" + }, + { + "langId": "fr", + "privacy": "https://www.commandersact.com/fr/vie-privee/" + }, + { + "langId": "de", + "privacy": "https://www.commandersact.com/de/datenschutz/" + }, + { + "langId": "it", + "privacy": "https://www.commandersact.com/it/privacy/" + } + ], + "dataDeclaration": [ + 1, + 3 + ], + "deviceStorageDisclosureUrl": "https://cdn.trustcommander.net/iab-v2/additional_vendor_information_list.json" + }, + "422": { + "id": 422, + "name": "Brand Metrics Sweden AB", + "purposes": [ + 1, + 7, + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 33350400, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 386, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://collector.brandmetrics.com/brandmetrics_privacypolicy.pdf", + "legIntClaim": "https://collector.brandmetrics.com/brandmetrics_privacypolicy.pdf" + } + ], + "dataDeclaration": [ + 6, + 7 + ], + "deviceStorageDisclosureUrl": "https://collector.brandmetrics.com/deviceStorageDisclosure.json" + }, + "423": { + "id": 423, + "name": "travel audience GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 34300800, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 397, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://travelaudience.com/product-privacy-notice/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 8, + 10 + ], + "deviceStorageDisclosureUrl": "https://ads.travelaudience.com/deviceStorage.json" + }, + "430": { + "id": 430, + "name": "AdServing Factory srl", + "purposes": [ + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 1, + "purposes": { + "7": 30 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.adservingfactory.com/privacy-policy.html", + "legIntClaim": "https://www.adservingfactory.com/privacy-policy.html" + } + ], + "dataDeclaration": [ + 2 + ], + "deviceStorageDisclosureUrl": "https://content.adunity.com/tcf-vdso.json" + }, + "431": { + "id": 431, + "name": "HUMAN", + "purposes": [], + "legIntPurposes": [ + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 1095, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.humansecurity.com/privacy", + "legIntClaim": "https://www.humansecurity.com/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 8 + ], + "deviceStorageDisclosureUrl": "https://humansecurity.com/hubfs/devicestoragedisclosure.json" + }, + "434": { + "id": 434, + "name": "DynAdmic", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 360, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://eu.dynadmic.com/privacy-policy/", + "legIntClaim": "https://eu.dynadmic.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.dynadmic.com/device-storage-disclosures.json" + }, + "435": { + "id": 435, + "name": "SINGLESPOT SAS ", + "purposes": [ + 1, + 3, + 4, + 7, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 385, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.singlespot.com/privacy_policy", + "legIntClaim": "https://www.singlespot.com/privacy_policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://singlespot-public.s3.eu-west-1.amazonaws.com/disclosures.json" + }, + "436": { + "id": 436, + "name": "INVIBES GROUP", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 9 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.invibes.com/terms.html", + "legIntClaim": "https://www.invibes.com/terms.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.invibes.com/deviceStorage.json" + }, + "438": { + "id": 438, + "name": "INVIDI technologies AB", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [], + "features": [ + 1, + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 315360000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": { + "3": 0, + "7": 765, + "9": 765 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.invidi.com/privacy-policy-ad-tech-services/", + "legIntClaim": "https://www.invidi.com/privacy-policy-ad-tech-services/#legal-basis" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://storage.googleapis.com/iab-consent-framework/device-storage.json" + }, + "440": { + "id": 440, + "name": "DEFINE MEDIA GMBH", + "purposes": [ + 1, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.definemedia.de/datenschutz-conative/", + "legIntClaim": "https://definemedia.de/de/datenschutz-conative" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://definemedia.de/tcf/deviceStorageDisclosureURL.json" + }, + "450": { + "id": 450, + "name": "Neodata Group srl", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31556952, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.neodatagroup.com/en/services-privacy-policy-en/", + "legIntClaim": "https://www.neodatagroup.com/en/services-privacy-policy-en/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://support.neodatagroup.com/deviceStorage.json" + }, + "452": { + "id": 452, + "name": "Innovid LLC", + "purposes": [ + 1, + 4 + ], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.innovid.com/privacy-policy", + "legIntClaim": "https://www.innovid.com/privacy-policy/#additional-information-europe-residents" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://iab.inbake.com/Innovid-IAB-TCFv2-disclosure.json" + }, + "459": { + "id": 459, + "name": "uppr GmbH", + "purposes": [ + 1 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://netzwerk.uppr.de/privacy-policy.do", + "legIntClaim": "https://uppr.emcustomers.de/api/tcf/definitions/disclosures.json" + } + ], + "dataDeclaration": [ + 7 + ], + "deviceStorageDisclosureUrl": "https://uppr.emcustomers.de/api/tcf/definitions/disclosures.json" + }, + "461": { + "id": 461, + "name": "B2B Media Group GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.b2bmg.com/en/data-privacy/", + "legIntClaim": "https://www.b2bmg.com/en/data-privacy" + }, + { + "langId": "de", + "privacy": "https://www.b2bmg.com/de/datenschutz", + "legIntClaim": "https://www.b2bmg.com/de/datenschutz" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://b2biq.net/iab_vendor_storage.json" + }, + "466": { + "id": 466, + "name": "Papirfly AS", + "purposes": [], + "legIntPurposes": [ + 7 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": { + "7": 4320 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://tacticrealtime.com/privacy/", + "legIntClaim": "https://tacticrealtime.com/privacy/dsar/" + } + ], + "dataDeclaration": [ + 2 + ], + "deviceStorageDisclosureUrl": "https://tacticrealtime.com/privacy/iab-device-storage.json" + }, + "468": { + "id": 468, + "name": "Neustar, Inc., a TransUnion company", + "purposes": [ + 1, + 3 + ], + "legIntPurposes": [ + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [ + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 540, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.home.neustar/privacy", + "legIntClaim": "https://www.home.neustar/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://gdpr-tcf.agkn.com/NeustarDeviceStorage.json" + }, + "473": { + "id": 473, + "name": "Sub2 Technologies Ltd", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.sub2tech.com/privacy-policy/", + "legIntClaim": "https://www.sub2tech.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 6, + 8, + 10 + ], + "deviceStorageDisclosureUrl": "https://cdn.sub2tech.com/privacy/devicestorage.json" + }, + "479": { + "id": 479, + "name": "INFINIA MOBILE S.L.", + "purposes": [ + 2, + 3, + 4, + 7, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "es", + "privacy": "https://www.infiniamobile.com/avisopolitica.html#pri", + "legIntClaim": "https://www.infiniamobile.com/avisopolitica.html#pri" + }, + { + "langId": "en", + "privacy": "https://www.infiniamobile.com/avisopolitica-us.html#pri", + "legIntClaim": "https://www.infiniamobile.com/avisopolitica-us.html#pri" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.infiniamobile.com/tcf/tcf2.0.json" + }, + "488": { + "id": 488, + "name": "Opinary GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 5184000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": { + "2": 60, + "3": 0, + "4": 60, + "5": 0, + "7": 60 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://opinary.com/privacy-policy/", + "legIntClaim": "https://opinary.com/opt-out" + }, + { + "langId": "de", + "privacy": "https://opinary.com/datenschutz/", + "legIntClaim": "https://opinary.com/opt-out" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.opinary.com/.well-known/device-storage.json" + }, + "490": { + "id": 490, + "name": "PLAYGROUND XYZ EMEA LTD", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 15552200, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 45, + "purposes": {}, + "specialPurposes": { + "1": 30 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://playground.xyz/privacy", + "legIntClaim": "https://playground.xyz/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://playground.xyz/tcf-disclosure.json" + }, + "491": { + "id": 491, + "name": "SevenData S.p.a.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "it", + "privacy": "https://www.shinystat.com/it/informativa_privacy_generale.html" + } + ], + "dataDeclaration": [ + 2, + 3, + 4, + 6 + ], + "deviceStorageDisclosureUrl": "https://www.shinystat.com/shinystat_cookie.json" + }, + "493": { + "id": 493, + "name": "Magnite, Inc. (Carbon AI Limited)", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "legIntPurposes": [ + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7689600, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.magnite.com/legal/advertising-technology-privacy-policy/", + "legIntClaim": "https://www.magnite.com/legal/advertising-technology-privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://nai-edge.ccgateway.net/privacy/disclosure" + }, + "495": { + "id": 495, + "name": "Arcspire Limited", + "purposes": [ + 2, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://public.arcspire.io/privacy.pdf", + "legIntClaim": "https://public.arcspire.io/privacy.pdf" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://public.arcspire.io/disclosures.json" + }, + "496": { + "id": 496, + "name": "Automattic Ads", + "purposes": [ + 1, + 2, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 4320, + "purposes": { + "2": 730, + "4": 90 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://automattic.com/privacy/", + "legIntClaim": "https://automattic.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://c0.pubmine.com/device-storage.json" + }, + "497": { + "id": 497, + "name": "Little Big Data sp. z o.o.", + "purposes": [ + 1, + 3, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 94608001, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 2555, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "pl", + "privacy": "https://www.dataexchanger.pl/privacy-policy", + "legIntClaim": "https://www.dataexchanger.pl/privacy-policy" + } + ], + "dataDeclaration": [ + 2, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://dtxngr.com/additional-vendor-information-list.json" + }, + "498": { + "id": 498, + "name": "Mediakeys Platform", + "purposes": [ + 1, + 2, + 3, + 4, + 6, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 1825, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://arago.com/fr/politique-de-confidentialite/", + "legIntClaim": "https://arago.com/fr/politique-de-confidentialite/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://resourcekeys.com/deviceStorageDisclosure.json" + }, + "507": { + "id": 507, + "name": "AdsWizz Inc.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.adswizz.com/privacy-policy/", + "legIntClaim": "https://www.adswizz.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.adswizz.com/deviceStorage.json" + }, + "511": { + "id": 511, + "name": "Admixer EU GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 7, + 9 + ], + "legIntPurposes": [ + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://admixer.com/privacy/", + "legIntClaim": "https://admixer.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 7, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://admixer.com/tcf.json" + }, + "512": { + "id": 512, + "name": "Verve Group Europe GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": { + "7": 4320, + "8": 4320, + "10": 4320 + }, + "specialPurposes": { + "2": 0 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://pubnative.net/privacy-notice/", + "legIntClaim": "https://pubnative.net/privacy-notice/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://resources.verve.com/hubfs/deviceStorage.json" + }, + "516": { + "id": 516, + "name": "Pexi B.V.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "nl", + "privacy": "https://pexi.nl/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3 + ], + "deviceStorageDisclosureUrl": "https://dash.pexi.nl/api/public/device-storage-url.json" + }, + "517": { + "id": 517, + "name": "SunMedia ", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 10368000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 120, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.sunmedia.tv/en/cookies-users/" + }, + { + "langId": "es", + "privacy": "https://www.sunmedia.tv/cookies-users/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 8 + ], + "deviceStorageDisclosureUrl": "https://vod.sunmedia.tv/sunmedia/cookies.json" + }, + "530": { + "id": 530, + "name": "Near Intelligence Pte. Ltd.", + "purposes": [ + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 1460, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://near.com/privacy-policy/", + "legIntClaim": "https://near.com/privacy-policy/#services-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://near.com/iab/disclosures.json" + }, + "531": { + "id": 531, + "name": "Smartclip Hispania S.L.", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 0, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 120, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "es", + "privacy": "https://rgpd-smartclip.com/" + } + ], + "dataDeclaration": [ + 1, + 3, + 4, + 6, + 7, + 8, + 10 + ], + "deviceStorageDisclosureUrl": "https://cdn.smartclip-services.com/.well-known/deviceStorage.json" + }, + "535": { + "id": 535, + "name": "INNITY", + "purposes": [ + 1, + 2, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "2": 365, + "4": 720, + "5": 720, + "6": 720, + "7": 365, + "8": 365, + "9": 720, + "10": 720 + }, + "specialPurposes": { + "1": 365, + "2": 365 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.innity.com/privacy-policy.php", + "legIntClaim": "https://www.innity.com/privacy-policy.php" + } + ], + "dataDeclaration": [ + 1, + 4, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.advenueplatform.com/tcf" + }, + "536": { + "id": 536, + "name": "GlobalWebIndex", + "purposes": [ + 1, + 7, + 8, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31622400, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://legal.trendstream.net/non-panellist_privacy_policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://gwiq.globalwebindex.net/tcf2/deviceStorage.json" + }, + "539": { + "id": 539, + "name": "AdDefend GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.addefend.com/en/privacy-policy/", + "legIntClaim": "https://www.addefend.com/en/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 4 + ], + "deviceStorageDisclosureUrl": "https://www.addefend.com/deviceStorage.json" + }, + "544": { + "id": 544, + "name": "Kochava Inc.", + "purposes": [ + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "7": 395 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.kochava.com/support-privacy/" + }, + { + "langId": "de", + "privacy": "https://www.kochava.com/support-privacy/" + }, + { + "langId": "ru", + "privacy": "https://www.kochava.com/support-privacy/" + }, + { + "langId": "es", + "privacy": "https://www.kochava.com/support-privacy/" + }, + { + "langId": "ja", + "privacy": "https://www.kochava.com/support-privacy/" + }, + { + "langId": "zh", + "privacy": "https://www.kochava.com/support-privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://iab.kochava.com/DeviceStorageDisclosure.json" + }, + "546": { + "id": 546, + "name": "Smart Traffik", + "purposes": [ + 1, + 3, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 34187400, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": { + "1": 90 + } + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://okube-attribution.com/politique-de-confidentialite/", + "legIntClaim": "https://okube-attribution.com/politique-de-confidentialite-precisions-sur-la-source-de-donnee-smartbox/" + }, + { + "langId": "en", + "privacy": "https://okube-attribution.com/en/privacy-policy/", + "legIntClaim": "https://okube-attribution.com/en/privacy-policy/privacy-policy-details-of-the-smartbox-data-source/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://std-prod-static-crossorigin.s3.eu-west-1.amazonaws.com/public/deviceStorage.json" + }, + "550": { + "id": 550, + "name": "Happydemics", + "purposes": [ + 1, + 2 + ], + "legIntPurposes": [ + 9, + 10 + ], + "flexiblePurposes": [ + 9, + 10 + ], + "specialPurposes": [ + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 129600, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "2": 90, + "9": 1095, + "10": 1095 + }, + "specialPurposes": { + "2": 90 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://happydemics.com/en/terms_and_conditions", + "legIntClaim": "https://happydemics.com/en/terms_and_conditions" + }, + { + "langId": "fr", + "privacy": "https://happydemics.com/fr/conditions-generales", + "legIntClaim": "https://happydemics.com/fr/conditions-generales" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://files.happydemics.com/iab-tcf/device_storage_disclosure.json" + }, + "565": { + "id": 565, + "name": "Adobe Audience Manager, Adobe Experience Platform", + "purposes": [ + 1, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.adobe.com/privacy/policy.html", + "legIntClaim": "https://www.adobe.com/privacy/policy.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://aam-iab-tcf-vendor.s3.amazonaws.com/aam_device_storage_disclosures.json" + }, + "568": { + "id": 568, + "name": "Next Media SRL", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "it", + "privacy": "https://next14.com/media/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://js.datafront.co/next14_dmp_device_storage_information.json" + }, + "570": { + "id": 570, + "name": "Czech Publisher Exchange z.s.p.o.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31622389, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "cs", + "privacy": "https://www.cpex.cz/pro-uzivatele/ochrana-soukromi/" + } + ], + "dataDeclaration": [ + 1, + 2, + 5, + 6, + 7, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cpex.cz/storagedisclosure.json" + }, + "573": { + "id": 573, + "name": "Dailymotion SA", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 34214390, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 92, + "purposes": { + "3": 366, + "4": 366, + "5": 186, + "6": 186, + "8": 731, + "9": 731, + "10": 2192, + "11": 30 + }, + "specialPurposes": { + "1": 1096 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://legal.dailymotion.com/en/privacy-policy/", + "legIntClaim": "https://legal.dailymotion.com/en/legitimate-interest/" + }, + { + "langId": "fr", + "privacy": "https://legal.dailymotion.com/fr/politique-de-confidentialite/", + "legIntClaim": "https://legal.dailymotion.com/en/legitimate-interest/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://statics.dmcdn.net/a/vds.json" + }, + "580": { + "id": 580, + "name": "Goldbach Group AG", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 94670856, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://goldbach.com/ch/de/datenschutzerklaerung/goldbach-group-ag", + "legIntClaim": "https://goldbach.com/ch/de/datenschutzerklaerung/goldbach-group-ag" + }, + { + "langId": "en", + "privacy": "https://goldbach.com/ch/en/privacy-policy/goldbach-group", + "legIntClaim": "https://goldbach.com/ch/en/privacy-policy/goldbach-group" + }, + { + "langId": "fr", + "privacy": "https://goldbach.com/ch/fr/politique-de-confidentialite/goldbach-group", + "legIntClaim": "https://goldbach.com/ch/fr/politique-de-confidentialite/goldbach-group" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://dai-video.s3.eu-central-1.amazonaws.com/JSON/TcfGoldbachDeviceStorage.json" + }, + "601": { + "id": 601, + "name": "WebAds B.V", + "purposes": [ + 1, + 2 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 28, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://privacy.webads.eu/", + "legIntClaim": "https://privacy.webads.eu/" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://nojazz.eu/int/iab/tcf-storage.json" + }, + "602": { + "id": 602, + "name": "Online Solution", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": { + "1": 365 + } + }, + "urls": [ + { + "langId": "de", + "privacy": "https://adsafety.net/privacy.html", + "legIntClaim": "https://adsafety.net/privacy.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://tcf.adtech.app/gen/deviceStorageDisclosure/os.json" + }, + "606": { + "id": 606, + "name": "Impactify SARL", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": { + "7": 7, + "8": 7, + "9": 7, + "10": 7 + }, + "specialPurposes": { + "1": 14 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://impactify.io/privacy-policy/", + "legIntClaim": "https://impactify.io/privacy-policy/#legal-basis-and-purposes-for-processing" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://ad.impactify.io/tcfvendors.json" + }, + "612": { + "id": 612, + "name": "Adnami Aps", + "purposes": [], + "legIntPurposes": [ + 7 + ], + "flexiblePurposes": [ + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.adnami.io/privacy-policy-services", + "legIntClaim": "https://www.adnami.io/privacy-policy-services" + }, + { + "langId": "de", + "privacy": "https://www.adnami.io/privacy-policy-services-de", + "legIntClaim": "https://www.adnami.io/privacy-policy-services-de" + } + ], + "dataDeclaration": [ + 1, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://macro.adnami.io/macro/iab/deviceStorage.json" + }, + "613": { + "id": 613, + "name": "Adserve.zone / Artworx AS", + "purposes": [ + 10 + ], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [ + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://adserve.zone/adserveprivacypolicy.html", + "legIntClaim": "https://adserve.zone/adserveprivacypolicy.html#legitimateinterestclaim" + } + ], + "dataDeclaration": [ + 1, + 8 + ], + "deviceStorageDisclosureUrl": "https://adserve.zone/tcf/deviceStorageDisclosure.json" + }, + "620": { + "id": 620, + "name": "Blue", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.getblue.io/privacy/", + "legIntClaim": "https://www.getblue.io/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://getblue.io/iab/iab.json" + }, + "621": { + "id": 621, + "name": "Seznam.cz, a.s.", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 31556926, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": { + "2": 540, + "5": 1460, + "6": 1460, + "10": 14 + }, + "specialPurposes": { + "1": 540 + } + }, + "urls": [ + { + "langId": "cs", + "privacy": "https://www.seznam.cz/ochranaudaju", + "legIntClaim": "https://o.seznam.cz/personalizace-obsahu-a-reklamy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://h.seznam.cz/js/deviceStorage.json" + }, + "624": { + "id": 624, + "name": "Norstat AS", + "purposes": [ + 1, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 63113904, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "9": 1080 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.norstatpanel.com/en/data-protection" + }, + { + "langId": "no", + "privacy": "https://www.norstatpanel.com/nb/personvern" + }, + { + "langId": "de", + "privacy": "https://www.norstatpanel.com/de/datenschutz" + }, + { + "langId": "sv", + "privacy": "https://www.norstatpanel.com/sv/dataskydd" + }, + { + "langId": "da", + "privacy": "https://www.norstatpanel.com/da/data-beskyttelse" + }, + { + "langId": "fi", + "privacy": "https://www.norstatpanel.com/fi/tietosuoja" + }, + { + "langId": "pl", + "privacy": "https://www.norstatpanel.com/pl/ochrona-danych" + }, + { + "langId": "it", + "privacy": "https://www.norstatpanel.com/it/protezione-dati" + }, + { + "langId": "fr", + "privacy": "https://www.norstatpanel.com/fr/protection-des-donnees" + }, + { + "langId": "et", + "privacy": "https://www.norstatpanel.com/et/andmekaitse" + }, + { + "langId": "nl", + "privacy": "https://www.norstatpanel.com/nl/data-protection" + }, + { + "langId": "lv", + "privacy": "https://www.norstatpanel.com/lv/datu-aizsardziba" + }, + { + "langId": "lt", + "privacy": "https://www.norstatpanel.com/lt/privatumo-politika" + }, + { + "langId": "es", + "privacy": "https://www.norstatpanel.com/es/proteccion-de-datos" + }, + { + "langId": "ru", + "privacy": "https://www.norstatpanel.com/ru/zaschita-dannykh" + } + ], + "dataDeclaration": [ + 7 + ], + "deviceStorageDisclosureUrl": "https://aws.norstat.no/iab/tcf.json" + }, + "626": { + "id": 626, + "name": "Hivestack Inc.", + "purposes": [ + 1, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 394, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://hivestack.com/privacy-policy" + } + ], + "dataDeclaration": [ + 3, + 9 + ], + "deviceStorageDisclosureUrl": "https://tcf.hivestack.com/TCF_File.json" + }, + "628": { + "id": 628, + "name": ": Tappx", + "purposes": [ + 1, + 2, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 10800, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.tappx.com/en/privacy-policy/", + "legIntClaim": "https://www.tappx.com/en/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 11 + ], + "deviceStorageDisclosureUrl": "https://tappx.com/devicestorage.json" + }, + "630": { + "id": 630, + "name": "Contact Impact GmbH/Axel Springer Teaser Ad GmbH", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 43200000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://contactimpact.de/privacy", + "legIntClaim": "https://contactimpact.de/privacy.html#section-3" + } + ], + "dataDeclaration": [ + 1, + 2, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.c-i.as/d/gdpr/deviceStorage.json" + }, + "631": { + "id": 631, + "name": "Relay42 Netherlands B.V.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 1096, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://relay42.com/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://relay42.com/relay42-iab-disclosures.json" + }, + "646": { + "id": 646, + "name": "Notify", + "purposes": [ + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "9": 390 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://fr.notify-group.com/en/mentions-legales/" + } + ], + "dataDeclaration": [ + 7 + ], + "deviceStorageDisclosureUrl": "https://notify-group.com/cookies/tcf.json" + }, + "647": { + "id": 647, + "name": "Axel Springer Teaser Ad GmbH", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.adup-tech.com/privacy", + "legIntClaim": "https://www.adup-tech.com/en/privacy-policy/#c4489" + }, + { + "langId": "de", + "privacy": "https://www.adup-tech.com/rechtliches/datenschutz/", + "legIntClaim": "https://www.adup-tech.com/rechtliches/datenschutz/#c4488" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://s.d.adup-tech.com/gdpr/deviceStorage.json" + }, + "655": { + "id": 655, + "name": "Sportradar AG", + "purposes": [ + 1, + 3, + 4, + 10 + ], + "legIntPurposes": [ + 2, + 7, + 9 + ], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 100, + "purposes": { + "4": 1095 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.sportradar.com/about-us/privacy/", + "legIntClaim": "https://www.sportradar.com/about-us/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://creatives.sportradarserving.com/TCF_Sportradar_device_storage_url/sportradar_device_storage_url.json" + }, + "656": { + "id": 656, + "name": "Content Ignite", + "purposes": [], + "legIntPurposes": [ + 2, + 11 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": { + "1": 7 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.contentignite.com/privacy-policy/", + "legIntClaim": "https://www.contentignite.com/privacy-policy/" + } + ], + "deviceStorageDisclosureUrl": "https://contentignite.com/deviceStorage.json" + }, + "658": { + "id": 658, + "name": "BLIINK SAS", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 34186669, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 395, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://bliink.io/privacy-policy", + "legIntClaim": "https://bliink.io/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://bliink.io/disclosures.json" + }, + "659": { + "id": 659, + "name": "Research and Analysis of Media in Sweden AB", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 7, + 8, + 9 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 2 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 32000000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www2.rampanel.com/privacy-policy/", + "legIntClaim": "https://www2.rampanel.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 3 + ], + "deviceStorageDisclosureUrl": "https://www.rampanel.com/tcf/deviceStorage.json" + }, + "662": { + "id": 662, + "name": "SoundCast", + "purposes": [ + 1, + 2, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 0, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 390, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://soundcast.fm/en/data-privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 11 + ], + "deviceStorageDisclosureUrl": "https://soundcast.io/devicestorage.json" + }, + "663": { + "id": 663, + "name": "Mobsuccess", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 150, + "purposes": { + "2": 730 + }, + "specialPurposes": { + "1": 730 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.mobsuccess.com/en/privacy", + "legIntClaim": "https://www.mobsuccess.com/en/privacy" + }, + { + "langId": "fr", + "privacy": "https://www.mobsuccess.com/fr/privacy", + "legIntClaim": "https://www.mobsuccess.com/fr/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.mobsuccess.com/deviceStorage.json" + }, + "667": { + "id": 667, + "name": "Liftoff Mobile, Inc.", + "purposes": [], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://liftoff.io/privacy-policy/", + "legIntClaim": "https://liftoff.io/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://vungle2-cdn-prod.s3.amazonaws.com/sdks/IAB/IABVendorDisclosure.json" + }, + "671": { + "id": 671, + "name": "MEDIA FORCE COMMUNICATIONS (2007) LTD", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "legIntPurposes": [ + 2, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://comparisons.org/privacy.php", + "legIntClaim": "https://comparisons.org/privacy.php" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 9 + ], + "deviceStorageDisclosureUrl": "https://comparisons.org/privacy.json" + }, + "674": { + "id": 674, + "name": "Duration Media, LLC.", + "purposes": [ + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.durationmedia.net/privacy-policy", + "legIntClaim": "https://www.durationmedia.net/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2 + ], + "deviceStorageDisclosureUrl": "https://duration-media.s3.amazonaws.com/dm-vendor-device-storage-and-operational-disclosures.json" + }, + "676": { + "id": 676, + "name": "Businessclick Sp. z o.o.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "legIntPurposes": [ + 10 + ], + "flexiblePurposes": [ + 7, + 8, + 9 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 94608000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": { + "7": 1095, + "8": 1095, + "10": 1095 + }, + "specialPurposes": { + "1": 1095, + "2": 1095 + } + }, + "urls": [ + { + "langId": "pl", + "privacy": "https://www.businessclick.com/documents/Polityka_prywatnosci.pdf", + "legIntClaim": "https://www.businessclick.com/documents/Polityka_prywatnosci.pdf#page=7" + }, + { + "langId": "en", + "privacy": "https://www.businessclick.com/documents/Privacy_Policy.pdf", + "legIntClaim": "https://www.businessclick.com/documents/Privacy_Policy.pdf#page=7" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://ssp.wp.pl/deviceStorage.json" + }, + "677": { + "id": 677, + "name": "Intercept Interactive Inc. dba Undertone", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31556926, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.undertone.com/privacy-center/", + "legIntClaim": "https://www.undertone.com/privacy-center/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://cdn.undertone.com/js/deviceStorage.json" + }, + "681": { + "id": 681, + "name": "MyTraffic", + "purposes": [ + 1, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "9": 105 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.mytraffic.io/en/privacy" + }, + { + "langId": "fr", + "privacy": "https://www.mytraffic.io/fr/privacy" + } + ], + "dataDeclaration": [ + 2, + 3, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://app.mytraffic.io/static/json/iab/disclosures.json" + }, + "702": { + "id": 702, + "name": "Kwanko", + "purposes": [ + 1, + 2, + 7, + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 5184000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 180, + "purposes": { + "2": 30 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.kwanko.com/fr/rgpd/politique-gestion-donnees/", + "legIntClaim": "https://www.kwanko.com/fr/rgpd/politique-gestion-donnees/" + }, + { + "langId": "en", + "privacy": "https://www.kwanko.com/gdpr/privacy-policy/", + "legIntClaim": "https://www.kwanko.com/gdpr/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.kwanko.com/.well-known/deviceStorage.json" + }, + "703": { + "id": 703, + "name": "MindTake Research GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 10 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.mindtake.com/en/reppublika-privacy-policy", + "legIntClaim": "https://www.mindtake.com/en/reppublika-privacy-policy" + }, + { + "langId": "de", + "privacy": "https://www.mindtake.com/de/reppublika-datenschutzordnung", + "legIntClaim": "https://www.mindtake.com/de/reppublika-datenschutzordnung" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 10 + ], + "deviceStorageDisclosureUrl": "https://pub.mindtake.com/TCF_DeviceStorageDisclosure/703/ " + }, + "707": { + "id": 707, + "name": "Dentsu Italia SpA", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 5184000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "it", + "privacy": "https://www.dentsu.com/it/it/policies/info-cookie", + "legIntClaim": "https://www.dentsu.com/it/it/policies/legittimo-interesse" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://cloud.thebignow.it/data/" + }, + "713": { + "id": 713, + "name": "Dataseat Ltd", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8 + ], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 86400, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://dataseat.com/privacy-policy", + "legIntClaim": "https://dataseat.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3 + ], + "deviceStorageDisclosureUrl": "https://assets.dataseat.com/GDPR_TCF.json" + }, + "714": { + "id": 714, + "name": "Upwave Inc.", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 7, + 8, + 9 + ], + "flexiblePurposes": [ + 7, + 8, + 9 + ], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 32000000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 400, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.upwave.com/privacy-policy/", + "legIntClaim": "https://www.upwave.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3 + ], + "deviceStorageDisclosureUrl": "https://www.upwave.com/tcf.json" + }, + "715": { + "id": 715, + "name": "BidBerry SRL", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.bidberrymedia.com/service-privacy-policy/", + "legIntClaim": "https://www.bidberrymedia.com/service-privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.bidberrymedia.com/deviceStorage.php" + }, + "717": { + "id": 717, + "name": "Audience Network", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://audiencenetwork.pl/en/internet-advertising-privacy-policy", + "legIntClaim": "https://audiencenetwork.pl/en/internet-advertising-privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://audiencenetwork.pl/deviceStorage.json" + }, + "718": { + "id": 718, + "name": "XChange by SFBX®", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 12, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": { + "2": 90 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://sfbx.io/politique-de-confidentialite/" + }, + { + "langId": "en", + "privacy": "https://sfbx.io/en/politique-de-confidentialite/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.appconsent.io/iab/xchange-by-sfbx.json" + }, + "724": { + "id": 724, + "name": "Between Exchange", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 7 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://en.betweenx.com/pdata.pdf", + "legIntClaim": "https://en.betweenx.com/pdata.pdf" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://en.betweenx.com/deviceStorage.json" + }, + "726": { + "id": 726, + "name": "YouGov", + "purposes": [ + 1, + 3, + 5, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 9, + 10 + ], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31557600, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://account.yougov.com/gb-en/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/gb-en/account/privacy-policy" + }, + { + "langId": "de", + "privacy": "https://account.yougov.com/de-de/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/de-de/account/privacy-policy" + }, + { + "langId": "fr", + "privacy": "https://account.yougov.com/fr-fr/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/fr-fr/account/privacy-policy" + }, + { + "langId": "es", + "privacy": "https://account.yougov.com/es-es/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/es-es/account/privacy-policy" + }, + { + "langId": "it", + "privacy": "https://account.yougov.com/it-it/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/it-it/account/privacy-policy" + }, + { + "langId": "da", + "privacy": "https://account.yougov.com/dk-da/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/dk-da/account/privacy-policy" + }, + { + "langId": "cs", + "privacy": "https://account.yougov.com/cz-cs/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/cz-cs/account/privacy-policy" + }, + { + "langId": "nl", + "privacy": "https://account.yougov.com/nl-nl/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/nl-nl/account/privacy-policy" + }, + { + "langId": "no", + "privacy": "https://account.yougov.com/no-nb/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/no-nb/account/privacy-policy" + }, + { + "langId": "el", + "privacy": "https://account.yougov.com/gr-el/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/gr-el/account/privacy-policy" + }, + { + "langId": "tr", + "privacy": "https://account.yougov.com/tr-tr/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/tr-tr/account/privacy-policy" + }, + { + "langId": "ar", + "privacy": "https://account.yougov.com/ae-ar/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/ae-ar/account/privacy-policy" + }, + { + "langId": "fi", + "privacy": "https://account.yougov.com/ae-ar/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/ae-ar/account/privacy-policy" + }, + { + "langId": "sv", + "privacy": "https://account.yougov.com/se-sv/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/se-sv/account/privacy-policy" + }, + { + "langId": "hr", + "privacy": "https://account.yougov.com/hr-hr/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/hr-hr/account/privacy-policy" + }, + { + "langId": "hu", + "privacy": "https://account.yougov.com/hu-hu/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/hu-hu/account/privacy-policy" + }, + { + "langId": "pl", + "privacy": "https://account.yougov.com/pl-pl/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/pl-pl/account/privacy-policy" + }, + { + "langId": "pt", + "privacy": "https://account.yougov.com/pt-pt/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/pt-pt/account/privacy-policy" + }, + { + "langId": "ro", + "privacy": "https://account.yougov.com/ro-ro/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/ro-ro/account/privacy-policy" + }, + { + "langId": "sk", + "privacy": "https://account.yougov.com/sk-sk/account/privacy-policy", + "legIntClaim": "https://account.yougov.com/sk-sk/account/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 3, + 5, + 7, + 11 + ], + "deviceStorageDisclosureUrl": "https://d4a766y0k7kjw.cloudfront.net/global-panel/static/tcf/TCF-1.json" + }, + "727": { + "id": 727, + "name": "Pinpoll GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.pinpoll.com/pdf/data-protection-declaration.pdf", + "legIntClaim": "https://www.pinpoll.com/pdf/data-protection-declaration.pdf" + } + ], + "dataDeclaration": [ + 1, + 7 + ], + "deviceStorageDisclosureUrl": "https://www.pinpoll.com/deviceStorage.json" + }, + "728": { + "id": 728, + "name": "Appier PTE Ltd", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 11 + ], + "legIntPurposes": [ + 2, + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 397, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.appier.com/en/about/privacy-policy/", + "legIntClaim": "https://www.appier.com/en/about/privacy-policy/" + }, + { + "langId": "ja", + "privacy": "https://www.appier.com/ja-jp/about/privacy-policy", + "legIntClaim": "https://www.appier.com/ja-jp/about/privacy-policy" + }, + { + "langId": "zh", + "privacy": "https://www.appier.com/zh-tw/about/privacy-policy", + "legIntClaim": "https://www.appier.com/zh-tw/about/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://tcf.appier.com/deviceStorage.json" + }, + "730": { + "id": 730, + "name": "INFOnline GmbH", + "purposes": [ + 1, + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "8": 180 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.infonline.de/datenschutz/" + }, + { + "langId": "en", + "privacy": "https://www.infonline.de/en/datenschutzerklaerung/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6 + ], + "deviceStorageDisclosureUrl": "https://www.infonline.de/deviceStorage.json" + }, + "732": { + "id": 732, + "name": "Performax.cz, s.r.o.", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 8 + ], + "legIntPurposes": [ + 2, + 7, + 9, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 34164000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "cs", + "privacy": "https://www.performax.cz/cs/privacy-policy/", + "legIntClaim": "https://www.performax.cz/cs/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3 + ], + "deviceStorageDisclosureUrl": "https://www.performax.cz/sellers.json" + }, + "742": { + "id": 742, + "name": "Audiencerate LTD", + "purposes": [ + 1, + 3, + 5 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 1296000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.audiencerate.com/full-data-privacy-compliance" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://a.audrte.com/tcfDeviceDisclosures.json" + }, + "744": { + "id": 744, + "name": "Vidazoo Ltd", + "purposes": [ + 1, + 2, + 3, + 4 + ], + "legIntPurposes": [ + 7, + 10 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 2600000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://vidazoo.gitbook.io/vidazoo-legal/privacy-policy", + "legIntClaim": "https://vidazoo.gitbook.io/vidazoo-legal/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://vidazoo.com/gdpr-tcf/deviceStorage.json" + }, + "745": { + "id": 745, + "name": "Justtag Sp. z o.o.", + "purposes": [ + 1, + 3, + 4, + 7, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "pl", + "privacy": "https://www.justtag.com/POLITYKA_PRYWATNOSCI.pdf", + "legIntClaim": "https://www.justtag.com/POLITYKA_PRYWATNOSCI.pdf" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 8, + 9, + 10 + ], + "deviceStorageDisclosureUrl": "https://www.justtag.com/.well-known/deviceStorage.json" + }, + "748": { + "id": 748, + "name": "AUDIOMOB LTD", + "purposes": [ + 1, + 2, + 7, + 8, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.audiomob.com/privacy", + "legIntClaim": "https://www.audiomob.com/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.audiomob.com/deviceStorage.json" + }, + "749": { + "id": 749, + "name": "Good-Loop Ltd", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 7, + 10 + ], + "flexiblePurposes": [ + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 2678400, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 31, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://doc.good-loop.com/policy/privacy-policy.html", + "legIntClaim": "https://localdoc.good-loop.com/policy/privacy-policy.html#2a-legitimate-interests" + } + ], + "dataDeclaration": [ + 1, + 2 + ], + "deviceStorageDisclosureUrl": "https://portal.good-loop.com/gvl.json" + }, + "751": { + "id": 751, + "name": "Kiosked Ltd", + "purposes": [], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://kiosked.com/privacy-policy/", + "legIntClaim": "https://www.kiosked.com/data-processing-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 11 + ], + "deviceStorageDisclosureUrl": "https://resources.kiosked.com/tcf.json" + }, + "755": { + "id": 755, + "name": "Google Advertising Products", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 34190000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 548, + "purposes": { + "3": 180, + "4": 180 + }, + "specialPurposes": { + "1": 1096 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://business.safety.google/privacy/", + "legIntClaim": "https://policies.google.com/privacy#europeanrequirements" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.gstatic.com/iabtcf/deviceStorageDisclosure.json" + }, + "756": { + "id": 756, + "name": "Fandom, Inc.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 99999999, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.fandom.com/privacy-policy", + "legIntClaim": "https://www.fandom.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://script.wikia.nocookie.net/fandom-ae-assets/tcf/v2/deviceStorage.json" + }, + "758": { + "id": 758, + "name": "GfK SE", + "purposes": [ + 1, + 7, + 8, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 720, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://help.sensic.net/privacypolicy_en.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://sensic.net/deviceStorage.json" + }, + "759": { + "id": 759, + "name": "RevJet", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.innervate.com/privacy", + "legIntClaim": "https://www.innervate.com/privacy" + } + ], + "dataDeclaration": [ + 1, + 3, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://tcf.revjet.com/TCFV2-disclosures.json" + }, + "768": { + "id": 768, + "name": "Global Media Group Services Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 46657000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 37, + "purposes": { + "5": 3285, + "6": 3285, + "11": 3285 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://global.com/legal/privacy-policy/", + "legIntClaim": "https://global.com/legal/privacy-policy/" + }, + { + "langId": "nl", + "privacy": "https://global.com/nl/privacy-policy/", + "legIntClaim": "https://global.com/nl/privacy-policy/" + }, + { + "langId": "es", + "privacy": "https://global.com/es/legal/politica-de-privacidad/", + "legIntClaim": "https://global.com/es/legal/politica-de-privacidad/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "deviceStorageDisclosureUrl": "https://thisisdax.com/tcfdeviceStorage.json" + }, + "769": { + "id": 769, + "name": "MEDIAMETRIE", + "purposes": [ + 1, + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "8": 1095 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.mediametrie.fr/fr/gestion-des-cookies" + }, + { + "langId": "en", + "privacy": "https://www.mediametrie.fr/en/management-cookies" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://tcf.mediametrie.com/Mediametrie_deviceStorageDisclosure.json" + }, + "770": { + "id": 770, + "name": "MARKETPERF CORP", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.marketperf.com/assets/images/app/marketperf/pdf/privacy-policy.pdf", + "legIntClaim": "https://www.marketperf.com/assets/images/app/marketperf/pdf/privacy-policy.pdf" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 5, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://s.marketperf.com/tcf.json" + }, + "771": { + "id": 771, + "name": "bam! interactive marketing GmbH ", + "purposes": [ + 1, + 3, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 86400, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 7, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://bam-interactive.de/datenschutz/", + "legIntClaim": "https://bam-interactive.de/datenschutz/" + } + ], + "dataDeclaration": [ + 2, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://libs.adtron.io/iab_tcf.json" + }, + "774": { + "id": 774, + "name": "Wagawin GmbH", + "purposes": [], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 7, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.wagawin.com/privacy-en/productprivacy", + "legIntClaim": "https://www.wagawin.com/product-privacy-policy" + }, + { + "langId": "de", + "privacy": "https://www.wagawin.com/product-privacy-policy", + "legIntClaim": "https://www.wagawin.com/product-privacy-policy" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://docs.wagawin.com/deviceStorage.json" + }, + "778": { + "id": 778, + "name": "Discover-Tech ltd", + "purposes": [ + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 93, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.discover-tech.io/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 3 + ], + "deviceStorageDisclosureUrl": "https://www.discover-tech.io/_functions/api/disclosure.json" + }, + "780": { + "id": 780, + "name": "Aniview LTD", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": { + "1": 100 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.aniview.com/privacy-policy/", + "legIntClaim": "https://www.aniview.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://player.aniview.com/gdpr/gdpr.json" + }, + "781": { + "id": 781, + "name": "FeedAd GmbH", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 8, + 9 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://feedad.com/privacy/", + "legIntClaim": "https://feedad.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://api.feedad.com/tcf-device-disclosures.json" + }, + "784": { + "id": 784, + "name": "Nubo LTD", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2, + 7 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 86400, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 1, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://api.recod3suite.com/privacypolicy.php", + "legIntClaim": "https://api.recod3suite.com/privacypolicy.php" + } + ], + "dataDeclaration": [ + 1, + 2, + 8 + ], + "deviceStorageDisclosureUrl": "https://api.recod3suite.com/deviceStorage.json" + }, + "786": { + "id": 786, + "name": "TargetVideo GmbH", + "purposes": [ + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "8": 1 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.target-video.com/datenschutz/" + } + ], + "dataDeclaration": [ + 2 + ], + "deviceStorageDisclosureUrl": "https://www.target-video.com/vendors-device-storage-and-operational-disclosures.json" + }, + "787": { + "id": 787, + "name": "Hearts and Science München GmbH", + "purposes": [ + 1, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 5184000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 45, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.nonstoppartner.net", + "legIntClaim": "https://www.nonstoppartner.net" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://a.nonstoppartner.net/tcf.php" + }, + "788": { + "id": 788, + "name": "Ad Alliance GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 395, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.ad-alliance.de/datenschutz/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 10 + ], + "deviceStorageDisclosureUrl": "https://static.emsservice.de/iabtcf/deviceStorageDisclosure.json" + }, + "791": { + "id": 791, + "name": "Media Square", + "purposes": [ + 1, + 2 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.mediasquare.fr/e-privacy/", + "legIntClaim": "https://www.mediasquare.fr/e-privacy/" + } + ], + "dataDeclaration": [ + 2, + 3, + 11 + ], + "deviceStorageDisclosureUrl": "https://mediasquare.fr/deviceStorage.json" + }, + "794": { + "id": 794, + "name": "Kubient Inc. ", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 31104000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://kubient.com/privacy-policy/", + "legIntClaim": "https://kubient.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://kubient.com/wp-content/uploads/2022/08/TCFv2.json" + }, + "795": { + "id": 795, + "name": "Factor Eleven GmbH", + "purposes": [ + 1, + 2, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://de.f11-ads.com/privacy.php", + "legIntClaim": "https://de.f11-ads.com/privacy.php" + }, + { + "langId": "en", + "privacy": "https://de.f11-ads.com/privacy.php", + "legIntClaim": "https://de.f11-ads.com/privacy.php" + } + ], + "dataDeclaration": [ + 1, + 2, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.factor-eleven.de/tcf/deviceStorage2.json" + }, + "796": { + "id": 796, + "name": "EASY Marketing GmbH", + "purposes": [ + 1, + 2, + 7, + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://trck.easy-m.de/privacy-policy.do", + "legIntClaim": "https://trck.easy-m.de/privacy-policy.do" + }, + { + "langId": "en", + "privacy": "https://trck.easy-m.de/privacy-policy.do", + "legIntClaim": "https://trck.easy-m.de/privacy-policy.do" + } + ], + "dataDeclaration": [ + 2, + 3, + 4, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://trck.easy-m.de/api/tcf/definitions/disclosures.json" + }, + "798": { + "id": 798, + "name": "Adverticum cPlc.", + "purposes": [ + 1, + 2, + 3, + 4, + 8, + 9, + 10 + ], + "legIntPurposes": [ + 7 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://adverticum.net/english/privacy-and-data-processing-information/", + "legIntClaim": "https://adverticum.net/english/privacy-and-data-processing-information/" + } + ], + "dataDeclaration": [ + 1, + 2 + ], + "deviceStorageDisclosureUrl": "https://adverticum.net/static/deviceStorageDisclosure.json" + }, + "800": { + "id": 800, + "name": "Reppublika Data Analytics and Technologies GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 10 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.reppublika.com/privacy-policy", + "legIntClaim": "https://www.reppublika.com/privacy-policy" + }, + { + "langId": "de", + "privacy": "https://www.reppublika.com/datenschutzordnung", + "legIntClaim": "https://www.reppublika.com/datenschutzordnung" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 10 + ], + "deviceStorageDisclosureUrl": "https://pub.mindtake.com/TCF_DeviceStorageDisclosure/?vendorID=800" + }, + "806": { + "id": 806, + "name": "Aarki, Inc.", + "purposes": [ + 1, + 2, + 3, + 4 + ], + "legIntPurposes": [ + 7, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": { + "3": 3650, + "4": 3650, + "7": 1500 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://corp.aarki.com/privacy", + "legIntClaim": "https://corp.aarki.com/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 7, + 8 + ], + "deviceStorageDisclosureUrl": "https://www.aarki.com/hubfs/device_storage_disclosure.json" + }, + "807": { + "id": 807, + "name": "Moloco, Inc.", + "purposes": [ + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": { + "2": 0 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.moloco.com/privacy-policy", + "legIntClaim": "https://www.moloco.com/advertising-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 8 + ], + "deviceStorageDisclosureUrl": "https://www.moloco.com/device-storage-disclosure-json" + }, + "810": { + "id": 810, + "name": "lead alliance GmbH", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 7 + ], + "flexiblePurposes": [ + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.lead-alliance.net/dataprotection2", + "legIntClaim": "https://www.lead-alliance.net/dataprotection2" + } + ], + "dataDeclaration": [ + 1, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://files.leadalliance.eu/devicestorage.json" + }, + "812": { + "id": 812, + "name": "Nielsen International SA", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 7, + 10 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 33696000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 390, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.nielsen.com/eu/en/legal/privacy-statement/digital-measurement/", + "legIntClaim": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/#personal-data" + }, + { + "langId": "sv", + "privacy": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/", + "legIntClaim": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/#personal-data" + }, + { + "langId": "pt", + "privacy": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/", + "legIntClaim": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/#personal-data" + }, + { + "langId": "it", + "privacy": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/", + "legIntClaim": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/#personal-data" + }, + { + "langId": "fr", + "privacy": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/", + "legIntClaim": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/#personal-data" + }, + { + "langId": "es", + "privacy": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/", + "legIntClaim": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/#personal-data" + }, + { + "langId": "cs", + "privacy": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/", + "legIntClaim": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/#personal-data" + }, + { + "langId": "no", + "privacy": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/", + "legIntClaim": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/#personal-data" + }, + { + "langId": "pl", + "privacy": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/", + "legIntClaim": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/#personal-data" + }, + { + "langId": "da", + "privacy": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/", + "legIntClaim": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/#personal-data" + }, + { + "langId": "gl", + "privacy": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/", + "legIntClaim": "https://www.nielsen.com/legal/privacy-principles/digital-measurement-privacy-statement/#personal-data" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 11 + ], + "deviceStorageDisclosureUrl": "https://files.imrworldwide.com/deviceStorageDisclosure.json" + }, + "820": { + "id": 820, + "name": "Kameleoon SAS", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 7, + 8, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 10 + ], + "specialPurposes": [], + "features": [ + 1, + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://developers.kameleoon.com/local-storage.html#list-of-collected-data", + "legIntClaim": "https://www.kameleoon.com/en/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://developers.kameleoon.com/tcf/kameleoon-tcf.json" + }, + "821": { + "id": 821, + "name": "vitrado GmbH", + "purposes": [ + 1, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": { + "7": 4320 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.vitrado.de/datenschutz", + "legIntClaim": "https://www.vitrado.de/datenschutz" + } + ], + "dataDeclaration": [ + 2 + ], + "deviceStorageDisclosureUrl": "https://static.ppro.de/deviceStorage.json" + }, + "826": { + "id": 826, + "name": "DNA-I.COM", + "purposes": [ + 7, + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "7": 1095, + "8": 1095 + }, + "specialPurposes": { + "1": 30, + "2": 30 + } + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.adn.ai/fr/politique-confidentialite-adserver", + "legIntClaim": "https://www.adn.ai/fr/politique-confidentialite-adserver" + } + ], + "dataDeclaration": [ + 2, + 6 + ], + "deviceStorageDisclosureUrl": "https://static.adn.ai/deploymanuel/tcf/deviceStorageDisclosure.json" + }, + "828": { + "id": 828, + "name": "TX Group AG", + "purposes": [ + 1, + 3, + 5, + 6 + ], + "legIntPurposes": [ + 8, + 9, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 94608000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://tx.group/de/datenschutzerklaerung/", + "legIntClaim": "https://tx.group/de/datenschutzerklaerung/#process_personal_data" + }, + { + "langId": "en", + "privacy": "https://tx.group/privacy-policy/", + "legIntClaim": "https://tx.group/privacy-policy/#process_personal_data" + }, + { + "langId": "fr", + "privacy": "https://tx.group/fr/declaration-de-confidentialite/", + "legIntClaim": "https://tx.group/fr/declaration-de-confidentialite/#process_personal_data" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://tx.group/iab/tcf-glv.json" + }, + "831": { + "id": 831, + "name": "United Internet Media GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.united-internet-media.de/de/datenschutzhinweis/", + "legIntClaim": "https://www.united-internet-media.de/de/datenschutzhinweis/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.united-internet-media.de/services/deviceStorage.json" + }, + "835": { + "id": 835, + "name": "Quality Media Network GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 25920000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.qualitymedianetwork.de/datenschutz/", + "legIntClaim": "https://ads.qualitymedianetwork.de/privacy.php" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.qualitymedianetwork.de/json-file/deviceStorage2.json" + }, + "836": { + "id": 836, + "name": "Bring! Labs AG", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 7, + 8 + ], + "specialPurposes": [], + "features": [], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.getbring.com/en/privacy-policy", + "legIntClaim": "https://www.getbring.com/en/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 5, + 7, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://files.getbring.com/iab/DeviceStorageDisclosure.json" + }, + "839": { + "id": 839, + "name": "PIXFUTURE MEDIA INC.", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.pixfuture.com/terms-and-conditions#platform-terms", + "legIntClaim": "https://www.pixfuture.com/terms-and-conditions#platform-terms" + } + ], + "dataDeclaration": [ + 4 + ], + "deviceStorageDisclosureUrl": "https://pixfuture.com/vendor-disclosures.json" + }, + "844": { + "id": 844, + "name": "SPICY MOBILE Karczewski Zawadzki Spółka Jawna", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 2419200, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://spicymobile.pl/polityka-prywatnosci" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7 + ], + "deviceStorageDisclosureUrl": "https://spicyrtb.com/static/iab-disclosure.json" + }, + "848": { + "id": 848, + "name": "BSmartData GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 0, + "purposes": { + "3": 7, + "4": 7 + }, + "specialPurposes": { + "1": 7 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.bsmartdata.com/en/privacy/", + "legIntClaim": "https://www.bsmartdata.com/en/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 10 + ], + "deviceStorageDisclosureUrl": "https://ad.bsmartdata.com/DeviceStorage.json" + }, + "849": { + "id": 849, + "name": "Epom Ltd.", + "purposes": [ + 1, + 2, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 3, + "purposes": { + "2": 730 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://epom.com/privacy-policy", + "legIntClaim": "https://epom.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 8 + ], + "deviceStorageDisclosureUrl": "https://epom.com/deviceStorage.json" + }, + "850": { + "id": 850, + "name": "Publisher First, Inc.", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 604800, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://freestar.com/privacy-policy/", + "legIntClaim": "https://freestar.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://iab.pub.network/json/freestar-us.json" + }, + "855": { + "id": 855, + "name": "Adnuntius AS", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 214748364, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": { + "2": 0 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://adnuntius.com/resources/privacy-policy/", + "legIntClaim": "https://adnuntius.com/resources/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://delivery.adnuntius.com/.well-known/deviceStorage.json" + }, + "856": { + "id": 856, + "name": "Petal Ads", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": { + "2": 7 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.aspiegel.com/en/privacy", + "legIntClaim": "https://h5hosting.dbankcdn.com/cch5/PPS/ads/interests/legitimate_interests.htm" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://h5hosting-dre.dbankcdn.com/cch5/PPS/ads/tcfvendor/disclosure.json" + }, + "857": { + "id": 857, + "name": "SOMQUERY SOMTAG - (SevenOne Media)", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 10 + ], + "flexiblePurposes": [ + 2, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.seven.one/datenschutzhinweise/somquery-somtag", + "legIntClaim": "https://www.seven.one/datenschutzhinweise/somquery-somtag" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://ad.71i.de/consent/deviceStorage.json" + }, + "858": { + "id": 858, + "name": "Mediavine, Inc.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31560000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.mediavine.com/privacy-policy", + "legIntClaim": "https://www.mediavine.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.mediavine.com/deviceStorage.json" + }, + "861": { + "id": 861, + "name": "Triple13 Ltd", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 2 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": { + "7": 730, + "8": 730, + "9": 730, + "10": 730 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://freestar.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://static.s2s.t13.io/iab/deviceStorageDisclosure.json" + }, + "862": { + "id": 862, + "name": "Truvid Inc.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 8 + ], + "legIntPurposes": [ + 7, + 10 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 5184000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 60, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.truvid.com/terms/privacy_policy", + "legIntClaim": "https://www.truvid.com/terms/privacy_policy" + } + ], + "dataDeclaration": [ + 2, + 7, + 8 + ], + "deviceStorageDisclosureUrl": "https://www.truvid.com/deviceStorage.json" + }, + "864": { + "id": 864, + "name": "I.R.V. D.O.O.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.contentexchange.me/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 6, + 8, + 10 + ], + "deviceStorageDisclosureUrl": "https://hb.contentexchange.me/template/deviceStorage.json" + }, + "866": { + "id": 866, + "name": "YieldLift LLC", + "purposes": [ + 1, + 2, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://yieldlift.com/privacy-policy.html", + "legIntClaim": "https://yieldlift.com/privacy-policy.html" + } + ], + "dataDeclaration": [ + 11 + ], + "deviceStorageDisclosureUrl": "https://yieldlift.s3.amazonaws.com/yl-vendor-device-storage-and-operational-disclosures.json" + }, + "868": { + "id": 868, + "name": "Converto AG", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 360, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.converto.com/datenschutz-privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://converto-docs.s3.eu-central-1.amazonaws.com/TCD+2.0+json/converto-tcf-vendor-cookie.json" + }, + "878": { + "id": 878, + "name": "Natív Hirdetés Korlátolt Felelősségű Társaság", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2, + 7, + 8 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 5184000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 60, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "hu", + "privacy": "https://related.hu/adatkezeles/", + "legIntClaim": "https://related.hu/adatkezeles/" + }, + { + "langId": "en", + "privacy": "https://related.hu/en/privacy-policy", + "legIntClaim": "https://related.hu/en/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 8 + ], + "deviceStorageDisclosureUrl": "https://related.hu/tcf/tcf.json" + }, + "881": { + "id": 881, + "name": "Hillside (Sports) GP Limited", + "purposes": [ + 1, + 2, + 7, + 8, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 388800, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 45, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.bet365partners.com/privacypolicy", + "legIntClaim": "https://www.bet365partners.com/privacypolicy" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.bet365partners.com/privacypolicy/iab_tcf/device_storage.json" + }, + "882": { + "id": 882, + "name": "NumberEight Technologies Ltd", + "purposes": [ + 1, + 3, + 5, + 10 + ], + "legIntPurposes": [ + 9 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 183, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://portal.eu.numbereight.ai/policies-license#software-privacy-notice", + "legIntClaim": "https://portal.eu.numbereight.ai/policies-license#software-privacy-notice" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://server.eu.numbereight.ai/.well-known/deviceStorage.json" + }, + "885": { + "id": 885, + "name": "Dianomi PLC", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 8, + 9 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.dianomi.com/legal/privacy.epl", + "legIntClaim": "https://www.dianomi.com/legal/privacy.epl" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.dianomi.com/device_storage.json" + }, + "889": { + "id": 889, + "name": "Admo.tv (Clickon)", + "purposes": [ + 8, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 32000000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 390, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.admo.tv/en/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://vol.admo.tv/cookie-properties.json" + }, + "890": { + "id": 890, + "name": "Channel Pilot Solutions GmbH", + "purposes": [ + 1, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 12690000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "7": 30 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://channelpilot.co.uk/privacy-policy" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://static.content.channelpilot.com/tcf.json" + }, + "896": { + "id": 896, + "name": "IPSOS MORI UK LTD", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 8, + 9 + ], + "flexiblePurposes": [ + 8, + 9 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 40, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://iris.ipsos.com/site-centric-privacy/", + "legIntClaim": "https://iris.ipsos.com/site-centric-privacy/#legitimateInterests" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://download.dotmetrics.net/Privacy/deviceStorage.json" + }, + "898": { + "id": 898, + "name": "Mobkoi Ltd", + "purposes": [], + "legIntPurposes": [ + 2, + 10 + ], + "flexiblePurposes": [ + 2, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "2": 365, + "10": 365 + }, + "specialPurposes": { + "1": 0, + "2": 0 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.mobkoi.com/advertising-platform-privacy-policy/", + "legIntClaim": "https://www.mobkoi.com/advertising-platform-privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.maximus.mobkoi.com/tcf/deviceStorageDisclosure.json" + }, + "900": { + "id": 900, + "name": "Advisible AB", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.advisible.com/privacy", + "legIntClaim": "https://www.advisible.com/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 8 + ], + "deviceStorageDisclosureUrl": "https://misc.advisible.com/static/deviceStorage.json" + }, + "901": { + "id": 901, + "name": "STUDIO GONG GmbH & Co. Studiobetriebs KG", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 34128000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.studio-gong.de/datenschutzerklaerung", + "legIntClaim": "https://www.studio-gong.de/datenschutzerklaerung" + } + ], + "dataDeclaration": [ + 1, + 2, + 3 + ], + "deviceStorageDisclosureUrl": "https://www.studio-gong.de/devicedisclosure_vendor_studiogong.json" + }, + "907": { + "id": 907, + "name": "AWIN AG", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 7 + ], + "flexiblePurposes": [ + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 1096, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.awin.com/gb/privacy", + "legIntClaim": "https://www.awin.com/gb/privacy" + }, + { + "langId": "de", + "privacy": "https://www.awin.com/de/datenschutzerklarung", + "legIntClaim": "https://www.awin.com/de/datenschutzerklarung" + }, + { + "langId": "fr", + "privacy": "https://www.awin.com/fr/politique-de-confidentialite", + "legIntClaim": "https://www.awin.com/fr/politique-de-confidentialite" + }, + { + "langId": "it", + "privacy": "https://www.awin.com/it/privacy", + "legIntClaim": "https://www.awin.com/it/privacy" + }, + { + "langId": "pl", + "privacy": "https://www.awin.com/pl/prywatnosc", + "legIntClaim": "https://www.awin.com/pl/prywatnosc" + }, + { + "langId": "sv", + "privacy": "https://www.awin.com/se/privacy", + "legIntClaim": "https://www.awin.com/se/privacy" + }, + { + "langId": "nl", + "privacy": "https://www.awin.com/nl/privacy", + "legIntClaim": "https://www.awin.com/nl/privacy" + }, + { + "langId": "pt", + "privacy": "https://www.awin.com/pt/privacy", + "legIntClaim": "https://www.awin.com/pt/privacy" + }, + { + "langId": "es", + "privacy": "https://www.awin.com/es/privacidad", + "legIntClaim": "https://www.awin.com/es/privacidad" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 5, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://privacy.awin.com/AwinDeviceStorage.json" + }, + "909": { + "id": 909, + "name": "MobileFuse LLC", + "purposes": [ + 1, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://mobilefuse.com/privacy-policy/", + "legIntClaim": "https://mobilefuse.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 7, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://mobilefuse.com/storage-disclosures.json" + }, + "918": { + "id": 918, + "name": "SPORTORITY UK LTD", + "purposes": [ + 1, + 2, + 5, + 6 + ], + "legIntPurposes": [ + 7, + 8, + 9, + 10, + 11 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 1800, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 2555, + "purposes": { + "2": 0 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.90min.com/privacy", + "legIntClaim": "https://www.90min.com/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://disclosures.mmctsvc.com/device-storage.json" + }, + "919": { + "id": 919, + "name": "Livewrapped AB", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://livewrapped.com/privacy-policy", + "legIntClaim": "https://livewrapped.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://content.lwadm.com/deviceStorageDisclosure.json" + }, + "922": { + "id": 922, + "name": "Amnet GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 30758400, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://mediaintelligence.de/privacy-policy.do", + "legIntClaim": "https://mediaintelligence.de/privacy-policy.do" + }, + { + "langId": "en", + "privacy": "https://mediaintelligence.de/privacy-policyeng.do", + "legIntClaim": "https://mediaintelligence.de/privacy-policyeng.do" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 5, + 6, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://min.easyapi.de/api/tcf/definitions/disclosures" + }, + "931": { + "id": 931, + "name": "Traffective GmbH", + "purposes": [ + 1, + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 365, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.iubenda.com/privacy-policy/30563919", + "legIntClaim": "https://www.iubenda.com/privacy-policy/30563919/legal" + } + ], + "dataDeclaration": [ + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.opencmp.net/vendor-device-storage-disclosures.json" + }, + "935": { + "id": 935, + "name": "INIS sp. zo.o.", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 7, + 8, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 7, + 8 + ], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": { + "3": 365, + "5": 365, + "10": 365 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "pl", + "privacy": "https://www.inis.pl/polityka-prywatnosci", + "legIntClaim": "https://www.inis.pl/polityka-prywatnosci" + } + ], + "dataDeclaration": [ + 1, + 2, + 7 + ], + "deviceStorageDisclosureUrl": "https://www.inis.pl/tcf/vendor.json" + }, + "938": { + "id": 938, + "name": "dataXtrade GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": { + "1": 365 + } + }, + "urls": [ + { + "langId": "de", + "privacy": "https://dataxtrade.com/de/privacy.html", + "legIntClaim": "https://dataxtrade.com/de/privacy.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://tcf.adtech.app/gen/deviceStorageDisclosure/dxt.json" + }, + "940": { + "id": 940, + "name": "Terminus Software Inc.", + "purposes": [], + "legIntPurposes": [ + 7 + ], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "7": 4320 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://terminus.com/privacy-policy/", + "legIntClaim": "https://terminus.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://iabdisclosure.terminusplatform.com/deviceStorageDisclosureURL.json" + }, + "941": { + "id": 941, + "name": "ADSOCY", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 25920000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 60, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "es", + "privacy": "https://adsocy.com/politica-de-privacidad-y-aviso-legal/", + "legIntClaim": "https://adsocy.com/politica-de-privacidad-y-aviso-legal/" + } + ], + "dataDeclaration": [ + 1, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://adsocy.com/vendor.json" + }, + "943": { + "id": 943, + "name": "Marfeel Solutions, SL (Compass)", + "purposes": [ + 1, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 780, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://community.marfeel.com/t/marfeel-saas-privacy-policy/7500" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://live.mrf.io/statics/marfeel/resources/lib/deviceStorage/compass.json" + }, + "944": { + "id": 944, + "name": "AudienceRun corp", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.audiencerun.com/privacy-policy", + "legIntClaim": "https://www.audiencerun.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 5, + 7, + 8 + ], + "deviceStorageDisclosureUrl": "https://www.audiencerun.com/tcf.json" + }, + "950": { + "id": 950, + "name": "Stream Eye OOD", + "purposes": [], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": {}, + "specialPurposes": { + "2": 0 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://app.streameye.com/policy/net", + "legIntClaim": "https://app.streameye.com/policy/net" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://static.streameye.net/iab/dsdu.json" + }, + "952": { + "id": 952, + "name": "ProSiebenSat.1 Digital Data GmbH", + "purposes": [ + 1, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 1110, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.7pass.de/psdd/datenschutzbestimmungen-cdb.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.7pass.de/psdd/deviceStorage.json" + }, + "953": { + "id": 953, + "name": "adbalancer Werbeagentur GmbH", + "purposes": [], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": {}, + "specialPurposes": { + "2": 0 + } + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.adbalancer.com/hosting-datenschutzerklaerung", + "legIntClaim": "https://www.adbalancer.com/legitimes-interesse" + } + ], + "dataDeclaration": [ + 8 + ], + "deviceStorageDisclosureUrl": "https://streaming-cdn.ad-balancer.at/deviceStorageDisclosure.json" + }, + "955": { + "id": 955, + "name": "Konodrac S.L.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "es", + "privacy": "https://konodrac.com/politica-privacidad/" + }, + { + "langId": "en", + "privacy": "https://konodrac.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.konograma.com/public/device_storage_disclosure.json" + }, + "956": { + "id": 956, + "name": "Avantis Video Ltd", + "purposes": [ + 1, + 2, + 7, + 8, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 400, + "purposes": { + "2": 0, + "11": 0 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.avantisvideo.com/privacy-policy/", + "legIntClaim": "https://www.avantisvideo.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://avantisvideo.com/local-storage-disclosure.json" + }, + "966": { + "id": 966, + "name": "socoto gmbh & co. kg", + "purposes": [ + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "7": 0 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.socoto.com/datenschutz/" + } + ], + "deviceStorageDisclosureUrl": "https://www.socoto.com/.iab/deviceStorage.json" + }, + "968": { + "id": 968, + "name": "WEMASS MEDIA AUDIENCE SAFE SOLUTIONS, S.L. ", + "purposes": [ + 1, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 94608000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "es", + "privacy": "https://wemass.com/privacidad/", + "legIntClaim": "https://wemass.com/privacidad/" + } + ], + "dataDeclaration": [ + 2, + 4, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://sellers.wemass.com/deviceStorage.json" + }, + "970": { + "id": 970, + "name": "Frameplay Corporation", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 547, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.frameplay.gg/terms", + "legIntClaim": "https://www.frameplay.gg/terms" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 8 + ], + "deviceStorageDisclosureUrl": "https://www.frameplay.gg/deviceStorageDisclosure.json" + }, + "978": { + "id": 978, + "name": "ARKHEUS", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.arkheus.fr/conditions-d-utilisation/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.arkheus.fr/tcf.json" + }, + "982": { + "id": 982, + "name": "Netpoint Media GmbH", + "purposes": [ + 1, + 2 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 3600, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "2": 30 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.netpoint-media.de/technik/datenschutz" + } + ], + "dataDeclaration": [ + 6 + ], + "deviceStorageDisclosureUrl": "https://cdn.netpoint-media.de/iab/deviceStorage.json" + }, + "987": { + "id": 987, + "name": "Media16 ltd", + "purposes": [ + 1, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 3 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "7": 30 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://media16.tv/privacy-policy/" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://media16.tv/disclosure.json" + }, + "991": { + "id": 991, + "name": "iProspect GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 30758400, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://inetpro.io/privacy-policyeng.do", + "legIntClaim": "https://inetpro.io/privacy-policyeng.do" + }, + { + "langId": "de", + "privacy": "https://inetpro.io/privacy-policy.do", + "legIntClaim": "https://inetpro.io/privacy-policy.do" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://n2.min.emcustomers.de/api/tcf/definitions/disclosures" + }, + "993": { + "id": 993, + "name": "QUARTER MEDIA GmbH", + "purposes": [ + 1, + 2, + 3, + 7, + 8, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 90, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://quartermedia.de/daten/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.quartermedia-ad-service.net/prebid/device-storage.json" + }, + "994": { + "id": 994, + "name": "Leadoo Marketing Technologies Ltd", + "purposes": [ + 3, + 4, + 5, + 6, + 9 + ], + "legIntPurposes": [ + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 9 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 1825, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://leadoo.com/privacy-policy/", + "legIntClaim": "https://leadoo.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 2, + 3, + 4, + 5, + 6, + 7, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://res.leadoo.com/tcf/deviceStorage.json" + }, + "1001": { + "id": 1001, + "name": "wetter.com GmbH", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 400, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.wetter.com/internal/news/datenschutzhinweise_aid_607698849b8ecf79e21584fa.html", + "legIntClaim": "https://www.wetter.com/internal/news/datenschutzhinweise_aid_607698849b8ecf79e21584fa.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://cs3.wettercomassets.com/iab/disclosure.json" + }, + "1002": { + "id": 1002, + "name": "Extreme Reach, Inc", + "purposes": [ + 1, + 2, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 7, + 10 + ], + "specialPurposes": [], + "features": [ + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 15552000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://extremereach.com/privacy-policies/", + "legIntClaim": "https://NotApplicableConsetOnly" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://beacons.extremereach.io/gdpr-tcfv2.json" + }, + "1015": { + "id": 1015, + "name": "Samsung Ads", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 9, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://policy.samsungrs.com/consent/eu/privacy_policy_en.html", + "legIntClaim": "https://policy.samsungrs.com/consent/eu/privacy_policy_en.html#use-information" + }, + { + "langId": "de", + "privacy": "https://policy.samsungrs.com/consent/eu/v1.0.0/privacy_policy_de.html", + "legIntClaim": "https://policy.samsungrs.com/consent/eu/v1.0.0/privacy_policy_de.html#use-information" + }, + { + "langId": "it", + "privacy": "https://policy.samsungrs.com/consent/eu/v1.0.0/privacy_policy_it.html", + "legIntClaim": "https://policy.samsungrs.com/consent/eu/v1.0.0/privacy_policy_it.html#use-information" + }, + { + "langId": "fr", + "privacy": "https://policy.samsungrs.com/consent/eu/v1.0.0/privacy_policy_fr.html", + "legIntClaim": "https://policy.samsungrs.com/consent/eu/v1.0.0/privacy_policy_fr.html#use-information" + }, + { + "langId": "es", + "privacy": "https://policy.samsungrs.com/consent/eu/v1.0.0/privacy_policy_es.html", + "legIntClaim": "https://policy.samsungrs.com/consent/eu/v1.0.0/privacy_policy_es.html#use-information" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://policy.samsungrs.com/consent/eu/deviceStorageDisclosure.json" + }, + "1020": { + "id": 1020, + "name": "Baidu USA", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31622400, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.mediago.io/policy/", + "legIntClaim": "https://www.mediago.io/policy/" + } + ], + "dataDeclaration": [ + 6 + ], + "deviceStorageDisclosureUrl": "https://cdn.mediago.io/js/tcf.json" + }, + "1027": { + "id": 1027, + "name": "Exit Bee Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.exitbee.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 7, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.exitbee.com/DeviceStorageDisclosure.json" + }, + "1028": { + "id": 1028, + "name": "Sparteo", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.bricks-co.com/confidentialite", + "legIntClaim": "https://www.bricksfounders.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://bid.bricks-co.com/.well-known/deviceStorage.json" + }, + "1032": { + "id": 1032, + "name": "Project Agora Ltd", + "purposes": [ + 1, + 7, + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://projectagora.com/privacy-policy/", + "legIntClaim": "https://projectagora.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 2, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://projectagora.net/1032_deviceStorageDisclosure.json" + }, + "1035": { + "id": 1035, + "name": "Allegro sp. z o.o.", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": { + "3": 180 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "pl", + "privacy": "https://allegro.pl/terms/attachment/5" + }, + { + "langId": "cs", + "privacy": "https://allegro.cz/podminky/priloha/5" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://naanalle.pl/iab/deviceStorage.json" + }, + "1036": { + "id": 1036, + "name": "VIADS ADVERTISING S.L.", + "purposes": [ + 1, + 3, + 4, + 7, + 9 + ], + "legIntPurposes": [ + 2, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://viads.com/privacy-policy", + "legIntClaim": "https://viads.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://viads.com/deviceStorage.json" + }, + "1041": { + "id": 1041, + "name": "Sqreem Technologies Private Limited", + "purposes": [], + "legIntPurposes": [ + 2, + 7, + 9 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://sqreemtech.com/privacy/", + "legIntClaim": "https://sqreemtech.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 3 + ], + "deviceStorageDisclosureUrl": "https://ttd-misc-public-assets.s3.us-west-2.amazonaws.com/deviceStorageDisclosureURL.json" + }, + "1044": { + "id": 1044, + "name": "TMT Digital Inc", + "purposes": [], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": {}, + "specialPurposes": { + "1": 0 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://mediatrust.com/privacy-statement/", + "legIntClaim": "https://mediatrust.com/privacy-statement/" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://webcontentassessor.com/tcf.json" + }, + "1048": { + "id": 1048, + "name": "Questpass Sp. z o.o.", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "pl", + "privacy": "https://questpass.pl/pl/regulaminy/polityka-prywatnosci/", + "legIntClaim": "https://questpass.pl/pl/regulaminy/polityka-prywatnosci/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.dqst.pl/static/prod/consents/tcf_disclosures.json" + }, + "1050": { + "id": 1050, + "name": "Hurra Communications GmbH", + "purposes": [ + 1, + 2, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 2 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536500, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 396, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://privacy.hurra.com/tcf/", + "legIntClaim": "https://privacy.hurra.com/tcf/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 8, + 9 + ], + "deviceStorageDisclosureUrl": "https://privacy.hurra.com/tcf/disclosures.json" + }, + "1051": { + "id": 1051, + "name": "Samoukale Enterprises Limited dba ADEX", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 7, + 8, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://adex.com/privacy", + "legIntClaim": "https://adex.com/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 5, + 7, + 11 + ], + "deviceStorageDisclosureUrl": "https://adex.com/gdpr.json" + }, + "1060": { + "id": 1060, + "name": "Next Millennium Media INC", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 36000, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 7, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://nextmillennium.io/privacy-policy/", + "legIntClaim": "https://nextmillennium.io/privacy-policy/" + } + ], + "dataDeclaration": [ + 3, + 4, + 6 + ], + "deviceStorageDisclosureUrl": "https://nextmillennium.io/deviceStorage.json" + }, + "1064": { + "id": 1064, + "name": "optimise-it GmbH", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 8 + ], + "flexiblePurposes": [ + 8 + ], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 0, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "8": 13 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://optimise-it.de/datenschutz", + "legIntClaim": "https://optimise-it.de/datenschutz" + } + ], + "dataDeclaration": [ + 1, + 2, + 7 + ], + "deviceStorageDisclosureUrl": "https://optimise-it.de/.well-known/deviceStorage.json" + }, + "1067": { + "id": 1067, + "name": "Arpeely Ltd.", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 540, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.arpeely.com/privacy", + "legIntClaim": "https://www.arpeely.com/privacy" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://cdn.rtbrain.app/deviceStorageDisclosureUrl.json" + }, + "1069": { + "id": 1069, + "name": "BCOVERY SAS", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": { + "10": 365 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.bcovery.com/politique-de-confidentialite.html", + "legIntClaim": "https://www.bcovery.com/legitimate-interest-claim.html" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.bcovery.com/dsd-bcovery.json" + }, + "1070": { + "id": 1070, + "name": "Playhill Limited", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://playhill.com/privacy", + "legIntClaim": "https://playhill.com/privacy" + } + ], + "dataDeclaration": [ + 1, + 2 + ], + "deviceStorageDisclosureUrl": "https://playhill.com/iab.json" + }, + "1072": { + "id": 1072, + "name": "Adrino Mobile Sp. z o.o.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 360, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "pl", + "privacy": "https://adrino.pl/wp-content/uploads/2021/01/POLITYKA-PRYWATNOS%CC%81CI-Adrino-Mobile.pdf" + } + ], + "dataDeclaration": [ + 1, + 8 + ], + "deviceStorageDisclosureUrl": "https://cdn.adrino.cloud/iab/gvl.json" + }, + "1080": { + "id": 1080, + "name": "CITISERVI EUROPE, S.L.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 5000000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "es", + "privacy": "https://www.citiservimedia.com/politica-de-privacidad-plataforma-citiservimedia/", + "legIntClaim": "https://www.citiservimedia.com/politica-de-privacidad-plataforma-citiservimedia/#legitimate-interest" + } + ], + "dataDeclaration": [ + 2, + 3, + 4, + 5, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://csm.citiservi.es/static/device-storage-disclosure.json" + }, + "1081": { + "id": 1081, + "name": "C Wire AG", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.cwire.com/privacy-policy", + "legIntClaim": "https://www.cwire.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.cwi.re/artifacts/iab/iab.json" + }, + "1085": { + "id": 1085, + "name": "Njuice AB", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 34560000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 400, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://squidapp.co/en/privacy-policy.php", + "legIntClaim": "https://squidapp.co/en/privacy-policy.php" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://squid-tcf.s3.eu-central-1.amazonaws.com/disclosure.json" + }, + "1087": { + "id": 1087, + "name": "CASTOOLA D.O.O.", + "purposes": [ + 1, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [ + 2 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://castoola.com/wp-content/uploads/2022/01/castoola_pp_06.01.2022.pdf", + "legIntClaim": "https://castoola.com/wp-content/uploads/2022/01/castoola_pp_06.01.2022.pdf" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://privacy.castoola.tv/deviceStorage.json" + }, + "1089": { + "id": 1089, + "name": "Teavaro", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 120, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.teavaro.com/privacy-policy/" + }, + { + "langId": "de", + "privacy": "https://teavaro.com/de/datenschutz-bestimmungen/" + }, + { + "langId": "es", + "privacy": "https://teavaro.com/es/politica-de-privacidad/" + } + ], + "dataDeclaration": [ + 1, + 2, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://service.tvtestenv1.net/utiq/prebid/deviceStorage.json" + }, + "1090": { + "id": 1090, + "name": "Score Media Group GmbH & Co. KG", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://score-media.de/datenschutzerklaerung/", + "legIntClaim": "https://score-media.de/datenschutzerklaerung/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://ad.tag.score-media.de/privacy/tcf/deviceStorage/93a705a5f5d52cf1.json" + }, + "1091": { + "id": 1091, + "name": "Octave IP Limited", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 34190000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://octaveip.com/policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://octaveip.com/deviceStorage.json" + }, + "1094": { + "id": 1094, + "name": "ADMAX", + "purposes": [ + 1 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://admaxmedia.io/privacy-policy/", + "legIntClaim": "https://admaxmedia.io/privacy-policy/" + }, + { + "langId": "fr", + "privacy": "https://admaxmedia.io/privacy-policy-fr/", + "legIntClaim": "https://admaxmedia.io/privacy-policy-fr/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.admaxmedia.io/deviceStorage.json" + }, + "1100": { + "id": 1100, + "name": "Relevant Digital Oy", + "purposes": [ + 1 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.relevant-digital.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://cdn.relevant-digital.com/resources/deviceStorage.json" + }, + "1101": { + "id": 1101, + "name": "PIA Advertising GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.performance-advertising.de/datenschutz/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://imagesrv.adition.com/banners/268/xml/cm/ts/tcf/deviceStorage.json" + }, + "1104": { + "id": 1104, + "name": "Covatic Ltd", + "purposes": [ + 1, + 2, + 3, + 4, + 8, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 0, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://covatic.com/terms/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://tcf.covatic.io/onDeviceStorage.json" + }, + "1110": { + "id": 1110, + "name": "KÖNIGSTEINER digital GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.koenigsteiner.digital/datenschutzerklaerung", + "legIntClaim": "https://www.koenigsteiner.digital/datenschutzerklaerung" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 8 + ], + "deviceStorageDisclosureUrl": "https://roqad-public.s3.eu-central-1.amazonaws.com/tcf-disclosure.json" + }, + "1116": { + "id": 1116, + "name": "Anonymised", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.anonymised.io/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 7, + 8, + 10 + ], + "deviceStorageDisclosureUrl": "https://static.anonymised.io/deviceStorage.json" + }, + "1119": { + "id": 1119, + "name": "Novatiq limited ", + "purposes": [ + 3, + 4, + 7, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 1, + "purposes": { + "7": 0 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://novatiq.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 4, + 5, + 11 + ], + "deviceStorageDisclosureUrl": "https://novatiq.com/privacy/iab/novatiq.json" + }, + "1120": { + "id": 1120, + "name": "Bababam", + "purposes": [ + 1, + 2, + 3 + ], + "legIntPurposes": [ + 7, + 8, + 9, + 10, + 11 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 730, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.bababam.com/terms", + "legIntClaim": "https://www.bababam.com/terms" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.bababam.com/.well-known/deviceStorage.json" + }, + "1122": { + "id": 1122, + "name": "Arbeitsgemeinschaft Media-Analyse", + "purposes": [ + 1, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31622400, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": { + "9": 180 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.agma-mmc.de/datenschutz" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 5, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.agma-mmc.de/ioam/deviceStorage.json" + }, + "1127": { + "id": 1127, + "name": "XAD spoteffects GmbH", + "purposes": [ + 1, + 3, + 5, + 7, + 8, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 63072000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 396, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://xadspoteffects.com/en/privacy-policy/" + } + ], + "dataDeclaration": [ + 2, + 3, + 4, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://trck.spoteffects.net/tcf2/ops-disclosure.json" + }, + "1129": { + "id": 1129, + "name": "Brandhouse/Subsero A/S", + "purposes": [], + "legIntPurposes": [ + 8 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 360, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://subserohost.com/privacy_policy.aspx", + "legIntClaim": "https://subserohost.com/privacy_policy.aspx#datacoll_legitimateinterest" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://subserohost.com/device_storage_disclosure_tcfv2.json" + }, + "1130": { + "id": 1130, + "name": "WebMedia", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 120960, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://mobupps.com/pdf/Mobupps_Privacy_policy.pdf", + "legIntClaim": "https://mobupps.com/pdf/Mobupps_Privacy_policy.pdf" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 8 + ], + "deviceStorageDisclosureUrl": "https://mobupps.com/tcf.json" + }, + "1134": { + "id": 1134, + "name": "Bidmatic Inc", + "purposes": [ + 1, + 2, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 8035200, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": { + "2": 0 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://bidmatic.io/privacy-policy/", + "legIntClaim": "https://bidmatic.io/tos/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://bidmatic.io/.well-known/deviceStorage.json" + }, + "1136": { + "id": 1136, + "name": "Infolinks Media, LLC", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 4320, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.infolinks.com/privacy-policy", + "legIntClaim": "https://www.infolinks.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://resources.infolinks.com/static/tcf/devicestoragedisclosure.json" + }, + "1144": { + "id": 1144, + "name": "Unicredit BankAustria AG", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31536000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 180, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.bankaustria.at/rechtliches-datenschutz.jsp" + } + ], + "dataDeclaration": [ + 1, + 3, + 4, + 10 + ], + "deviceStorageDisclosureUrl": "https://js.ucg-at.datafront.co/next14_dmp_ucg-at_device_storage_information.json" + }, + "1147": { + "id": 1147, + "name": "MADINAD PC", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 7 + ], + "legIntPurposes": [ + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 604800, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 7, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://madinad.com/privacy-policy/", + "legIntClaim": "https://madinad.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6 + ], + "deviceStorageDisclosureUrl": "https://static.madinad.com/static/iab-tcf.json" + }, + "1149": { + "id": 1149, + "name": "AdInMo LTD", + "purposes": [], + "legIntPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": { + "2": 30, + "10": 4320 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.adinmo.com/privacy-policy/", + "legIntClaim": "https://www.adinmo.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 11 + ], + "deviceStorageDisclosureUrl": "https://rtb.adinmo.com/iab-tcf-vendor" + }, + "1154": { + "id": 1154, + "name": "Alphonso Inc. ", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 800, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu/" + }, + { + "langId": "bg", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-bulgarian/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-bulgarian/" + }, + { + "langId": "hr", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-croatian/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-croatian/" + }, + { + "langId": "cs", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-czech/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-czech/" + }, + { + "langId": "da", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-danish/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-danish/" + }, + { + "langId": "nl", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-dutch/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-dutch/" + }, + { + "langId": "fi", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-finnish/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-finnish/" + }, + { + "langId": "et", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-estonian/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-estonian/" + }, + { + "langId": "fr", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-fr/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-fr/" + }, + { + "langId": "gl", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-gaelic/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-gaelic/" + }, + { + "langId": "de", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-de/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-de/" + }, + { + "langId": "el", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-greek/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-greek/" + }, + { + "langId": "hu", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-hungarian/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-hungarian/" + }, + { + "langId": "it", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-it/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-it/" + }, + { + "langId": "lv", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-latvian/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-latvian/" + }, + { + "langId": "lt", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-lithuanian/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-lithuanian/" + }, + { + "langId": "mt", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-maltese/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-maltese/" + }, + { + "langId": "pl", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-polish/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-polish/" + }, + { + "langId": "pt", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-portuguese/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-portuguese/" + }, + { + "langId": "ro", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-romanian/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-romanian/" + }, + { + "langId": "sk", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-slovak/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-slovak/" + }, + { + "langId": "sl", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-slovenian/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-slovenian/" + }, + { + "langId": "es", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-es/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-es/" + }, + { + "langId": "sv", + "privacy": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-swedish/", + "legIntClaim": "https://alphonso.tv/privacy/smart-tvs/smart-tv-privacy-policy-eu-swedish/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://cdn.alphonso.tv/static-assets/iab-tcf/policy/device-storage-disclosure.json" + }, + "1157": { + "id": 1157, + "name": "Refine Direct Srl", + "purposes": [ + 1, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 1, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "it", + "privacy": "https://www.refine.direct/it/cookie-policy/", + "legIntClaim": "https://www.refine.direct/it/legitimate-interest-assessment/" + }, + { + "langId": "en", + "privacy": "https://www.refine.direct/en/cookie-policy/", + "legIntClaim": "https://www.refine.direct/en/legitimate-interest-assessment/" + } + ], + "dataDeclaration": [ + 1, + 2, + 4 + ], + "deviceStorageDisclosureUrl": "https://cdn.refine.direct/tcf2/tcf2.json" + }, + "1160": { + "id": 1160, + "name": "streaMonkey GmbH", + "purposes": [], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.streamonkey.de/de/datenschutz", + "legIntClaim": "https://www.streamonkey.de/de/datenschutz" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://www.streamonkey.de/iab_disclosures.json" + }, + "1161": { + "id": 1161, + "name": "freenet DLS GmbH", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 7884000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://www.freenet-mobilfunk.de/legal/datenschutz/", + "legIntClaim": "https://www.freenet-mobilfunk.de/legal/datenschutz/" + } + ], + "dataDeclaration": [ + 2, + 3, + 6, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.freenet-mobilfunk.de/deviceStorage.json" + }, + "1165": { + "id": 1165, + "name": "Kueez Entertainment Ltd.", + "purposes": [ + 1, + 3, + 4, + 5, + 6 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10, + 11 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.kueez.com/en/privacy", + "legIntClaim": "https://www.kueez.com/en/privacy" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://en.kueez.com/tcf.json" + }, + "1168": { + "id": 1168, + "name": "Voxnest Inc", + "purposes": [ + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": { + "1": 180, + "2": 4320 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.voxnest.com/privacy/", + "legIntClaim": "https://www.voxnest.com/privacy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 6, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.voxnest.com/iab-tcf-disclosures.json" + }, + "1170": { + "id": 1170, + "name": "Zeit Agency ApS", + "purposes": [], + "legIntPurposes": [ + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://zeitagency.com/privacy.html", + "legIntClaim": "https://zeitagency.com/privacy.html" + } + ], + "dataDeclaration": [ + 1, + 2 + ], + "deviceStorageDisclosureUrl": "https://zeitagency.com/domains.json" + }, + "1176": { + "id": 1176, + "name": "AlgoriX Technology Pte. Ltd.,", + "purposes": [ + 1, + 3, + 4, + 7 + ], + "legIntPurposes": [ + 2, + 10 + ], + "flexiblePurposes": [ + 2, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 7, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.algorix.co/privacy-policy/", + "legIntClaim": "https://www.algorix.co/privacy-policy/#section-3-3" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 9, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.algorix.co/gdpr-disclosure.json" + }, + "1178": { + "id": 1178, + "name": "First-id", + "purposes": [ + 1, + 2, + 3, + 4, + 7 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [ + 2 + ], + "cookieMaxAgeSeconds": 34128000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 395, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "fr", + "privacy": "https://www.first-id.fr/fr/politique-de-confidentialite" + }, + { + "langId": "en", + "privacy": "https://www.first-id.fr/politique-de-confidentialite" + } + ], + "dataDeclaration": [ + 1, + 2, + 7, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://static.first-id.fr/tcf/cookie.json" + }, + "1181": { + "id": 1181, + "name": "BotTalk UG (haftungsbeschränkt)", + "purposes": [ + 1, + 8, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 2592000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://bottalk.io/privacy", + "legIntClaim": "https://bottalk.io/privacy" + } + ], + "dataDeclaration": [ + 2 + ], + "deviceStorageDisclosureUrl": "https://bottalk.io/gvr.json" + }, + "1184": { + "id": 1184, + "name": "Schwarz Media GmbH ", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": 7776000, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 89, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "de", + "privacy": "https://gruppe.schwarz/datenschutz", + "legIntClaim": "https://gruppe.schwarz/datenschutz" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 8, + 9, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://dmp.theadex.com/.well-known/deviceStorage.json" + }, + "1187": { + "id": 1187, + "name": "AccountInsight Ltd", + "purposes": [], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": {}, + "specialPurposes": { + "1": 180, + "2": 365 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.accountinsight.ai/privacy-policy/", + "legIntClaim": "https://www.accountinsight.ai/privacy-policy/#IP_Processing" + } + ], + "dataDeclaration": [ + 1 + ], + "deviceStorageDisclosureUrl": "https://static.accountinsight.cloud/TCF/Device%20Storage%20Disclosure.json" + }, + "1195": { + "id": 1195, + "name": "Amplified IntelligenceTechnologies", + "purposes": [ + 7, + 9, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 7, + 9, + 10 + ], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 3650, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.amplifiedintelligence.com.au/privacy-policy/", + "legIntClaim": "https://www.amplifiedintelligence.com.au/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 8 + ], + "deviceStorageDisclosureUrl": "https://www.amplifiedintelligence.com.au/tcfv2.json" + }, + "1196": { + "id": 1196, + "name": "MEDIAWAYSS Sp. z o.o.", + "purposes": [ + 1, + 2, + 3, + 4, + 5, + 7, + 8 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 31449600, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 364, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://vidverto.io/privacy-policy/", + "legIntClaim": "https://vidverto.io/privacy-policy/#interest" + } + ], + "dataDeclaration": [ + 2, + 3, + 4, + 6, + 8, + 10, + 11 + ], + "deviceStorageDisclosureUrl": "https://ad.vidverto.io/delivery/iab_tcf_ds.json" + }, + "1199": { + "id": 1199, + "name": "Adsyield Inc", + "purposes": [ + 1, + 2, + 7, + 8, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 2 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 2, + "purposes": { + "2": 1, + "8": 1 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://adsyield.com/privacy-policy/", + "legIntClaim": "https://adsyield.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 4, + 6 + ], + "deviceStorageDisclosureUrl": "https://adsyield.com/sellers.json" + }, + "1201": { + "id": 1201, + "name": "hyScore.io GmbH", + "purposes": [ + 2, + 7, + 8, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://hyscore.io/data-privacy/" + } + ], + "dataDeclaration": [ + 8, + 9 + ], + "deviceStorageDisclosureUrl": "https://act.hyscore.io/tcf/tcf.json" + }, + "1202": { + "id": 1202, + "name": "Edge226 Ltd", + "purposes": [ + 2, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [ + 2, + 7, + 10 + ], + "specialPurposes": [ + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": { + "2": 90 + }, + "specialPurposes": { + "2": 1 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://edge226.com/privacy-policy/", + "legIntClaim": "https://edge226.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 8 + ], + "deviceStorageDisclosureUrl": "https://snatch.adjns.com/cdn_storage/tcf/tcf.json" + }, + "1204": { + "id": 1204, + "name": "fraud0 GmbH", + "purposes": [], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1 + ], + "features": [], + "specialFeatures": [], + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "purposes": {}, + "specialPurposes": { + "1": 730 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.fraud0.com/privacy-policy/", + "legIntClaim": "https://www.fraud0.com/privacy-policy/" + }, + { + "langId": "de", + "privacy": "https://www.fraud0.com/de/datenschutz/", + "legIntClaim": "https://www.fraud0.com/de/datenschutz/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 6 + ], + "deviceStorageDisclosureUrl": "https://api.fraud0.com/iab.json" + }, + "1207": { + "id": 1207, + "name": "Feeltapmedia Limited", + "purposes": [ + 1 + ], + "legIntPurposes": [ + 2 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [], + "features": [], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "purposes": { + "2": 90 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://feeltapmedia.com/Privacy-policy/", + "legIntClaim": "https://feeltapmedia.com/Privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3 + ], + "deviceStorageDisclosureUrl": "https://feeltapmedia.com/ftm.json" + }, + "1209": { + "id": 1209, + "name": "Memob Plus FZ LLC", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 9 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2 + ], + "specialFeatures": [ + 1 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://memob.com/privacy-policy/", + "legIntClaim": "https://memob.com/privacy-policy/" + } + ], + "dataDeclaration": [ + 1, + 2, + 3, + 4, + 6, + 7, + 9, + 10 + ], + "deviceStorageDisclosureUrl": "https://gdpr.memob.com/deviceStorage.json" + }, + "1210": { + "id": 1210, + "name": "ADNOW I RENODO MEDIA LTD", + "purposes": [ + 1, + 2 + ], + "legIntPurposes": [ + 7, + 8, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "overflow": { + "httpGetLimit": 128 + }, + "cookieMaxAgeSeconds": 1209600, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 30, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://adnow.com/privacy-policy", + "legIntClaim": "https://adnow.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 8 + ], + "deviceStorageDisclosureUrl": "https://adnow.com/vdsod.json" + }, + "1212": { + "id": 1212, + "name": "Ads Interactive Ltd.", + "purposes": [ + 1, + 2, + 3, + 4, + 7, + 10 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": 4838400, + "usesCookies": true, + "cookieRefresh": false, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 60, + "purposes": {}, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://adsinteractive.com/privacy-policy", + "legIntClaim": "https://adsinteractive.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://adsinteractive.com/vendor.json" + }, + "1214": { + "id": 1214, + "name": "Kamino Retail", + "purposes": [ + 1, + 3, + 4 + ], + "legIntPurposes": [ + 2, + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [], + "cookieMaxAgeSeconds": 365, + "usesCookies": true, + "cookieRefresh": true, + "usesNonCookieAccess": false, + "dataRetention": { + "stdRetention": 365, + "purposes": {}, + "specialPurposes": { + "2": 0 + } + }, + "urls": [ + { + "langId": "en", + "privacy": "https://www.kaminoretail.com/privacy-policy", + "legIntClaim": "https://www.kaminoretail.com/privacy-policy" + } + ], + "dataDeclaration": [ + 1, + 2, + 5, + 6, + 8, + 11 + ], + "deviceStorageDisclosureUrl": "https://privacy.kaminoretail.io/privacy/kaminoretaildevicesstoragedisclosures.json" + }, + "1218": { + "id": 1218, + "name": "AIDEM Technologies LTD", + "purposes": [ + 1, + 2, + 7, + 10, + 11 + ], + "legIntPurposes": [], + "flexiblePurposes": [], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [], + "overflow": { + "httpGetLimit": 32 + }, + "cookieMaxAgeSeconds": null, + "usesCookies": false, + "cookieRefresh": false, + "usesNonCookieAccess": true, + "dataRetention": { + "stdRetention": 90, + "purposes": { + "7": 30, + "11": 0 + }, + "specialPurposes": {} + }, + "urls": [ + { + "langId": "en", + "privacy": "https://kb.aidem.com/privacy/policies/privacy-policy/", + "legIntClaim": "https://kb.aidem.com/privacy/policies/privacy-policy/#4-how-we-use-your-data" + } + ], + "dataDeclaration": [ + 1, + 2, + 6, + 11 + ], + "deviceStorageDisclosureUrl": "https://www.aidem.com/tcf.json" + } + } +} \ No newline at end of file diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index 35fda85f..a1ac55d1 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.0.11-SNAPSHOT + 3.1.1-SNAPSHOT iabgpp-extras @@ -18,13 +18,6 @@ maven-surefire-plugin 2.22.2 - - - org.junit.platform - junit-platform-surefire-provider - 1.3.2 - - diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/cmp/Cmp.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/cmp/Cmp.java index 3aacf32a..ed0e6615 100644 --- a/iabgpp-extras/src/main/java/com/iab/gpp/extras/cmp/Cmp.java +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/cmp/Cmp.java @@ -25,38 +25,39 @@ public interface Cmp { - /** - * A CMP id: a numeric ID which is incrementally assigned and never re-used – inactive CMPs are marked as deleted - * - * @return CMP id - */ - int getId(); - - /** - * Name of the CMP - * - * @return CMP name - */ - String getName(); - - /** - * Whether or not the CMP is a commercial service - * - * @return true, if the CMP is available as a commercial service - */ - boolean isCommercial(); - - /** - * If available, the date/time after which CMP is considered inactive - * - * @return {@link Optional} time after which CMP is inactive - */ - Optional getDeletedDate(); - - /** - * Check whether the CMP is deleted - * - * @return true, if the CMP is considered deleted - */ - boolean isDeleted(); + /** + * A CMP id: a numeric ID which is incrementally assigned and never re-used – inactive CMPs are + * marked as deleted + * + * @return CMP id + */ + int getId(); + + /** + * Name of the CMP + * + * @return CMP name + */ + String getName(); + + /** + * Whether or not the CMP is a commercial service + * + * @return true, if the CMP is available as a commercial service + */ + boolean isCommercial(); + + /** + * If available, the date/time after which CMP is considered inactive + * + * @return {@link Optional} time after which CMP is inactive + */ + Optional getDeletedDate(); + + /** + * Check whether the CMP is deleted + * + * @return true, if the CMP is considered deleted + */ + boolean isDeleted(); } diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/cmp/CmpList.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/cmp/CmpList.java index 5b62d386..5f3c3d4a 100644 --- a/iabgpp-extras/src/main/java/com/iab/gpp/extras/cmp/CmpList.java +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/cmp/CmpList.java @@ -25,26 +25,26 @@ public interface CmpList { - /** - * Last Updated Date - * - * @return {@link Instant} time when the record was last updated - */ - Instant getLastUpdated(); + /** + * Last Updated Date + * + * @return {@link Instant} time when the record was last updated + */ + Instant getLastUpdated(); - /** - * List of CMPs - * - * @return {@link List} of {@link Cmp} objects - */ - List getCmps(); + /** + * List of CMPs + * + * @return {@link List} of {@link Cmp} objects + */ + List getCmps(); - /** - * Get the CMP object for a give CMP id - * - * @param cmpId CMP id - * @return {@link Cmp} object - */ - Cmp getCmp(int cmpId); + /** + * Get the CMP object for a give CMP id + * + * @param cmpId CMP id + * @return {@link Cmp} object + */ + Cmp getCmp(int cmpId); } diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/DataCategory.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/DataCategory.java new file mode 100644 index 00000000..e7e62cc3 --- /dev/null +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/DataCategory.java @@ -0,0 +1,29 @@ +package com.iab.gpp.extras.gvl; + +/* + * DataCategory + */ +public interface DataCategory { + + /** + * id + * + * @return id + */ + Integer getId(); + + /** + * name + * + * @return name + */ + String getName(); + + /** + * description + * + * @return description + */ + String getDescription(); + +} diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/DataRetention.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/DataRetention.java new file mode 100644 index 00000000..12615dfa --- /dev/null +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/DataRetention.java @@ -0,0 +1,53 @@ +package com.iab.gpp.extras.gvl; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/*- + * #%L + * IAB TCF Java GVL and CMP List + * %% + * Copyright (C) 2020 IAB Technology Laboratory, Inc + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +/* + * DataRetention + */ +public interface DataRetention { + + /** + * stdRetention + * + * @return stdRetention + */ + Optional getStdRetention(); + + /** + * purposes + * + * @return purposes + */ + Map getPurposes(); + + /** + * specialPurposes + * + * @return specialPurposes + */ + Map getSpecialPurposes(); + +} diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Feature.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Feature.java index e6f330f4..946fa856 100644 --- a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Feature.java +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Feature.java @@ -1,5 +1,8 @@ package com.iab.gpp.extras.gvl; +import java.util.List; +import java.util.Optional; + /*- * #%L * IAB TCF Java GVL and CMP List @@ -25,31 +28,38 @@ */ public interface Feature { - /** - * A feature id - * - * @return feature id - */ - int getId(); - - /** - * Name of the feature - * - * @return feature name string - */ - String getName(); - - /** - * Description of the feature - * - * @return feature description string - */ - String getDescription(); - - /** - * Legal description of the feature - * - * @return legal description string - */ - String getDescriptionLegal(); + /** + * A feature id + * + * @return feature id + */ + int getId(); + + /** + * Name of the feature + * + * @return feature name string + */ + String getName(); + + /** + * Description of the feature + * + * @return feature description string + */ + String getDescription(); + + /** + * Legal description of the feature + * + * @return legal description string + */ + Optional getDescriptionLegal(); + + /** + * A list of illustrations + * + * @return A {@link List} of strings + */ + Optional> getIllustrations(); } diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Gvl.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Gvl.java index 29d29df4..a1a6e545 100644 --- a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Gvl.java +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Gvl.java @@ -22,84 +22,93 @@ import java.time.Instant; import java.util.List; +import java.util.Optional; public interface Gvl { - /** - * A Global Vendor List Specification Version - * - * @return global vendor list specification version - */ - int getGvlSpecificationVersion(); + /** + * A Global Vendor List Specification Version + * + * @return global vendor list specification version + */ + int getGvlSpecificationVersion(); - /** - * A Global Vendor List version incremented with each published file change - * - * @return global vendor list version - */ - int getVendorListVersion(); + /** + * A Global Vendor List version incremented with each published file change + * + * @return global vendor list version + */ + int getVendorListVersion(); - /** - * A TCF Policy Version. - * - * @return tcf policy version - */ - int getTcfPolicyVersion(); + /** + * A TCF Policy Version. + * + * @return tcf policy version + */ + int getTcfPolicyVersion(); - /** - * Last Updated Date - * - * @return timestamp when the record was last updated - */ - Instant getLastUpdated(); + /** + * Last Updated Date + * + * @return timestamp when the record was last updated + */ + Instant getLastUpdated(); - /** - * A list of standard purposes - * - * @return A {@link List} of standard {@link Purpose} objects - */ - List getPurposes(); + /** + * A list of standard purposes + * + * @return A {@link List} of standard {@link Purpose} objects + */ + List getPurposes(); - /** - * A list of special purposes - * - * @return A {@link List} of {@link SpecialPurpose} objects - */ - List getSpecialPurposes(); + /** + * A list of special purposes + * + * @return A {@link List} of {@link SpecialPurpose} objects + */ + List getSpecialPurposes(); - /** - * A list of standard features - * - * @return A {@link List} of standard {@link Feature} objects - */ - List getFeatures(); + /** + * A list of standard features + * + * @return A {@link List} of standard {@link Feature} objects + */ + List getFeatures(); - /** - * A list of special features - * - * @return A {@link List} of special {@link SpecialFeature} objects - */ - List getSpecialFeatures(); + /** + * A list of special features + * + * @return A {@link List} of special {@link SpecialFeature} objects + */ + List getSpecialFeatures(); - /** - * A list of stacks - * - * @return A {@link List} of {@link Stack} objects - */ - List getStacks(); + /** + * A list of stacks + * + * @return A {@link List} of {@link Stack} objects + */ + List getStacks(); - /** - * A list of vendors - * - * @return A {@link List} of {@link Vendor} objects - */ - List getVendors(); + /** + * A list of vendors + * + * @return A {@link List} of {@link Vendor} objects + */ + List getVendors(); - /** - * Return the vendor object for a given id - * - * @param vendorId vendor id - * @return A {@link Vendor} object - */ - Vendor getVendor(int vendorId); + /** + * Return the vendor object for a given id + * + * @param vendorId vendor id + * @return A {@link Vendor} object + */ + Vendor getVendor(int vendorId); + + /** + * A list of data categories + * @since 3.0 + * + * @return A {@link List} of {@link DataCategory} objects + */ + Optional> getDataCategories(); } diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Overflow.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Overflow.java index 74c1a0b7..12a74b0e 100644 --- a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Overflow.java +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Overflow.java @@ -23,10 +23,10 @@ public interface Overflow { - /** - * The vendor's http GET request length limit; 32 or 128 are the only supported options - * - * @return vendor's http GET request length limit - */ - int getHttpGetLimit(); + /** + * The vendor's http GET request length limit; 32 or 128 are the only supported options + * + * @return vendor's http GET request length limit + */ + int getHttpGetLimit(); } diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Purpose.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Purpose.java index 1b7fba69..ec5b214e 100644 --- a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Purpose.java +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Purpose.java @@ -1,5 +1,8 @@ package com.iab.gpp.extras.gvl; +import java.util.List; +import java.util.Optional; + /*- * #%L * IAB TCF Java GVL and CMP List @@ -25,47 +28,54 @@ */ public interface Purpose { - /** - * A purpose id - * - * @return purpose id - */ - int getId(); + /** + * A purpose id + * + * @return purpose id + */ + int getId(); + + /** + * Name of the purpose + * + * @return purpose name string + */ + String getName(); - /** - * Name of the purpose - * - * @return purpose name string - */ - String getName(); + /** + * Description of the purpose + * + * @return purpose description string + */ + String getDescription(); - /** - * Description of the purpose - * - * @return purpose description string - */ - String getDescription(); + /** + * Legal description of the purpose + * @deprecated since 3.0 + * @return legal description string + */ + Optional getDescriptionLegal(); - /** - * Legal description of the purpose - * - * @return legal description string - */ - String getDescriptionLegal(); + /** + * A list of illustrations + * @since 3.0 + * @return A {@link List} of strings + */ + Optional> getIllustrations(); - /** - * An optional flag where false means CMPs should never afford users the means to provide an - * opt-in consent choice - * - * @return consentable boolean - */ - boolean getConsentable(); + /** + * An optional flag where false means CMPs should never afford users the means to provide an opt-in + * consent choice + * + * @return consentable boolean + */ + boolean getConsentable(); - /** - * An optional flag where false means CMPs should never afford users the means to exercise a - * right to object - * - * @return consentable boolean - */ - boolean getRightToObject(); + /** + * An optional flag where false means CMPs should never afford users the means to exercise a right + * to object + * + * @return consentable boolean + */ + boolean getRightToObject(); } diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Stack.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Stack.java index e8c56df4..86c54421 100644 --- a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Stack.java +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Stack.java @@ -28,38 +28,38 @@ */ public interface Stack { - /** - * Stack id - * - * @return stack id - */ - int getId(); + /** + * Stack id + * + * @return stack id + */ + int getId(); - /** - * A list of special features - * - * @return A {@link List} of special feature ids - */ - List getSpecialFeatures(); + /** + * A list of special features + * + * @return A {@link List} of special feature ids + */ + List getSpecialFeatures(); - /** - * A list of purposes - * - * @return A {@link List} of purpose ids - */ - List getPurposes(); + /** + * A list of purposes + * + * @return A {@link List} of purpose ids + */ + List getPurposes(); - /** - * Name of the stack - * - * @return stack name string - */ - String getName(); + /** + * Name of the stack + * + * @return stack name string + */ + String getName(); - /** - * Description of the stack - * - * @return stack description string - */ - String getDescription(); + /** + * Description of the stack + * + * @return stack description string + */ + String getDescription(); } diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Vendor.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Vendor.java index 8889d3c2..dc2833f6 100644 --- a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Vendor.java +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Vendor.java @@ -26,136 +26,163 @@ public interface Vendor { - /** - * A vendor id: a numeric ID which is incrementally assigned and never re-used – deleted Vendors - * are just marked as deleted - * - * @return vendor id - */ - int getId(); - - /** - * Name of the vendor - * - * @return vendor name - */ - String getName(); - - /** - * List of Purposes for which the vendor is requesting consent - * - * @return A {@link List} of purpose ids that require consent - */ - List getPurposes(); - - /** - * List of Purposes for which the vendor requires to be transparently disclosed as their - * legitimate interest - * - * @return A {@link List} of purpose ids disclosed as legitimate interests - */ - List getLegIntPurposes(); - - /** - * List of purposes where the vendor is flexible regarding the legal basis; they will perform - * the processing based on consent or a legitimate interest. The 'default' is determined by - * which of the other two mutually-exclusive purpose fields is used to declare the purpose for - * the vendor - * - * @return A {@link List} of flexible purpose ids - */ - List getFlexiblePurposes(); - - /** - * List of Special Purposes that the vendor transparently discloses as their legitimate interest - * that a user has no right to object - * - * @return A {@link List} of special purpose ids - */ - List getSpecialPurposes(); - - /** - * List of Features the vendor uses across Purposes - * - * @return A {@link List} of features - */ - List getFeatures(); - - /** - * List of Special Features the vendor uses across Purposes - * - * @return A {@link List} of special features - */ - List getSpecialFeatures(); - - /** - * GDPR/privacy policy page URL - * - * @return policy url string - */ - String getPolicyUrl(); - - /** - * If available, a date/time after which the vendor is deleted from the GVL - * - * @return {@link Optional} time after which the vendor is considered deleted - */ - Optional getDeletedDate(); - - /** - * object specifying the vendor's http GET request length limit. It is optional. If a vendor - * entry does not include this attribute then the vendor has no overflow options and none can be - * inferred. - * - * @return A {@link Overflow} object - */ - Optional getOverflow(); - - /** - * Check if the vendor is deleted based on the current time (UTC) - * - * @return true, if the vendor is deleted - */ - boolean isDeleted(); - - /** - * The number of seconds representing the longest potential duration for cookie storage on a device. - * If a Vendor uses multiple cookies with differing durations, cookieMaxAgeSeconds represents the cookie with - * the longest duration. Note: cookies are the only method of storage or device access that permit a predictable - * duration to be set. - * This is required only if usesCookies is set to true, else optional - * @return The number, in seconds, of the longest potential duration for storage on a device, as set when using - * the cookie method of storage. A negative number or a 0 indicate session storage similar to the Set-Cookie spec. - * A "-100" value no longer indicates no cookie usage. - * Note: this only includes what is declared when the storage is set and does not consider duration extensions - * should storage be refreshed - */ - Optional getCookieMaxAgeSeconds(); - - /** - * This boolean field indicates whether the vendor uses cookie storage (session or otherwise). - * @return True indicates cookie storage is used - */ - boolean getUsesCookies(); - - /** - * This true or false field indicates whether any cookies in scope for cookieMaxAgeSeconds are refreshed after - * being initially set. - * @return True indicates the vendor refreshes this cookie - */ - boolean getHasCookieRefresh(); - - /** - * This boolean field indicates whether the vendor uses other, non-cookie methods of storage or accessing - * information already stored on a user’s device. Examples of non-cookie storage and access may be localStorage, - * indexDB, mobile ad IDs, etc. - * @return True indicates non-cookie access is used - */ - boolean getUsesNonCookieAccess(); - - /** - * Link to a recommended, vendor-hosted, secure URL for disclosing additional storage information - * @return Location of vendor-hosted deviceStorage.json file - */ - Optional getDeviceStorageDisclosureUrl(); + /** + * A vendor id: a numeric ID which is incrementally assigned and never re-used – deleted Vendors are + * just marked as deleted + * + * @return vendor id + */ + int getId(); + + /** + * Name of the vendor + * + * @return vendor name + */ + String getName(); + + /** + * List of Purposes for which the vendor is requesting consent + * + * @return A {@link List} of purpose ids that require consent + */ + List getPurposes(); + + /** + * List of Purposes for which the vendor requires to be transparently disclosed as their legitimate + * interest + * + * @return A {@link List} of purpose ids disclosed as legitimate interests + */ + List getLegIntPurposes(); + + /** + * List of purposes where the vendor is flexible regarding the legal basis; they will perform the + * processing based on consent or a legitimate interest. The 'default' is determined by which of the + * other two mutually-exclusive purpose fields is used to declare the purpose for the vendor + * + * @return A {@link List} of flexible purpose ids + */ + List getFlexiblePurposes(); + + /** + * List of Special Purposes that the vendor transparently discloses as their legitimate interest + * that a user has no right to object + * + * @return A {@link List} of special purpose ids + */ + List getSpecialPurposes(); + + /** + * List of Features the vendor uses across Purposes + * + * @return A {@link List} of features + */ + List getFeatures(); + + /** + * List of Special Features the vendor uses across Purposes + * + * @return A {@link List} of special features + */ + List getSpecialFeatures(); + + /** + * GDPR/privacy policy page URL + * @deprecated since 3.0 + * @return policy url string + */ + Optional getPolicyUrl(); + + /** + * If available, a date/time after which the vendor is deleted from the GVL + * + * @return {@link Optional} time after which the vendor is considered deleted + */ + Optional getDeletedDate(); + + /** + * object specifying the vendor's http GET request length limit. It is optional. If a vendor entry + * does not include this attribute then the vendor has no overflow options and none can be inferred. + * + * @return A {@link Overflow} object + */ + Optional getOverflow(); + + /** + * Check if the vendor is deleted based on the current time (UTC) + * + * @return true, if the vendor is deleted + */ + boolean isDeleted(); + + /** + * The number of seconds representing the longest potential duration for cookie storage on a device. + * If a Vendor uses multiple cookies with differing durations, cookieMaxAgeSeconds represents the + * cookie with the longest duration. Note: cookies are the only method of storage or device access + * that permit a predictable duration to be set. This is required only if usesCookies is set to + * true, else optional + * + * @return The number, in seconds, of the longest potential duration for storage on a device, as set + * when using the cookie method of storage. A negative number or a 0 indicate session + * storage similar to the Set-Cookie spec. A "-100" value no longer indicates no cookie + * usage. Note: this only includes what is declared when the storage is set and does not + * consider duration extensions should storage be refreshed + */ + Optional getCookieMaxAgeSeconds(); + + /** + * This boolean field indicates whether the vendor uses cookie storage (session or otherwise). + * + * @return True indicates cookie storage is used + */ + Optional getUsesCookies(); + + /** + * This true or false field indicates whether any cookies in scope for cookieMaxAgeSeconds are + * refreshed after being initially set. + * + * @return True indicates the vendor refreshes this cookie + */ + Optional getCookieRefresh(); + + /** + * This boolean field indicates whether the vendor uses other, non-cookie methods of storage or + * accessing information already stored on a user’s device. Examples of non-cookie storage and + * access may be localStorage, indexDB, mobile ad IDs, etc. + * + * @return True indicates non-cookie access is used + */ + Optional getUsesNonCookieAccess(); + + /** + * Link to a recommended, vendor-hosted, secure URL for disclosing additional storage information + * + * @return Location of vendor-hosted deviceStorage.json file + */ + Optional getDeviceStorageDisclosureUrl(); + + /** + * This object indicates how long vendors retain user's data for each declared purpose + * @since 3.0 + * + * @return {@link DataRetention} object + */ + Optional getDataRetention(); + + /** + * This list indicates unique urls to privacy policies by language and link to an + * explanation of their legitimate interests at stake + * @since 3.0 + * @return A {@link List} of {@link VendorUrl} objects + */ + Optional> getUrls(); + + /** + * This list of integers indicates data categories {@link DataCategory} that vendors collect and process + * @since 3.0 + * + * @return A {@link List} of integers + */ + Optional> getDataDeclaration(); } diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/VendorUrl.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/VendorUrl.java new file mode 100644 index 00000000..7a495de7 --- /dev/null +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/VendorUrl.java @@ -0,0 +1,51 @@ +package com.iab.gpp.extras.gvl; + +import java.util.Optional; + +/*- + * #%L + * IAB TCF Java GVL and CMP List + * %% + * Copyright (C) 2020 IAB Technology Laboratory, Inc + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +/* + * VendorUrl + */ +public interface VendorUrl { + + /** + * langId + * + * @return lang id + */ + String getLangId(); + + /** + * privacy + * + * @return privacy + */ + String getPrivacy(); + + /** + * legIntClaim + * + * @return legIntClaim + */ + Optional getLegIntClaim(); + +} diff --git a/pom.xml b/pom.xml index bad74e4c..f0fce412 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.0.11-SNAPSHOT + 3.1.1-SNAPSHOT IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From b539634fc0a8ab78c6dc56c5c1ceea558e05ef6e Mon Sep 17 00:00:00 2001 From: chuff Date: Thu, 14 Sep 2023 07:27:20 -0600 Subject: [PATCH 17/41] rename missed multistate usp* methods to us* (#35) Co-authored-by: chad --- .../src/main/java/com/iab/gpp/encoder/GppModel.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index 626fb82a..9877500a 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -160,27 +160,27 @@ public UspV1 getUspV1Section() { return (UspV1) getSection(UspV1.NAME); } - public UsNatV1 getUspNatV1Section() { + public UsNatV1 getUsNatV1Section() { return (UsNatV1) getSection(UsNatV1.NAME); } - public UsCaV1 getUspCaV1Section() { + public UsCaV1 getUsCaV1Section() { return (UsCaV1) getSection(UsCaV1.NAME); } - public UsVaV1 getUspVaV1Section() { + public UsVaV1 getUsVaV1Section() { return (UsVaV1) getSection(UsVaV1.NAME); } - public UsCoV1 getUspCoV1Section() { + public UsCoV1 getUsCoV1Section() { return (UsCoV1) getSection(UsCoV1.NAME); } - public UsUtV1 getUspUtV1Section() { + public UsUtV1 getUsUtV1Section() { return (UsUtV1) getSection(UsUtV1.NAME); } - public UsCtV1 getUspCtV1Section() { + public UsCtV1 getUsCtV1Section() { return (UsCtV1) getSection(UsCtV1.NAME); } From cafab6a8e9885fa5f57b1b8b4c5bf206b2c4462f Mon Sep 17 00:00:00 2001 From: Srinivas Bhagavatula Date: Thu, 14 Sep 2023 09:27:36 -0400 Subject: [PATCH 18/41] Adding a new field in Vendor for "impConsPurposes" as the GVL for Canada has changed to include this field in the place of "legIntPurposes". (#37) Both these fields will be set to Optional in order to handle both Canada and EU use cases. Co-authored-by: srini81 --- .../iab/gpp/extras/jackson/gvl/Vendor.java | 15 +- .../gpp/extras/jackson/gvl/GvlCanadaTest.java | 104 + .../iab/gpp/extras/jackson/gvl/GvlV2Test.java | 3 +- .../iab/gpp/extras/jackson/gvl/GvlV3Test.java | 6 +- .../vendorlist/v2/ca/vendor-list.json | 2070 +++++++++++++++++ .../java/com/iab/gpp/extras/gvl/Purpose.java | 1 - .../java/com/iab/gpp/extras/gvl/Vendor.java | 10 +- 7 files changed, 2202 insertions(+), 7 deletions(-) create mode 100644 iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlCanadaTest.java create mode 100644 iabgpp-extras-jackson/src/test/resources/vendorlist/v2/ca/vendor-list.json diff --git a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Vendor.java b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Vendor.java index 60946b5e..de55cfee 100644 --- a/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Vendor.java +++ b/iabgpp-extras-jackson/src/main/java/com/iab/gpp/extras/jackson/gvl/Vendor.java @@ -33,6 +33,7 @@ public class Vendor implements com.iab.gpp.extras.gvl.Vendor { private String name; private List purposes; private List legIntPurposes; + private List impConsPurposes; private List flexiblePurposes; private List specialPurposes; private List features; @@ -87,8 +88,18 @@ public List getPurposes() { * @return A {@link List} of purpose ids disclosed as legitimate interests */ @Override - public List getLegIntPurposes() { - return legIntPurposes; + public Optional> getLegIntPurposes() { + return Optional.ofNullable(legIntPurposes); + } + + /** + * List of Purposes for which the vendor requires to be transparently disclosed as implied Consent + * + * @return A {@link List} of purpose ids disclosed as legitimate interests + */ + @Override + public Optional> getImpConsPurposes() { + return Optional.ofNullable(impConsPurposes); } /** diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlCanadaTest.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlCanadaTest.java new file mode 100644 index 00000000..8f665014 --- /dev/null +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlCanadaTest.java @@ -0,0 +1,104 @@ +package com.iab.gpp.extras.jackson.gvl; + +import com.iab.gpp.extras.gvl.Gvl; +import com.iab.gpp.extras.jackson.Loader; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; + +public class GvlCanadaTest { + @Test + public void test() throws IOException { + Gvl gvl = new Loader() + .globalVendorList(GvlV2Test.class.getClassLoader().getResourceAsStream("vendorlist/v2/ca/vendor-list.json")); + Assertions.assertFalse(gvl.getDataCategories().isPresent()); + Assertions.assertEquals(3, gvl.getFeatures().size()); + Assertions.assertEquals(2, gvl.getGvlSpecificationVersion()); + Assertions.assertNotNull(gvl.getLastUpdated()); + Assertions.assertEquals(10, gvl.getPurposes().size()); + Assertions.assertEquals(2, gvl.getSpecialFeatures().size()); + Assertions.assertEquals(2, gvl.getSpecialPurposes().size()); + Assertions.assertEquals(42, gvl.getStacks().size()); + Assertions.assertEquals(2, gvl.getTcfPolicyVersion()); + Assertions.assertEquals(45, gvl.getVendorListVersion()); + Assertions.assertEquals(36, gvl.getVendors().size()); + + Assertions.assertEquals(1, gvl.getPurposes().get(0).getId()); + Assertions.assertEquals("Store and/or access information on a device", gvl.getPurposes().get(0).getName()); + Assertions.assertEquals( + "Cookies, device identifiers, or other information can be stored or accessed on your device for the purposes presented to you.", + gvl.getPurposes().get(0).getDescription()); + Assertions.assertTrue(gvl.getPurposes().get(0).getDescriptionLegal().isPresent()); + Assertions.assertEquals( + "Vendors can:\n* Store and access information on the device such as cookies and device identifiers presented to a user.", + gvl.getPurposes().get(0).getDescriptionLegal().get()); + Assertions.assertFalse(gvl.getPurposes().get(0).getIllustrations().isPresent()); + + Assertions.assertEquals(1, gvl.getSpecialPurposes().get(0).getId()); + Assertions.assertEquals("Ensure security, prevent fraud, and debug", gvl.getSpecialPurposes().get(0).getName()); + Assertions.assertEquals( + "Your data can be used to monitor for and prevent fraudulent activity, and ensure systems and processes work properly and securely.", + gvl.getSpecialPurposes().get(0).getDescription()); + Assertions.assertTrue(gvl.getSpecialPurposes().get(0).getDescriptionLegal().isPresent()); + Assertions.assertEquals( + "To ensure security, prevent fraud and debug vendors can:\n* Ensure data are securely transmitted\n* Detect and prevent malicious, fraudulent, invalid, or illegal activity.\n* Ensure correct and efficient operation of systems and processes, including to monitor and enhance the performance of systems and processes engaged in permitted purposes\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose.\nNote: Data collected and used to ensure security, prevent fraud, and debug may include automatically-sent device characteristics for identification, precise geolocation data, and data obtained by actively scanning device characteristics for identification without separate disclosure and/or opt-in.", + gvl.getSpecialPurposes().get(0).getDescriptionLegal().get()); + Assertions.assertFalse(gvl.getSpecialPurposes().get(0).getIllustrations().isPresent()); + + Assertions.assertEquals(1, gvl.getFeatures().get(0).getId()); + Assertions.assertEquals("Match and combine offline data sources", gvl.getFeatures().get(0).getName()); + Assertions.assertEquals( + "Data from offline data sources can be combined with your online activity in support of one or more purposes", + gvl.getFeatures().get(0).getDescription()); + Assertions.assertTrue(gvl.getFeatures().get(0).getDescriptionLegal().isPresent()); + Assertions.assertEquals( + "Vendors can:\n* Combine data obtained offline with data collected online in support of one or more Purposes or Special Purposes.", + gvl.getFeatures().get(0).getDescriptionLegal().get()); + Assertions.assertFalse(gvl.getFeatures().get(0).getIllustrations().isPresent()); + + Assertions.assertEquals(1, gvl.getSpecialFeatures().get(0).getId()); + Assertions.assertEquals("Use precise geolocation data", gvl.getSpecialFeatures().get(0).getName()); + Assertions.assertEquals( + "Your precise geolocation data can be used in support of one or more purposes. This means your location can be accurate to within several meters.", + gvl.getSpecialFeatures().get(0).getDescription()); + Assertions.assertTrue(gvl.getSpecialFeatures().get(0).getDescriptionLegal().isPresent()); + Assertions.assertEquals( + "Vendors can:\n* Collect and process precise geolocation data in support of one or more purposes.\nN.B. Precise geolocation means that there are no restrictions on the precision of a user’s location; this can be accurate to within several meters.", + gvl.getSpecialFeatures().get(0).getDescriptionLegal().get()); + Assertions.assertFalse(gvl.getSpecialFeatures().get(0).getIllustrations().isPresent()); + + Assertions.assertEquals(1, gvl.getStacks().get(0).getId()); + Assertions.assertEquals("Precise geolocation data, and identification through device scanning", gvl.getStacks().get(0).getName()); + Assertions.assertEquals("Precise geolocation and information about device characteristics can be used.", gvl.getStacks().get(0).getDescription()); + Assertions.assertTrue(gvl.getStacks().get(0).getPurposes().isEmpty()); + Assertions.assertEquals(Arrays.asList(1, 2), gvl.getStacks().get(0).getSpecialFeatures()); + + Assertions.assertEquals(2, gvl.getStacks().get(1).getId()); + Assertions.assertEquals("Basic ads, and ad measurement", gvl.getStacks().get(1).getName()); + Assertions.assertEquals("Basic ads can be served. Ad performance can be measured.", gvl.getStacks().get(1).getDescription()); + Assertions.assertEquals(Arrays.asList(2, 7), gvl.getStacks().get(1).getPurposes()); + Assertions.assertTrue(gvl.getStacks().get(1).getSpecialFeatures().isEmpty()); + + Assertions.assertEquals(10, gvl.getVendors().get(0).getId()); + Assertions.assertFalse(gvl.getVendors().get(0).getDeletedDate().isPresent()); + Assertions.assertEquals("Index Exchange Inc. ", gvl.getVendors().get(0).getName()); + Assertions.assertEquals(Arrays.asList(2, 7), gvl.getVendors().get(0).getPurposes()); + Assertions.assertFalse(gvl.getVendors().get(0).getLegIntPurposes().isPresent()); + Assertions.assertTrue(gvl.getVendors().get(0).getImpConsPurposes().isPresent()); + Assertions.assertEquals(Collections.emptyList(), gvl.getVendors().get(0).getImpConsPurposes().get()); + Assertions.assertEquals(Arrays.asList(2, 7), gvl.getVendors().get(0).getFlexiblePurposes()); + Assertions.assertEquals(Arrays.asList(1, 2), gvl.getVendors().get(0).getSpecialPurposes()); + Assertions.assertEquals(Collections.singletonList(3), gvl.getVendors().get(0).getFeatures()); + Assertions.assertEquals(Collections.singletonList(1), gvl.getVendors().get(0).getSpecialFeatures()); + Assertions.assertTrue(gvl.getVendors().get(0).getUrls().isPresent()); + Assertions.assertEquals("https://www.indexexchange.com/privacy/", + gvl.getVendors().get(0).getUrls().get().get(0).getPrivacy()); + Assertions.assertEquals("en", + gvl.getVendors().get(0).getUrls().get().get(0).getLangId()); + Assertions.assertEquals(52, gvl.getVendors().get(1).getId()); + Assertions.assertFalse(gvl.getVendors().get(1).getDeletedDate().isPresent()); + } +} diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV2Test.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV2Test.java index de0531e0..04ba44c9 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV2Test.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV2Test.java @@ -106,7 +106,8 @@ public void test() throws IOException { Assertions.assertFalse(gvl.getVendors().get(0).getDeletedDate().isPresent()); Assertions.assertEquals("Emerse Sverige AB", gvl.getVendors().get(0).getName()); Assertions.assertEquals(Arrays.asList(1, 3, 4), gvl.getVendors().get(0).getPurposes()); - Assertions.assertEquals(Arrays.asList(2, 7, 8, 9), gvl.getVendors().get(0).getLegIntPurposes()); + Assertions.assertTrue(gvl.getVendors().get(0).getLegIntPurposes().isPresent()); + Assertions.assertEquals(Arrays.asList(2, 7, 8, 9), gvl.getVendors().get(0).getLegIntPurposes().get()); Assertions.assertEquals(Arrays.asList(2, 9), gvl.getVendors().get(0).getFlexiblePurposes()); Assertions.assertEquals(Arrays.asList(1, 2), gvl.getVendors().get(0).getSpecialPurposes()); Assertions.assertEquals(Arrays.asList(1, 2), gvl.getVendors().get(0).getFeatures()); diff --git a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV3Test.java b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV3Test.java index ef880d26..e27831f1 100644 --- a/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV3Test.java +++ b/iabgpp-extras-jackson/src/test/java/com/iab/gpp/extras/jackson/gvl/GvlV3Test.java @@ -95,7 +95,8 @@ public void test() throws IOException { Assertions.assertFalse(gvl.getVendors().get(0).getDeletedDate().isPresent()); Assertions.assertEquals("Exponential Interactive, Inc d/b/a VDX.tv", gvl.getVendors().get(0).getName()); Assertions.assertEquals(Arrays.asList(1, 2, 3, 4, 7, 8, 9, 10), gvl.getVendors().get(0).getPurposes()); - Assertions.assertEquals(Collections.emptyList(), gvl.getVendors().get(0).getLegIntPurposes()); + Assertions.assertTrue(gvl.getVendors().get(0).getLegIntPurposes().isPresent()); + Assertions.assertEquals(Collections.emptyList(), gvl.getVendors().get(0).getLegIntPurposes().get()); Assertions.assertEquals(Arrays.asList(7, 8, 9, 10), gvl.getVendors().get(0).getFlexiblePurposes()); Assertions.assertEquals(Arrays.asList(1, 2), gvl.getVendors().get(0).getSpecialPurposes()); Assertions.assertEquals(Arrays.asList(1, 2, 3), gvl.getVendors().get(0).getFeatures()); @@ -129,7 +130,8 @@ public void test() throws IOException { Assertions.assertFalse(gvl.getVendors().get(4).getDeletedDate().isPresent()); Assertions.assertEquals("BeeswaxIO Corporation", gvl.getVendors().get(4).getName()); Assertions.assertEquals(Arrays.asList(1, 2, 3, 4, 7), gvl.getVendors().get(4).getPurposes()); - Assertions.assertEquals(Collections.emptyList(), gvl.getVendors().get(4).getLegIntPurposes()); + Assertions.assertTrue(gvl.getVendors().get(4).getLegIntPurposes().isPresent()); + Assertions.assertEquals(Collections.emptyList(), gvl.getVendors().get(4).getLegIntPurposes().get()); Assertions.assertEquals(Collections.emptyList(), gvl.getVendors().get(4).getFlexiblePurposes()); Assertions.assertEquals(Arrays.asList(1, 2), gvl.getVendors().get(4).getSpecialPurposes()); Assertions.assertEquals(Arrays.asList(1, 3), gvl.getVendors().get(4).getFeatures()); diff --git a/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/ca/vendor-list.json b/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/ca/vendor-list.json new file mode 100644 index 00000000..bb4840a2 --- /dev/null +++ b/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/ca/vendor-list.json @@ -0,0 +1,2070 @@ +{ + "gvlSpecificationVersion": 2, + "vendorListVersion": 45, + "tcfPolicyVersion": 2, + "lastUpdated": "2023-09-07T16:00:27Z", + "purposes": { + "1": { + "id": 1, + "name": "Store and/or access information on a device", + "description": "Cookies, device identifiers, or other information can be stored or accessed on your device for the purposes presented to you.", + "descriptionLegal": "Vendors can:\n* Store and access information on the device such as cookies and device identifiers presented to a user." + }, + "2": { + "id": 2, + "name": "Select basic ads", + "description": "Ads can be shown to you based on the content you’re viewing, the app you’re using, your approximate location, or your device type.", + "descriptionLegal": "To do basic ad selection vendors can:\n* Use real-time information about the context in which the ad will be shown, to show the ad, including information about the content and the device, such as: device type and capabilities, user agent, URL, IP address\n* Use a user’s non-precise geolocation data\n* Control the frequency of ads shown to a user.\n* Sequence the order in which ads are shown to a user.\n* Prevent an ad from serving in an unsuitable editorial (brand-unsafe) context\nVendors cannot:\n* Create a personalised ads profile using this information for the selection of future ads without a separate legal basis to create a personalised ads profile.\n* N.B. Non-precise means only an approximate location involving at least a radius of 500 meters is permitted." + }, + "3": { + "id": 3, + "name": "Create a personalised ads profile", + "description": "A profile can be built about you and your interests to show you personalised ads that are relevant to you.", + "descriptionLegal": "To create a personalised ads profile vendors can:\n* Collect information about a user, including a user's activity, interests, demographic information, or location, to create or edit a user profile for use in personalised advertising.\n* Combine this information with other information previously collected, including from across websites and apps, to create or edit a user profile for use in personalised advertising." + }, + "4": { + "id": 4, + "name": "Select personalised ads", + "description": "Personalised ads can be shown to you based on a profile about you.", + "descriptionLegal": "To select personalised ads vendors can:\n* Select personalised ads based on a user profile or other historical user data, including a user’s prior activity, interests, visits to sites or apps, location, or demographic information." + }, + "5": { + "id": 5, + "name": "Create a personalised content profile", + "description": "A profile can be built about you and your interests to show you personalised content that is relevant to you.", + "descriptionLegal": "To create a personalised content profile vendors can:\n* Collect information about a user, including a user's activity, interests, visits to sites or apps, demographic information, or location, to create or edit a user profile for personalising content.\n* Combine this information with other information previously collected, including from across websites and apps, to create or edit a user profile for use in personalising content." + }, + "6": { + "id": 6, + "name": "Select personalised content", + "description": "Personalised content can be shown to you based on a profile about you.", + "descriptionLegal": "To select personalised content vendors can:\n* Select personalised content based on a user profile or other historical user data, including a user’s prior activity, interests, visits to sites or apps, location, or demographic information." + }, + "7": { + "id": 7, + "name": "Measure ad performance", + "description": "The performance and effectiveness of ads that you see or interact with can be measured.", + "descriptionLegal": "To measure ad performance vendors can:\n* Measure whether and how ads were delivered to and interacted with by a user\n* Provide reporting about ads including their effectiveness and performance\n* Provide reporting about users who interacted with ads using data observed during the course of the user's interaction with that ad\n* Provide reporting to publishers about the ads displayed on their property\n* Measure whether an ad is serving in a suitable editorial environment (brand-safe) context\n* Determine the percentage of the ad that had the opportunity to be seen and the duration of that opportunity\n* Combine this information with other information previously collected, including from across websites and apps\nVendors cannot:\n*Apply panel- or similarly-derived audience insights data to ad measurement data without a Legal Basis to apply market research to generate audience insights (Purpose 9)" + }, + "8": { + "id": 8, + "name": "Measure content performance", + "description": "The performance and effectiveness of content that you see or interact with can be measured.", + "descriptionLegal": "To measure content performance vendors can:\n* Measure and report on how content was delivered to and interacted with by users.\n* Provide reporting, using directly measurable or known information, about users who interacted with the content\n* Combine this information with other information previously collected, including from across websites and apps.\nVendors cannot:\n* Measure whether and how ads (including native ads) were delivered to and interacted with by a user.\n* Apply panel- or similarly derived audience insights data to ad measurement data without a Legal Basis to apply market research to generate audience insights (Purpose 9)" + }, + "9": { + "id": 9, + "name": "Apply market research to generate audience insights", + "description": "Market research can be used to learn more about the audiences who visit sites/apps and view ads.", + "descriptionLegal": "To apply market research to generate audience insights vendors can:\n* Provide aggregate reporting to advertisers or their representatives about the audiences reached by their ads, through panel-based and similarly derived insights.\n* Provide aggregate reporting to publishers about the audiences that were served or interacted with content and/or ads on their property by applying panel-based and similarly derived insights.\n* Associate offline data with an online user for the purposes of market research to generate audience insights if vendors have declared to match and combine offline data sources (Feature 1)\n* Combine this information with other information previously collected including from across websites and apps. \nVendors cannot:\n* Measure the performance and effectiveness of ads that a specific user was served or interacted with, without a Legal Basis to measure ad performance.\n* Measure which content a specific user was served and how they interacted with it, without a Legal Basis to measure content performance." + }, + "10": { + "id": 10, + "name": "Develop and improve products", + "description": "Your data can be used to improve existing systems and software, and to develop new products", + "descriptionLegal": "To develop new products and improve products vendors can:\n* Use information to improve their existing products with new features and to develop new products\n* Create new models and algorithms through machine learning\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose" + } + }, + "specialPurposes": { + "1": { + "id": 1, + "name": "Ensure security, prevent fraud, and debug", + "description": "Your data can be used to monitor for and prevent fraudulent activity, and ensure systems and processes work properly and securely.", + "descriptionLegal": "To ensure security, prevent fraud and debug vendors can:\n* Ensure data are securely transmitted\n* Detect and prevent malicious, fraudulent, invalid, or illegal activity.\n* Ensure correct and efficient operation of systems and processes, including to monitor and enhance the performance of systems and processes engaged in permitted purposes\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose.\nNote: Data collected and used to ensure security, prevent fraud, and debug may include automatically-sent device characteristics for identification, precise geolocation data, and data obtained by actively scanning device characteristics for identification without separate disclosure and/or opt-in." + }, + "2": { + "id": 2, + "name": "Technically deliver ads or content", + "description": "Your device can receive and send information that allows you to see and interact with ads and content.", + "descriptionLegal": "To deliver information and respond to technical requests vendors can:\n* Use a user’s IP address to deliver an ad over the internet\n* Respond to a user’s interaction with an ad by sending the user to a landing page\n* Use a user’s IP address to deliver content over the internet\n* Respond to a user’s interaction with content by sending the user to a landing page\n* Use information about the device type and capabilities for delivering ads or content, for example, to deliver the right size ad creative or video file in a format supported by the device\nVendors cannot:\n* Conduct any other data processing operation allowed under a different purpose under this purpose" + } + }, + "features": { + "1": { + "id": 1, + "name": "Match and combine offline data sources", + "description": "Data from offline data sources can be combined with your online activity in support of one or more purposes", + "descriptionLegal": "Vendors can:\n* Combine data obtained offline with data collected online in support of one or more Purposes or Special Purposes." + }, + "2": { + "id": 2, + "name": "Link different devices", + "description": "Different devices can be determined as belonging to you or your household in support of one or more of purposes.", + "descriptionLegal": "Vendors can:\n* Deterministically determine that two or more devices belong to the same user or household\n* Probabilistically determine that two or more devices belong to the same user or household\n* Actively scan device characteristics for identification for probabilistic identification if users have allowed vendors to actively scan device characteristics for identification (Special Feature 2)" + }, + "3": { + "id": 3, + "name": "Receive and use automatically-sent device characteristics for identification", + "description": "Your device might be distinguished from other devices based on information it automatically sends, such as IP address or browser type.", + "descriptionLegal": "Vendors can:\n* Create an identifier using data collected automatically from a device for specific characteristics, e.g. IP address, user-agent string.\n* Use such an identifier to attempt to re-identify a device.\nVendors cannot:\n* Create an identifier using data collected via actively scanning a device for specific characteristics, e.g. installed font or screen resolution without users’ separate opt-in to actively scanning device characteristics for identification.\n* Use such an identifier to re-identify a device." + } + }, + "specialFeatures": { + "1": { + "id": 1, + "name": "Use precise geolocation data", + "description": "Your precise geolocation data can be used in support of one or more purposes. This means your location can be accurate to within several meters.", + "descriptionLegal": "Vendors can:\n* Collect and process precise geolocation data in support of one or more purposes.\nN.B. Precise geolocation means that there are no restrictions on the precision of a user’s location; this can be accurate to within several meters." + }, + "2": { + "id": 2, + "name": "Actively scan device characteristics for identification", + "description": "Your device can be identified based on a scan of your device's unique combination of characteristics.", + "descriptionLegal": "Vendors can:\n* Create an identifier using data collected via actively scanning a device for specific characteristics, e.g. installed fonts or screen resolution.\n* Use such an identifier to re-identify a device." + } + }, + "stacks": { + "1": { + "id": 1, + "purposes": [ + + ], + "specialFeatures": [ + 1, + 2 + ], + "name": "Precise geolocation data, and identification through device scanning", + "description": "Precise geolocation and information about device characteristics can be used." + }, + "2": { + "id": 2, + "purposes": [ + 2, + 7 + ], + "specialFeatures": [ + + ], + "name": "Basic ads, and ad measurement", + "description": "Basic ads can be served. Ad performance can be measured." + }, + "3": { + "id": 3, + "purposes": [ + 2, + 3, + 4 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads", + "description": "Ads can be personalised based on a profile. More data can be added to better personalise ads." + }, + "4": { + "id": 4, + "purposes": [ + 2, + 7, + 9 + ], + "specialFeatures": [ + + ], + "name": "Basic ads, ad measurement, and audience insights", + "description": "Basic ads can be served. Ad performance can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "5": { + "id": 5, + "purposes": [ + 2, + 3, + 7 + ], + "specialFeatures": [ + + ], + "name": "Basic ads, personalised ads profile, and ad measurement", + "description": "Basic ads can be served. More data can be added to better personalise ads. Ad performance can be measured." + }, + "6": { + "id": 6, + "purposes": [ + 2, + 4, + 7 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads display and ad measurement", + "description": "Ads can be personalised based on a profile. Ad performance can be measured." + }, + "7": { + "id": 7, + "purposes": [ + 2, + 4, + 7, + 9 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads display, ad measurement, and audience insights", + "description": "Ads can be personalised based on a profile. Ad performance can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "8": { + "id": 8, + "purposes": [ + 2, + 3, + 4, + 7 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads, and ad measurement", + "description": "Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad performance can be measured." + }, + "9": { + "id": 9, + "purposes": [ + 2, + 3, + 4, + 7, + 9 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads, ad measurement, and audience insights", + "description": "Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad performance can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "10": { + "id": 10, + "purposes": [ + 3, + 4 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads profile and display", + "description": "Ads can be personalised based on a profile. More data can be added to better personalise ads." + }, + "11": { + "id": 11, + "purposes": [ + 5, + 6 + ], + "specialFeatures": [ + + ], + "name": "Personalised content", + "description": "Content can be personalised based on a profile. More data can be added to better personalise content." + }, + "12": { + "id": 12, + "purposes": [ + 6, + 8 + ], + "specialFeatures": [ + + ], + "name": "Personalised content display, and content measurement", + "description": "Content can be personalised based on a profile. Content performance can be measured." + }, + "13": { + "id": 13, + "purposes": [ + 6, + 8, + 9 + ], + "specialFeatures": [ + + ], + "name": "Personalised content display, content measurement and audience insights", + "description": "Content can be personalised based on a profile. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "14": { + "id": 14, + "purposes": [ + 5, + 6, + 8 + ], + "specialFeatures": [ + + ], + "name": "Personalised content, and content measurement", + "description": "Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured." + }, + "15": { + "id": 15, + "purposes": [ + 5, + 6, + 8, + 9 + ], + "specialFeatures": [ + + ], + "name": "Personalised content, content measurement and audience insights", + "description": "Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "16": { + "id": 16, + "purposes": [ + 5, + 6, + 8, + 9, + 10 + ], + "specialFeatures": [ + + ], + "name": "Personalised content, content measurement, audience insights, and product development", + "description": "Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software" + }, + "17": { + "id": 17, + "purposes": [ + 7, + 8, + 9 + ], + "specialFeatures": [ + + ], + "name": "Ad and content measurement, and audience insights", + "description": "Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "18": { + "id": 18, + "purposes": [ + 7, + 8 + ], + "specialFeatures": [ + + ], + "name": "Ad and content measurement", + "description": "Ad and content performance can be measured." + }, + "19": { + "id": 19, + "purposes": [ + 7, + 9 + ], + "specialFeatures": [ + + ], + "name": "Ad measurement, and audience insights", + "description": "Ad can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "20": { + "id": 20, + "purposes": [ + 7, + 8, + 9, + 10 + ], + "specialFeatures": [ + + ], + "name": "Ad and content measurement, audience insights, and product development", + "description": "Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software. Insights about the audiences who saw the ads and content can be derived." + }, + "21": { + "id": 21, + "purposes": [ + 8, + 9, + 10 + ], + "specialFeatures": [ + + ], + "name": "Content measurement, audience insights, and product development", + "description": "Content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software." + }, + "22": { + "id": 22, + "purposes": [ + 8, + 10 + ], + "specialFeatures": [ + + ], + "name": "Content measurement, and product development", + "description": "Content performance can be measured. Data can be used to build or improve user experience, systems, and software." + }, + "23": { + "id": 23, + "purposes": [ + 2, + 4, + 6, + 7, + 8 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads and content display, ad and content measurement", + "description": "Ads and content can be personalised based on a profile. Ad and content performance can be measured." + }, + "24": { + "id": 24, + "purposes": [ + 2, + 4, + 6, + 7, + 8, + 9 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads and content display, ad and content measurement, and audience insights", + "description": "Ads and content can be personalised based on a profile. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software." + }, + "25": { + "id": 25, + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads and content, ad and content measurement", + "description": "Ads and content can be personalised based on a profile. More data can be added to better personalise ads and content. Ad and content performance can be measured." + }, + "26": { + "id": 26, + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads and content, ad and content measurement, and audience insights", + "description": "Ads and content can be personalised based on a profile. More data can be added to better personalise ads and content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "27": { + "id": 27, + "purposes": [ + 3, + 5 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads, and content profile", + "description": "More data can be added to personalise ads and content." + }, + "28": { + "id": 28, + "purposes": [ + 2, + 4, + 6 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads and content display", + "description": "Ads and content can be personalised based on a profile." + }, + "29": { + "id": 29, + "purposes": [ + 2, + 7, + 8, + 9 + ], + "specialFeatures": [ + + ], + "name": "Basic ads, ad and content measurement, and audience insights", + "description": "Basic ads can be served. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "30": { + "id": 30, + "purposes": [ + 2, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads display, personalised content, ad and content measurement, and audience insights", + "description": "Ads and content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "31": { + "id": 31, + "purposes": [ + 2, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads display, personalised content, ad and content measurement, audience insights, and product development", + "description": "Ads and content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software." + }, + "32": { + "id": 32, + "purposes": [ + 2, + 5, + 6, + 7, + 8, + 9 + ], + "specialFeatures": [ + + ], + "name": "Basic ads, personalised content, ad and content measurement, and audience insights", + "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "33": { + "id": 33, + "purposes": [ + 2, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "specialFeatures": [ + + ], + "name": "Basic ads, personalised content, ad and content measurement, audience insights, and product development", + "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software." + }, + "34": { + "id": 34, + "purposes": [ + 2, + 5, + 6, + 8, + 9 + ], + "specialFeatures": [ + + ], + "name": "Basic ads, personalised content, content measurement, and audience insights", + "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad and content performance can be measured. Insights about the audiences who saw the ads and content can be derived." + }, + "35": { + "id": 35, + "purposes": [ + 2, + 5, + 6, + 8, + 9, + 10 + ], + "specialFeatures": [ + + ], + "name": "Basic ads, personalised content, content measurement, audience insights, and product development", + "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Content performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems, and software." + }, + "36": { + "id": 36, + "purposes": [ + 2, + 5, + 6, + 7 + ], + "specialFeatures": [ + + ], + "name": "Basic ads, personalised content, and ad measurement", + "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad performance can be measured." + }, + "37": { + "id": 37, + "purposes": [ + 2, + 5, + 6, + 7, + 10 + ], + "specialFeatures": [ + + ], + "name": "Basic ads, personalised content, ad measurement, and product development", + "description": "Basic ads can be served. Content can be personalised based on a profile. More data can be added to better personalise content. Ad performance can be measured. Data can be used to build or improve user experience, systems, and software." + }, + "38": { + "id": 38, + "purposes": [ + 2, + 3, + 4, + 7, + 10 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads, ad measurement, and product development", + "description": "Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad performance can be measured. Data can be used to build or improve user experience, systems, and software." + }, + "39": { + "id": 39, + "purposes": [ + 2, + 3, + 4, + 7, + 9, + 10 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads, ad measurement, audience insights and product development", + "description": "Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad performance can be measured. Insights about the audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems and software." + }, + "40": { + "id": 40, + "purposes": [ + 2, + 3, + 4, + 7, + 8, + 9, + 10 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads, ad and content measurement, audience insights and product development", + "description": "Ads can be personalised based on a profile. More data can be added to better personalise ads. Ad and content performance can be measured. Insights about audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems and software." + }, + "41": { + "id": 41, + "purposes": [ + 2, + 3, + 4, + 6, + 7, + 8, + 9, + 10 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads, personalised content display, ad and content measurement, audience insights and product development", + "description": "Ads and content can be personalised based on a profile. More data can be added to better personalise ads. Ad and content performance can be measured. Insights about audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems and software." + }, + "42": { + "id": 42, + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "specialFeatures": [ + + ], + "name": "Personalised ads and content, ad and content measurement, audience insights and product development", + "description": "Ads and content can be personalised based on a profile. More data can be added to better personalise ads and content. Ad and content performance can be measured. Insights about audiences who saw the ads and content can be derived. Data can be used to build or improve user experience, systems and software." + } + }, + "vendors": { + "10": { + "id": 10, + "name": "Index Exchange Inc. ", + "purposes": [ + 2, + 7 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.indexexchange.com/privacy/" + } + ] + }, + "52": { + "id": 52, + "name": "Magnite, Inc. ", + "purposes": [ + + ], + "impConsPurposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 3, + 4, + 5, + 6 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.magnite.com/legal/advertising-platform-privacy-policy/" + } + ], + "overflow": { + "httpGetLimit": 128 + } + }, + "75": { + "id": 75, + "name": "M32 Connect Inc", + "purposes": [ + 2, + 3, + 4, + 8, + 10 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 2 + ], + "urls": [ + { + "langId": "en", + "privacy": "https://m32connect.com/privacy-consent-management/privacy-cookie-policy/" + }, + { + "langId": "fr", + "privacy": "https://m32connect.com/fr/vie-privee-et-gestion-du-consentement/politique-de-confidentialite/" + } + ] + }, + "93": { + "id": 93, + "name": "Adloox SA", + "purposes": [ + 2, + 7 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1 + ], + "features": [ + + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.adloox.com/legal/privacy-policy" + } + ], + "overflow": { + "httpGetLimit": 128 + } + }, + "102": { + "id": 102, + "name": "Magnite, Inc. (Outstream)", + "purposes": [ + + ], + "impConsPurposes": [ + 2, + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 2, + 8 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.magnite.com/legal/advertising-platform-privacy-policy/" + } + ], + "overflow": { + "httpGetLimit": 128 + } + }, + "130": { + "id": 130, + "name": "NextRoll, Inc.", + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 9, + 10 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + 2, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.nextroll.com/privacy" + }, + { + "langId": "de", + "privacy": "https://www.nextroll.com/privacy" + }, + { + "langId": "es", + "privacy": "https://www.nextroll.com/es-ES/privacy" + }, + { + "langId": "nl", + "privacy": "https://www.nextroll.com/nl-NL/privacy" + }, + { + "langId": "fr", + "privacy": "https://www.nextroll.com/fr-FR/privacy" + }, + { + "langId": "it", + "privacy": "https://www.nextroll.com/it-IT/privacy" + } + ] + }, + "138": { + "id": 138, + "name": "ConnectAd Demand GmbH", + "purposes": [ + 4 + ], + "impConsPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 7, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://connectadrealtime.com/privacy/" + } + ] + }, + "202": { + "id": 202, + "name": "Magnite CTV, Inc.", + "purposes": [ + + ], + "impConsPurposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 2, + 3, + 4, + 5, + 6, + 8 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.magnite.com/legal/advertising-platform-privacy-policy/" + } + ], + "overflow": { + "httpGetLimit": 128 + } + }, + "211": { + "id": 211, + "name": "AdTheorent, Inc", + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "urls": [ + { + "langId": "en", + "privacy": "https://adtheorent.com/privacy-policy" + } + ], + "overflow": { + "httpGetLimit": 128 + } + }, + "231": { + "id": 231, + "name": "AcuityAds Inc.", + "purposes": [ + 3, + 4 + ], + "impConsPurposes": [ + 2, + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://illumin.com/legal/privacy/" + } + ] + }, + "293": { + "id": 293, + "name": "SpringServe, LLC", + "purposes": [ + + ], + "impConsPurposes": [ + 2, + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "urls": [ + { + "langId": "en", + "privacy": "https://springserve.com/privacy-policy/" + } + ] + }, + "294": { + "id": 294, + "name": "Jivox Corporation", + "purposes": [ + 2, + 3, + 4, + 5, + 7 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + 2, + 3, + 4, + 5, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2 + ], + "specialFeatures": [ + 1 + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.jivox.com/privacy" + } + ], + "overflow": { + "httpGetLimit": 32 + } + }, + "319": { + "id": 319, + "name": "Clipcentric, Inc.", + "purposes": [ + + ], + "impConsPurposes": [ + 2, + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 7 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + 1 + ] + }, + "410": { + "id": 410, + "name": "Adtelligent Inc.", + "purposes": [ + 2, + 7 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://adtelligent.com/privacy-policy/" + } + ] + }, + "413": { + "id": 413, + "name": "Eulerian Technologies", + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.eulerian.com/en/privacy/" + }, + { + "langId": "fr", + "privacy": "https://www.eulerian.com/vieprivee/" + }, + { + "langId": "it", + "privacy": "https://www.eulerian.com/it/privacy" + }, + { + "langId": "es", + "privacy": "https://www.eulerian.com/es/privacidad" + } + ] + }, + "415": { + "id": 415, + "name": "Seenthis AB", + "purposes": [ + + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 2 + ], + "features": [ + + ], + "specialFeatures": [ + + ] + }, + "431": { + "id": 431, + "name": "HUMAN", + "purposes": [ + + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 3 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.humansecurity.com/privacy" + } + ] + }, + "639": { + "id": 639, + "name": "Smile Wanted Group", + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + + ], + "features": [ + + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.smilewanted.com/privacy.php" + } + ] + }, + "734": { + "id": 734, + "name": "Cint AB", + "purposes": [ + 7, + 8, + 9 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + 7, + 8, + 9 + ], + "specialPurposes": [ + 1 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.cint.com/participant-privacy-notice" + } + ] + }, + "737": { + "id": 737, + "name": "Monet Engine Inc", + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://adaptmx.com/privacy-policy/" + } + ] + }, + "759": { + "id": 759, + "name": "RevJet", + "purposes": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.innervate.com/privacy" + } + ], + "overflow": { + "httpGetLimit": 128 + } + }, + "767": { + "id": 767, + "name": "Clinch Labs LTD", + "purposes": [ + + ], + "impConsPurposes": [ + 2, + 3, + 4, + 7, + 9, + 10 + ], + "flexiblePurposes": [ + 2, + 3, + 4, + 7, + 9, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://clinch.co/privacy-policy/" + } + ] + }, + "775": { + "id": 775, + "name": "SelectMedia International LTD", + "purposes": [ + 2, + 3, + 4, + 7, + 8 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.selectmedia.asia/terms-and-privacy/" + } + ] + }, + "816": { + "id": 816, + "name": "NoBid, Inc.", + "purposes": [ + 2 + ], + "impConsPurposes": [ + 7, + 10 + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.nobid.io/privacy-policy/" + } + ] + }, + "839": { + "id": 839, + "name": "PIXFUTURE MEDIA INC.", + "purposes": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "impConsPurposes": [ + 2 + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.pixfuture.com/terms-and-conditions#dpa-terms" + } + ] + }, + "874": { + "id": 874, + "name": "PRECISO SRL", + "purposes": [ + 3, + 4, + 5, + 6 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + + ], + "features": [ + + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://preciso.net/privacy.html" + } + ], + "overflow": { + "httpGetLimit": 128 + } + }, + "881": { + "id": 881, + "name": "Hillside (Sports) GP Limited", + "purposes": [ + 2, + 7, + 8, + 10 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 2 + ], + "features": [ + + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.bet365partners.com/en/privacypolicy" + }, + { + "langId": "it", + "privacy": "https://www.bet365partners.com/it/privacypolicy" + }, + { + "langId": "es", + "privacy": "https://www.bet365partners.com/es/privacypolicy" + }, + { + "langId": "de", + "privacy": "https://www.bet365partners.com/de/privacypolicy" + }, + { + "langId": "da", + "privacy": "https://www.bet365partners.com/da/privacypolicy" + }, + { + "langId": "sv", + "privacy": "https://www.bet365partners.com/sv/privacypolicy" + }, + { + "langId": "no", + "privacy": "https://www.bet365partners.com/nn/privacypolicy" + }, + { + "langId": "fr", + "privacy": "https://www.bet365partners.com/fr/privacypolicy" + }, + { + "langId": "bg", + "privacy": "https://www.bet365partners.com/bg/privacypolicy" + }, + { + "langId": "el", + "privacy": "https://www.bet365partners.com/el/privacypolicy" + }, + { + "langId": "pt", + "privacy": "https://www.bet365partners.com/br/privacypolicy" + }, + { + "langId": "pl", + "privacy": "https://www.bet365partners.com/pl/privacypolicy" + }, + { + "langId": "cs", + "privacy": "https://www.bet365partners.com/cs/privacypolicy" + }, + { + "langId": "hu", + "privacy": "https://www.bet365partners.com/hu/privacypolicy" + }, + { + "langId": "sl", + "privacy": "https://www.bet365partners.com/sk/privacypolicy" + }, + { + "langId": "nl", + "privacy": "https://www.bet365partners.com/nl/privacypolicy" + }, + { + "langId": "et", + "privacy": "https://www.bet365partners.com/et/privacypolicy" + }, + { + "langId": "ru", + "privacy": "https://www.bet365partners.com/ru/privacypolicy" + }, + { + "langId": "ja", + "privacy": "https://www.bet365partners.com/ja/privacypolicy" + } + ] + }, + "909": { + "id": 909, + "name": "MobileFuse LLC", + "purposes": [ + 2, + 7, + 9, + 10 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://mobilefuse.com/privacy-policy/" + } + ] + }, + "964": { + "id": 964, + "name": "Solution coupons", + "purposes": [ + 2, + 3, + 7, + 8 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + + ], + "features": [ + + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://solution.coupons/privacy" + } + ], + "overflow": { + "httpGetLimit": 32 + } + }, + "996": { + "id": 996, + "name": "CMI Marketing, Inc. d/b/a CafeMedia", + "purposes": [ + 3, + 4, + 5, + 6, + 7, + 8, + 10 + ], + "impConsPurposes": [ + 2 + ], + "flexiblePurposes": [ + 2 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://cafemedia.com/publisher-advertising-privacy-policy/" + } + ] + }, + "1028": { + "id": 1028, + "name": "Sparteo", + "purposes": [ + 3, + 4, + 5, + 6, + 9 + ], + "impConsPurposes": [ + 2, + 7, + 8, + 10 + ], + "flexiblePurposes": [ + 2, + 7, + 8, + 10 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 2, + 3 + ], + "specialFeatures": [ + 1 + ], + "urls": [ + { + "langId": "en", + "privacy": "https://sparteo.com/privacy-policy" + } + ] + }, + "1134": { + "id": 1134, + "name": "Bidmatic Inc", + "purposes": [ + 2, + 7 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 3 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://bidmatic.io/privacy-policy/" + } + ] + }, + "1151": { + "id": 1151, + "name": "Boldwin LTD", + "purposes": [ + 7 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1, + 2 + ], + "urls": [ + { + "langId": "en", + "privacy": "https://bold-win.com/privacy-policy/" + } + ] + }, + "1189": { + "id": 1189, + "name": "ResponsiveAds, Inc.", + "purposes": [ + 7, + 10 + ], + "impConsPurposes": [ + + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + + ], + "specialFeatures": [ + + ] + }, + "1194": { + "id": 1194, + "name": "GREEN GREY HOLDING (CY) LTD", + "purposes": [ + 2, + 3, + 4, + 9 + ], + "impConsPurposes": [ + 7, + 10 + ], + "flexiblePurposes": [ + 2, + 4, + 7, + 9 + ], + "specialPurposes": [ + 1, + 2 + ], + "features": [ + 1, + 2, + 3 + ], + "specialFeatures": [ + 1 + ] + }, + "1217": { + "id": 1217, + "name": "Channel99, Inc.", + "purposes": [ + + ], + "impConsPurposes": [ + 7 + ], + "flexiblePurposes": [ + + ], + "specialPurposes": [ + + ], + "features": [ + 1 + ], + "specialFeatures": [ + + ], + "urls": [ + { + "langId": "en", + "privacy": "https://www.channel99.com/privacy-policy/" + } + ] + } + } +} \ No newline at end of file diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Purpose.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Purpose.java index ec5b214e..2f2812d7 100644 --- a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Purpose.java +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Purpose.java @@ -51,7 +51,6 @@ public interface Purpose { /** * Legal description of the purpose - * @deprecated since 3.0 * @return legal description string */ Optional getDescriptionLegal(); diff --git a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Vendor.java b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Vendor.java index dc2833f6..480a21b7 100644 --- a/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Vendor.java +++ b/iabgpp-extras/src/main/java/com/iab/gpp/extras/gvl/Vendor.java @@ -54,7 +54,15 @@ public interface Vendor { * * @return A {@link List} of purpose ids disclosed as legitimate interests */ - List getLegIntPurposes(); + Optional> getLegIntPurposes(); + + /** + * List of Purposes for which the vendor requires to be transparently disclosed as implied Consent + * This is not applicable for EU, but for Canada + * + * @return A {@link List} of purpose ids disclosed as legitimate interests + */ + Optional> getImpConsPurposes(); /** * List of purposes where the vendor is flexible regarding the legal basis; they will perform the From db78746e79dbb8151614a7ee14be27d3d92dbf94 Mon Sep 17 00:00:00 2001 From: chad Date: Thu, 14 Sep 2023 07:46:44 -0600 Subject: [PATCH 19/41] 3.1.1 --- iabgpp-encoder/pom.xml | 2 +- iabgpp-extras-jackson/pom.xml | 4 ++-- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index b6690766..c741e537 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.1-SNAPSHOT + 3.1.1 iabgpp-encoder diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index b0aaedfc..4956766d 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.1.1-SNAPSHOT + 3.1.1 iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.1.1-SNAPSHOT + 3.1.1 diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index a1ac55d1..07e1ff5b 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.1-SNAPSHOT + 3.1.1 iabgpp-extras diff --git a/pom.xml b/pom.xml index f0fce412..d8aca0d8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.1.1-SNAPSHOT + 3.1.1 IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From 982430586aaa6e5bd8f71fe2bab80b9de7ce5c69 Mon Sep 17 00:00:00 2001 From: chad Date: Thu, 14 Sep 2023 07:46:47 -0600 Subject: [PATCH 20/41] 3.1.2-SNAPSHOT --- iabgpp-encoder/pom.xml | 2 +- iabgpp-extras-jackson/pom.xml | 4 ++-- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index c741e537..fe7ebc3b 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.1 + 3.1.2-SNAPSHOT iabgpp-encoder diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index 4956766d..92075406 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.1.1 + 3.1.2-SNAPSHOT iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.1.1 + 3.1.2-SNAPSHOT diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index 07e1ff5b..d82bb0d9 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.1 + 3.1.2-SNAPSHOT iabgpp-extras diff --git a/pom.xml b/pom.xml index d8aca0d8..42a5e198 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.1.1 + 3.1.2-SNAPSHOT IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From 2b303d197e13a2097e613f026fc321b35f822e7c Mon Sep 17 00:00:00 2001 From: chuff Date: Thu, 14 Sep 2023 08:21:24 -0600 Subject: [PATCH 21/41] Version Bump (#38) * 3.1.1 * 3.1.2-SNAPSHOT --------- Co-authored-by: chad --- iabgpp-encoder/pom.xml | 2 +- iabgpp-extras-jackson/pom.xml | 4 ++-- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index b6690766..fe7ebc3b 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.1-SNAPSHOT + 3.1.2-SNAPSHOT iabgpp-encoder diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index b0aaedfc..92075406 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.1.1-SNAPSHOT + 3.1.2-SNAPSHOT iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.1.1-SNAPSHOT + 3.1.2-SNAPSHOT diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index a1ac55d1..d82bb0d9 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.1-SNAPSHOT + 3.1.2-SNAPSHOT iabgpp-extras diff --git a/pom.xml b/pom.xml index f0fce412..42a5e198 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.1.1-SNAPSHOT + 3.1.2-SNAPSHOT IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From 60eb6645325011c3711687a3bc1e782f28329153 Mon Sep 17 00:00:00 2001 From: chuff Date: Tue, 9 Apr 2024 14:31:53 -0600 Subject: [PATCH 22/41] lazy decoding (#34) * lazy decoding * java 8 compatible gppmodel tests * rename missed multistate usp* methods to us* * lazier decoding * lazier decoding * tests for null and empty string constructor arguments * deprecate multi-state usp* methods * remove deprecated usp methods * encodeSection lazy fix * optimize bitstring padding --------- Co-authored-by: chad --- .../java/com/iab/gpp/encoder/GppModel.java | 191 +++++++--- .../AbstractBase64UrlEncoder.java | 7 +- .../base64/CompressedBase64UrlEncoder.java | 38 ++ .../base64/TraditionalBase64UrlEncoder.java | 28 ++ .../encoder/bitstring/BitStringEncoder.java | 50 +++ .../AbstractEncodableBitStringDataType.java | 11 +- .../iab/gpp/encoder/datatype/DataType.java | 7 + .../encoder/datatype/EncodableBoolean.java | 6 +- .../encoder/datatype/EncodableDataType.java | 7 + .../encoder/datatype/EncodableDatetime.java | 3 +- .../datatype/EncodableFibonacciInteger.java | 3 +- .../EncodableFibonacciIntegerRange.java | 2 +- .../datatype/EncodableFixedBitfield.java | 6 +- .../datatype/EncodableFixedInteger.java | 3 +- .../datatype/EncodableFixedIntegerList.java | 6 +- .../datatype/EncodableFixedIntegerRange.java | 5 +- .../datatype/EncodableFixedString.java | 6 +- .../datatype/EncodableFlexibleBitfield.java | 6 +- .../EncodableOptimizedFibonacciRange.java | 5 +- .../EncodableOptimizedFixedRange.java | 8 +- .../datatype/UnencodableCharacter.java | 26 ++ .../encoder/datatype/UnencodableInteger.java | 26 ++ .../datatype/encoder/BooleanEncoder.java | 4 +- .../encoder/CompressedBase64UrlEncoder.java | 17 - .../encoder/FixedBitfieldEncoder.java | 5 +- .../encoder/FixedIntegerListEncoder.java | 4 +- .../datatype/encoder/FixedStringEncoder.java | 4 +- .../encoder/TraditionalBase64UrlEncoder.java | 13 - .../gpp/encoder/error/DecodingException.java | 2 +- .../gpp/encoder/error/EncodingException.java | 2 +- .../encoder/error/InvalidFieldException.java | 2 +- .../encoder/error/LazyDecodingException.java | 18 - .../field/EncodableBitStringFields.java | 31 ++ .../com/iab/gpp/encoder/field/Fields.java | 14 + .../iab/gpp/encoder/field/GenericFields.java | 31 ++ .../iab/gpp/encoder/field/HeaderV1Field.java | 12 + .../iab/gpp/encoder/field/TcfCaV1Field.java | 33 ++ .../iab/gpp/encoder/field/TcfEuV2Field.java | 51 +++ .../iab/gpp/encoder/field/UsCaV1Field.java | 26 ++ .../iab/gpp/encoder/field/UsCoV1Field.java | 26 ++ .../iab/gpp/encoder/field/UsCtV1Field.java | 26 ++ .../iab/gpp/encoder/field/UsNatV1Field.java | 30 ++ .../iab/gpp/encoder/field/UsUtV1Field.java | 20 + .../iab/gpp/encoder/field/UsVaV1Field.java | 18 + .../com/iab/gpp/encoder/field/UspV1Field.java | 11 + .../gpp/encoder/field/UspV1LegacyField.java | 10 - .../AbstractEncodableBitStringSection.java | 81 ---- ...actEncodableSegmentedBitStringSection.java | 100 ----- .../AbstractLazilyEncodableSection.java | 91 +++++ .../gpp/encoder/section/EncodableSection.java | 12 +- .../com/iab/gpp/encoder/section/HeaderV1.java | 90 ++--- .../com/iab/gpp/encoder/section/TcfCaV1.java | 262 +++++-------- .../com/iab/gpp/encoder/section/TcfEuV2.java | 347 ++++++------------ .../com/iab/gpp/encoder/section/UsCaV1.java | 202 ++++------ .../com/iab/gpp/encoder/section/UsCoV1.java | 199 ++++------ .../com/iab/gpp/encoder/section/UsCtV1.java | 195 ++++------ .../com/iab/gpp/encoder/section/UsNatV1.java | 215 ++++------- .../com/iab/gpp/encoder/section/UsUtV1.java | 134 +++---- .../com/iab/gpp/encoder/section/UsVaV1.java | 126 +++---- .../com/iab/gpp/encoder/section/UspV1.java | 121 +++--- .../AbstractLazilyEncodableSegment.java | 75 ++++ .../gpp/encoder/segment/EncodableSegment.java | 18 + .../encoder/segment/HeaderV1CoreSegment.java | 57 +++ .../encoder/segment/TcfCaV1CoreSegment.java | 82 +++++ .../TcfCaV1PublisherPurposesSegment.java | 81 ++++ .../encoder/segment/TcfEuV2CoreSegment.java | 88 +++++ .../TcfEuV2PublisherPurposesSegment.java | 81 ++++ .../segment/TcfEuV2VendorsAllowedSegment.java | 55 +++ .../TcfEuV2VendorsDisclosedSegment.java | 55 +++ .../encoder/segment/UsCaV1CoreSegment.java | 67 ++++ .../gpp/encoder/segment/UsCaV1GpcSegment.java | 55 +++ .../encoder/segment/UsCoV1CoreSegment.java | 66 ++++ .../gpp/encoder/segment/UsCoV1GpcSegment.java | 55 +++ .../encoder/segment/UsCtV1CoreSegment.java | 67 ++++ .../gpp/encoder/segment/UsCtV1GpcSegment.java | 55 +++ .../encoder/segment/UsNatV1CoreSegment.java | 71 ++++ .../encoder/segment/UsNatV1GpcSegment.java | 55 +++ .../encoder/segment/UsUtV1CoreSegment.java | 67 ++++ .../encoder/segment/UsVaV1CoreSegment.java | 66 ++++ .../gpp/encoder/segment/UspV1CoreSegment.java | 60 +++ .../com/iab/gpp/encoder/GppModelTest.java | 151 +++++--- .../TraditionalBase64UrlEncoderTest.java | 20 +- .../EncodableOptimizedFixedRangeTest.java | 22 +- .../datatype/encoder/BooleanEncoderTest.java | 9 +- .../encoder/FixedBitfieldEncoderTest.java | 29 +- .../encoder/FixedIntegerListEncoderTest.java | 71 ++-- .../encoder/FixedStringEncoderTest.java | 8 +- .../iab/gpp/encoder/section/HeaderV1Test.java | 60 +-- .../iab/gpp/encoder/section/TcfCaV1Test.java | 13 +- .../iab/gpp/encoder/section/TcfEuV2Test.java | 33 +- .../iab/gpp/encoder/section/UsCaV1Test.java | 15 +- .../iab/gpp/encoder/section/UsCoV1Test.java | 13 +- .../iab/gpp/encoder/section/UsCtV1Test.java | 8 +- .../iab/gpp/encoder/section/UsNatV1Test.java | 10 +- .../iab/gpp/encoder/section/UsUtV1Test.java | 6 +- .../iab/gpp/encoder/section/UsVaV1Test.java | 4 +- .../iab/gpp/encoder/section/UspV1Test.java | 35 +- .../resources/vendorlist/v2/purposes-fr.json | 1 + .../vendorlist/v3.0/purposes-fr.json | 1 + 99 files changed, 2972 insertions(+), 1848 deletions(-) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/{datatype/encoder => base64}/AbstractBase64UrlEncoder.java (94%) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/base64/CompressedBase64UrlEncoder.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/base64/TraditionalBase64UrlEncoder.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/bitstring/BitStringEncoder.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/DataType.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDataType.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableCharacter.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableInteger.java delete mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/CompressedBase64UrlEncoder.java delete mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoder.java delete mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/LazyDecodingException.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/EncodableBitStringFields.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/Fields.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/GenericFields.java delete mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspV1LegacyField.java delete mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableBitStringSection.java delete mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractLazilyEncodableSection.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1CoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1PublisherPurposesSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2CoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2PublisherPurposesSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsAllowedSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsDisclosedSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1GpcSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1GpcSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1GpcSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1GpcSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java rename iabgpp-encoder/src/test/java/com/iab/gpp/encoder/{datatype/encoder => base64}/TraditionalBase64UrlEncoderTest.java (60%) create mode 100644 iabgpp-extras-jackson/src/test/resources/vendorlist/v2/purposes-fr.json create mode 100644 iabgpp-extras-jackson/src/test/resources/vendorlist/v3.0/purposes-fr.json diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index 9877500a..90c46d10 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -5,7 +5,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.section.EncodableSection; @@ -18,27 +17,36 @@ import com.iab.gpp.encoder.section.UsCtV1; import com.iab.gpp.encoder.section.UsNatV1; import com.iab.gpp.encoder.section.UsUtV1; -import com.iab.gpp.encoder.section.UspV1; import com.iab.gpp.encoder.section.UsVaV1; +import com.iab.gpp.encoder.section.UspV1; public class GppModel { private Map sections = new HashMap<>(); + private String encodedString; + + private boolean dirty = false; + private boolean decoded = true; + public GppModel() { } - public GppModel(String encodedString) throws DecodingException { - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } + public GppModel(String encodedString) { + decode(encodedString); } - public void setFieldValue(int sectionId, String fieldName, Object value) throws InvalidFieldException { + public void setFieldValue(int sectionId, String fieldName, Object value) { setFieldValue(Sections.SECTION_ID_NAME_MAP.get(sectionId), fieldName, value); } - public void setFieldValue(String sectionName, String fieldName, Object value) throws InvalidFieldException { + public void setFieldValue(String sectionName, String fieldName, Object value) { + if (!this.decoded) { + this.sections = this.decodeModel(this.encodedString); + this.dirty = false; + this.decoded = true; + } + EncodableSection section = null; if (!this.sections.containsKey(sectionName)) { if (sectionName.equals(TcfCaV1.NAME)) { @@ -75,6 +83,7 @@ public void setFieldValue(String sectionName, String fieldName, Object value) th if (section != null) { section.setFieldValue(fieldName, value); + this.dirty = true; } else { throw new InvalidFieldException(sectionName + "." + fieldName + " not found"); } @@ -85,6 +94,12 @@ public Object getFieldValue(int sectionId, String fieldName) { } public Object getFieldValue(String sectionName, String fieldName) { + if (!this.decoded) { + this.sections = this.decodeModel(this.encodedString); + this.dirty = false; + this.decoded = true; + } + if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).getFieldValue(fieldName); } else { @@ -97,6 +112,12 @@ public boolean hasField(int sectionId, String fieldName) { } public boolean hasField(String sectionName, String fieldName) { + if (!this.decoded) { + this.sections = this.decodeModel(this.encodedString); + this.dirty = false; + this.decoded = true; + } + if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).hasField(fieldName); } else { @@ -109,10 +130,22 @@ public boolean hasSection(int sectionId) { } public boolean hasSection(String sectionName) { + if (!this.decoded) { + this.sections = this.decodeModel(this.encodedString); + this.dirty = false; + this.decoded = true; + } + return this.sections.containsKey(sectionName); } public HeaderV1 getHeader() { + if (!this.decoded) { + this.sections = this.decodeModel(this.encodedString); + this.dirty = false; + this.decoded = true; + } + HeaderV1 header = new HeaderV1(); try { header.setFieldValue("SectionIds", this.getSectionIds()); @@ -127,6 +160,12 @@ public EncodableSection getSection(int sectionId) { } public EncodableSection getSection(String sectionName) { + if (!this.decoded) { + this.sections = this.decodeModel(this.encodedString); + this.dirty = false; + this.decoded = true; + } + if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName); } else { @@ -139,13 +178,23 @@ public void deleteSection(int sectionId) { } public void deleteSection(String sectionName) { + if (!this.decoded) { + this.sections = this.decodeModel(this.encodedString); + this.dirty = false; + this.decoded = true; + } + if (this.sections.containsKey(sectionName)) { this.sections.remove(sectionName); + this.dirty = true; } } public void clear() { this.sections.clear(); + this.encodedString = null; + this.dirty = false; + this.decoded = true; } public TcfCaV1 getTcfCaV1Section() { @@ -185,6 +234,12 @@ public UsCtV1 getUsCtV1Section() { } public List getSectionIds() { + if (!this.decoded) { + this.sections = this.decodeModel(this.encodedString); + this.dirty = false; + this.decoded = true; + } + List sectionIds = new ArrayList<>(); for (int i = 0; i < Sections.SECTION_ORDER.size(); i++) { String sectionName = Sections.SECTION_ORDER.get(i); @@ -196,13 +251,13 @@ public List getSectionIds() { return sectionIds; } - public String encode() throws EncodingException { + protected String encodeModel(Map sections) { List encodedSections = new ArrayList<>(); List sectionIds = new ArrayList<>(); for (int i = 0; i < Sections.SECTION_ORDER.size(); i++) { String sectionName = Sections.SECTION_ORDER.get(i); - if (this.sections.containsKey(sectionName)) { - EncodableSection section = this.sections.get(sectionName); + if (sections.containsKey(sectionName)) { + EncodableSection section = sections.get(sectionName); encodedSections.add(section.encode()); sectionIds.add(section.getId()); } @@ -210,7 +265,7 @@ public String encode() throws EncodingException { HeaderV1 header = new HeaderV1(); try { - header.setFieldValue("SectionIds", this.getSectionIds()); + header.setFieldValue("SectionIds", getSectionIds()); } catch (InvalidFieldException e) { throw new EncodingException(e); } @@ -220,52 +275,62 @@ public String encode() throws EncodingException { return encodedString; } - public void decode(String str) throws DecodingException { - this.sections.clear(); - - String[] encodedSections = str.split("~"); - HeaderV1 header = new HeaderV1(encodedSections[0]); - this.sections.put(HeaderV1.NAME, header); - - @SuppressWarnings("unchecked") - List sectionIds = (List) header.getFieldValue("SectionIds"); - for (int i = 0; i < sectionIds.size(); i++) { - if (sectionIds.get(i).equals(TcfEuV2.ID)) { - TcfEuV2 section = new TcfEuV2(encodedSections[i + 1]); - this.sections.put(TcfEuV2.NAME, section); - } else if (sectionIds.get(i).equals(TcfCaV1.ID)) { - TcfCaV1 section = new TcfCaV1(encodedSections[i + 1]); - this.sections.put(TcfCaV1.NAME, section); - } else if (sectionIds.get(i).equals(UspV1.ID)) { - UspV1 section = new UspV1(encodedSections[i + 1]); - this.sections.put(UspV1.NAME, section); - } else if (sectionIds.get(i).equals(UsCaV1.ID)) { - UsCaV1 section = new UsCaV1(encodedSections[i + 1]); - this.sections.put(UsCaV1.NAME, section); - } else if (sectionIds.get(i).equals(UsNatV1.ID)) { - UsNatV1 section = new UsNatV1(encodedSections[i + 1]); - this.sections.put(UsNatV1.NAME, section); - } else if (sectionIds.get(i).equals(UsVaV1.ID)) { - UsVaV1 section = new UsVaV1(encodedSections[i + 1]); - this.sections.put(UsVaV1.NAME, section); - } else if (sectionIds.get(i).equals(UsCoV1.ID)) { - UsCoV1 section = new UsCoV1(encodedSections[i + 1]); - this.sections.put(UsCoV1.NAME, section); - } else if (sectionIds.get(i).equals(UsUtV1.ID)) { - UsUtV1 section = new UsUtV1(encodedSections[i + 1]); - this.sections.put(UsUtV1.NAME, section); - } else if (sectionIds.get(i).equals(UsCtV1.ID)) { - UsCtV1 section = new UsCtV1(encodedSections[i + 1]); - this.sections.put(UsCtV1.NAME, section); + protected Map decodeModel(String str) { + Map sections = new HashMap<>(); + + if(str != null && !str.isEmpty()) { + String[] encodedSections = str.split("~"); + HeaderV1 header = new HeaderV1(encodedSections[0]); + sections.put(HeaderV1.NAME, header); + + @SuppressWarnings("unchecked") + List sectionIds = (List) header.getFieldValue("SectionIds"); + for (int i = 0; i < sectionIds.size(); i++) { + if (sectionIds.get(i).equals(TcfEuV2.ID)) { + TcfEuV2 section = new TcfEuV2(encodedSections[i + 1]); + sections.put(TcfEuV2.NAME, section); + } else if (sectionIds.get(i).equals(TcfCaV1.ID)) { + TcfCaV1 section = new TcfCaV1(encodedSections[i + 1]); + sections.put(TcfCaV1.NAME, section); + } else if (sectionIds.get(i).equals(UspV1.ID)) { + UspV1 section = new UspV1(encodedSections[i + 1]); + sections.put(UspV1.NAME, section); + } else if (sectionIds.get(i).equals(UsCaV1.ID)) { + UsCaV1 section = new UsCaV1(encodedSections[i + 1]); + sections.put(UsCaV1.NAME, section); + } else if (sectionIds.get(i).equals(UsNatV1.ID)) { + UsNatV1 section = new UsNatV1(encodedSections[i + 1]); + sections.put(UsNatV1.NAME, section); + } else if (sectionIds.get(i).equals(UsVaV1.ID)) { + UsVaV1 section = new UsVaV1(encodedSections[i + 1]); + sections.put(UsVaV1.NAME, section); + } else if (sectionIds.get(i).equals(UsCoV1.ID)) { + UsCoV1 section = new UsCoV1(encodedSections[i + 1]); + sections.put(UsCoV1.NAME, section); + } else if (sectionIds.get(i).equals(UsUtV1.ID)) { + UsUtV1 section = new UsUtV1(encodedSections[i + 1]); + sections.put(UsUtV1.NAME, section); + } else if (sectionIds.get(i).equals(UsCtV1.ID)) { + UsCtV1 section = new UsCtV1(encodedSections[i + 1]); + sections.put(UsCtV1.NAME, section); + } } } + + return sections; } - public String encodeSection(int sectionId) throws EncodingException { + public String encodeSection(int sectionId) { return encodeSection(Sections.SECTION_ID_NAME_MAP.get(sectionId)); } - public String encodeSection(String sectionName) throws EncodingException { + public String encodeSection(String sectionName) { + if (!this.decoded) { + this.sections = this.decodeModel(this.encodedString); + this.dirty = false; + this.decoded = true; + } + if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).encode(); } else { @@ -273,11 +338,11 @@ public String encodeSection(String sectionName) throws EncodingException { } } - public void decodeSection(int sectionId, String encodedString) throws DecodingException { + public void decodeSection(int sectionId, String encodedString) { decodeSection(Sections.SECTION_ID_NAME_MAP.get(sectionId), encodedString); } - public void decodeSection(String sectionName, String encodedString) throws DecodingException { + public void decodeSection(String sectionName, String encodedString) { EncodableSection section = null; if (!this.sections.containsKey(sectionName)) { if (sectionName.equals(TcfEuV2.NAME)) { @@ -316,4 +381,22 @@ public void decodeSection(String sectionName, String encodedString) throws Decod section.decode(encodedString); } } -} + + public String encode() { + if (this.encodedString == null || this.encodedString.isEmpty() || this.dirty) { + this.encodedString = encodeModel(this.sections); + this.dirty = false; + this.decoded = true; + } + + return this.encodedString; + } + + public void decode(String encodedString) { + this.encodedString = encodedString; + this.dirty = false; + this.decoded = false; + } + + +} \ No newline at end of file diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/AbstractBase64UrlEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/base64/AbstractBase64UrlEncoder.java similarity index 94% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/AbstractBase64UrlEncoder.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/base64/AbstractBase64UrlEncoder.java index 698a0994..a5434073 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/AbstractBase64UrlEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/base64/AbstractBase64UrlEncoder.java @@ -1,9 +1,10 @@ -package com.iab.gpp.encoder.datatype.encoder; +package com.iab.gpp.encoder.base64; import java.util.Map; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; +import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; @@ -31,7 +32,7 @@ public abstract class AbstractBase64UrlEncoder { private static Pattern BASE64URL_VERIFICATION_PATTERN = Pattern.compile("^[A-Za-z0-9\\-_]*$", Pattern.CASE_INSENSITIVE); - public String encode(String bitString) throws EncodingException { + public String encode(String bitString) { // should only be 0 or 1 if (!BITSTRING_VERIFICATION_PATTERN.matcher(bitString).matches()) { throw new EncodingException("Unencodable Base64Url '" + bitString + "'"); @@ -58,7 +59,7 @@ public String encode(String bitString) throws EncodingException { return str; } - public String decode(String str) throws DecodingException { + public String decode(String str) { // should contain only characters from the base64url set if (!BASE64URL_VERIFICATION_PATTERN.matcher(str).matches()) { throw new DecodingException("Undecodable Base64URL string"); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/base64/CompressedBase64UrlEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/base64/CompressedBase64UrlEncoder.java new file mode 100644 index 00000000..4ebd7be7 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/base64/CompressedBase64UrlEncoder.java @@ -0,0 +1,38 @@ +package com.iab.gpp.encoder.base64; + +import java.util.Arrays; + +public class CompressedBase64UrlEncoder extends AbstractBase64UrlEncoder { + + private static CompressedBase64UrlEncoder instance = new CompressedBase64UrlEncoder(); + + private CompressedBase64UrlEncoder() { + + } + + public static CompressedBase64UrlEncoder getInstance() { + return instance; + } + + @Override + protected String pad(String bitString) { + char[] chars1 = null; + if(bitString.length() % 8 > 0) { + chars1 = new char[8 - (bitString.length() % 8)]; + } else { + chars1 = new char[0]; + } + Arrays.fill(chars1, '0'); + + char[] chars2 = null; + if((bitString.length() + chars1.length) % 6 > 0) { + chars2 = new char[6 - ((bitString.length() + chars1.length) % 6)]; + } else { + chars2 = new char[0]; + } + Arrays.fill(chars2, '0'); + + return bitString + new String(chars1) + new String(chars2); + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/base64/TraditionalBase64UrlEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/base64/TraditionalBase64UrlEncoder.java new file mode 100644 index 00000000..78ffe719 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/base64/TraditionalBase64UrlEncoder.java @@ -0,0 +1,28 @@ +package com.iab.gpp.encoder.base64; + +import java.util.Arrays; + +public class TraditionalBase64UrlEncoder extends AbstractBase64UrlEncoder { + + private static TraditionalBase64UrlEncoder instance = new TraditionalBase64UrlEncoder(); + + private TraditionalBase64UrlEncoder() { + + } + + public static TraditionalBase64UrlEncoder getInstance() { + return instance; + } + + @Override + protected String pad(String bitString) { + if(bitString.length() % 24 > 0) { + char[] chars = new char[24 - (bitString.length() % 24)]; + Arrays.fill(chars, '0'); + return bitString + new String(chars); + } else { + return bitString; + } + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/bitstring/BitStringEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/bitstring/BitStringEncoder.java new file mode 100644 index 00000000..20ef6fdd --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/bitstring/BitStringEncoder.java @@ -0,0 +1,50 @@ +package com.iab.gpp.encoder.bitstring; + +import java.util.List; +import com.iab.gpp.encoder.datatype.AbstractEncodableBitStringDataType; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; + +public class BitStringEncoder { + + private static BitStringEncoder instance = new BitStringEncoder(); + + private BitStringEncoder() { + + } + + public static BitStringEncoder getInstance() { + return instance; + } + + public String encode(EncodableBitStringFields fields, List fieldNames) { + String bitString = ""; + for (int i = 0; i < fieldNames.size(); i++) { + String fieldName = fieldNames.get(i); + if (fields.containsKey(fieldName)) { + AbstractEncodableBitStringDataType field = fields.get(fieldName); + bitString += field.encode(); + } else { + throw new EncodingException("Field not found: '" + fieldName + "'"); + } + } + + return bitString; + } + + public void decode(String bitString, List fieldNames, EncodableBitStringFields fields) { + int index = 0; + for (int i = 0; i < fieldNames.size(); i++) { + String fieldName = fieldNames.get(i); + if (fields.containsKey(fieldName)) { + AbstractEncodableBitStringDataType field = fields.get(fieldName); + String substring = field.substring(bitString, index); + field.decode(substring); + index += substring.length(); + } else { + throw new DecodingException("Field not found: '" + fieldName + "'"); + } + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java index 27359760..12a6011b 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java @@ -1,9 +1,6 @@ package com.iab.gpp.encoder.datatype; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; - -public abstract class AbstractEncodableBitStringDataType { +public abstract class AbstractEncodableBitStringDataType implements EncodableDataType { protected T value; protected AbstractEncodableBitStringDataType() { @@ -23,9 +20,5 @@ public void setValue(Object value) { this.value = (T) value; } - public abstract String encode() throws EncodingException; - - public abstract void decode(String bitString) throws DecodingException; - - public abstract String substring(String bitString, int fromIndex) throws DecodingException; + public abstract String substring(String str, int fromIndex); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/DataType.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/DataType.java new file mode 100644 index 00000000..8a0d2c07 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/DataType.java @@ -0,0 +1,7 @@ +package com.iab.gpp.encoder.datatype; + +public interface DataType { + boolean hasValue(); + T getValue(); + void setValue(Object value); +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java index 09d47ac7..a8f0b601 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java @@ -1,8 +1,6 @@ package com.iab.gpp.encoder.datatype; import com.iab.gpp.encoder.datatype.encoder.BooleanEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class EncodableBoolean extends AbstractEncodableBitStringDataType { @@ -15,11 +13,11 @@ public EncodableBoolean(Boolean value) { setValue(value); } - public String encode() throws EncodingException { + public String encode() { return BooleanEncoder.encode(this.value); } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { this.value = BooleanEncoder.decode(bitString); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDataType.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDataType.java new file mode 100644 index 00000000..94d416a6 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDataType.java @@ -0,0 +1,7 @@ +package com.iab.gpp.encoder.datatype; + +public interface EncodableDataType extends DataType { + String encode(); + + void decode(String str); +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java index f146d0aa..4fdfd447 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java @@ -2,7 +2,6 @@ import java.time.ZonedDateTime; import com.iab.gpp.encoder.datatype.encoder.DatetimeEncoder; -import com.iab.gpp.encoder.error.DecodingException; public class EncodableDatetime extends AbstractEncodableBitStringDataType { @@ -19,7 +18,7 @@ public String encode() { return DatetimeEncoder.encode(this.value); } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { this.value = DatetimeEncoder.decode(bitString); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java index 5d4e1783..dc413368 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java @@ -1,7 +1,6 @@ package com.iab.gpp.encoder.datatype; import com.iab.gpp.encoder.datatype.encoder.FibonacciIntegerEncoder; -import com.iab.gpp.encoder.error.DecodingException; public class EncodableFibonacciInteger extends AbstractEncodableBitStringDataType { @@ -18,7 +17,7 @@ public String encode() { return FibonacciIntegerEncoder.encode(this.value); } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { this.value = FibonacciIntegerEncoder.decode(bitString); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java index eaff0382..48d69559 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java @@ -22,7 +22,7 @@ public String encode() { return FibonacciIntegerRangeEncoder.encode(this.value); } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { this.value = FibonacciIntegerRangeEncoder.decode(bitString); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java index e0ae9b8e..5f4cd5e4 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java @@ -3,8 +3,6 @@ import java.util.ArrayList; import java.util.List; import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class EncodableFixedBitfield extends AbstractEncodableBitStringDataType> { @@ -21,11 +19,11 @@ public EncodableFixedBitfield(List value) { setValue(value); } - public String encode() throws EncodingException { + public String encode() { return FixedBitfieldEncoder.encode(this.value, this.numElements); } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { this.value = FixedBitfieldEncoder.decode(bitString); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java index 8b0fcb7e..05802f65 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java @@ -1,7 +1,6 @@ package com.iab.gpp.encoder.datatype; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; -import com.iab.gpp.encoder.error.DecodingException; public class EncodableFixedInteger extends AbstractEncodableBitStringDataType { @@ -22,7 +21,7 @@ public String encode() { return FixedIntegerEncoder.encode(this.value, this.bitStringLength); } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { this.value = FixedIntegerEncoder.decode(bitString); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java index ccaca886..9ac06346 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java @@ -3,8 +3,6 @@ import java.util.ArrayList; import java.util.List; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerListEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class EncodableFixedIntegerList extends AbstractEncodableBitStringDataType> { @@ -24,11 +22,11 @@ public EncodableFixedIntegerList(int elementBitStringLength, List value setValue(value); } - public String encode() throws EncodingException { + public String encode() { return FixedIntegerListEncoder.encode(this.value, this.elementBitStringLength, this.numElements); } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { this.value = FixedIntegerListEncoder.decode(bitString, this.elementBitStringLength, this.numElements); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java index e43751af..d78f5186 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java @@ -5,7 +5,6 @@ import java.util.TreeSet; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerRangeEncoder; -import com.iab.gpp.encoder.error.DecodingException; public class EncodableFixedIntegerRange extends AbstractEncodableBitStringDataType> { @@ -22,11 +21,11 @@ public String encode() { return FixedIntegerRangeEncoder.encode(this.value); } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { this.value = FixedIntegerRangeEncoder.decode(bitString); } - public String substring(String bitString, int fromIndex) throws DecodingException { + public String substring(String bitString, int fromIndex) { // TODO: add some validation int count = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 12)); int index = fromIndex + 12; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java index ed736fc2..f7c92665 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java @@ -1,8 +1,6 @@ package com.iab.gpp.encoder.datatype; import com.iab.gpp.encoder.datatype.encoder.FixedStringEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class EncodableFixedString extends AbstractEncodableBitStringDataType { @@ -19,11 +17,11 @@ public EncodableFixedString(int stringLength, String value) { setValue(value); } - public String encode() throws EncodingException { + public String encode() { return FixedStringEncoder.encode(this.value, this.stringLength); } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { this.value = FixedStringEncoder.decode(bitString); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java index 93c3c26b..b38235ac 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java @@ -4,8 +4,6 @@ import java.util.List; import java.util.function.IntSupplier; import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class EncodableFlexibleBitfield extends AbstractEncodableBitStringDataType> { @@ -22,11 +20,11 @@ public EncodableFlexibleBitfield(IntSupplier getLengthSupplier, List va this.setValue(value); } - public String encode() throws EncodingException { + public String encode() { return FixedBitfieldEncoder.encode(this.value, this.getLengthSupplier.getAsInt()); } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { this.value = FixedBitfieldEncoder.decode(bitString); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java index d32dcc49..891ff673 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java @@ -7,7 +7,6 @@ import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class EncodableOptimizedFibonacciRange extends AbstractEncodableBitStringDataType> { @@ -20,7 +19,7 @@ public EncodableOptimizedFibonacciRange(List value) { setValue(value); } - public String encode() throws EncodingException { + public String encode() { // TODO: encoding the range before choosing the shortest is inefficient. There is probably a way // to identify in advance which will be shorter based on the array length and values int max = this.value.size() > 0 ? this.value.get(this.value.size() - 1) : 0; @@ -45,7 +44,7 @@ public String encode() throws EncodingException { } } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { if (bitString.charAt(16) == '1') { this.value = FibonacciIntegerRangeEncoder.decode(bitString.substring(17)); } else { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java index d3250f07..9dbbf5ae 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java @@ -6,8 +6,6 @@ import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerRangeEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class EncodableOptimizedFixedRange extends AbstractEncodableBitStringDataType> { @@ -20,7 +18,7 @@ public EncodableOptimizedFixedRange(List value) { setValue(value); } - public String encode() throws EncodingException { + public String encode() { // TODO: encoding the range before choosing the shortest is inefficient. There is probably a way // to identify in advance which will be shorter based on the array length and values int max = this.value.size() > 0 ? this.value.get(this.value.size() - 1) : 0; @@ -46,7 +44,7 @@ public String encode() throws EncodingException { } } - public void decode(String bitString) throws DecodingException { + public void decode(String bitString) { if (bitString.charAt(16) == '1') { this.value = FixedIntegerRangeEncoder.decode(bitString.substring(17)); } else { @@ -61,7 +59,7 @@ public void decode(String bitString) throws DecodingException { } } - public String substring(String bitString, int fromIndex) throws DecodingException { + public String substring(String bitString, int fromIndex) { int max = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 16)); if (bitString.charAt(fromIndex + 16) == '1') { return bitString.substring(fromIndex, fromIndex + 17) diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableCharacter.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableCharacter.java new file mode 100644 index 00000000..31fd0caa --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableCharacter.java @@ -0,0 +1,26 @@ +package com.iab.gpp.encoder.datatype; + +public class UnencodableCharacter implements DataType { + + private Character value = null; + + public UnencodableCharacter(Character value) { + this.value = value; + } + + @Override + public boolean hasValue() { + return this.value != null; + } + + @Override + public Character getValue() { + return this.value; + } + + @Override + public void setValue(Object value) { + this.value = value.toString().charAt(0); + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableInteger.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableInteger.java new file mode 100644 index 00000000..7435ff2d --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableInteger.java @@ -0,0 +1,26 @@ +package com.iab.gpp.encoder.datatype; + +public class UnencodableInteger implements DataType { + + private Integer value = null; + + public UnencodableInteger(Integer value) { + this.value = value; + } + + @Override + public boolean hasValue() { + return this.value != null; + } + + @Override + public Integer getValue() { + return this.value; + } + + @Override + public void setValue(Object value) { + this.value = (Integer)value; + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoder.java index b49ff391..20e6cbd0 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoder.java @@ -4,7 +4,7 @@ import com.iab.gpp.encoder.error.EncodingException; public class BooleanEncoder { - public static String encode(Boolean value) throws EncodingException { + public static String encode(Boolean value) { if (value == true) { return "1"; } else if (value == false) { @@ -14,7 +14,7 @@ public static String encode(Boolean value) throws EncodingException { } } - public static boolean decode(String bitString) throws DecodingException { + public static boolean decode(String bitString) { if (bitString.equals("1")) { return true; } else if (bitString.equals("0")) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/CompressedBase64UrlEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/CompressedBase64UrlEncoder.java deleted file mode 100644 index c41e7465..00000000 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/CompressedBase64UrlEncoder.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.iab.gpp.encoder.datatype.encoder; - -public class CompressedBase64UrlEncoder extends AbstractBase64UrlEncoder { - - @Override - protected String pad(String bitString) { - while (bitString.length() % 8 > 0) { - bitString += "0"; - } - while (bitString.length() % 6 > 0) { - bitString += "0"; - } - - return bitString; - } - -} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoder.java index 20a71c13..05c53dcd 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoder.java @@ -4,13 +4,12 @@ import java.util.List; import java.util.regex.Pattern; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class FixedBitfieldEncoder { private static Pattern BITSTRING_VERIFICATION_PATTERN = Pattern.compile("^[0-1]*$", Pattern.CASE_INSENSITIVE); - public static String encode(List value, int bitStringLength) throws EncodingException { + public static String encode(List value, int bitStringLength) { String bitString = ""; for (int i = 0; i < value.size(); i++) { bitString += BooleanEncoder.encode(value.get(i)); @@ -23,7 +22,7 @@ public static String encode(List value, int bitStringLength) throws Enc return bitString; } - public static List decode(String bitString) throws DecodingException { + public static List decode(String bitString) { if (!BITSTRING_VERIFICATION_PATTERN.matcher(bitString).matches()) { throw new DecodingException("Undecodable FixedBitfield '" + bitString + "'"); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java index ba829322..e130f50d 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java @@ -4,14 +4,12 @@ import java.util.List; import java.util.regex.Pattern; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class FixedIntegerListEncoder { private static Pattern BITSTRING_VERIFICATION_PATTERN = Pattern.compile("^[0-1]*$", Pattern.CASE_INSENSITIVE); - public static String encode(List value, int elementBitStringLength, int numElements) - throws EncodingException { + public static String encode(List value, int elementBitStringLength, int numElements) { String bitString = ""; for (int i = 0; i < value.size(); i++) { bitString += FixedIntegerEncoder.encode(value.get(i), elementBitStringLength); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoder.java index 5cb8762a..38db681e 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoder.java @@ -8,7 +8,7 @@ public class FixedStringEncoder { private static Pattern BITSTRING_VERIFICATION_PATTERN = Pattern.compile("^[0-1]*$", Pattern.CASE_INSENSITIVE); - public static String encode(String value, int stringLength) throws EncodingException { + public static String encode(String value, int stringLength) { while (value.length() < stringLength) { value += " "; } @@ -29,7 +29,7 @@ public static String encode(String value, int stringLength) throws EncodingExcep return bitString; } - public static String decode(String bitString) throws DecodingException { + public static String decode(String bitString) { if (!BITSTRING_VERIFICATION_PATTERN.matcher(bitString).matches() || bitString.length() % 6 != 0) { throw new DecodingException("Undecodable FixedString '" + bitString + "'"); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoder.java deleted file mode 100644 index 848bbfe5..00000000 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoder.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.iab.gpp.encoder.datatype.encoder; - -public class TraditionalBase64UrlEncoder extends AbstractBase64UrlEncoder { - - @Override - protected String pad(String bitString) { - while (bitString.length() % 24 > 0) { - bitString += "0"; - } - return bitString; - } - -} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/DecodingException.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/DecodingException.java index 91c29b2f..d60c3459 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/DecodingException.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/DecodingException.java @@ -1,6 +1,6 @@ package com.iab.gpp.encoder.error; -public class DecodingException extends Exception { +public class DecodingException extends RuntimeException { private static final long serialVersionUID = 2098268445119981680L; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/EncodingException.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/EncodingException.java index 2c7f80ad..a7f19355 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/EncodingException.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/EncodingException.java @@ -1,6 +1,6 @@ package com.iab.gpp.encoder.error; -public class EncodingException extends Exception { +public class EncodingException extends RuntimeException { private static final long serialVersionUID = 1161321945571871601L; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/InvalidFieldException.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/InvalidFieldException.java index 5b1e1aa9..22113280 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/InvalidFieldException.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/InvalidFieldException.java @@ -1,6 +1,6 @@ package com.iab.gpp.encoder.error; -public class InvalidFieldException extends Exception { +public class InvalidFieldException extends RuntimeException { private static final long serialVersionUID = 2098268445119981680L; diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/LazyDecodingException.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/LazyDecodingException.java deleted file mode 100644 index 070a02d8..00000000 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/LazyDecodingException.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.iab.gpp.encoder.error; - -public class LazyDecodingException extends DecodingException { - - private static final long serialVersionUID = 2098268445119981680L; - - public LazyDecodingException(String msg) { - super(msg); - } - - public LazyDecodingException(Exception e) { - super(e); - } - - public LazyDecodingException(String msg, Exception e) { - super(msg, e); - } -} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/EncodableBitStringFields.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/EncodableBitStringFields.java new file mode 100644 index 00000000..d2ac0f43 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/EncodableBitStringFields.java @@ -0,0 +1,31 @@ +package com.iab.gpp.encoder.field; + +import java.util.HashMap; +import java.util.Map; +import com.iab.gpp.encoder.datatype.AbstractEncodableBitStringDataType; + +public class EncodableBitStringFields implements Fields> { + + private Map> fields = new HashMap<>(); + + public boolean containsKey(String key) { + return this.fields.containsKey(key); + } + + public void put(String key, AbstractEncodableBitStringDataType value) { + this.fields.put(key, value); + } + + public AbstractEncodableBitStringDataType get(String key) { + return this.fields.get(key); + } + + public Map> getAll() { + return new HashMap<>(this.fields); + } + + public void reset(Fields> fields) { + this.fields.clear(); + this.fields.putAll(fields.getAll()); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/Fields.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/Fields.java new file mode 100644 index 00000000..ca091e7f --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/Fields.java @@ -0,0 +1,14 @@ +package com.iab.gpp.encoder.field; + +import java.util.Map; +import com.iab.gpp.encoder.datatype.DataType; + +public interface Fields> { + + boolean containsKey(String key); + void put(String key, T value); + T get(String key); + Map getAll(); + void reset(Fields fields); + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/GenericFields.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/GenericFields.java new file mode 100644 index 00000000..00263e55 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/GenericFields.java @@ -0,0 +1,31 @@ +package com.iab.gpp.encoder.field; + +import java.util.HashMap; +import java.util.Map; +import com.iab.gpp.encoder.datatype.DataType; + +public class GenericFields implements Fields> { + + private Map> fields = new HashMap<>(); + + public boolean containsKey(String key) { + return this.fields.containsKey(key); + } + + public void put(String key, DataType value) { + this.fields.put(key, value); + } + + public DataType get(String key) { + return this.fields.get(key); + } + + public Map> getAll() { + return new HashMap<>(this.fields); + } + + public void reset(Fields> fields) { + this.fields.clear(); + this.fields.putAll(fields.getAll()); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/HeaderV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/HeaderV1Field.java index 384befab..17f1f5d9 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/HeaderV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/HeaderV1Field.java @@ -1,9 +1,21 @@ package com.iab.gpp.encoder.field; +import java.util.Arrays; +import java.util.List; + public class HeaderV1Field { public static String ID = "Id"; public static String VERSION = "Version"; public static String SECTION_IDS = "SectionIds"; + //@formatter:off + public static List HEADER_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + HeaderV1Field.ID, + HeaderV1Field.VERSION, + HeaderV1Field.SECTION_IDS + }); + //@formatter:on + + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV1Field.java index 86c91dff..4cacd6dc 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV1Field.java @@ -1,5 +1,8 @@ package com.iab.gpp.encoder.field; +import java.util.Arrays; +import java.util.List; + public class TcfCaV1Field { public static String VERSION = "Version"; @@ -25,4 +28,34 @@ public class TcfCaV1Field { public static String CUSTOM_PURPOSES_EXPRESS_CONSENT = "CustomPurposesExpressConsent"; public static String CUSTOM_PURPOSES_IMPLIED_CONSENT = "CustomPurposesImpliedConsent"; + //@formatter:off + public static List TCFCAV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + TcfCaV1Field.VERSION, + TcfCaV1Field.CREATED, + TcfCaV1Field.LAST_UPDATED, + TcfCaV1Field.CMP_ID, + TcfCaV1Field.CMP_VERSION, + TcfCaV1Field.CONSENT_SCREEN, + TcfCaV1Field.CONSENT_LANGUAGE, + TcfCaV1Field.VENDOR_LIST_VERSION, + TcfCaV1Field.TCF_POLICY_VERSION, + TcfCaV1Field.USE_NON_STANDARD_STACKS, + TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT, + TcfCaV1Field.PURPOSES_EXPRESS_CONSENT, + TcfCaV1Field.PURPOSES_IMPLIED_CONSENT, + TcfCaV1Field.VENDOR_EXPRESS_CONSENT, + TcfCaV1Field.VENDOR_IMPLIED_CONSENT + }); + //@formatter:on + + //@formatter:off + public static List TCFCAV1_PUBLISHER_PURPOSES_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + TcfCaV1Field.PUB_PURPOSES_SEGMENT_TYPE, + TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT, + TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT, + TcfCaV1Field.NUM_CUSTOM_PURPOSES, + TcfCaV1Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, + TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, + }); + //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfEuV2Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfEuV2Field.java index 660443c3..fedb510f 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfEuV2Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfEuV2Field.java @@ -1,5 +1,8 @@ package com.iab.gpp.encoder.field; +import java.util.Arrays; +import java.util.List; + public class TcfEuV2Field { public static String VERSION = "Version"; @@ -32,4 +35,52 @@ public class TcfEuV2Field { public static String VENDORS_DISCLOSED_SEGMENT_TYPE = "VendorsDisclosedSegmentType"; public static String VENDORS_DISCLOSED = "VendorsDisclosed"; + //@formatter:off + public static List TCFEUV2_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + TcfEuV2Field.VERSION, + TcfEuV2Field.CREATED, + TcfEuV2Field.LAST_UPDATED, + TcfEuV2Field.CMP_ID, + TcfEuV2Field.CMP_VERSION, + TcfEuV2Field.CONSENT_SCREEN, + TcfEuV2Field.CONSENT_LANGUAGE, + TcfEuV2Field.VENDOR_LIST_VERSION, + TcfEuV2Field.POLICY_VERSION, + TcfEuV2Field.IS_SERVICE_SPECIFIC, + TcfEuV2Field.USE_NON_STANDARD_STACKS, + TcfEuV2Field.SPECIAL_FEATURE_OPTINS, + TcfEuV2Field.PURPOSE_CONSENTS, + TcfEuV2Field.PURPOSE_LEGITIMATE_INTERESTS, + TcfEuV2Field.PURPOSE_ONE_TREATMENT, + TcfEuV2Field.PUBLISHER_COUNTRY_CODE, + TcfEuV2Field.VENDOR_CONSENTS, + TcfEuV2Field.VENDOR_LEGITIMATE_INTERESTS, + TcfEuV2Field.PUBLISHER_RESTRICTIONS + }); + //@formatter:on + + //@formatter:off + public static List TCFEUV2_PUBLISHER_PURPOSES_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + TcfEuV2Field.PUBLISHER_PURPOSES_SEGMENT_TYPE, + TcfEuV2Field.PUBLISHER_CONSENTS, + TcfEuV2Field.PUBLISHER_LEGITIMATE_INTERESTS, + TcfEuV2Field.NUM_CUSTOM_PURPOSES, + TcfEuV2Field.PUBLISHER_CUSTOM_CONSENTS, + TcfEuV2Field.PUBLISHER_CUSTOM_LEGITIMATE_INTERESTS, + }); + //@formatter:on + + //@formatter:off + public static List TCFEUV2_VENDORS_ALLOWED_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + TcfEuV2Field.VENDORS_ALLOWED_SEGMENT_TYPE, + TcfEuV2Field.VENDORS_ALLOWED, + }); + //@formatter:on + + //@formatter:off + public static List TCFEUV2_VENDORS_DISCLOSED_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + TcfEuV2Field.VENDORS_DISCLOSED_SEGMENT_TYPE, + TcfEuV2Field.VENDORS_DISCLOSED, + }); + //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaV1Field.java index 0c139803..07c1a13f 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaV1Field.java @@ -1,5 +1,8 @@ package com.iab.gpp.encoder.field; +import java.util.Arrays; +import java.util.List; + public class UsCaV1Field { public static String VERSION = "Version"; @@ -19,4 +22,27 @@ public class UsCaV1Field { public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; public static String GPC = "Gpc"; + //@formatter:off + public static List USCAV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCaV1Field.VERSION, + UsCaV1Field.SALE_OPT_OUT_NOTICE, + UsCaV1Field.SHARING_OPT_OUT_NOTICE, + UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, + UsCaV1Field.SALE_OPT_OUT, + UsCaV1Field.SHARING_OPT_OUT, + UsCaV1Field.SENSITIVE_DATA_PROCESSING, + UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsCaV1Field.PERSONAL_DATA_CONSENTS, + UsCaV1Field.MSPA_COVERED_TRANSACTION, + UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USCAV1_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCaV1Field.GPC_SEGMENT_TYPE, + UsCaV1Field.GPC + }); + //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoV1Field.java index 8bcce1a3..36489c13 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoV1Field.java @@ -1,5 +1,8 @@ package com.iab.gpp.encoder.field; +import java.util.Arrays; +import java.util.List; + public class UsCoV1Field { public static String VERSION = "Version"; @@ -17,4 +20,27 @@ public class UsCoV1Field { public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; public static String GPC = "Gpc"; + + //@formatter:off + public static List USCOV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCoV1Field.VERSION, + UsCoV1Field.SHARING_NOTICE, + UsCoV1Field.SALE_OPT_OUT_NOTICE, + UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsCoV1Field.SALE_OPT_OUT, + UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, + UsCoV1Field.SENSITIVE_DATA_PROCESSING, + UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsCoV1Field.MSPA_COVERED_TRANSACTION, + UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USCOV1_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCoV1Field.GPC_SEGMENT_TYPE, + UsCoV1Field.GPC + }); + //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtV1Field.java index ba7b9b07..31e67a69 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtV1Field.java @@ -1,5 +1,8 @@ package com.iab.gpp.encoder.field; +import java.util.Arrays; +import java.util.List; + public class UsCtV1Field { public static String VERSION = "Version"; @@ -17,4 +20,27 @@ public class UsCtV1Field { public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; public static String GPC = "Gpc"; + + //@formatter:off + public static List USCTV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCtV1Field.VERSION, + UsCtV1Field.SHARING_NOTICE, + UsCtV1Field.SALE_OPT_OUT_NOTICE, + UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsCtV1Field.SALE_OPT_OUT, + UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, + UsCtV1Field.SENSITIVE_DATA_PROCESSING, + UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsCtV1Field.MSPA_COVERED_TRANSACTION, + UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USCTV1_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCtV1Field.GPC_SEGMENT_TYPE, + UsCtV1Field.GPC + }); + //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatV1Field.java index 5a023e8f..0bdf0fb6 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatV1Field.java @@ -1,5 +1,8 @@ package com.iab.gpp.encoder.field; +import java.util.Arrays; +import java.util.List; + public class UsNatV1Field { public static String VERSION = "Version"; @@ -23,4 +26,31 @@ public class UsNatV1Field { public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; public static String GPC = "Gpc"; + //@formatter:off + public static List USNATV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsNatV1Field.VERSION, + UsNatV1Field.SHARING_NOTICE, + UsNatV1Field.SALE_OPT_OUT_NOTICE, + UsNatV1Field.SHARING_OPT_OUT_NOTICE, + UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, + UsNatV1Field.SALE_OPT_OUT, + UsNatV1Field.SHARING_OPT_OUT, + UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, + UsNatV1Field.SENSITIVE_DATA_PROCESSING, + UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsNatV1Field.PERSONAL_DATA_CONSENTS, + UsNatV1Field.MSPA_COVERED_TRANSACTION, + UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USNATV1_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsNatV1Field.GPC_SEGMENT_TYPE, + UsNatV1Field.GPC + }); + //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtV1Field.java index 7a649e90..be7584a4 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtV1Field.java @@ -1,5 +1,8 @@ package com.iab.gpp.encoder.field; +import java.util.Arrays; +import java.util.List; + public class UsUtV1Field { public static String VERSION = "Version"; @@ -14,4 +17,21 @@ public class UsUtV1Field { public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + //@formatter:off + public static List USUTV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsUtV1Field.VERSION, + UsUtV1Field.SHARING_NOTICE, + UsUtV1Field.SALE_OPT_OUT_NOTICE, + UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + UsUtV1Field.SALE_OPT_OUT, + UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, + UsUtV1Field.SENSITIVE_DATA_PROCESSING, + UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsUtV1Field.MSPA_COVERED_TRANSACTION, + UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaV1Field.java index 6125d171..e926b916 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaV1Field.java @@ -1,5 +1,8 @@ package com.iab.gpp.encoder.field; +import java.util.Arrays; +import java.util.List; + public class UsVaV1Field { public static String VERSION = "Version"; @@ -14,4 +17,19 @@ public class UsVaV1Field { public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + //@formatter:off + public static List USVAV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsVaV1Field.VERSION, + UsVaV1Field.SHARING_NOTICE, + UsVaV1Field.SALE_OPT_OUT_NOTICE, + UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsVaV1Field.SALE_OPT_OUT, + UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, + UsVaV1Field.SENSITIVE_DATA_PROCESSING, + UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsVaV1Field.MSPA_COVERED_TRANSACTION, + UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, + UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspV1Field.java index c5346823..2551632c 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspV1Field.java @@ -1,5 +1,8 @@ package com.iab.gpp.encoder.field; +import java.util.Arrays; +import java.util.List; + public class UspV1Field { public static String VERSION = "Version"; @@ -7,4 +10,12 @@ public class UspV1Field { public static String OPT_OUT_SALE = "OptOutSale"; public static String LSPA_COVERED = "LspaCovered"; + //@formatter:off + public static List USPV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UspV1Field.VERSION, + UspV1Field.NOTICE, + UspV1Field.OPT_OUT_SALE, + UspV1Field.LSPA_COVERED + }); + //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspV1LegacyField.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspV1LegacyField.java deleted file mode 100644 index 3b1642c1..00000000 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UspV1LegacyField.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.iab.gpp.encoder.field; - -public class UspV1LegacyField { - - public static String VERSION = "Version"; - public static String NOTICE = "Notice"; - public static String OPT_OUT_SALE = "OptOutSale"; - public static String LSPA_COVERED = "LspaCovered"; - -} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableBitStringSection.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableBitStringSection.java deleted file mode 100644 index 5b8f0b7c..00000000 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableBitStringSection.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.iab.gpp.encoder.section; - -import java.util.Map; -import com.iab.gpp.encoder.datatype.AbstractEncodableBitStringDataType; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; - -public abstract class AbstractEncodableBitStringSection implements EncodableSection { - protected Map> fields; - protected String[] fieldOrder; - - @Override - public boolean hasField(String fieldName) { - return this.fields.containsKey(fieldName); - } - - @Override - public Object getFieldValue(String fieldName) { - if (this.fields.containsKey(fieldName)) { - return this.fields.get(fieldName).getValue(); - } else { - return null; - } - } - - @Override - public void setFieldValue(String fieldName, Object value) throws InvalidFieldException { - if (this.fields.containsKey(fieldName)) { - this.fields.get(fieldName).setValue(value); - } else { - throw new InvalidFieldException(fieldName + " not found"); - } - } - - public String[] getFieldOrder() { - return this.fieldOrder; - } - - public String encodeToBitString() throws EncodingException { - String bitString = ""; - for (int i = 0; i < this.fieldOrder.length; i++) { - String fieldName = this.fieldOrder[i]; - if (this.fields.containsKey(fieldName)) { - AbstractEncodableBitStringDataType field = this.fields.get(fieldName); - bitString += field.encode(); - } else { - throw new EncodingException("Field not found: '" + fieldName + "'"); - } - } - - return bitString; - } - - public void decodeFromBitString(String bitString) throws DecodingException { - int index = 0; - for (int i = 0; i < this.fieldOrder.length; i++) { - String fieldName = this.fieldOrder[i]; - if (this.fields.containsKey(fieldName)) { - AbstractEncodableBitStringDataType field = this.fields.get(fieldName); - String substring = field.substring(bitString, index); - field.decode(substring); - index += substring.length(); - } else { - throw new DecodingException("Field not found: '" + fieldName + "'"); - } - } - } - - @Override - public abstract String encode() throws EncodingException; - - @Override - public abstract void decode(String encodedString) throws DecodingException; - - @Override - public abstract int getId(); - - @Override - public abstract String getName(); -} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java deleted file mode 100644 index d9339189..00000000 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.iab.gpp.encoder.section; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import com.iab.gpp.encoder.datatype.AbstractEncodableBitStringDataType; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; - -public abstract class AbstractEncodableSegmentedBitStringSection implements EncodableSection { - protected Map> fields; - protected String[][] segments; - - @Override - public boolean hasField(String fieldName) { - return this.fields.containsKey(fieldName); - } - - @Override - public Object getFieldValue(String fieldName) { - if (this.fields.containsKey(fieldName)) { - return this.fields.get(fieldName).getValue(); - } else { - return null; - } - } - - @Override - public void setFieldValue(String fieldName, Object value) throws InvalidFieldException { - if (this.fields.containsKey(fieldName)) { - this.fields.get(fieldName).setValue(value); - } else { - throw new InvalidFieldException(fieldName + " not found"); - } - } - - public String[][] getSegments() { - return this.segments; - } - - public List encodeSegmentsToBitStrings() throws EncodingException { - List segmentBitStrings = new ArrayList<>(); - for (int i = 0; i < this.segments.length; i++) { - String segmentBitString = ""; - for (int j = 0; j < this.segments[i].length; j++) { - String fieldName = this.segments[i][j]; - if (this.fields.containsKey(fieldName)) { - try { - AbstractEncodableBitStringDataType field = this.fields.get(fieldName); - segmentBitString += field.encode(); - } catch (Exception e) { - throw new EncodingException("Unable to encode " + fieldName, e); - } - } else { - throw new EncodingException("Field not found: '" + fieldName + "'"); - } - } - segmentBitStrings.add(segmentBitString); - } - - return segmentBitStrings; - } - - public void decodeSegmentsFromBitStrings(List segmentBitStrings) throws DecodingException { - for (int i = 0; i < this.segments.length && i < segmentBitStrings.size(); i++) { - String segmentBitString = segmentBitStrings.get(i); - if (segmentBitString != null && segmentBitString.length() > 0) { - int index = 0; - for (int j = 0; j < this.segments[i].length; j++) { - String fieldName = this.segments[i][j]; - if (this.fields.containsKey(fieldName)) { - try { - AbstractEncodableBitStringDataType field = this.fields.get(fieldName); - String substring = field.substring(segmentBitString, index); - field.decode(substring); - index += substring.length(); - } catch (Exception e) { - throw new DecodingException("Unable to decode " + fieldName, e); - } - } else { - throw new DecodingException("Field not found: '" + fieldName + "'"); - } - } - } - } - } - - @Override - public abstract String encode() throws EncodingException; - - @Override - public abstract void decode(String encodedString) throws DecodingException; - - @Override - public abstract int getId(); - - @Override - public abstract String getName(); -} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractLazilyEncodableSection.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractLazilyEncodableSection.java new file mode 100644 index 00000000..5e97e144 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractLazilyEncodableSection.java @@ -0,0 +1,91 @@ +package com.iab.gpp.encoder.section; + +import java.util.List; +import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.segment.EncodableSegment; + +public abstract class AbstractLazilyEncodableSection implements EncodableSection { + + private List segments; + + private String encodedString = null; + + private boolean dirty = false; + private boolean decoded = true; + + public AbstractLazilyEncodableSection() { + this.segments = initializeSegments(); + } + + protected abstract List initializeSegments(); + + protected abstract String encodeSection(List segments); + + protected abstract List decodeSection(String encodedString); + + public boolean hasField(String fieldName) { + if (!this.decoded) { + this.segments = this.decodeSection(this.encodedString); + this.dirty = false; + this.decoded = true; + } + + for(EncodableSegment segment : segments) { + if(segment.getFieldNames().contains(fieldName)) { + return segment.hasField(fieldName); + } + } + + return false; + } + + public Object getFieldValue(String fieldName) { + if (!this.decoded) { + this.segments = this.decodeSection(this.encodedString); + this.dirty = false; + this.decoded = true; + } + + for(EncodableSegment segment : segments) { + if(segment.hasField(fieldName)) { + return segment.getFieldValue(fieldName); + } + } + + throw new InvalidFieldException("Invalid field: '" + fieldName + "'"); + } + + public void setFieldValue(String fieldName, Object value) { + if (!this.decoded) { + this.segments = this.decodeSection(this.encodedString); + this.dirty = false; + this.decoded = true; + } + + for(EncodableSegment segment : segments) { + if(segment.hasField(fieldName)) { + segment.setFieldValue(fieldName, value); + return; + } + } + + throw new InvalidFieldException("Invalid field: '" + fieldName + "'"); + } + + public String encode() { + if (this.encodedString == null || this.encodedString.isEmpty() || this.dirty) { + this.encodedString = this.encodeSection(this.segments); + this.dirty = false; + this.decoded = true; + } + + return this.encodedString; + } + + public void decode(String encodedString) { + this.encodedString = encodedString; + this.dirty = false; + this.decoded = false; + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/EncodableSection.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/EncodableSection.java index a547e6d3..e1f0a854 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/EncodableSection.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/EncodableSection.java @@ -1,22 +1,20 @@ package com.iab.gpp.encoder.section; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; - public interface EncodableSection { int getId(); String getName(); + int getVersion(); + boolean hasField(String fieldName); Object getFieldValue(String fieldName); - void setFieldValue(String fieldName, Object value) throws InvalidFieldException; + void setFieldValue(String fieldName, Object value); - String encode() throws EncodingException; + String encode(); - void decode(String encodedString) throws DecodingException; + void decode(String encodedString); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/HeaderV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/HeaderV1.java index 59ec9483..fd5d991c 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/HeaderV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/HeaderV1.java @@ -1,79 +1,79 @@ package com.iab.gpp.encoder.section; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import com.iab.gpp.encoder.datatype.EncodableFibonacciIntegerRange; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.HeaderV1Field; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.HeaderV1CoreSegment; -public class HeaderV1 extends AbstractEncodableBitStringSection { +public class HeaderV1 extends AbstractLazilyEncodableSection { + public static int ID = 3; public static int VERSION = 1; public static String NAME = "header"; - private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - public HeaderV1() { - initFields(); + super(); } - public HeaderV1(String encodedString) throws DecodingException { - initFields(); - - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } + public HeaderV1(String encodedString) { + super(); + decode(encodedString); } - private void initFields() { - fields = new HashMap<>(); - fields.put(HeaderV1Field.ID, new EncodableFixedInteger(6, HeaderV1.ID)); - fields.put(HeaderV1Field.VERSION, new EncodableFixedInteger(6, HeaderV1.VERSION)); - fields.put(HeaderV1Field.SECTION_IDS, new EncodableFibonacciIntegerRange(new ArrayList<>())); - - //@formatter:off - fieldOrder = new String[] { - HeaderV1Field.ID, - HeaderV1Field.VERSION, - HeaderV1Field.SECTION_IDS - }; - //@formatter:on + @Override + public int getId() { + return HeaderV1.ID; } @Override - public String encode() throws EncodingException { - String bitString = this.encodeToBitString(); - String encodedString = base64UrlEncoder.encode(bitString); - return encodedString; + public String getName() { + return HeaderV1.NAME; } @Override - public void decode(String encodedString) throws DecodingException { - String bitString = base64UrlEncoder.decode(encodedString); - this.decodeFromBitString(bitString); + public int getVersion() { + return HeaderV1.VERSION; } @Override - public int getId() { - return HeaderV1.ID; + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new HeaderV1CoreSegment()); + return segments; } - + @Override - public String getName() { - return HeaderV1.NAME; + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + for(int i=0; i i) { + segments.get(i).decode(encodedSegments[i]); + } + } + } + + return segments; } - public Integer getVersion() { - return (Integer) this.fields.get(HeaderV1Field.VERSION).getValue(); + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + for(EncodableSegment segment : segments) { + encodedSegments.add(segment.encode()); + } + return String.join(".", encodedSegments); } + @SuppressWarnings("unchecked") public List getSectionsIds() { - return (List) this.fields.get(HeaderV1Field.SECTION_IDS).getValue(); + return (List) this.getFieldValue(HeaderV1Field.SECTION_IDS); } + + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java index ec3b4891..684aaee5 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java @@ -3,174 +3,92 @@ import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.function.IntSupplier; -import java.util.stream.Collectors; -import com.iab.gpp.encoder.datatype.EncodableBoolean; -import com.iab.gpp.encoder.datatype.EncodableDatetime; -import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedString; -import com.iab.gpp.encoder.datatype.EncodableFlexibleBitfield; -import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfCaV1Field; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.TcfCaV1CoreSegment; +import com.iab.gpp.encoder.segment.TcfCaV1PublisherPurposesSegment; -public class TcfCaV1 extends AbstractEncodableSegmentedBitStringSection { +public class TcfCaV1 extends AbstractLazilyEncodableSection { + public static int ID = 5; public static int VERSION = 1; public static String NAME = "tcfcav1"; - private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - public TcfCaV1() { - initFields(); + super(); } - public TcfCaV1(String encodedString) throws DecodingException { - initFields(); + public TcfCaV1(String encodedString) { + super(); + decode(encodedString); + } - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } + @Override + public int getId() { + return TcfCaV1.ID; } - private void initFields() { - fields = new HashMap<>(); - - ZonedDateTime date = ZonedDateTime.now(); - - // core section - fields.put(TcfCaV1Field.VERSION, new EncodableFixedInteger(6, TcfCaV1.VERSION)); - fields.put(TcfCaV1Field.CREATED, new EncodableDatetime(date)); - fields.put(TcfCaV1Field.LAST_UPDATED, new EncodableDatetime(date)); - fields.put(TcfCaV1Field.CMP_ID, new EncodableFixedInteger(12, 0)); - fields.put(TcfCaV1Field.CMP_VERSION, new EncodableFixedInteger(12, 0)); - fields.put(TcfCaV1Field.CONSENT_SCREEN, new EncodableFixedInteger(6, 0)); - fields.put(TcfCaV1Field.CONSENT_LANGUAGE, new EncodableFixedString(2, "EN")); - fields.put(TcfCaV1Field.VENDOR_LIST_VERSION, new EncodableFixedInteger(12, 0)); - fields.put(TcfCaV1Field.TCF_POLICY_VERSION, new EncodableFixedInteger(6, 2)); - fields.put(TcfCaV1Field.USE_NON_STANDARD_STACKS, new EncodableBoolean(false)); - fields.put(TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT, new EncodableFixedBitfield( - Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false))); - fields.put(TcfCaV1Field.PURPOSES_EXPRESS_CONSENT, - new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false))); - fields.put(TcfCaV1Field.PURPOSES_IMPLIED_CONSENT, - new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false))); - fields.put(TcfCaV1Field.VENDOR_EXPRESS_CONSENT, new EncodableOptimizedFixedRange(new ArrayList<>())); - fields.put(TcfCaV1Field.VENDOR_IMPLIED_CONSENT, new EncodableOptimizedFixedRange(new ArrayList<>())); - - // publisher purposes segment - fields.put(TcfCaV1Field.PUB_PURPOSES_SEGMENT_TYPE, new EncodableFixedInteger(3, 3)); - fields.put(TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT, - new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false))); - fields.put(TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT, - new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false))); - - EncodableFixedInteger numCustomPurposes = new EncodableFixedInteger(6, 0); - fields.put(TcfCaV1Field.NUM_CUSTOM_PURPOSES, numCustomPurposes); - - IntSupplier getLengthSupplier = new IntSupplier() { - - @Override - public int getAsInt() { - return numCustomPurposes.getValue(); - } + @Override + public String getName() { + return TcfCaV1.NAME; + } - }; - - fields.put(TcfCaV1Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, - new EncodableFlexibleBitfield(getLengthSupplier, new ArrayList<>())); - - fields.put(TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, - new EncodableFlexibleBitfield(getLengthSupplier, new ArrayList<>())); - - //@formatter:off - String[] coreSegment = new String[] { - TcfCaV1Field.VERSION, - TcfCaV1Field.CREATED, - TcfCaV1Field.LAST_UPDATED, - TcfCaV1Field.CMP_ID, - TcfCaV1Field.CMP_VERSION, - TcfCaV1Field.CONSENT_SCREEN, - TcfCaV1Field.CONSENT_LANGUAGE, - TcfCaV1Field.VENDOR_LIST_VERSION, - TcfCaV1Field.TCF_POLICY_VERSION, - TcfCaV1Field.USE_NON_STANDARD_STACKS, - TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT, - TcfCaV1Field.PURPOSES_EXPRESS_CONSENT, - TcfCaV1Field.PURPOSES_IMPLIED_CONSENT, - TcfCaV1Field.VENDOR_EXPRESS_CONSENT, - TcfCaV1Field.VENDOR_IMPLIED_CONSENT - }; - - String[] publisherPurposesSegment = new String[] { - TcfCaV1Field.PUB_PURPOSES_SEGMENT_TYPE, - TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT, - TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT, - TcfCaV1Field.NUM_CUSTOM_PURPOSES, - TcfCaV1Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, - TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, - }; - - segments = new String[][] { - coreSegment, - publisherPurposesSegment - }; - //@formatter:on + @Override + public int getVersion() { + return TcfCaV1.VERSION; } @Override - public String encode() throws EncodingException { - List segmentBitStrings = this.encodeSegmentsToBitStrings(); - List encodedSegments = new ArrayList<>(); - if (segmentBitStrings.size() >= 1) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); - if (segmentBitStrings.size() >= 2) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new TcfCaV1CoreSegment()); + segments.add(new TcfCaV1PublisherPurposesSegment()); + return segments; + } + + @Override + public List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + for (int i = 0; i < encodedSegments.length; i++) { + + /** + * The first 3 bits contain the segment id. Rather than decode the entire string, just check the first character. + * + * A-H = '000' = 0 + * Y-Z,a-f = '011' = 3 + * + * Note that there is no segment id field for the core segment. Instead the first 6 bits are reserved + * for the encoding version which only coincidentally works here because the version value is less than 8. + */ + + String encodedSegment = encodedSegments[i]; + if(!encodedSegment.isEmpty()) { + char firstChar = encodedSegment.charAt(0); + + if(firstChar >= 'A' && firstChar <= 'H') { + segments.get(0).decode(encodedSegments[i]); + } else if((firstChar >= 'Y' && firstChar <= 'Z') || (firstChar >= 'a' && firstChar <= 'f')) { + segments.get(1).decode(encodedSegments[i]); + } + } } } - - return encodedSegments.stream().collect(Collectors.joining(".")); + + return segments; } @Override - public void decode(String encodedSection) throws DecodingException { - String[] encodedSegments = encodedSection.split("\\."); - String[] segmentBitStrings = new String[4]; - for (int i = 0; i < encodedSegments.length; i++) { - /** - * first char will contain 6 bits, we only need the first 3. There is no segment type for the CORE - * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on - * a maximum of encoding version 2 the first 3 bits in the core segment will evaluate to 0. - */ - String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); - switch (segmentBitString.substring(0, 3)) { - // unfortunately, the segment ordering doesn't match the segment ids - case "000": { - segmentBitStrings[0] = segmentBitString; - break; - } - case "011": { - segmentBitStrings[1] = segmentBitString; - break; - } - default: { - throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); - } - } + public String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + for(EncodableSegment segment : segments) { + encodedSegments.add(segment.encode()); } - this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); + return String.join(".", encodedSegments); } @Override @@ -185,107 +103,93 @@ public void setFieldValue(String fieldName, Object value) throws InvalidFieldExc } } - @Override - public int getId() { - return TcfCaV1.ID; - } - - @Override - public String getName() { - return TcfCaV1.NAME; - } - - public Integer getVersion() { - return (Integer) this.fields.get(TcfCaV1Field.VERSION).getValue(); - } - + public ZonedDateTime getCreated() { - return (ZonedDateTime) this.fields.get(TcfCaV1Field.CREATED).getValue(); + return (ZonedDateTime) this.getFieldValue(TcfCaV1Field.CREATED); } public ZonedDateTime getLastUpdated() { - return (ZonedDateTime) this.fields.get(TcfCaV1Field.LAST_UPDATED).getValue(); + return (ZonedDateTime) this.getFieldValue(TcfCaV1Field.LAST_UPDATED); } public Integer getCmpId() { - return (Integer) this.fields.get(TcfCaV1Field.CMP_ID).getValue(); + return (Integer) this.getFieldValue(TcfCaV1Field.CMP_ID); } public Integer getCmpVersion() { - return (Integer) this.fields.get(TcfCaV1Field.CMP_VERSION).getValue(); + return (Integer) this.getFieldValue(TcfCaV1Field.CMP_VERSION); } public Integer getConsentScreen() { - return (Integer) this.fields.get(TcfCaV1Field.CONSENT_SCREEN).getValue(); + return (Integer) this.getFieldValue(TcfCaV1Field.CONSENT_SCREEN); } public String getConsentLanguage() { - return (String) this.fields.get(TcfCaV1Field.CONSENT_LANGUAGE).getValue(); + return (String) this.getFieldValue(TcfCaV1Field.CONSENT_LANGUAGE); } public Integer getVendorListVersion() { - return (Integer) this.fields.get(TcfCaV1Field.VENDOR_LIST_VERSION).getValue(); + return (Integer) this.getFieldValue(TcfCaV1Field.VENDOR_LIST_VERSION); } public Integer getPolicyVersion() { - return (Integer) this.fields.get(TcfCaV1Field.TCF_POLICY_VERSION).getValue(); + return (Integer) this.getFieldValue(TcfCaV1Field.TCF_POLICY_VERSION); } public Boolean getUseNonStandardStacks() { - return (Boolean) this.fields.get(TcfCaV1Field.USE_NON_STANDARD_STACKS).getValue(); + return (Boolean) this.getFieldValue(TcfCaV1Field.USE_NON_STANDARD_STACKS); } @SuppressWarnings("unchecked") public List getSpecialFeatureExpressConsent() { - return (List) this.fields.get(TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT).getValue(); + return (List) this.getFieldValue(TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT); } @SuppressWarnings("unchecked") public List getPurposesExpressConsent() { - return (List) this.fields.get(TcfCaV1Field.PURPOSES_EXPRESS_CONSENT).getValue(); + return (List) this.getFieldValue(TcfCaV1Field.PURPOSES_EXPRESS_CONSENT); } @SuppressWarnings("unchecked") public List getPurposesImpliedConsent() { - return (List) this.fields.get(TcfCaV1Field.PURPOSES_IMPLIED_CONSENT).getValue(); + return (List) this.getFieldValue(TcfCaV1Field.PURPOSES_IMPLIED_CONSENT); } @SuppressWarnings("unchecked") public List getVendorExpressConsent() { - return (List) this.fields.get(TcfCaV1Field.VENDOR_EXPRESS_CONSENT).getValue(); + return (List) this.getFieldValue(TcfCaV1Field.VENDOR_EXPRESS_CONSENT); } @SuppressWarnings("unchecked") public List getVendorImpliedConsent() { - return (List) this.fields.get(TcfCaV1Field.VENDOR_IMPLIED_CONSENT).getValue(); + return (List) this.getFieldValue(TcfCaV1Field.VENDOR_IMPLIED_CONSENT); } public Integer getPubPurposesSegmentType() { - return (Integer) this.fields.get(TcfCaV1Field.PUB_PURPOSES_SEGMENT_TYPE).getValue(); + return (Integer) this.getFieldValue(TcfCaV1Field.PUB_PURPOSES_SEGMENT_TYPE); } @SuppressWarnings("unchecked") public List getPubPurposesExpressConsent() { - return (List) this.fields.get(TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT).getValue(); + return (List) this.getFieldValue(TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT); } @SuppressWarnings("unchecked") public List getPubPurposesImpliedConsent() { - return (List) this.fields.get(TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT).getValue(); + return (List) this.getFieldValue(TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT); } public Integer getNumCustomPurposes() { - return (Integer) this.fields.get(TcfCaV1Field.NUM_CUSTOM_PURPOSES).getValue(); + return (Integer) this.getFieldValue(TcfCaV1Field.NUM_CUSTOM_PURPOSES); } @SuppressWarnings("unchecked") public List getCustomPurposesExpressConsent() { - return (List) this.fields.get(TcfCaV1Field.CUSTOM_PURPOSES_EXPRESS_CONSENT).getValue(); + return (List) this.getFieldValue(TcfCaV1Field.CUSTOM_PURPOSES_EXPRESS_CONSENT); } @SuppressWarnings("unchecked") public List getCustomPurposesImpliedConsent() { - return (List) this.fields.get(TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT).getValue(); + return (List) this.getFieldValue(TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT); } - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java index 625121bd..b9b643eb 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java @@ -3,222 +3,119 @@ import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.function.IntSupplier; -import java.util.stream.Collectors; -import com.iab.gpp.encoder.datatype.EncodableBoolean; -import com.iab.gpp.encoder.datatype.EncodableDatetime; -import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerRange; -import com.iab.gpp.encoder.datatype.EncodableFixedString; -import com.iab.gpp.encoder.datatype.EncodableFlexibleBitfield; -import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.TraditionalBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfEuV2Field; - -public class TcfEuV2 extends AbstractEncodableSegmentedBitStringSection { +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.TcfEuV2CoreSegment; +import com.iab.gpp.encoder.segment.TcfEuV2PublisherPurposesSegment; +import com.iab.gpp.encoder.segment.TcfEuV2VendorsAllowedSegment; +import com.iab.gpp.encoder.segment.TcfEuV2VendorsDisclosedSegment; + +public class TcfEuV2 extends AbstractLazilyEncodableSection { + public static int ID = 2; public static int VERSION = 2; public static String NAME = "tcfeuv2"; - private AbstractBase64UrlEncoder base64UrlEncoder = new TraditionalBase64UrlEncoder(); - public TcfEuV2() { - initFields(); + super(); } - public TcfEuV2(String encodedString) throws DecodingException { - initFields(); + public TcfEuV2(String encodedString) { + super(); + decode(encodedString); + } - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } + @Override + public int getId() { + return TcfEuV2.ID; } - private void initFields() { - fields = new HashMap<>(); - - ZonedDateTime date = ZonedDateTime.now(); - - // core section - fields.put(TcfEuV2Field.VERSION, new EncodableFixedInteger(6, TcfEuV2.VERSION)); - fields.put(TcfEuV2Field.CREATED, new EncodableDatetime(date)); - fields.put(TcfEuV2Field.LAST_UPDATED, new EncodableDatetime(date)); - fields.put(TcfEuV2Field.CMP_ID, new EncodableFixedInteger(12, 0)); - fields.put(TcfEuV2Field.CMP_VERSION, new EncodableFixedInteger(12, 0)); - fields.put(TcfEuV2Field.CONSENT_SCREEN, new EncodableFixedInteger(6, 0)); - fields.put(TcfEuV2Field.CONSENT_LANGUAGE, new EncodableFixedString(2, "EN")); - fields.put(TcfEuV2Field.VENDOR_LIST_VERSION, new EncodableFixedInteger(12, 0)); - fields.put(TcfEuV2Field.POLICY_VERSION, new EncodableFixedInteger(6, 2)); - fields.put(TcfEuV2Field.IS_SERVICE_SPECIFIC, new EncodableBoolean(false)); - fields.put(TcfEuV2Field.USE_NON_STANDARD_STACKS, new EncodableBoolean(false)); - fields.put(TcfEuV2Field.SPECIAL_FEATURE_OPTINS, new EncodableFixedBitfield( - Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false))); - fields.put(TcfEuV2Field.PURPOSE_CONSENTS, - new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false))); - fields.put(TcfEuV2Field.PURPOSE_LEGITIMATE_INTERESTS, - new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false))); - fields.put(TcfEuV2Field.PURPOSE_ONE_TREATMENT, new EncodableBoolean(false)); - fields.put(TcfEuV2Field.PUBLISHER_COUNTRY_CODE, new EncodableFixedString(2, "AA")); - fields.put(TcfEuV2Field.VENDOR_CONSENTS, new EncodableOptimizedFixedRange(new ArrayList<>())); - fields.put(TcfEuV2Field.VENDOR_LEGITIMATE_INTERESTS, new EncodableOptimizedFixedRange(new ArrayList<>())); - - fields.put(TcfEuV2Field.PUBLISHER_RESTRICTIONS, new EncodableFixedIntegerRange(new ArrayList<>())); - - // publisher purposes segment - fields.put(TcfEuV2Field.PUBLISHER_PURPOSES_SEGMENT_TYPE, new EncodableFixedInteger(3, 3)); - fields.put(TcfEuV2Field.PUBLISHER_CONSENTS, - new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false))); - fields.put(TcfEuV2Field.PUBLISHER_LEGITIMATE_INTERESTS, - new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false))); - - EncodableFixedInteger numCustomPurposes = new EncodableFixedInteger(6, 0); - fields.put(TcfEuV2Field.NUM_CUSTOM_PURPOSES, numCustomPurposes); - - IntSupplier getLengthSupplier = new IntSupplier() { - - @Override - public int getAsInt() { - return numCustomPurposes.getValue(); - } + @Override + public String getName() { + return TcfEuV2.NAME; + } - }; - - fields.put(TcfEuV2Field.PUBLISHER_CUSTOM_CONSENTS, - new EncodableFlexibleBitfield(getLengthSupplier, new ArrayList<>())); - - fields.put(TcfEuV2Field.PUBLISHER_CUSTOM_LEGITIMATE_INTERESTS, - new EncodableFlexibleBitfield(getLengthSupplier, new ArrayList<>())); - - fields.put(TcfEuV2Field.VENDORS_ALLOWED_SEGMENT_TYPE, new EncodableFixedInteger(3, 2)); - fields.put(TcfEuV2Field.VENDORS_ALLOWED, new EncodableOptimizedFixedRange(new ArrayList<>())); - - fields.put(TcfEuV2Field.VENDORS_DISCLOSED_SEGMENT_TYPE, new EncodableFixedInteger(3, 1)); - fields.put(TcfEuV2Field.VENDORS_DISCLOSED, new EncodableOptimizedFixedRange(new ArrayList<>())); - - //@formatter:off - String[] coreSegment = new String[] { - TcfEuV2Field.VERSION, - TcfEuV2Field.CREATED, - TcfEuV2Field.LAST_UPDATED, - TcfEuV2Field.CMP_ID, - TcfEuV2Field.CMP_VERSION, - TcfEuV2Field.CONSENT_SCREEN, - TcfEuV2Field.CONSENT_LANGUAGE, - TcfEuV2Field.VENDOR_LIST_VERSION, - TcfEuV2Field.POLICY_VERSION, - TcfEuV2Field.IS_SERVICE_SPECIFIC, - TcfEuV2Field.USE_NON_STANDARD_STACKS, - TcfEuV2Field.SPECIAL_FEATURE_OPTINS, - TcfEuV2Field.PURPOSE_CONSENTS, - TcfEuV2Field.PURPOSE_LEGITIMATE_INTERESTS, - TcfEuV2Field.PURPOSE_ONE_TREATMENT, - TcfEuV2Field.PUBLISHER_COUNTRY_CODE, - TcfEuV2Field.VENDOR_CONSENTS, - TcfEuV2Field.VENDOR_LEGITIMATE_INTERESTS, - TcfEuV2Field.PUBLISHER_RESTRICTIONS - }; - - String[] publisherPurposesSegment = new String[] { - TcfEuV2Field.PUBLISHER_PURPOSES_SEGMENT_TYPE, - TcfEuV2Field.PUBLISHER_CONSENTS, - TcfEuV2Field.PUBLISHER_LEGITIMATE_INTERESTS, - TcfEuV2Field.NUM_CUSTOM_PURPOSES, - TcfEuV2Field.PUBLISHER_CUSTOM_CONSENTS, - TcfEuV2Field.PUBLISHER_CUSTOM_LEGITIMATE_INTERESTS, - }; - - String[] vendorsAllowedSegment = new String[] { - TcfEuV2Field.VENDORS_ALLOWED_SEGMENT_TYPE, - TcfEuV2Field.VENDORS_ALLOWED, - }; - - String[] vendorsDisclosedSegment = new String[] { - TcfEuV2Field.VENDORS_DISCLOSED_SEGMENT_TYPE, - TcfEuV2Field.VENDORS_DISCLOSED, - }; - - segments = new String[][] { - coreSegment, - publisherPurposesSegment, - vendorsAllowedSegment, - vendorsDisclosedSegment - }; - //@formatter:on + @Override + public int getVersion() { + return TcfEuV2.VERSION; } @Override - public String encode() throws EncodingException { - List segmentBitStrings = this.encodeSegmentsToBitStrings(); + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new TcfEuV2CoreSegment()); + segments.add(new TcfEuV2PublisherPurposesSegment()); + segments.add(new TcfEuV2VendorsAllowedSegment()); + segments.add(new TcfEuV2VendorsDisclosedSegment()); + return segments; + } + + @Override + public List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + for (int i = 0; i < encodedSegments.length; i++) { + + /** + * The first 3 bits contain the segment id. Rather than decode the entire string, just check the first character. + * + * A-H = '000' = 0 + * I-P = '001' = 1 + * Q-X = '010' = 2 + * Y-Z,a-f = '011' = 3 + * + * Note that there is no segment id field for the core segment. Instead the first 6 bits are reserved + * for the encoding version which only coincidentally works here because the version value is less than 8. + */ + + String encodedSegment = encodedSegments[i]; + if(!encodedSegment.isEmpty()) { + char firstChar = encodedSegment.charAt(0); + + // unfortunately, the segment ordering doesn't match the segment ids + if(firstChar >= 'A' && firstChar <= 'H') { + segments.get(0).decode(encodedSegments[i]); + } else if(firstChar >= 'I' && firstChar <= 'P') { + segments.get(3).decode(encodedSegments[i]); + } else if(firstChar >= 'Q' && firstChar <= 'X') { + segments.get(2).decode(encodedSegments[i]); + } else if((firstChar >= 'Y' && firstChar <= 'Z') || (firstChar >= 'a' && firstChar <= 'f')) { + segments.get(1).decode(encodedSegments[i]); + } + } + } + } + + return segments; + } + + @Override + public String encodeSection(List segments) { List encodedSegments = new ArrayList<>(); - if (segmentBitStrings.size() >= 1) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); + if (segments.size() >= 1) { + encodedSegments.add(segments.get(0).encode()); Boolean isServiceSpecific = (Boolean) this.getFieldValue(TcfEuV2Field.IS_SERVICE_SPECIFIC); if (isServiceSpecific) { - if (segmentBitStrings.size() >= 2) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); + if (segments.size() >= 2) { + encodedSegments.add(segments.get(1).encode()); } } else { - if (segmentBitStrings.size() >= 2) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(2))); + if (segments.size() >= 2) { + encodedSegments.add(segments.get(2).encode()); - if (segmentBitStrings.size() >= 3) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(3))); + if (segments.size() >= 3) { + encodedSegments.add(segments.get(3).encode()); } } } } - return encodedSegments.stream().collect(Collectors.joining(".")); - } - - @Override - public void decode(String encodedSection) throws DecodingException { - String[] encodedSegments = encodedSection.split("\\."); - String[] segmentBitStrings = new String[4]; - for (int i = 0; i < encodedSegments.length; i++) { - /** - * first char will contain 6 bits, we only need the first 3. There is no segment type for the CORE - * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on - * a maximum of encoding version 2 the first 3 bits in the core segment will evaluate to 0. - */ - String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); - switch (segmentBitString.substring(0, 3)) { - // unfortunately, the segment ordering doesn't match the segment ids - case "000": { - segmentBitStrings[0] = segmentBitString; - break; - } - case "001": { - segmentBitStrings[3] = segmentBitString; - break; - } - case "010": { - segmentBitStrings[2] = segmentBitString; - break; - } - case "011": { - segmentBitStrings[1] = segmentBitString; - break; - } - default: { - throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); - } - } - } - this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); + return String.join(".", encodedSegments); } @Override @@ -233,144 +130,130 @@ public void setFieldValue(String fieldName, Object value) throws InvalidFieldExc } } - @Override - public int getId() { - return TcfEuV2.ID; - } - - @Override - public String getName() { - return TcfEuV2.NAME; - } - - public Integer getVersion() { - return (Integer) this.fields.get(TcfEuV2Field.VERSION).getValue(); - } - + public ZonedDateTime getCreated() { - return (ZonedDateTime) this.fields.get(TcfEuV2Field.CREATED).getValue(); + return (ZonedDateTime) this.getFieldValue(TcfEuV2Field.CREATED); } public ZonedDateTime getLastUpdated() { - return (ZonedDateTime) this.fields.get(TcfEuV2Field.LAST_UPDATED).getValue(); + return (ZonedDateTime) this.getFieldValue(TcfEuV2Field.LAST_UPDATED); } public Integer getCmpId() { - return (Integer) this.fields.get(TcfEuV2Field.CMP_ID).getValue(); + return (Integer) this.getFieldValue(TcfEuV2Field.CMP_ID); } public Integer getCmpVersion() { - return (Integer) this.fields.get(TcfEuV2Field.CMP_VERSION).getValue(); + return (Integer) this.getFieldValue(TcfEuV2Field.CMP_VERSION); } public Integer getConsentScreen() { - return (Integer) this.fields.get(TcfEuV2Field.CONSENT_SCREEN).getValue(); + return (Integer) this.getFieldValue(TcfEuV2Field.CONSENT_SCREEN); } public String getConsentLanguage() { - return (String) this.fields.get(TcfEuV2Field.CONSENT_LANGUAGE).getValue(); + return (String) this.getFieldValue(TcfEuV2Field.CONSENT_LANGUAGE); } public Integer getVendorListVersion() { - return (Integer) this.fields.get(TcfEuV2Field.VENDOR_LIST_VERSION).getValue(); + return (Integer) this.getFieldValue(TcfEuV2Field.VENDOR_LIST_VERSION); } public Integer getPolicyVersion() { - return (Integer) this.fields.get(TcfEuV2Field.POLICY_VERSION).getValue(); + return (Integer) this.getFieldValue(TcfEuV2Field.POLICY_VERSION); } public Boolean getIsServiceSpecific() { - return (Boolean) this.fields.get(TcfEuV2Field.IS_SERVICE_SPECIFIC).getValue(); + return (Boolean) this.getFieldValue(TcfEuV2Field.IS_SERVICE_SPECIFIC); } public Boolean getUseNonStandardStacks() { - return (Boolean) this.fields.get(TcfEuV2Field.USE_NON_STANDARD_STACKS).getValue(); + return (Boolean) this.getFieldValue(TcfEuV2Field.USE_NON_STANDARD_STACKS); } @SuppressWarnings("unchecked") public List getSpecialFeatureOptins() { - return (List) this.fields.get(TcfEuV2Field.SPECIAL_FEATURE_OPTINS).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.SPECIAL_FEATURE_OPTINS); } @SuppressWarnings("unchecked") public List getPurposeConsents() { - return (List) this.fields.get(TcfEuV2Field.PURPOSE_CONSENTS).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.PURPOSE_CONSENTS); } @SuppressWarnings("unchecked") public List getPurposeLegitimateInterests() { - return (List) this.fields.get(TcfEuV2Field.PURPOSE_LEGITIMATE_INTERESTS).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.PURPOSE_LEGITIMATE_INTERESTS); } public Boolean getPurposeOneTreatment() { - return (Boolean) this.fields.get(TcfEuV2Field.PURPOSE_ONE_TREATMENT).getValue(); + return (Boolean) this.getFieldValue(TcfEuV2Field.PURPOSE_ONE_TREATMENT); } public String getPublisherCountryCode() { - return (String) this.fields.get(TcfEuV2Field.PUBLISHER_COUNTRY_CODE).getValue(); + return (String) this.getFieldValue(TcfEuV2Field.PUBLISHER_COUNTRY_CODE); } @SuppressWarnings("unchecked") public List getVendorConsents() { - return (List) this.fields.get(TcfEuV2Field.VENDOR_CONSENTS).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.VENDOR_CONSENTS); } @SuppressWarnings("unchecked") public List getVendorLegitimateInterests() { - return (List) this.fields.get(TcfEuV2Field.VENDOR_LEGITIMATE_INTERESTS).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.VENDOR_LEGITIMATE_INTERESTS); } @SuppressWarnings("unchecked") public List getPublisherRestrictions() { - return (List) this.fields.get(TcfEuV2Field.PUBLISHER_RESTRICTIONS).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.PUBLISHER_RESTRICTIONS); } public Integer getPublisherPurposesSegmentType() { - return (Integer) this.fields.get(TcfEuV2Field.PUBLISHER_PURPOSES_SEGMENT_TYPE).getValue(); + return (Integer) this.getFieldValue(TcfEuV2Field.PUBLISHER_PURPOSES_SEGMENT_TYPE); } @SuppressWarnings("unchecked") public List getPublisherConsents() { - return (List) this.fields.get(TcfEuV2Field.PUBLISHER_CONSENTS).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.PUBLISHER_CONSENTS); } @SuppressWarnings("unchecked") public List getPublisherLegitimateInterests() { - return (List) this.fields.get(TcfEuV2Field.PUBLISHER_LEGITIMATE_INTERESTS).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.PUBLISHER_LEGITIMATE_INTERESTS); } public Integer getNumCustomPurposes() { - return (Integer) this.fields.get(TcfEuV2Field.NUM_CUSTOM_PURPOSES).getValue(); + return (Integer) this.getFieldValue(TcfEuV2Field.NUM_CUSTOM_PURPOSES); } @SuppressWarnings("unchecked") public List getPublisherCustomConsents() { - return (List) this.fields.get(TcfEuV2Field.PUBLISHER_CUSTOM_CONSENTS).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.PUBLISHER_CUSTOM_CONSENTS); } @SuppressWarnings("unchecked") public List getPublisherCustomLegitimateInterests() { - return (List) this.fields.get(TcfEuV2Field.PUBLISHER_CUSTOM_LEGITIMATE_INTERESTS).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.PUBLISHER_CUSTOM_LEGITIMATE_INTERESTS); } public Integer getVendorsAllowedSegmentType() { - return (Integer) this.fields.get(TcfEuV2Field.VENDORS_ALLOWED_SEGMENT_TYPE).getValue(); + return (Integer) this.getFieldValue(TcfEuV2Field.VENDORS_ALLOWED_SEGMENT_TYPE); } @SuppressWarnings("unchecked") public List getVendorsAllowed() { - return (List) this.fields.get(TcfEuV2Field.VENDORS_ALLOWED).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.VENDORS_ALLOWED); } public Integer getVendorsDisclosedSegmentType() { - return (Integer) this.fields.get(TcfEuV2Field.VENDORS_DISCLOSED_SEGMENT_TYPE).getValue(); + return (Integer) this.getFieldValue(TcfEuV2Field.VENDORS_DISCLOSED_SEGMENT_TYPE); } @SuppressWarnings("unchecked") public List getVendorsDisclosed() { - return (List) this.fields.get(TcfEuV2Field.VENDORS_DISCLOSED).getValue(); + return (List) this.getFieldValue(TcfEuV2Field.VENDORS_DISCLOSED); } - - - + + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCaV1.java index de88746f..03442533 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCaV1.java @@ -1,208 +1,142 @@ package com.iab.gpp.encoder.section; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.stream.Collectors; -import com.iab.gpp.encoder.datatype.EncodableBoolean; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.UsCaV1Field; -import com.iab.gpp.encoder.field.UspV1Field; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsCaV1CoreSegment; +import com.iab.gpp.encoder.segment.UsCaV1GpcSegment; -public class UsCaV1 extends AbstractEncodableSegmentedBitStringSection { +public class UsCaV1 extends AbstractLazilyEncodableSection { + public static int ID = 8; public static int VERSION = 1; public static String NAME = "uscav1"; - private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - public UsCaV1() { - initFields(); + super(); } - public UsCaV1(String encodedString) throws DecodingException { - initFields(); - - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } + public UsCaV1(String encodedString) { + super(); + decode(encodedString); } - private void initFields() { - fields = new HashMap<>(); - - fields.put(UsCaV1Field.VERSION, new EncodableFixedInteger(6, UsCaV1.VERSION)); - fields.put(UsCaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); - fields.put(UsCaV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); - - // gpc segment - fields.put(UsCaV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UsCaV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UsCaV1Field.GPC, new EncodableBoolean(false)); - - //@formatter:off - String[] coreSegment = new String[] { - UsCaV1Field.VERSION, - UsCaV1Field.SALE_OPT_OUT_NOTICE, - UsCaV1Field.SHARING_OPT_OUT_NOTICE, - UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, - UsCaV1Field.SALE_OPT_OUT, - UsCaV1Field.SHARING_OPT_OUT, - UsCaV1Field.SENSITIVE_DATA_PROCESSING, - UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsCaV1Field.PERSONAL_DATA_CONSENTS, - UsCaV1Field.MSPA_COVERED_TRANSACTION, - UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE - }; - - String[] gpcSegment = new String[] { - UsCaV1Field.GPC_SEGMENT_TYPE, - UsCaV1Field.GPC - }; - - segments = new String[][] { - coreSegment, - gpcSegment - }; - //@formatter:on + @Override + public int getId() { + return UsCaV1.ID; } @Override - public String encode() throws EncodingException { - List segmentBitStrings = this.encodeSegmentsToBitStrings(); - List encodedSegments = new ArrayList<>(); - if (segmentBitStrings.size() >= 1) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); - - if (segmentBitStrings.size() >= 2) { - Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).getValue(); - if (gpcSegmentIncluded) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); - } - - } - } - - return encodedSegments.stream().collect(Collectors.joining(".")); + public String getName() { + return UsCaV1.NAME; } @Override - public void decode(String encodedSection) throws DecodingException { - String[] encodedSegments = encodedSection.split("\\."); - String[] segmentBitStrings = new String[2]; - boolean gpcSegmentIncluded = false; - for (int i = 0; i < encodedSegments.length; i++) { - /** - * first char will contain 6 bits, we only need the first 2. There is no segment type for the CORE - * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on - * a maximum of encoding version 2 the first 2 bits in the core segment will evaluate to 0. - */ - String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); - switch (segmentBitString.substring(0, 2)) { - case "00": { - segmentBitStrings[0] = segmentBitString; - break; - } - case "01": { - gpcSegmentIncluded = true; - segmentBitStrings[1] = segmentBitString; - break; - } - default: { - throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); - } - } - } - this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); - this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); + public int getVersion() { + return UsCaV1.VERSION; } @Override - public int getId() { - return UsCaV1.ID; + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsCaV1CoreSegment()); + segments.add(new UsCaV1GpcSegment()); + return segments; } - + @Override - public String getName() { - return UsCaV1.NAME; + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if(encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if(encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED, false); + } + } + + return segments; } - public Integer getVersion() { - return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if(!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); } + public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UsCaV1Field.SALE_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE); } public Integer getSensitiveDataLimitUseNotice() { - return (Integer) this.fields.get(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE); } public Integer getSharingOptOutNotice() { - return (Integer) this.fields.get(UsCaV1Field.SHARING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.fields.get(UsCaV1Field.SALE_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsCaV1Field.SALE_OPT_OUT); } public Integer getSharingOptOut() { - return (Integer) this.fields.get(UsCaV1Field.SHARING_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsCaV1Field.SHARING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.fields.get(UsCaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + return (List) this.getFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING); } @SuppressWarnings("unchecked") public List getKnownChildSensitiveDataConsents() { - return (List) this.fields.get(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + return (List) this.getFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getPersonalDataConsents() { - return (Integer) this.fields.get(UsCaV1Field.PERSONAL_DATA_CONSENTS).getValue(); + return (Integer) this.getFieldValue(UsCaV1Field.PERSONAL_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UsCaV1Field.MSPA_COVERED_TRANSACTION).getValue(); + return (Integer) this.getFieldValue(UsCaV1Field.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + return (Integer) this.getFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + return (Integer) this.getFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE); } public Integer getGpcSegmentType() { - return (Integer) this.fields.get(UsCaV1Field.GPC_SEGMENT_TYPE).getValue(); + return (Integer) this.getFieldValue(UsCaV1Field.GPC_SEGMENT_TYPE); } public Boolean getGpcSegmentIncluded() { - return (Boolean) this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).getValue(); + return (Boolean) this.getFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED); } public Boolean getGpc() { - return (Boolean) this.fields.get(UsCaV1Field.GPC).getValue(); + return (Boolean) this.getFieldValue(UsCaV1Field.GPC); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCoV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCoV1.java index 05b2f9d6..22bd56a6 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCoV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCoV1.java @@ -1,202 +1,137 @@ package com.iab.gpp.encoder.section; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.stream.Collectors; -import com.iab.gpp.encoder.datatype.EncodableBoolean; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.UsCaV1Field; import com.iab.gpp.encoder.field.UsCoV1Field; -import com.iab.gpp.encoder.field.UspV1Field; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsCoV1CoreSegment; +import com.iab.gpp.encoder.segment.UsCoV1GpcSegment; -public class UsCoV1 extends AbstractEncodableSegmentedBitStringSection { +public class UsCoV1 extends AbstractLazilyEncodableSection { + public static int ID = 10; public static int VERSION = 1; public static String NAME = "uscov1"; - private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - public UsCoV1() { - initFields(); + super(); } - public UsCoV1(String encodedString) throws DecodingException { - initFields(); - - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } + public UsCoV1(String encodedString) { + super(); + decode(encodedString); } - private void initFields() { - fields = new HashMap<>(); - - fields.put(UsCoV1Field.VERSION, new EncodableFixedInteger(6, UsCoV1.VERSION)); - fields.put(UsCoV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0))); - fields.put(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); - - // gpc segment - fields.put(UsCoV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UsCoV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UsCoV1Field.GPC, new EncodableBoolean(false)); - - - //@formatter:off - String[] coreSegment = new String[] { - UsCoV1Field.VERSION, - UsCoV1Field.SHARING_NOTICE, - UsCoV1Field.SALE_OPT_OUT_NOTICE, - UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UsCoV1Field.SALE_OPT_OUT, - UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, - UsCoV1Field.SENSITIVE_DATA_PROCESSING, - UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsCoV1Field.MSPA_COVERED_TRANSACTION, - UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE - }; - - String[] gpcSegment = new String[] { - UsCoV1Field.GPC_SEGMENT_TYPE, - UsCoV1Field.GPC - }; - - segments = new String[][] { - coreSegment, - gpcSegment - }; - //@formatter:on + @Override + public int getId() { + return UsCoV1.ID; } @Override - public String encode() throws EncodingException { - List segmentBitStrings = this.encodeSegmentsToBitStrings(); - List encodedSegments = new ArrayList<>(); - if (segmentBitStrings.size() >= 1) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); - - if (segmentBitStrings.size() >= 2) { - Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UsCoV1Field.GPC_SEGMENT_INCLUDED).getValue(); - if (gpcSegmentIncluded) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); - } - } - } - - return encodedSegments.stream().collect(Collectors.joining(".")); + public String getName() { + return UsCoV1.NAME; } @Override - public void decode(String encodedSection) throws DecodingException { - String[] encodedSegments = encodedSection.split("\\."); - String[] segmentBitStrings = new String[2]; - boolean gpcSegmentIncluded = false; - for (int i = 0; i < encodedSegments.length; i++) { - /** - * first char will contain 6 bits, we only need the first 2. There is no segment type for the CORE - * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on - * a maximum of encoding version 2 the first 2 bits in the core segment will evaluate to 0. - */ - String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); - switch (segmentBitString.substring(0, 2)) { - case "00": { - segmentBitStrings[0] = segmentBitString; - break; - } - case "01": { - gpcSegmentIncluded = true; - segmentBitStrings[1] = segmentBitString; - break; - } - default: { - throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); - } - } - } - this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); - this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); + public int getVersion() { + return UsCoV1.VERSION; } @Override - public int getId() { - return UsCoV1.ID; + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsCoV1CoreSegment()); + segments.add(new UsCoV1GpcSegment()); + return segments; } - + @Override - public String getName() { - return UsCoV1.NAME; + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if(encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if(encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED, false); + } + } + + return segments; } - public Integer getVersion() { - return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if(!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); } + public Integer getSharingNotice() { - return (Integer) this.fields.get(UsCoV1Field.SHARING_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsCoV1Field.SHARING_NOTICE); } public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UsCoV1Field.SALE_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.fields.get(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.fields.get(UsCoV1Field.SALE_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsCoV1Field.SALE_OPT_OUT); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.fields.get(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.fields.get(UsCoV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + return (List) this.getFieldValue(UsCoV1Field.SENSITIVE_DATA_PROCESSING); } public Integer getKnownChildSensitiveDataConsents() { - return (Integer) this.fields.get(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + return (Integer) this.getFieldValue(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UsCoV1Field.MSPA_COVERED_TRANSACTION).getValue(); + return (Integer) this.getFieldValue(UsCoV1Field.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + return (Integer) this.getFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + return (Integer) this.getFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE); } public Integer getGpcSegmentType() { - return (Integer) this.fields.get(UsCoV1Field.GPC_SEGMENT_TYPE).getValue(); + return (Integer) this.getFieldValue(UsCoV1Field.GPC_SEGMENT_TYPE); } public Boolean getGpcSegmentIncluded() { - return (Boolean) this.fields.get(UsCoV1Field.GPC_SEGMENT_INCLUDED).getValue(); + return (Boolean) this.getFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED); } public Boolean getGpc() { - return (Boolean) this.fields.get(UsCoV1Field.GPC).getValue(); + return (Boolean) this.getFieldValue(UsCoV1Field.GPC); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCtV1.java index 9df3e780..2acd3f2f 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCtV1.java @@ -1,203 +1,138 @@ package com.iab.gpp.encoder.section; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.stream.Collectors; -import com.iab.gpp.encoder.datatype.EncodableBoolean; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.UsCaV1Field; import com.iab.gpp.encoder.field.UsCtV1Field; -import com.iab.gpp.encoder.field.UspV1Field; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsCtV1CoreSegment; +import com.iab.gpp.encoder.segment.UsCtV1GpcSegment; + +public class UsCtV1 extends AbstractLazilyEncodableSection { -public class UsCtV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 12; public static int VERSION = 1; public static String NAME = "usctv1"; - private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - public UsCtV1() { - initFields(); + super(); } - public UsCtV1(String encodedString) throws DecodingException { - initFields(); + public UsCtV1(String encodedString) { + super(); + decode(encodedString); + } - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } + @Override + public int getId() { + return UsCtV1.ID; } - private void initFields() { - fields = new HashMap<>(); - - fields.put(UsCtV1Field.VERSION, new EncodableFixedInteger(6, UsCtV1.VERSION)); - fields.put(UsCtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0))); - fields.put(UsCtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); - - // gpc segment - fields.put(UsCtV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UsCtV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UsCtV1Field.GPC, new EncodableBoolean(false)); - - //@formatter:off - String[] coreSegment = new String[] { - UsCtV1Field.VERSION, - UsCtV1Field.SHARING_NOTICE, - UsCtV1Field.SALE_OPT_OUT_NOTICE, - UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UsCtV1Field.SALE_OPT_OUT, - UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, - UsCtV1Field.SENSITIVE_DATA_PROCESSING, - UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsCtV1Field.MSPA_COVERED_TRANSACTION, - UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE - }; - - String[] gpcSegment = new String[] { - UsCtV1Field.GPC_SEGMENT_TYPE, - UsCtV1Field.GPC - }; - - segments = new String[][] { - coreSegment, - gpcSegment - }; - //@formatter:on + @Override + public String getName() { + return UsCtV1.NAME; } @Override - public String encode() throws EncodingException { - List segmentBitStrings = this.encodeSegmentsToBitStrings(); - List encodedSegments = new ArrayList<>(); - if (segmentBitStrings.size() >= 1) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); - - if (segmentBitStrings.size() >= 2) { - Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UsCtV1Field.GPC_SEGMENT_INCLUDED).getValue(); - if (gpcSegmentIncluded) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); - } - } - } + public int getVersion() { + return UsCtV1.VERSION; + } - return encodedSegments.stream().collect(Collectors.joining(".")); + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsCtV1CoreSegment()); + segments.add(new UsCtV1GpcSegment()); + return segments; } @Override - public void decode(String encodedSection) throws DecodingException { - String[] encodedSegments = encodedSection.split("\\."); - String[] segmentBitStrings = new String[2]; - boolean gpcSegmentIncluded = false; - for (int i = 0; i < encodedSegments.length; i++) { - /** - * first char will contain 6 bits, we only need the first 2. There is no segment type for the CORE - * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on - * a maximum of encoding version 2 the first 2 bits in the core segment will evaluate to 0. - */ - String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); - switch (segmentBitString.substring(0, 2)) { - case "00": { - segmentBitStrings[0] = segmentBitString; - break; - } - case "01": { - gpcSegmentIncluded = true; - segmentBitStrings[1] = segmentBitString; - break; - } - default: { - throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); - } + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if(encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if(encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED, false); } } - this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); - this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); - } - @Override - public int getId() { - return UsCtV1.ID; + return segments; } @Override - public String getName() { - return UsCtV1.NAME; + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if(!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); } - public Integer getVersion() { - return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); - } public Integer getSharingNotice() { - return (Integer) this.fields.get(UsCtV1Field.SHARING_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsCtV1Field.SHARING_NOTICE); } public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UsCtV1Field.SALE_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.fields.get(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.fields.get(UsCtV1Field.SALE_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsCtV1Field.SALE_OPT_OUT); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.fields.get(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.fields.get(UsCtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + return (List) this.getFieldValue(UsCtV1Field.SENSITIVE_DATA_PROCESSING); } @SuppressWarnings("unchecked") public List getKnownChildSensitiveDataConsents() { - return (List) this.fields.get(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + return (List) this.getFieldValue(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UsCtV1Field.MSPA_COVERED_TRANSACTION).getValue(); + return (Integer) this.getFieldValue(UsCtV1Field.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + return (Integer) this.getFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + return (Integer) this.getFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE); } public Integer getGpcSegmentType() { - return (Integer) this.fields.get(UsCtV1Field.GPC_SEGMENT_TYPE).getValue(); + return (Integer) this.getFieldValue(UsCtV1Field.GPC_SEGMENT_TYPE); } public Boolean getGpcSegmentIncluded() { - return (Boolean) this.fields.get(UsCtV1Field.GPC_SEGMENT_INCLUDED).getValue(); + return (Boolean) this.getFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED); } public Boolean getGpc() { - return (Boolean) this.fields.get(UsCtV1Field.GPC).getValue(); + return (Boolean) this.getFieldValue(UsCtV1Field.GPC); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNatV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNatV1.java index 6cd943d9..0f0811cf 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNatV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNatV1.java @@ -1,233 +1,158 @@ package com.iab.gpp.encoder.section; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.stream.Collectors; -import com.iab.gpp.encoder.datatype.EncodableBoolean; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.UsCaV1Field; import com.iab.gpp.encoder.field.UsNatV1Field; -import com.iab.gpp.encoder.field.UspV1Field; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsNatV1CoreSegment; +import com.iab.gpp.encoder.segment.UsNatV1GpcSegment; + +public class UsNatV1 extends AbstractLazilyEncodableSection { -public class UsNatV1 extends AbstractEncodableSegmentedBitStringSection { public static int ID = 7; public static int VERSION = 1; public static String NAME = "usnatv1"; - private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - public UsNatV1() { - initFields(); + super(); } - public UsNatV1(String encodedString) throws DecodingException { - initFields(); + public UsNatV1(String encodedString) { + super(); + decode(encodedString); + } - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } + @Override + public int getId() { + return UsNatV1.ID; } - private void initFields() { - fields = new HashMap<>(); - - fields.put(UsNatV1Field.VERSION, new EncodableFixedInteger(6, UsNatV1.VERSION)); - fields.put(UsNatV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); - fields.put(UsNatV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); - - // gpc segment - fields.put(UsNatV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UsNatV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UsNatV1Field.GPC, new EncodableBoolean(false)); - - - //@formatter:off - String[] coreSegment = new String[] { - UsNatV1Field.VERSION, - UsNatV1Field.SHARING_NOTICE, - UsNatV1Field.SALE_OPT_OUT_NOTICE, - UsNatV1Field.SHARING_OPT_OUT_NOTICE, - UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, - UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, - UsNatV1Field.SALE_OPT_OUT, - UsNatV1Field.SHARING_OPT_OUT, - UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, - UsNatV1Field.SENSITIVE_DATA_PROCESSING, - UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsNatV1Field.PERSONAL_DATA_CONSENTS, - UsNatV1Field.MSPA_COVERED_TRANSACTION, - UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE - }; - - String[] gpcSegment = new String[] { - UsNatV1Field.GPC_SEGMENT_TYPE, - UsNatV1Field.GPC - }; - - segments = new String[][] { - coreSegment, - gpcSegment - }; - //@formatter:on + @Override + public String getName() { + return UsNatV1.NAME; } @Override - public String encode() throws EncodingException { - List segmentBitStrings = this.encodeSegmentsToBitStrings(); - List encodedSegments = new ArrayList<>(); - if (segmentBitStrings.size() >= 1) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(0))); - - if (segmentBitStrings.size() >= 2) { - Boolean gpcSegmentIncluded = (Boolean) this.fields.get(UsNatV1Field.GPC_SEGMENT_INCLUDED).getValue(); - if (gpcSegmentIncluded) { - encodedSegments.add(base64UrlEncoder.encode(segmentBitStrings.get(1))); - } - } - } + public int getVersion() { + return UsNatV1.VERSION; + } - return encodedSegments.stream().collect(Collectors.joining(".")); + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsNatV1CoreSegment()); + segments.add(new UsNatV1GpcSegment()); + return segments; } @Override - public void decode(String encodedSection) throws DecodingException { - String[] encodedSegments = encodedSection.split("\\."); - String[] segmentBitStrings = new String[2]; - boolean gpcSegmentIncluded = false; - for (int i = 0; i < encodedSegments.length; i++) { - /** - * first char will contain 6 bits, we only need the first 2. There is no segment type for the CORE - * string. Instead the first 6 bits are reserved for the encoding version, but because we're only on - * a maximum of encoding version 2 the first 2 bits in the core segment will evaluate to 0. - */ - String segmentBitString = base64UrlEncoder.decode(encodedSegments[i]); - switch (segmentBitString.substring(0, 2)) { - case "00": { - segmentBitStrings[0] = segmentBitString; - break; - } - case "01": { - gpcSegmentIncluded = true; - segmentBitStrings[1] = segmentBitString; - break; - } - default: { - throw new DecodingException("Unable to decode segment '" + encodedSegments[i] + "'"); - } + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if(encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if(encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED, false); } } - this.decodeSegmentsFromBitStrings(Arrays.asList(segmentBitStrings)); - this.fields.get(UsCaV1Field.GPC_SEGMENT_INCLUDED).setValue(gpcSegmentIncluded); - } - @Override - public int getId() { - return UsNatV1.ID; + return segments; } @Override - public String getName() { - return UsNatV1.NAME; + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if(!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); } - public Integer getVersion() { - return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); - } public Integer getSharingNotice() { - return (Integer) this.fields.get(UsNatV1Field.SHARING_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.SHARING_NOTICE); } public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UsNatV1Field.SALE_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE); } public Integer getSharingOptOutNotice() { - return (Integer) this.fields.get(UsNatV1Field.SHARING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.fields.get(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE); } public Integer getSensitiveDataProcessingOptOutNotice() { - return (Integer) this.fields.get(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE); } public Integer getSensitiveDataLimitUseNotice() { - return (Integer) this.fields.get(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.fields.get(UsNatV1Field.SALE_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.SALE_OPT_OUT); } public Integer getSharingOptOut() { - return (Integer) this.fields.get(UsNatV1Field.SHARING_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.SHARING_OPT_OUT); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.fields.get(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.fields.get(UsNatV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + return (List) this.getFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING); } @SuppressWarnings("unchecked") public List getKnownChildSensitiveDataConsents() { - return (List) this.fields.get(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + return (List) this.getFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getPersonalDataConsents() { - return (Integer) this.fields.get(UsNatV1Field.PERSONAL_DATA_CONSENTS).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.PERSONAL_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UsNatV1Field.MSPA_COVERED_TRANSACTION).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE); } public Integer getGpcSegmentType() { - return (Integer) this.fields.get(UsNatV1Field.GPC_SEGMENT_TYPE).getValue(); + return (Integer) this.getFieldValue(UsNatV1Field.GPC_SEGMENT_TYPE); } public Boolean getGpcSegmentIncluded() { - return (Boolean) this.fields.get(UsNatV1Field.GPC_SEGMENT_INCLUDED).getValue(); + return (Boolean) this.getFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED); } public Boolean getGpc() { - return (Boolean) this.fields.get(UsNatV1Field.GPC).getValue(); + return (Boolean) this.getFieldValue(UsNatV1Field.GPC); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUtV1.java index 9bd56c35..a73a0b6f 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUtV1.java @@ -1,141 +1,119 @@ package com.iab.gpp.encoder.section; -import java.util.Arrays; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.UsUtV1Field; -import com.iab.gpp.encoder.field.UspV1Field; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsUtV1CoreSegment; -public class UsUtV1 extends AbstractEncodableBitStringSection { +public class UsUtV1 extends AbstractLazilyEncodableSection { + public static int ID = 11; public static int VERSION = 1; public static String NAME = "usutv1"; - private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - public UsUtV1() { - initFields(); + super(); } - public UsUtV1(String encodedString) throws DecodingException { - initFields(); - - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } + public UsUtV1(String encodedString) { + super(); + decode(encodedString); } - private void initFields() { - fields = new HashMap<>(); - - fields.put(UsUtV1Field.VERSION, new EncodableFixedInteger(6, UsUtV1.VERSION)); - fields.put(UsUtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); - - //@formatter:off - fieldOrder = new String[] { - UsUtV1Field.VERSION, - UsUtV1Field.SHARING_NOTICE, - UsUtV1Field.SALE_OPT_OUT_NOTICE, - UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, - UsUtV1Field.SALE_OPT_OUT, - UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, - UsUtV1Field.SENSITIVE_DATA_PROCESSING, - UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsUtV1Field.MSPA_COVERED_TRANSACTION, - UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE - }; - //@formatter:on + @Override + public int getId() { + return UsUtV1.ID; } @Override - public String encode() throws EncodingException { - String bitString = this.encodeToBitString(); - String encodedString = base64UrlEncoder.encode(bitString); - return encodedString; + public String getName() { + return UsUtV1.NAME; } @Override - public void decode(String encodedString) throws DecodingException { - String bitString = base64UrlEncoder.decode(encodedString); - this.decodeFromBitString(bitString); + public int getVersion() { + return UsUtV1.VERSION; } @Override - public int getId() { - return UsUtV1.ID; + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsUtV1CoreSegment()); + return segments; } - + @Override - public String getName() { - return UsUtV1.NAME; + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + for(int i=0; i i) { + segments.get(i).decode(encodedSegments[i]); + } + } + } + + return segments; } - public Integer getVersion() { - return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + for(EncodableSegment segment : segments) { + encodedSegments.add(segment.encode()); + } + return String.join(".", encodedSegments); } + public Integer getSharingNotice() { - return (Integer) this.fields.get(UsUtV1Field.SHARING_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsUtV1Field.SHARING_NOTICE); } public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UsUtV1Field.SALE_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.fields.get(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE); } public Integer getSensitiveDataProcessingOptOutNotice() { - return (Integer) this.fields.get(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.fields.get(UsUtV1Field.SALE_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsUtV1Field.SALE_OPT_OUT); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.fields.get(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.fields.get(UsUtV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + return (List) this.getFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING); } public Integer getKnownChildSensitiveDataConsents() { - return (Integer) this.fields.get(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + return (Integer) this.getFieldValue(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UsUtV1Field.MSPA_COVERED_TRANSACTION).getValue(); + return (Integer) this.getFieldValue(UsUtV1Field.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + return (Integer) this.getFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + return (Integer) this.getFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE); } - + + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVaV1.java index fdd48f49..6695b943 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVaV1.java @@ -1,135 +1,113 @@ package com.iab.gpp.encoder.section; -import java.util.Arrays; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; -import com.iab.gpp.encoder.datatype.encoder.AbstractBase64UrlEncoder; -import com.iab.gpp.encoder.datatype.encoder.CompressedBase64UrlEncoder; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.field.UspV1Field; import com.iab.gpp.encoder.field.UsVaV1Field; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsVaV1CoreSegment; + +public class UsVaV1 extends AbstractLazilyEncodableSection { -public class UsVaV1 extends AbstractEncodableBitStringSection { public static int ID = 9; public static int VERSION = 1; public static String NAME = "usvav1"; - private AbstractBase64UrlEncoder base64UrlEncoder = new CompressedBase64UrlEncoder(); - public UsVaV1() { - initFields(); + super(); } - public UsVaV1(String encodedString) throws DecodingException { - initFields(); - - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } + public UsVaV1(String encodedString) { + super(); + decode(encodedString); } - private void initFields() { - fields = new HashMap<>(); - - fields.put(UsVaV1Field.VERSION, new EncodableFixedInteger(6, UsVaV1.VERSION)); - fields.put(UsVaV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); - - //@formatter:off - fieldOrder = new String[] { - UsVaV1Field.VERSION, - UsVaV1Field.SHARING_NOTICE, - UsVaV1Field.SALE_OPT_OUT_NOTICE, - UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UsVaV1Field.SALE_OPT_OUT, - UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, - UsVaV1Field.SENSITIVE_DATA_PROCESSING, - UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsVaV1Field.MSPA_COVERED_TRANSACTION, - UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE - }; - //@formatter:on + @Override + public int getId() { + return UsVaV1.ID; } @Override - public String encode() throws EncodingException { - String bitString = this.encodeToBitString(); - String encodedString = base64UrlEncoder.encode(bitString); - return encodedString; + public String getName() { + return UsVaV1.NAME; } @Override - public void decode(String encodedString) throws DecodingException { - String bitString = base64UrlEncoder.decode(encodedString); - this.decodeFromBitString(bitString); + public int getVersion() { + return UsVaV1.VERSION; } @Override - public int getId() { - return UsVaV1.ID; + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsVaV1CoreSegment()); + return segments; } @Override - public String getName() { - return UsVaV1.NAME; + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + for (int i = 0; i < segments.size(); i++) { + if (encodedSegments.length > i) { + segments.get(i).decode(encodedSegments[i]); + } + } + } + + return segments; } - public Integer getVersion() { - return (Integer) this.fields.get(UspV1Field.VERSION).getValue(); + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + for (EncodableSegment segment : segments) { + encodedSegments.add(segment.encode()); + } + return String.join(".", encodedSegments); } + public Integer getSharingNotice() { - return (Integer) this.fields.get(UsVaV1Field.SHARING_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsVaV1Field.SHARING_NOTICE); } public Integer getSaleOptOutNotice() { - return (Integer) this.fields.get(UsVaV1Field.SALE_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.fields.get(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE).getValue(); + return (Integer) this.getFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.fields.get(UsVaV1Field.SALE_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsVaV1Field.SALE_OPT_OUT); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.fields.get(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT).getValue(); + return (Integer) this.getFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.fields.get(UsVaV1Field.SENSITIVE_DATA_PROCESSING).getValue(); + return (List) this.getFieldValue(UsVaV1Field.SENSITIVE_DATA_PROCESSING); } public Integer getKnownChildSensitiveDataConsents() { - return (Integer) this.fields.get(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS).getValue(); + return (Integer) this.getFieldValue(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.fields.get(UsVaV1Field.MSPA_COVERED_TRANSACTION).getValue(); + return (Integer) this.getFieldValue(UsVaV1Field.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.fields.get(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE).getValue(); + return (Integer) this.getFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.fields.get(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE).getValue(); + return (Integer) this.getFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE); } - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java index cdb20122..e70261e4 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UspV1.java @@ -1,107 +1,84 @@ package com.iab.gpp.encoder.section; -import java.util.HashMap; -import java.util.Map; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; -import com.iab.gpp.encoder.field.UspV1LegacyField; - -public class UspV1 implements EncodableSection { +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.field.UspV1Field; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UspV1CoreSegment; + +public class UspV1 extends AbstractLazilyEncodableSection { + public static int ID = 6; public static int VERSION = 1; public static String NAME = "uspv1"; - protected Map fields; - public UspV1() { - initFields(); - } - - public UspV1(String encodedString) throws DecodingException { - initFields(); - - if (encodedString != null && encodedString.length() > 0) { - this.decode(encodedString); - } + super(); } - private void initFields() { - fields = new HashMap<>(); - fields.put(UspV1LegacyField.VERSION, UspV1.VERSION); - fields.put(UspV1LegacyField.NOTICE, "-"); - fields.put(UspV1LegacyField.OPT_OUT_SALE, "-"); - fields.put(UspV1LegacyField.LSPA_COVERED, "-"); + public UspV1(String encodedString) { + super(); + decode(encodedString); } @Override - public boolean hasField(String fieldName) { - return this.fields.containsKey(fieldName); + public int getId() { + return UspV1.ID; } @Override - public Object getFieldValue(String fieldName) { - if (this.fields.containsKey(fieldName)) { - return this.fields.get(fieldName); - } else { - return null; - } + public String getName() { + return UspV1.NAME; } @Override - public void setFieldValue(String fieldName, Object value) throws InvalidFieldException { - if (this.fields.containsKey(fieldName)) { - this.fields.put(fieldName, value); - } else { - throw new InvalidFieldException(fieldName + " not found"); - } + public int getVersion() { + return UspV1.VERSION; } @Override - public String encode() throws EncodingException { - String str = ""; - str += this.getFieldValue(UspV1LegacyField.VERSION); - str += this.getFieldValue(UspV1LegacyField.NOTICE); - str += this.getFieldValue(UspV1LegacyField.OPT_OUT_SALE); - str += this.getFieldValue(UspV1LegacyField.LSPA_COVERED); - return str; + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UspV1CoreSegment()); + return segments; } - + @Override - public void decode(String encodedString) throws DecodingException { - try { - this.setFieldValue(UspV1LegacyField.VERSION, Integer.parseInt(String.valueOf(encodedString.charAt(0)))); - this.setFieldValue(UspV1LegacyField.NOTICE, String.valueOf(encodedString.charAt(1))); - this.setFieldValue(UspV1LegacyField.OPT_OUT_SALE, String.valueOf(encodedString.charAt(2))); - this.setFieldValue(UspV1LegacyField.LSPA_COVERED, String.valueOf(encodedString.charAt(3))); - } catch (InvalidFieldException e) { - throw new DecodingException(e); + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + for(int i=0; i i) { + segments.get(i).decode(encodedSegments[i]); + } + } } + + return segments; } @Override - public int getId() { - return UspV1.ID; - } - - @Override - public String getName() { - return UspV1.NAME; - } - - public Integer getVersion() { - return (Integer) this.fields.get(UspV1LegacyField.VERSION); + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + for(EncodableSegment segment : segments) { + encodedSegments.add(segment.encode()); + } + return String.join(".", encodedSegments); } - public String getNotice() { - return (String) fields.get(UspV1LegacyField.NOTICE); + + public Character getNotice() { + return (Character) this.getFieldValue(UspV1Field.NOTICE); } - public String getOptOutSale() { - return (String) fields.get(UspV1LegacyField.OPT_OUT_SALE); + public Character getOptOutSale() { + return (Character) this.getFieldValue(UspV1Field.OPT_OUT_SALE); } - public String getLspaCovered() { - return (String) fields.get(UspV1LegacyField.LSPA_COVERED); + public Character getLspaCovered() { + return (Character) this.getFieldValue(UspV1Field.LSPA_COVERED); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java new file mode 100644 index 00000000..44e6bc9f --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java @@ -0,0 +1,75 @@ +package com.iab.gpp.encoder.segment; + +import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.field.Fields; + +public abstract class AbstractLazilyEncodableSegment> implements EncodableSegment { + + protected T fields; + + private String encodedString = null; + + private boolean dirty = false; + private boolean decoded = true; + + public AbstractLazilyEncodableSegment() { + this.fields = initializeFields(); + } + + protected abstract T initializeFields(); + + protected abstract String encodeSegment(T fields); + + protected abstract void decodeSegment(String encodedString, T Fields); + + public boolean hasField(String fieldName) { + return this.fields.containsKey(fieldName); + } + + public Object getFieldValue(String fieldName) { + if (!this.decoded) { + this.decodeSegment(this.encodedString, this.fields); + this.dirty = false; + this.decoded = true; + } + + if (this.fields.containsKey(fieldName)) { + return this.fields.get(fieldName).getValue(); + } else { + throw new InvalidFieldException("Invalid field: '" + fieldName + "'"); + } + } + + public void setFieldValue(String fieldName, Object value) { + if (!this.decoded) { + this.decodeSegment(this.encodedString, this.fields); + this.dirty = false; + this.decoded = true; + } + + if (this.fields.containsKey(fieldName)) { + this.fields.get(fieldName).setValue(value); + this.dirty = true; + } else { + throw new InvalidFieldException(fieldName + " not found"); + } + } + + public String encode() { + if (this.encodedString == null || this.encodedString.isEmpty() || this.dirty) { + this.encodedString = encodeSegment(this.fields); + this.dirty = false; + this.decoded = true; + } + + return this.encodedString; + } + + public void decode(String encodedString) { + this.encodedString = encodedString; + this.dirty = false; + this.decoded = false; + } + + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java new file mode 100644 index 00000000..abdde319 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java @@ -0,0 +1,18 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; + +public interface EncodableSegment { + + List getFieldNames(); + + boolean hasField(String fieldName); + + Object getFieldValue(String fieldName); + + void setFieldValue(String fieldName, Object value); + + String encode(); + + void decode(String encodedString); +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java new file mode 100644 index 00000000..44e18bbf --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java @@ -0,0 +1,57 @@ +package com.iab.gpp.encoder.segment; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFibonacciIntegerRange; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.HeaderV1Field; +import com.iab.gpp.encoder.section.HeaderV1; + +public class HeaderV1CoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public HeaderV1CoreSegment() { + super(); + } + + public HeaderV1CoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return HeaderV1Field.HEADER_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(HeaderV1Field.ID, new EncodableFixedInteger(6, HeaderV1.ID)); + fields.put(HeaderV1Field.VERSION, new EncodableFixedInteger(6, HeaderV1.VERSION)); + fields.put(HeaderV1Field.SECTION_IDS, new EncodableFibonacciIntegerRange(new ArrayList<>())); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1CoreSegment.java new file mode 100644 index 00000000..069ec010 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1CoreSegment.java @@ -0,0 +1,82 @@ +package com.iab.gpp.encoder.segment; + +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableDatetime; +import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedString; +import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.TcfCaV1Field; +import com.iab.gpp.encoder.section.TcfCaV1; + +public class TcfCaV1CoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public TcfCaV1CoreSegment() { + super(); + } + + public TcfCaV1CoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return TcfCaV1Field.TCFCAV1_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + ZonedDateTime date = ZonedDateTime.now(); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(TcfCaV1Field.VERSION, new EncodableFixedInteger(6, TcfCaV1.VERSION)); + fields.put(TcfCaV1Field.CREATED, new EncodableDatetime(date)); + fields.put(TcfCaV1Field.LAST_UPDATED, new EncodableDatetime(date)); + fields.put(TcfCaV1Field.CMP_ID, new EncodableFixedInteger(12, 0)); + fields.put(TcfCaV1Field.CMP_VERSION, new EncodableFixedInteger(12, 0)); + fields.put(TcfCaV1Field.CONSENT_SCREEN, new EncodableFixedInteger(6, 0)); + fields.put(TcfCaV1Field.CONSENT_LANGUAGE, new EncodableFixedString(2, "EN")); + fields.put(TcfCaV1Field.VENDOR_LIST_VERSION, new EncodableFixedInteger(12, 0)); + fields.put(TcfCaV1Field.TCF_POLICY_VERSION, new EncodableFixedInteger(6, 2)); + fields.put(TcfCaV1Field.USE_NON_STANDARD_STACKS, new EncodableBoolean(false)); + fields.put(TcfCaV1Field.SPECIAL_FEATURE_EXPRESS_CONSENT, new EncodableFixedBitfield( + Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfCaV1Field.PURPOSES_EXPRESS_CONSENT, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfCaV1Field.PURPOSES_IMPLIED_CONSENT, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfCaV1Field.VENDOR_EXPRESS_CONSENT, new EncodableOptimizedFixedRange(new ArrayList<>())); + fields.put(TcfCaV1Field.VENDOR_IMPLIED_CONSENT, new EncodableOptimizedFixedRange(new ArrayList<>())); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1PublisherPurposesSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1PublisherPurposesSegment.java new file mode 100644 index 00000000..89d63390 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1PublisherPurposesSegment.java @@ -0,0 +1,81 @@ +package com.iab.gpp.encoder.segment; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.IntSupplier; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFlexibleBitfield; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.TcfCaV1Field; + +public class TcfCaV1PublisherPurposesSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public TcfCaV1PublisherPurposesSegment() { + super(); + } + + public TcfCaV1PublisherPurposesSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return TcfCaV1Field.TCFCAV1_PUBLISHER_PURPOSES_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(TcfCaV1Field.PUB_PURPOSES_SEGMENT_TYPE, new EncodableFixedInteger(3, 3)); + fields.put(TcfCaV1Field.PUB_PURPOSES_EXPRESS_CONSENT, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfCaV1Field.PUB_PURPOSES_IMPLIED_CONSENT, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + + EncodableFixedInteger numCustomPurposes = new EncodableFixedInteger(6, 0); + fields.put(TcfCaV1Field.NUM_CUSTOM_PURPOSES, numCustomPurposes); + + IntSupplier getLengthSupplier = new IntSupplier() { + + @Override + public int getAsInt() { + return numCustomPurposes.getValue(); + } + + }; + + fields.put(TcfCaV1Field.CUSTOM_PURPOSES_EXPRESS_CONSENT, + new EncodableFlexibleBitfield(getLengthSupplier, new ArrayList<>())); + + fields.put(TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, + new EncodableFlexibleBitfield(getLengthSupplier, new ArrayList<>())); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2CoreSegment.java new file mode 100644 index 00000000..5e894459 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2CoreSegment.java @@ -0,0 +1,88 @@ +package com.iab.gpp.encoder.segment; + +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.TraditionalBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableDatetime; +import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerRange; +import com.iab.gpp.encoder.datatype.EncodableFixedString; +import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.TcfEuV2Field; +import com.iab.gpp.encoder.section.TcfEuV2; + +public class TcfEuV2CoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = TraditionalBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public TcfEuV2CoreSegment() { + super(); + } + + public TcfEuV2CoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return TcfEuV2Field.TCFEUV2_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + ZonedDateTime date = ZonedDateTime.now(); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(TcfEuV2Field.VERSION, new EncodableFixedInteger(6, TcfEuV2.VERSION)); + fields.put(TcfEuV2Field.CREATED, new EncodableDatetime(date)); + fields.put(TcfEuV2Field.LAST_UPDATED, new EncodableDatetime(date)); + fields.put(TcfEuV2Field.CMP_ID, new EncodableFixedInteger(12, 0)); + fields.put(TcfEuV2Field.CMP_VERSION, new EncodableFixedInteger(12, 0)); + fields.put(TcfEuV2Field.CONSENT_SCREEN, new EncodableFixedInteger(6, 0)); + fields.put(TcfEuV2Field.CONSENT_LANGUAGE, new EncodableFixedString(2, "EN")); + fields.put(TcfEuV2Field.VENDOR_LIST_VERSION, new EncodableFixedInteger(12, 0)); + fields.put(TcfEuV2Field.POLICY_VERSION, new EncodableFixedInteger(6, 2)); + fields.put(TcfEuV2Field.IS_SERVICE_SPECIFIC, new EncodableBoolean(false)); + fields.put(TcfEuV2Field.USE_NON_STANDARD_STACKS, new EncodableBoolean(false)); + fields.put(TcfEuV2Field.SPECIAL_FEATURE_OPTINS, new EncodableFixedBitfield( + Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfEuV2Field.PURPOSE_CONSENTS, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfEuV2Field.PURPOSE_LEGITIMATE_INTERESTS, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfEuV2Field.PURPOSE_ONE_TREATMENT, new EncodableBoolean(false)); + fields.put(TcfEuV2Field.PUBLISHER_COUNTRY_CODE, new EncodableFixedString(2, "AA")); + fields.put(TcfEuV2Field.VENDOR_CONSENTS, new EncodableOptimizedFixedRange(new ArrayList<>())); + fields.put(TcfEuV2Field.VENDOR_LEGITIMATE_INTERESTS, new EncodableOptimizedFixedRange(new ArrayList<>())); + + fields.put(TcfEuV2Field.PUBLISHER_RESTRICTIONS, new EncodableFixedIntegerRange(new ArrayList<>())); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2PublisherPurposesSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2PublisherPurposesSegment.java new file mode 100644 index 00000000..4d351f67 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2PublisherPurposesSegment.java @@ -0,0 +1,81 @@ +package com.iab.gpp.encoder.segment; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.IntSupplier; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.TraditionalBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFlexibleBitfield; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.TcfEuV2Field; + +public class TcfEuV2PublisherPurposesSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = TraditionalBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public TcfEuV2PublisherPurposesSegment() { + super(); + } + + public TcfEuV2PublisherPurposesSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return TcfEuV2Field.TCFEUV2_PUBLISHER_PURPOSES_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(TcfEuV2Field.PUBLISHER_PURPOSES_SEGMENT_TYPE, new EncodableFixedInteger(3, 3)); + fields.put(TcfEuV2Field.PUBLISHER_CONSENTS, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + fields.put(TcfEuV2Field.PUBLISHER_LEGITIMATE_INTERESTS, + new EncodableFixedBitfield(Arrays.asList(false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false))); + + EncodableFixedInteger numCustomPurposes = new EncodableFixedInteger(6, 0); + fields.put(TcfEuV2Field.NUM_CUSTOM_PURPOSES, numCustomPurposes); + + IntSupplier getLengthSupplier = new IntSupplier() { + + @Override + public int getAsInt() { + return numCustomPurposes.getValue(); + } + + }; + + fields.put(TcfEuV2Field.PUBLISHER_CUSTOM_CONSENTS, + new EncodableFlexibleBitfield(getLengthSupplier, new ArrayList<>())); + + fields.put(TcfEuV2Field.PUBLISHER_CUSTOM_LEGITIMATE_INTERESTS, + new EncodableFlexibleBitfield(getLengthSupplier, new ArrayList<>())); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsAllowedSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsAllowedSegment.java new file mode 100644 index 00000000..ffe382be --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsAllowedSegment.java @@ -0,0 +1,55 @@ +package com.iab.gpp.encoder.segment; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.TraditionalBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.TcfEuV2Field; + +public class TcfEuV2VendorsAllowedSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = TraditionalBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public TcfEuV2VendorsAllowedSegment() { + super(); + } + + public TcfEuV2VendorsAllowedSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return TcfEuV2Field.TCFEUV2_VENDORS_ALLOWED_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(TcfEuV2Field.VENDORS_ALLOWED_SEGMENT_TYPE, new EncodableFixedInteger(3, 2)); + fields.put(TcfEuV2Field.VENDORS_ALLOWED, new EncodableOptimizedFixedRange(new ArrayList<>())); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsDisclosedSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsDisclosedSegment.java new file mode 100644 index 00000000..1487eb5b --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsDisclosedSegment.java @@ -0,0 +1,55 @@ +package com.iab.gpp.encoder.segment; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.TraditionalBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.TcfEuV2Field; + +public class TcfEuV2VendorsDisclosedSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = TraditionalBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public TcfEuV2VendorsDisclosedSegment() { + super(); + } + + public TcfEuV2VendorsDisclosedSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return TcfEuV2Field.TCFEUV2_VENDORS_DISCLOSED_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(TcfEuV2Field.VENDORS_DISCLOSED_SEGMENT_TYPE, new EncodableFixedInteger(3, 1)); + fields.put(TcfEuV2Field.VENDORS_DISCLOSED, new EncodableOptimizedFixedRange(new ArrayList<>())); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java new file mode 100644 index 00000000..4350e694 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java @@ -0,0 +1,67 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsCaV1Field; +import com.iab.gpp.encoder.section.UsCaV1; + +public class UsCaV1CoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsCaV1CoreSegment() { + super(); + } + + public UsCaV1CoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsCaV1Field.USCAV1_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsCaV1Field.VERSION, new EncodableFixedInteger(6, UsCaV1.VERSION)); + fields.put(UsCaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); + fields.put(UsCaV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1GpcSegment.java new file mode 100644 index 00000000..d3b15593 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1GpcSegment.java @@ -0,0 +1,55 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsCaV1Field; + +public class UsCaV1GpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsCaV1GpcSegment() { + super(); + } + + public UsCaV1GpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsCaV1Field.USCAV1_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsCaV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsCaV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsCaV1Field.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java new file mode 100644 index 00000000..4885f8f6 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java @@ -0,0 +1,66 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsCoV1Field; +import com.iab.gpp.encoder.section.UsCoV1; + +public class UsCoV1CoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsCoV1CoreSegment() { + super(); + } + + public UsCoV1CoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsCoV1Field.USCOV1_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsCoV1Field.VERSION, new EncodableFixedInteger(6, UsCoV1.VERSION)); + fields.put(UsCoV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0))); + fields.put(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1GpcSegment.java new file mode 100644 index 00000000..6281419c --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1GpcSegment.java @@ -0,0 +1,55 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsCoV1Field; + +public class UsCoV1GpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsCoV1GpcSegment() { + super(); + } + + public UsCoV1GpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsCoV1Field.USCOV1_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsCoV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsCoV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsCoV1Field.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java new file mode 100644 index 00000000..22a44d61 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java @@ -0,0 +1,67 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsCtV1Field; +import com.iab.gpp.encoder.section.UsCtV1; + +public class UsCtV1CoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsCtV1CoreSegment() { + super(); + } + + public UsCtV1CoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsCtV1Field.USCTV1_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsCtV1Field.VERSION, new EncodableFixedInteger(6, UsCtV1.VERSION)); + fields.put(UsCtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0))); + fields.put(UsCtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1GpcSegment.java new file mode 100644 index 00000000..6ff912c0 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1GpcSegment.java @@ -0,0 +1,55 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsCtV1Field; + +public class UsCtV1GpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsCtV1GpcSegment() { + super(); + } + + public UsCtV1GpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsCtV1Field.USCTV1_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsCtV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsCtV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsCtV1Field.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java new file mode 100644 index 00000000..ee664225 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java @@ -0,0 +1,71 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsNatV1Field; +import com.iab.gpp.encoder.section.UsNatV1; + +public class UsNatV1CoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsNatV1CoreSegment() { + super(); + } + + public UsNatV1CoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsNatV1Field.USNATV1_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsNatV1Field.VERSION, new EncodableFixedInteger(6, UsNatV1.VERSION)); + fields.put(UsNatV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); + fields.put(UsNatV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1GpcSegment.java new file mode 100644 index 00000000..ea8d9746 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1GpcSegment.java @@ -0,0 +1,55 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsNatV1Field; + +public class UsNatV1GpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsNatV1GpcSegment() { + super(); + } + + public UsNatV1GpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsNatV1Field.USNATV1_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsNatV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsNatV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsNatV1Field.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java new file mode 100644 index 00000000..21c941b5 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java @@ -0,0 +1,67 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsUtV1Field; +import com.iab.gpp.encoder.section.UsUtV1; + +public class UsUtV1CoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsUtV1CoreSegment() { + super(); + } + + public UsUtV1CoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsUtV1Field.USUTV1_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsUtV1Field.VERSION, new EncodableFixedInteger(6, UsUtV1.VERSION)); + fields.put(UsUtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java new file mode 100644 index 00000000..c52f7ba6 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java @@ -0,0 +1,66 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsVaV1Field; +import com.iab.gpp.encoder.section.UsVaV1; + +public class UsVaV1CoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsVaV1CoreSegment() { + super(); + } + + public UsVaV1CoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsVaV1Field.USVAV1_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsVaV1Field.VERSION, new EncodableFixedInteger(6, UsVaV1.VERSION)); + fields.put(UsVaV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); + fields.put(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java new file mode 100644 index 00000000..d7ec8525 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.datatype.UnencodableCharacter; +import com.iab.gpp.encoder.datatype.UnencodableInteger; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.GenericFields; +import com.iab.gpp.encoder.field.UspV1Field; +import com.iab.gpp.encoder.section.UspV1; + +public class UspV1CoreSegment extends AbstractLazilyEncodableSegment { + + public UspV1CoreSegment() { + super(); + } + + public UspV1CoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UspV1Field.USPV1_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected GenericFields initializeFields() { + GenericFields fields = new GenericFields(); + fields.put(UspV1Field.VERSION, new UnencodableInteger(UspV1.VERSION)); + fields.put(UspV1Field.NOTICE, new UnencodableCharacter('-')); + fields.put(UspV1Field.OPT_OUT_SALE, new UnencodableCharacter('-')); + fields.put(UspV1Field.LSPA_COVERED, new UnencodableCharacter('-')); + return fields; + } + + @Override + protected String encodeSegment(GenericFields fields) { + String str = ""; + str += fields.get(UspV1Field.VERSION).getValue(); + str += fields.get(UspV1Field.NOTICE).getValue(); + str += fields.get(UspV1Field.OPT_OUT_SALE).getValue(); + str += fields.get(UspV1Field.LSPA_COVERED).getValue(); + return str; + } + + @Override + protected void decodeSegment(String encodedString, GenericFields fields) { + if (encodedString == null || encodedString.length() != 4) { + throw new DecodingException("Invalid uspv1 string: '" + encodedString + "'"); + } + + fields.get(UspV1Field.VERSION).setValue(Integer.parseInt(encodedString.substring(0, 1))); + fields.get(UspV1Field.NOTICE).setValue(encodedString.charAt(1)); + fields.get(UspV1Field.OPT_OUT_SALE).setValue(encodedString.charAt(2)); + fields.get(UspV1Field.LSPA_COVERED).setValue(encodedString.charAt(3)); + } + +} + diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index a28858af..2799e551 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -4,13 +4,9 @@ import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.Arrays; -import java.util.List; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; -import com.iab.gpp.encoder.error.LazyDecodingException; import com.iab.gpp.encoder.field.TcfCaV1Field; import com.iab.gpp.encoder.field.TcfEuV2Field; import com.iab.gpp.encoder.field.UsCaV1Field; @@ -18,8 +14,8 @@ import com.iab.gpp.encoder.field.UsCtV1Field; import com.iab.gpp.encoder.field.UsNatV1Field; import com.iab.gpp.encoder.field.UsUtV1Field; -import com.iab.gpp.encoder.field.UspV1Field; import com.iab.gpp.encoder.field.UsVaV1Field; +import com.iab.gpp.encoder.field.UspV1Field; import com.iab.gpp.encoder.section.TcfCaV1; import com.iab.gpp.encoder.section.TcfEuV2; import com.iab.gpp.encoder.section.UsCaV1; @@ -27,15 +23,15 @@ import com.iab.gpp.encoder.section.UsCtV1; import com.iab.gpp.encoder.section.UsNatV1; import com.iab.gpp.encoder.section.UsUtV1; -import com.iab.gpp.encoder.section.UspV1; import com.iab.gpp.encoder.section.UsVaV1; +import com.iab.gpp.encoder.section.UspV1; public class GppModelTest { private ZonedDateTime utcDateTime = ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")); @Test - public void testEncodeDefault() throws EncodingException, LazyDecodingException { + public void testEncodeDefault() { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -60,17 +56,18 @@ public void testEncodeDefault() throws EncodingException, LazyDecodingException } @Test - public void testDecodingException() { + public void testLazyDecodingException() { + GppModel gppModel = new GppModel("invalid gpp string"); try { - GppModel gppModel = new GppModel("invalid gpp string"); - Assertions.fail("Expected LazyDecodingException"); + gppModel.getHeader(); + Assertions.fail("Expected DecodingException"); } catch (DecodingException e) { } } @Test - public void testEncodeDefaultAll() throws EncodingException, InvalidFieldException, LazyDecodingException { + public void testEncodeDefaultAll() { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); @@ -117,7 +114,7 @@ public void testEncodeDefaultAll() throws EncodingException, InvalidFieldExcepti } @Test - public void testEncodeUspv1() throws EncodingException, InvalidFieldException, LazyDecodingException { + public void testEncodeUspv1() { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -127,9 +124,9 @@ public void testEncodeUspv1() throws EncodingException, InvalidFieldException, L Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, "Y"); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, "N"); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, "N"); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, 'Y'); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, 'N'); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, 'N'); Assertions.assertEquals(Arrays.asList(6), gppModel.getSectionIds()); Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); @@ -157,7 +154,7 @@ public void testEncodeUspv1() throws EncodingException, InvalidFieldException, L } @Test - public void testEncodeTcfEuV2() throws EncodingException, InvalidFieldException, LazyDecodingException { + public void testEncodeTcfEuV2() { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -207,7 +204,7 @@ public void testEncodeTcfEuV2() throws EncodingException, InvalidFieldException, } @Test - public void testEncodeUspV1AndTcfEuV2() throws EncodingException, InvalidFieldException, LazyDecodingException { + public void testEncodeUspV1AndTcfEuV2() { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); @@ -231,9 +228,9 @@ public void testEncodeUspV1AndTcfEuV2() throws EncodingException, InvalidFieldEx Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, "Y"); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, "N"); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, "N"); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, 'Y'); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, 'N'); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, 'N'); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); @@ -253,7 +250,7 @@ public void testEncodeUspV1AndTcfEuV2() throws EncodingException, InvalidFieldEx @Test public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() - throws EncodingException, InvalidFieldException, LazyDecodingException { + { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -287,9 +284,9 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, "Y"); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, "N"); - gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, "N"); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.NOTICE, 'Y'); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE, 'N'); + gppModel.setFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED, 'N'); Assertions.assertEquals(true, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.ID)); @@ -355,7 +352,7 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() } @Test - public void testDecodeDefaults() throws DecodingException { + public void testDecodeDefaults() { String gppString = "DBAA"; GppModel gppModel = new GppModel(gppString); @@ -370,7 +367,7 @@ public void testDecodeDefaults() throws DecodingException { } @Test - public void testDecodeDefaultsAll() throws DecodingException { + public void testDecodeDefaultsAll() { String gppString = "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAAA.QA~BAAAAAAA.QA~BAAAAAA~BAAAAAA.QA~BAAAAAAA~BAAAAAAA.QA"; GppModel gppModel = new GppModel(gppString); @@ -387,7 +384,7 @@ public void testDecodeDefaultsAll() throws DecodingException { } @Test - public void testDecodeUspv1() throws DecodingException { + public void testDecodeUspv1() { String gppString = "DBABTA~1YNN"; GppModel gppModel = new GppModel(gppString); @@ -400,17 +397,17 @@ public void testDecodeUspv1() throws DecodingException { Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); - Assertions.assertEquals("Y", gppModel.getFieldValue(UspV1.ID, UspV1Field.NOTICE)); - Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.ID, UspV1Field.OPT_OUT_SALE)); - Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.ID, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals('Y', gppModel.getFieldValue(UspV1.ID, UspV1Field.NOTICE)); + Assertions.assertEquals('N', gppModel.getFieldValue(UspV1.ID, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals('N', gppModel.getFieldValue(UspV1.ID, UspV1Field.LSPA_COVERED)); - Assertions.assertEquals("Y", gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); - Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); - Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals('Y', gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); + Assertions.assertEquals('N', gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals('N', gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); } @Test - public void testDecodeTcfEuV2() throws DecodingException { + public void testDecodeTcfEuV2() { String gppString = "DBABMA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA"; GppModel gppModel = new GppModel(gppString); @@ -453,7 +450,7 @@ public void testDecodeTcfEuV2() throws DecodingException { } @Test - public void testDecodeUspv1AndTcfEuV2() throws DecodingException { + public void testDecodeUspv1AndTcfEuV2() { String gppString = "DBACNYA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~1YNN"; GppModel gppModel = new GppModel(gppString); @@ -467,13 +464,13 @@ public void testDecodeUspv1AndTcfEuV2() throws DecodingException { Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); - Assertions.assertEquals("Y", gppModel.getFieldValue(UspV1.ID, UspV1Field.NOTICE)); - Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.ID, UspV1Field.OPT_OUT_SALE)); - Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.ID, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals('Y', gppModel.getFieldValue(UspV1.ID, UspV1Field.NOTICE)); + Assertions.assertEquals('N', gppModel.getFieldValue(UspV1.ID, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals('N', gppModel.getFieldValue(UspV1.ID, UspV1Field.LSPA_COVERED)); - Assertions.assertEquals("Y", gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); - Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); - Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals('Y', gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); + Assertions.assertEquals('N', gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals('N', gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.VERSION)); Assertions.assertEquals(880, gppModel.getFieldValue(TcfEuV2.ID, TcfEuV2Field.CMP_ID)); @@ -511,13 +508,13 @@ public void testDecodeUspv1AndTcfEuV2() throws DecodingException { UspV1 uspV1Section = (UspV1) gppModel.getSection(UspV1.NAME); Integer uspV1Version = uspV1Section.getVersion(); - String notice = uspV1Section.getNotice(); + Character notice = uspV1Section.getNotice(); Assertions.assertEquals(1, uspV1Version); - Assertions.assertEquals("Y", notice); + Assertions.assertEquals('Y', notice); } @Test - public void testDecodeUspv1AndTcfEuV2AndTcfCaV1() throws DecodingException { + public void testDecodeUspv1AndTcfEuV2AndTcfCaV1() { String gppString = "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao~1YNN"; GppModel gppModel = new GppModel(gppString); @@ -527,9 +524,9 @@ public void testDecodeUspv1AndTcfEuV2AndTcfCaV1() throws DecodingException { Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME)); - Assertions.assertEquals("Y", gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); - Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); - Assertions.assertEquals("N", gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); + Assertions.assertEquals('Y', gppModel.getFieldValue(UspV1.NAME, UspV1Field.NOTICE)); + Assertions.assertEquals('N', gppModel.getFieldValue(UspV1.NAME, UspV1Field.OPT_OUT_SALE)); + Assertions.assertEquals('N', gppModel.getFieldValue(UspV1.NAME, UspV1Field.LSPA_COVERED)); Assertions.assertEquals(2, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VERSION)); Assertions.assertEquals(880, gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.CMP_ID)); @@ -553,9 +550,9 @@ public void testDecodeUspv1AndTcfEuV2AndTcfCaV1() throws DecodingException { UspV1 uspV1Section = (UspV1) gppModel.getSection(UspV1.NAME); Integer uspV1Version = uspV1Section.getVersion(); - String notice = uspV1Section.getNotice(); + Character notice = uspV1Section.getNotice(); Assertions.assertEquals(1, uspV1Version); - Assertions.assertEquals("Y", notice); + Assertions.assertEquals('Y', notice); TcfCaV1 tcfCaV1Section = (TcfCaV1) gppModel.getSection(TcfCaV1.NAME); Assertions.assertEquals(50, tcfCaV1Section.getCmpId()); @@ -598,7 +595,7 @@ public void testDecodeUspv1AndTcfEuV2AndTcfCaV1() throws DecodingException { } @Test - public void testEncode1() throws EncodingException, InvalidFieldException, LazyDecodingException { + public void testEncode1() { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(28)); @@ -609,7 +606,7 @@ public void testEncode1() throws EncodingException, InvalidFieldException, LazyD } @Test - public void testEncode2() throws EncodingException, InvalidFieldException, LazyDecodingException { + public void testEncode2() { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(29)); @@ -620,7 +617,7 @@ public void testEncode2() throws EncodingException, InvalidFieldException, LazyD } @Test - public void testEncode3() throws EncodingException, InvalidFieldException, LazyDecodingException { + public void testEncode3() { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(1, 173, 722)); @@ -632,26 +629,26 @@ public void testEncode3() throws EncodingException, InvalidFieldException, LazyD } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { GppModel gppModel = new GppModel("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAOAAAABAAAAA.QAAA.IAAA"); Assertions.assertEquals(Arrays.asList(28), gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS)); } @Test - public void testDecode2() throws DecodingException { + public void testDecode2() { GppModel gppModel = new GppModel("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAOwAQAOgAAAA.QAAA.IAAA"); Assertions.assertEquals(Arrays.asList(29), gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS)); } @Test - public void testDecode3() throws DecodingException { + public void testDecode3() { GppModel gppModel = new GppModel("DBABMA~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAFpQAwAAgCtAWkAAAAAAA.QAAA.IAAA"); Assertions.assertEquals(Arrays.asList(1, 173, 722), gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS)); } @Test - public void testConsistency() throws InvalidFieldException, EncodingException, DecodingException { + public void testConsistency() { GppModel fromObjectModel = new GppModel(); fromObjectModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.PURPOSE_CONSENTS, @@ -673,4 +670,46 @@ public void testConsistency() throws InvalidFieldException, EncodingException, D decodedModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS)); } + + @Test + public void testNullConstructor() { + GppModel gppModel = new GppModel(null); + Assertions.assertEquals("DBAA", gppModel.encode()); + + gppModel.setFieldValue("uspv1", UspV1Field.NOTICE, 'Y'); + Assertions.assertEquals("DBABTA~1Y--", gppModel.encode()); + } + + @Test + public void testEmptyStringConstructor() { + GppModel gppModel = new GppModel(""); + Assertions.assertEquals("DBAA", gppModel.encode()); + + gppModel.setFieldValue("uspv1", UspV1Field.NOTICE, 'Y'); + Assertions.assertEquals("DBABTA~1Y--", gppModel.encode()); + } + + @Test + public void testDecodingNull() { + GppModel gppModel = new GppModel("DBABTA~1---"); + Assertions.assertEquals("DBABTA~1---", gppModel.encode()); + + gppModel.decode(null); + Assertions.assertEquals("DBAA", gppModel.encode()); + + gppModel.setFieldValue("uspv1", UspV1Field.NOTICE, 'Y'); + Assertions.assertEquals("DBABTA~1Y--", gppModel.encode()); + } + + @Test + public void testDecodingEmptyString() { + GppModel gppModel = new GppModel("DBABTA~1---"); + Assertions.assertEquals("DBABTA~1---", gppModel.encode()); + + gppModel.decode(null); + Assertions.assertEquals("DBAA", gppModel.encode()); + + gppModel.setFieldValue("uspv1", UspV1Field.NOTICE, 'Y'); + Assertions.assertEquals("DBABTA~1Y--", gppModel.encode()); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/base64/TraditionalBase64UrlEncoderTest.java similarity index 60% rename from iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoderTest.java rename to iabgpp-encoder/src/test/java/com/iab/gpp/encoder/base64/TraditionalBase64UrlEncoderTest.java index a24cdf12..bd154790 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/TraditionalBase64UrlEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/base64/TraditionalBase64UrlEncoderTest.java @@ -1,42 +1,40 @@ -package com.iab.gpp.encoder.datatype.encoder; +package com.iab.gpp.encoder.base64; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class TraditionalBase64UrlEncoderTest { - private TraditionalBase64UrlEncoder base64UrlEncoder = new TraditionalBase64UrlEncoder(); + private TraditionalBase64UrlEncoder base64UrlEncoder = TraditionalBase64UrlEncoder.getInstance(); @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { Assertions.assertEquals("DBABMAAA", base64UrlEncoder.encode("0000110000010000000000010011")); } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() { Assertions.assertEquals("DBACNYAA", base64UrlEncoder.encode("000011000001000000000010001101011")); } @Test - public void testEncode3() throws EncodingException { + public void testEncode3() { Assertions.assertEquals("DBABjwAA", base64UrlEncoder.encode("00001100000100000000000110001111")); } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { Assertions.assertEquals("000011000001000000000001001100000000000000000000", base64UrlEncoder.decode("DBABMAAA")); } @Test - public void testDecode2() throws DecodingException { + public void testDecode2() { Assertions.assertEquals("000011000001000000000010001101011000000000000000", base64UrlEncoder.decode("DBACNYAA")); } @Test - public void testDecode3() throws DecodingException { + public void testDecode3() { Assertions.assertEquals("000011000001000000000001100011110000000000000000", base64UrlEncoder.decode("DBABjwAA")); } - + } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java index 73af6f6e..8036f13f 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java @@ -3,71 +3,69 @@ import java.util.Arrays; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class EncodableOptimizedFixedRangeTest { private EncodableOptimizedFixedRange encodableOptimizedFixedRange = new EncodableOptimizedFixedRange(); @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { encodableOptimizedFixedRange.setValue(Arrays.asList(12, 24, 48)); Assertions.assertEquals("00000000001100000000000000001000000000001000000000000000000000001", encodableOptimizedFixedRange.encode()); } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() { encodableOptimizedFixedRange.setValue(Arrays.asList(18, 30)); Assertions.assertEquals("00000000000111100000000000000000001000000000001", encodableOptimizedFixedRange.encode()); } @Test - public void testEncode3() throws EncodingException { + public void testEncode3() { encodableOptimizedFixedRange.setValue(Arrays.asList(28)); Assertions.assertEquals("000000000001110000000000000000000000000000001", encodableOptimizedFixedRange.encode()); } @Test - public void testEncode4() throws EncodingException { + public void testEncode4() { encodableOptimizedFixedRange.setValue(Arrays.asList(29)); Assertions.assertEquals("0000000000011101100000000000100000000000011101", encodableOptimizedFixedRange.encode()); } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { encodableOptimizedFixedRange.decode("00000000001100000000000000001000000000001000000000000000000000001"); Assertions.assertEquals(Arrays.asList(12, 24, 48), encodableOptimizedFixedRange.getValue()); } @Test - public void testDecode2() throws DecodingException { + public void testDecode2() { encodableOptimizedFixedRange.decode("00000000000111100000000000000000001000000000001"); Assertions.assertEquals(Arrays.asList(18, 30), encodableOptimizedFixedRange.getValue()); } @Test - public void testDecode3() throws DecodingException { + public void testDecode3() { encodableOptimizedFixedRange.decode("000000000001110000000000000000000000000000001"); Assertions.assertEquals(Arrays.asList(28), encodableOptimizedFixedRange.getValue()); } @Test - public void testDecode4() throws DecodingException { + public void testDecode4() { encodableOptimizedFixedRange.decode("0000000000011101100000000000100000000000011101"); Assertions.assertEquals(Arrays.asList(29), encodableOptimizedFixedRange.getValue()); } @Test - public void testSubstring1() throws DecodingException { + public void testSubstring1() { Assertions.assertEquals("000000000001110000000000000000000000000000001", encodableOptimizedFixedRange.substring( "000010001111010010000110111111111100000000001111010010000110111111111100000000000000000000000000000000000000000100001101000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000001000000000000000000000000000000", 213)); } @Test - public void testSubstring2() throws DecodingException { + public void testSubstring2() { Assertions.assertEquals("0000000000011101100000000000100000000000011101", encodableOptimizedFixedRange.substring( "000010001111010010000110111111111100000000001111010010000110111111111100000000000000000000000000000000000000000100001101000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110110000000000010000000000001110100000000000000000000000000000", 213)); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoderTest.java index 3d1450f5..fea6ee70 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/BooleanEncoderTest.java @@ -3,27 +3,26 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class BooleanEncoderTest { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { Assertions.assertEquals("0", BooleanEncoder.encode(false)); } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() { Assertions.assertEquals("1", BooleanEncoder.encode(true)); } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { Assertions.assertEquals(false, BooleanEncoder.decode("0")); } @Test - public void testDecode2() throws DecodingException { + public void testDecode2() { Assertions.assertEquals(true, BooleanEncoder.decode("1")); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java index 77b5c9cf..9ded962f 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java @@ -5,77 +5,76 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class FixedBitfieldEncoderTest { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { Assertions.assertEquals("00", FixedBitfieldEncoder.encode(new ArrayList<>(), 2)); } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() { Assertions.assertEquals("0", FixedBitfieldEncoder.encode(Arrays.asList(false), 1)); } @Test - public void testEncode3() throws EncodingException { + public void testEncode3() { Assertions.assertEquals("1", FixedBitfieldEncoder.encode(Arrays.asList(true), 1)); } @Test - public void testEncode4() throws EncodingException { + public void testEncode4() { Assertions.assertEquals("00", FixedBitfieldEncoder.encode(Arrays.asList(false, false), 2)); } @Test - public void testEncode5() throws EncodingException { + public void testEncode5() { Assertions.assertEquals("01", FixedBitfieldEncoder.encode(Arrays.asList(false, true), 2)); } @Test - public void testEncode6() throws EncodingException { + public void testEncode6() { Assertions.assertEquals("10", FixedBitfieldEncoder.encode(Arrays.asList(true, false), 2)); } @Test - public void testEncode7() throws EncodingException { + public void testEncode7() { Assertions.assertEquals("11", FixedBitfieldEncoder.encode(Arrays.asList(true, true), 2)); } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { Assertions.assertEquals(new ArrayList<>(), FixedBitfieldEncoder.decode("")); } @Test - public void testDecode2() throws DecodingException { + public void testDecode2() { Assertions.assertEquals(Arrays.asList(false), FixedBitfieldEncoder.decode("0")); } @Test - public void testDecode3() throws DecodingException { + public void testDecode3() { Assertions.assertEquals(Arrays.asList(true), FixedBitfieldEncoder.decode("1")); } @Test - public void testDecode4() throws DecodingException { + public void testDecode4() { Assertions.assertEquals(Arrays.asList(false, false), FixedBitfieldEncoder.decode("00")); } @Test - public void testDecode5() throws DecodingException { + public void testDecode5() { Assertions.assertEquals(Arrays.asList(false, true), FixedBitfieldEncoder.decode("01")); } @Test - public void testDecode6() throws DecodingException { + public void testDecode6() { Assertions.assertEquals(Arrays.asList(true, false), FixedBitfieldEncoder.decode("10")); } @Test - public void testDecode7() throws DecodingException { + public void testDecode7() { Assertions.assertEquals(Arrays.asList(true, true), FixedBitfieldEncoder.decode("11")); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java index 2c95b455..df656eeb 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java @@ -5,182 +5,181 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; public class FixedIntegerListEncoderTest { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { Assertions.assertEquals("0000", FixedIntegerListEncoder.encode(new ArrayList<>(), 2, 2)); } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() { Assertions.assertEquals("0000", FixedIntegerListEncoder.encode(Arrays.asList(0), 2, 2)); } @Test - public void testEncode3() throws EncodingException { + public void testEncode3() { Assertions.assertEquals("0000", FixedIntegerListEncoder.encode(Arrays.asList(0, 0), 2, 2)); } @Test - public void testEncode4() throws EncodingException { + public void testEncode4() { Assertions.assertEquals("0001", FixedIntegerListEncoder.encode(Arrays.asList(0, 1), 2, 2)); } @Test - public void testEncode5() throws EncodingException { + public void testEncode5() { Assertions.assertEquals("0010", FixedIntegerListEncoder.encode(Arrays.asList(0, 2), 2, 2)); } @Test - public void testEncode6() throws EncodingException { + public void testEncode6() { Assertions.assertEquals("0011", FixedIntegerListEncoder.encode(Arrays.asList(0, 3), 2, 2)); } @Test - public void testEncode7() throws EncodingException { + public void testEncode7() { Assertions.assertEquals("0100", FixedIntegerListEncoder.encode(Arrays.asList(1, 0), 2, 2)); } @Test - public void testEncode8() throws EncodingException { + public void testEncode8() { Assertions.assertEquals("0101", FixedIntegerListEncoder.encode(Arrays.asList(1, 1), 2, 2)); } @Test - public void testEncode9() throws EncodingException { + public void testEncode9() { Assertions.assertEquals("0110", FixedIntegerListEncoder.encode(Arrays.asList(1, 2), 2, 2)); } @Test - public void testEncode10() throws EncodingException { + public void testEncode10() { Assertions.assertEquals("0111", FixedIntegerListEncoder.encode(Arrays.asList(1, 3), 2, 2)); } @Test - public void testEncode11() throws EncodingException { + public void testEncode11() { Assertions.assertEquals("1000", FixedIntegerListEncoder.encode(Arrays.asList(2, 0), 2, 2)); } @Test - public void testEncode12() throws EncodingException { + public void testEncode12() { Assertions.assertEquals("1001", FixedIntegerListEncoder.encode(Arrays.asList(2, 1), 2, 2)); } @Test - public void testEncode13() throws EncodingException { + public void testEncode13() { Assertions.assertEquals("1010", FixedIntegerListEncoder.encode(Arrays.asList(2, 2), 2, 2)); } @Test - public void testEncode14() throws EncodingException { + public void testEncode14() { Assertions.assertEquals("1011", FixedIntegerListEncoder.encode(Arrays.asList(2, 3), 2, 2)); } @Test - public void testEncode15() throws EncodingException { + public void testEncode15() { Assertions.assertEquals("1100", FixedIntegerListEncoder.encode(Arrays.asList(3, 0), 2, 2)); } @Test - public void testEncode16() throws EncodingException { + public void testEncode16() { Assertions.assertEquals("1101", FixedIntegerListEncoder.encode(Arrays.asList(3, 1), 2, 2)); } @Test - public void testEncode17() throws EncodingException { + public void testEncode17() { Assertions.assertEquals("1110", FixedIntegerListEncoder.encode(Arrays.asList(3, 2), 2, 2)); } @Test - public void testEncode18() throws EncodingException { + public void testEncode18() { Assertions.assertEquals("1111", FixedIntegerListEncoder.encode(Arrays.asList(3, 3), 2, 2)); } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { Assertions.assertEquals(Arrays.asList(0, 0), FixedIntegerListEncoder.decode("", 2, 2)); } @Test - public void testDecode2() throws DecodingException { + public void testDecode2() { Assertions.assertEquals(Arrays.asList(0, 0), FixedIntegerListEncoder.decode("0000", 2, 2)); } @Test - public void testDecode3() throws DecodingException { + public void testDecode3() { Assertions.assertEquals(Arrays.asList(0, 1), FixedIntegerListEncoder.decode("0001", 2, 2)); } @Test - public void testDecode4() throws DecodingException { + public void testDecode4() { Assertions.assertEquals(Arrays.asList(0, 2), FixedIntegerListEncoder.decode("0010", 2, 2)); } @Test - public void testDecode5() throws DecodingException { + public void testDecode5() { Assertions.assertEquals(Arrays.asList(0, 3), FixedIntegerListEncoder.decode("0011", 2, 2)); } @Test - public void testDecode6() throws DecodingException { + public void testDecode6() { Assertions.assertEquals(Arrays.asList(1, 0), FixedIntegerListEncoder.decode("0100", 2, 2)); } @Test - public void testDecode7() throws DecodingException { + public void testDecode7() { Assertions.assertEquals(Arrays.asList(1, 1), FixedIntegerListEncoder.decode("0101", 2, 2)); } @Test - public void testDecode8() throws DecodingException { + public void testDecode8() { Assertions.assertEquals(Arrays.asList(1, 2), FixedIntegerListEncoder.decode("0110", 2, 2)); } @Test - public void testDecode9() throws DecodingException { + public void testDecode9() { Assertions.assertEquals(Arrays.asList(1, 3), FixedIntegerListEncoder.decode("0111", 2, 2)); } @Test - public void testDecode10() throws DecodingException { + public void testDecode10() { Assertions.assertEquals(Arrays.asList(2, 0), FixedIntegerListEncoder.decode("1000", 2, 2)); } @Test - public void testDecode11() throws DecodingException { + public void testDecode11() { Assertions.assertEquals(Arrays.asList(2, 1), FixedIntegerListEncoder.decode("1001", 2, 2)); } @Test - public void testDecode12() throws DecodingException { + public void testDecode12() { Assertions.assertEquals(Arrays.asList(2, 2), FixedIntegerListEncoder.decode("1010", 2, 2)); } @Test - public void testDecode13() throws DecodingException { + public void testDecode13() { Assertions.assertEquals(Arrays.asList(2, 3), FixedIntegerListEncoder.decode("1011", 2, 2)); } @Test - public void testDecode14() throws DecodingException { + public void testDecode14() { Assertions.assertEquals(Arrays.asList(3, 0), FixedIntegerListEncoder.decode("1100", 2, 2)); } @Test - public void testDecode15() throws DecodingException { + public void testDecode15() { Assertions.assertEquals(Arrays.asList(3, 1), FixedIntegerListEncoder.decode("1101", 2, 2)); } @Test - public void testDecode16() throws DecodingException { + public void testDecode16() { Assertions.assertEquals(Arrays.asList(3, 2), FixedIntegerListEncoder.decode("1110", 2, 2)); } @Test - public void testDecode17() throws DecodingException { + public void testDecode17() { Assertions.assertEquals(Arrays.asList(3, 3), FixedIntegerListEncoder.decode("1111", 2, 2)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoderTest.java index aba5ee84..4fef7dcc 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedStringEncoderTest.java @@ -8,12 +8,12 @@ public class FixedStringEncoderTest { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { Assertions.assertEquals("000000000001", FixedStringEncoder.encode("AB", 2)); } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() { Assertions.assertEquals("100000111111", FixedStringEncoder.encode("a", 2)); } @@ -28,12 +28,12 @@ public void testEncode3() { } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { Assertions.assertEquals("AB", FixedStringEncoder.decode("000000000001")); } @Test - public void testDecode2() throws DecodingException { + public void testDecode2() { Assertions.assertEquals("a", FixedStringEncoder.decode("100000111111")); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java index 4c74ec5a..16c365c5 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/HeaderV1Test.java @@ -4,80 +4,32 @@ import java.util.Arrays; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; public class HeaderV1Test { @Test - public void testEncodeToBitString1() throws EncodingException, InvalidFieldException { - HeaderV1 headerV1 = new HeaderV1(); - headerV1.setFieldValue("SectionIds", new ArrayList<>()); - Assertions.assertEquals("000011000001000000000000", headerV1.encodeToBitString()); - } - - @Test - public void testEncodeToBitString2() throws EncodingException, InvalidFieldException { - HeaderV1 headerV1 = new HeaderV1(); - headerV1.setFieldValue("SectionIds", Arrays.asList(2)); - Assertions.assertEquals("0000110000010000000000010011", headerV1.encodeToBitString()); - } - - @Test - public void testEncodeToBitString3() throws EncodingException, InvalidFieldException { - HeaderV1 headerV1 = new HeaderV1(); - headerV1.setFieldValue("SectionIds", Arrays.asList(2, 6)); - Assertions.assertEquals("000011000001000000000010001101011", headerV1.encodeToBitString()); - } - - @Test - public void testDecodeFromBitString1() throws DecodingException { - HeaderV1 headerV1 = new HeaderV1(); - headerV1.decodeFromBitString("000011000001000000000000"); - Assertions.assertEquals(new ArrayList<>(), headerV1.getFieldValue("SectionIds")); - Assertions.assertEquals(headerV1.getFieldValue("SectionIds"), headerV1.getSectionsIds()); - } - - @Test - public void testDecodeFromBitString2() throws DecodingException { - HeaderV1 headerV1 = new HeaderV1(); - headerV1.decodeFromBitString("0000110000010000000000010011"); - Assertions.assertEquals(Arrays.asList(2), headerV1.getFieldValue("SectionIds")); - Assertions.assertEquals(headerV1.getFieldValue("SectionIds"), headerV1.getSectionsIds()); - } - - @Test - public void testDecodeFromBitString3() throws DecodingException { - HeaderV1 headerV1 = new HeaderV1(); - headerV1.decodeFromBitString("000001000011000000000010001101011"); - Assertions.assertEquals(Arrays.asList(2, 6), headerV1.getFieldValue("SectionIds")); - Assertions.assertEquals(headerV1.getFieldValue("SectionIds"), headerV1.getSectionsIds()); - } - - @Test - public void testEncode1() throws EncodingException, InvalidFieldException { + public void testEncode1() { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", new ArrayList<>()); Assertions.assertEquals("DBAA", headerV1.encode()); } @Test - public void testEncode2() throws EncodingException, InvalidFieldException { + public void testEncode2() { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", Arrays.asList(2)); Assertions.assertEquals("DBABMA", headerV1.encode()); } @Test - public void testEncode3() throws EncodingException, InvalidFieldException { + public void testEncode3() { HeaderV1 headerV1 = new HeaderV1(); headerV1.setFieldValue("SectionIds", Arrays.asList(2, 6)); Assertions.assertEquals("DBACNYA", headerV1.encode()); } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { HeaderV1 headerV1 = new HeaderV1(); headerV1.decode("DBAA"); Assertions.assertEquals(new ArrayList<>(), headerV1.getFieldValue("SectionIds")); @@ -86,7 +38,7 @@ public void testDecode1() throws DecodingException { } @Test - public void testDecode2() throws DecodingException { + public void testDecode2() { HeaderV1 headerV1 = new HeaderV1(); headerV1.decode("DBABMA"); Assertions.assertEquals(Arrays.asList(2), headerV1.getFieldValue("SectionIds")); @@ -95,7 +47,7 @@ public void testDecode2() throws DecodingException { } @Test - public void testDecode3() throws DecodingException { + public void testDecode3() { HeaderV1 headerV1 = new HeaderV1(); headerV1.decode("DBACNYA"); Assertions.assertEquals(Arrays.asList(2, 6), headerV1.getFieldValue("SectionIds")); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java index 49b204d2..a1762dee 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java @@ -6,15 +6,12 @@ import java.util.Arrays; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfCaV1Field; public class TcfCaV1Test { @Test - public void testEncode1() throws EncodingException, InvalidFieldException { + public void testEncode1() { TcfCaV1 tcfCaV1 = new TcfCaV1(); tcfCaV1.setFieldValue(TcfCaV1Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); @@ -23,7 +20,7 @@ public void testEncode1() throws EncodingException, InvalidFieldException { } @Test - public void testEncode2() throws EncodingException, InvalidFieldException { + public void testEncode2() { TcfCaV1 tcfCaV1 = new TcfCaV1(); tcfCaV1.setFieldValue(TcfCaV1Field.CMP_ID, 50); @@ -57,7 +54,7 @@ public void testEncode2() throws EncodingException, InvalidFieldException { } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { TcfCaV1 tcfCaV1 = new TcfCaV1("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA"); Assertions.assertEquals(0, tcfCaV1.getCmpId()); @@ -99,8 +96,8 @@ public void testDecode1() throws DecodingException { } @Test - public void testDecode2() throws DecodingException { - TcfCaV1 tcfCaV1 = new TcfCaV1("CPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao"); + public void testDecode2() { + TcfCaV1 tcfCaV1 = new TcfCaV1("BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao"); Assertions.assertEquals(50, tcfCaV1.getCmpId()); Assertions.assertEquals(2, tcfCaV1.getCmpVersion()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java index 20eb2a7b..b11dbdbc 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java @@ -6,15 +6,12 @@ import java.util.List; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfEuV2Field; public class TcfEuV2Test { @Test - public void testEncode1() throws EncodingException, InvalidFieldException { + public void testEncode1() { TcfEuV2 tcfEuV2 = new TcfEuV2(); tcfEuV2.setFieldValue(TcfEuV2Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); tcfEuV2.setFieldValue(TcfEuV2Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); @@ -22,16 +19,30 @@ public void testEncode1() throws EncodingException, InvalidFieldException { } @Test - public void testEncode2() throws EncodingException, InvalidFieldException { + public void testEncode2() { TcfEuV2 tcfEuV2 = new TcfEuV2(); tcfEuV2.setFieldValue(TcfEuV2Field.IS_SERVICE_SPECIFIC, true); tcfEuV2.setFieldValue(TcfEuV2Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); tcfEuV2.setFieldValue(TcfEuV2Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); + + Assertions.assertEquals(3, tcfEuV2.getFieldValue(TcfEuV2Field.PUBLISHER_PURPOSES_SEGMENT_TYPE)); + Assertions.assertEquals( + Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue(TcfEuV2Field.PUBLISHER_CONSENTS)); + Assertions.assertEquals( + Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue(TcfEuV2Field.PUBLISHER_LEGITIMATE_INTERESTS)); + Assertions.assertEquals(0, tcfEuV2.getFieldValue(TcfEuV2Field.NUM_CUSTOM_PURPOSES)); + Assertions.assertEquals(Arrays.asList(), tcfEuV2.getFieldValue(TcfEuV2Field.PUBLISHER_CUSTOM_CONSENTS)); + Assertions.assertEquals(Arrays.asList(), tcfEuV2.getFieldValue(TcfEuV2Field.PUBLISHER_CUSTOM_LEGITIMATE_INTERESTS)); + Assertions.assertEquals("CPSG_8APSG_8AAAAAAENAACgAAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA", tcfEuV2.encode()); } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { TcfEuV2 tcfEuV2 = new TcfEuV2("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA"); Assertions.assertEquals(2, tcfEuV2.getVersion()); @@ -84,7 +95,7 @@ public void testDecode1() throws DecodingException { } @Test - public void testDecode2() throws DecodingException { + public void testDecode2() { TcfEuV2 tcfEuV2 = new TcfEuV2("CPSG_8APSG_8AAAAAAENAACgAAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAAA"); Assertions.assertEquals(2, tcfEuV2.getVersion()); @@ -138,7 +149,7 @@ public void testDecode2() throws DecodingException { @SuppressWarnings("unchecked") @Test - public void testDecode3() throws DecodingException { + public void testDecode3() { TcfEuV2 tcfEuV2 = new TcfEuV2( "CPcqBNJPcqBNJNwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA.QGLtV_T9fb2vj-_Z99_tkeYwf95y3p-wzhheMs-8NyZeH_B4Wv2MyvBX4JiQKGRgksjLBAQdtHGlcTQgBwIlViTLMYk2MjzNKJrJEilsbO2dYGD9Pn8HT3ZCY70-vv__7v3ff_3g.IGLtV_T9fb2vj-_Z99_tkeYwf95y3p-wzhheMs-8NyZeH_B4Wv2MyvBX4JiQKGRgksjLBAQdtHGlcTQgBwIlViTLMYk2MjzNKJrJEilsbO2dYGD9Pn8HT3ZCY70-vv__7v3ff_3g"); @@ -241,7 +252,7 @@ public void testDecode3() throws DecodingException { @SuppressWarnings("unchecked") @Test - public void testDecode4() throws DecodingException { + public void testDecode4() { TcfEuV2 tcfEuV2 = new TcfEuV2( "CPi8wgAPi8wgAAOACBENCuCoAP_AAEfAACiQJHNd_H__bX9n-f7_6ft0eY1f9_r37uQzDhfNk-8F3L_W_LwX_2E7NF36tq4KmR4ku1LBIUNtHMnUDUmxaokVrzHsak2cpzNKJ_BkknsZe2dYGF9vm5tj-QKZ7_5_d3f52T_9_9v-39z33913v3d93-_13LjdV5_9H_v9fR_b8_Kf9_5-_4v8_____3_e______8AEEggCTDVuIAuxLHAm0DCKBECMKwkKoFABBQDC0QGADg4KdlYBPrCBAAgFAEYEQIcAUYEAgAAAgCQiACQIsEAAAIgEAAIAEQiEABAwCCgAsDAIAAQDQMUQoABAkIMiAiKUwICIEggJbKhBKC6Q0wgCrLACgkRsFAAiAAAUgACAsHAMESAlYsECTFG-QAjBCgFEqFaAGGgAwABBI4RABgACCRwqADAAEEjgA"); @@ -278,7 +289,7 @@ public void testDecode4() throws DecodingException { @SuppressWarnings("unchecked") @Test - public void testDecode5() throws DecodingException { + public void testDecode5() { TcfEuV2 tcfEuV2 = new TcfEuV2( "CPgA5EAPgA5EAAOACBENCuCoAP_AAEfAACiQI0Nd_H__bX9n-f7_6Pt0cY1f9_r3ruQzDhfFk-8F3L_W3LwX32E7NF36pq4KmR4ku1LBIQFtHMnUDUmxaokVrzHsak2cpyNKI7BkknsZe2dYGF9Pm5lD-QKZ7_5_d3f52T_9_9v-39z339V3v3d93-_12PjdV599H_v9fR_b8_Kf9_5-_4v8___4IQAAAAQQ_AJMNW4gC7EscCbQMIoAQIwrCQqAUAEFAMLRAYAODgpmVgEusIEACAUARgRAhxBRgQCAAACAJCIAJAiwQAIAiAQAAgARAIQAEDAIKACwMAgABANAxACgAECQgyICIpTAgIgSCAlsqEEoKpDTCAKssAKARGwUACIAABSAAICwcAwRICViwQJMUbwAw0AGAAIJHCIAMAAQSOFQAYAAgkcA"); @@ -314,7 +325,7 @@ public void testDecode5() throws DecodingException { } @Test - public void testDecode6() throws DecodingException { + public void testDecode6() { TcfEuV2 tcfEuV2 = new TcfEuV2("COv_eg6Ov_eg6AOADBENAaCgAP_AAH_AACiQAVEUQQoAIQAqIoghAAQgAA.YAAAAAAAAAAAAAAAAAA"); Assertions.assertEquals(2, tcfEuV2.getFieldValue("Version")); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java index 1a10fa9e..f33a1e94 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java @@ -4,22 +4,19 @@ import java.util.Arrays; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UsCaV1Field; public class UsCaV1Test { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { UsCaV1 usCaV1 = new UsCaV1(); Assertions.assertEquals("BAAAAAAA.QA", usCaV1.encode()); } @Test - public void testEncode2() throws EncodingException, InvalidFieldException { + public void testEncode2() { UsCaV1 usCaV1 = new UsCaV1(); usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); @@ -39,7 +36,7 @@ public void testEncode2() throws EncodingException, InvalidFieldException { } @Test - public void testEncode3() throws EncodingException, InvalidFieldException { + public void testEncode3() { UsCaV1 usCaV1 = new UsCaV1(); usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); @@ -59,7 +56,7 @@ public void testEncode3() throws EncodingException, InvalidFieldException { } @Test - public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { + public void testEncodeWithGpcSegmentExcluded() { UsCaV1 usCaV1 = new UsCaV1(); usCaV1.setFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED, false); @@ -67,7 +64,7 @@ public void testEncodeWithGpcSegmentExcluded() throws EncodingException, Invalid } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { UsCaV1 usCaV1 = new UsCaV1("BbYbGwXY.YA"); Assertions.assertEquals(1, usCaV1.getSaleOptOutNotice()); @@ -85,7 +82,7 @@ public void testDecode1() throws DecodingException { } @Test - public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + public void testDecodeWithGpcSegmentExcluded() { UsCaV1 usCaV1 = new UsCaV1("BbYbGwXY"); Assertions.assertEquals(1, usCaV1.getSaleOptOutNotice()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java index 9c730803..f00b108b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java @@ -4,21 +4,18 @@ import java.util.Arrays; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UsCoV1Field; public class UsCoV1Test { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { UsCoV1 usCoV1 = new UsCoV1(); Assertions.assertEquals("BAAAAAA.QA", usCoV1.encode()); } @Test - public void testEncode2() throws EncodingException, InvalidFieldException { + public void testEncode2() { UsCoV1 usCoV1 = new UsCoV1(); usCoV1.setFieldValue(UsCoV1Field.SHARING_NOTICE, 1); @@ -37,14 +34,14 @@ public void testEncode2() throws EncodingException, InvalidFieldException { } @Test - public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { + public void testEncodeWithGpcSegmentExcluded() { UsCoV1 usCoV1 = new UsCoV1(); usCoV1.setFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED, false); Assertions.assertEquals("BAAAAAA", usCoV1.encode()); } @Test - public void testDecode1() throws DecodingException { + public void testDecode1() { UsCoV1 usCoV1 = new UsCoV1("BbYbG2wA.YA"); Assertions.assertEquals(1, usCoV1.getSharingNotice()); @@ -61,7 +58,7 @@ public void testDecode1() throws DecodingException { } @Test - public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + public void testDecodeWithGpcSegmentExcluded() { UsCoV1 usCoV1 = new UsCoV1("BbYbG2wA"); Assertions.assertEquals(1, usCoV1.getSharingNotice()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java index 2053e24c..864a1966 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java @@ -5,20 +5,18 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UsCtV1Field; public class UsCtV1Test { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { UsCtV1 usCtV1 = new UsCtV1(); Assertions.assertEquals("BAAAAAAA.QA", usCtV1.encode()); } @Test - public void testEncode2() throws EncodingException, InvalidFieldException { + public void testEncode2() { UsCtV1 usCtV1 = new UsCtV1(); usCtV1.setFieldValue(UsCtV1Field.SHARING_NOTICE, 1); @@ -37,7 +35,7 @@ public void testEncode2() throws EncodingException, InvalidFieldException { } @Test - public void testEncodeWithGpcSegmentExcluded() throws EncodingException, InvalidFieldException { + public void testEncodeWithGpcSegmentExcluded() { UsCtV1 usCtV1 = new UsCtV1(); usCtV1.setFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED, false); Assertions.assertEquals("BAAAAAAA", usCtV1.encode()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java index f0707542..379752e6 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java @@ -5,21 +5,19 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UsNatV1Field; public class UsNatV1Test { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { UsNatV1 usNatV1 = new UsNatV1(); Assertions.assertEquals("BAAAAAAAAAA.QA", usNatV1.encode()); } @Test - public void testEncode2() throws EncodingException, InvalidFieldException { + public void testEncode2() { UsNatV1 usNatV1 = new UsNatV1(); usNatV1.setFieldValue(UsNatV1Field.SHARING_NOTICE, 1); @@ -43,7 +41,7 @@ public void testEncode2() throws EncodingException, InvalidFieldException { } @Test - public void testEncode3() throws EncodingException, InvalidFieldException { + public void testEncode3() { UsNatV1 usNatV1 = new UsNatV1(); usNatV1.setFieldValue(UsNatV1Field.SHARING_NOTICE, 1); @@ -67,7 +65,7 @@ public void testEncode3() throws EncodingException, InvalidFieldException { } @Test - public void testEncodeWithGpcSegmentIncluded() throws EncodingException, InvalidFieldException { + public void testEncodeWithGpcSegmentIncluded() { UsNatV1 usNatV1 = new UsNatV1(); usNatV1.setFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED, false); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java index f26808a6..ac647a6b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java @@ -5,20 +5,18 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.UsUtV1Field; public class UsUtV1Test { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { UsUtV1 usUtV1 = new UsUtV1(); Assertions.assertEquals("BAAAAAAA", usUtV1.encode()); } @Test - public void testEncode2() throws EncodingException, InvalidFieldException { + public void testEncode2() { UsUtV1 usUtV1 = new UsUtV1(); usUtV1.setFieldValue(UsUtV1Field.SHARING_NOTICE, 1); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java index e65bec8c..06b5165f 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java @@ -12,13 +12,13 @@ public class UsVaV1Test { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { UsVaV1 usVaV1 = new UsVaV1(); Assertions.assertEquals("BAAAAAA", usVaV1.encode()); } @Test - public void testEncode2() throws EncodingException { + public void testEncode2() { UsVaV1 usVaV1 = new UsVaV1(); try { diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java index 13eb280d..ffc7e741 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UspV1Test.java @@ -3,34 +3,33 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.error.InvalidFieldException; public class UspV1Test { @Test - public void testEncode1() throws EncodingException { + public void testEncode1() { UspV1 uspv1 = new UspV1(); Assertions.assertEquals("1---", uspv1.encode()); } @Test - public void testEncode2() throws EncodingException, InvalidFieldException { + public void testEncode2() { UspV1 uspv1 = new UspV1(); - uspv1.setFieldValue("Notice", "Y"); - uspv1.setFieldValue("OptOutSale", "N"); - uspv1.setFieldValue("LspaCovered", "N"); + uspv1.setFieldValue("Notice", 'Y'); + uspv1.setFieldValue("OptOutSale", 'N'); + uspv1.setFieldValue("LspaCovered", 'N'); Assertions.assertEquals("1YNN", uspv1.encode()); } @Test - public void testEncode3() throws EncodingException, InvalidFieldException { + public void testEncode3() { UspV1 uspv1 = new UspV1(); uspv1.setFieldValue("Version", 2); - uspv1.setFieldValue("Notice", "N"); - uspv1.setFieldValue("OptOutSale", "Y"); - uspv1.setFieldValue("LspaCovered", "Y"); + uspv1.setFieldValue("Notice", 'N'); + uspv1.setFieldValue("OptOutSale", 'Y'); + uspv1.setFieldValue("LspaCovered", 'Y'); Assertions.assertEquals("2NYY", uspv1.encode()); } @@ -39,9 +38,9 @@ public void testEncode3() throws EncodingException, InvalidFieldException { public void testDecode1() throws DecodingException, InvalidFieldException { UspV1 uspv1 = new UspV1("1NYN"); Assertions.assertEquals(1, uspv1.getFieldValue("Version")); - Assertions.assertEquals("N", uspv1.getFieldValue("Notice")); - Assertions.assertEquals("Y", uspv1.getFieldValue("OptOutSale")); - Assertions.assertEquals("N", uspv1.getFieldValue("LspaCovered")); + Assertions.assertEquals('N', uspv1.getFieldValue("Notice")); + Assertions.assertEquals('Y', uspv1.getFieldValue("OptOutSale")); + Assertions.assertEquals('N', uspv1.getFieldValue("LspaCovered")); Assertions.assertEquals(uspv1.getFieldValue("Version"), uspv1.getVersion()); Assertions.assertEquals(uspv1.getFieldValue("Notice"), uspv1.getNotice()); @@ -51,11 +50,11 @@ public void testDecode1() throws DecodingException, InvalidFieldException { @Test public void testDecode2() throws DecodingException, InvalidFieldException { - UspV1 uspv1 = new UspV1("2YNY"); - Assertions.assertEquals(2, uspv1.getFieldValue("Version")); - Assertions.assertEquals("Y", uspv1.getFieldValue("Notice")); - Assertions.assertEquals("N", uspv1.getFieldValue("OptOutSale")); - Assertions.assertEquals("Y", uspv1.getFieldValue("LspaCovered")); + UspV1 uspv1 = new UspV1("1YNY"); + Assertions.assertEquals(1, uspv1.getFieldValue("Version")); + Assertions.assertEquals('Y', uspv1.getFieldValue("Notice")); + Assertions.assertEquals('N', uspv1.getFieldValue("OptOutSale")); + Assertions.assertEquals('Y', uspv1.getFieldValue("LspaCovered")); Assertions.assertEquals(uspv1.getFieldValue("Version"), uspv1.getVersion()); Assertions.assertEquals(uspv1.getFieldValue("Notice"), uspv1.getNotice()); diff --git a/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/purposes-fr.json b/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/purposes-fr.json new file mode 100644 index 00000000..98cfa81b --- /dev/null +++ b/iabgpp-extras-jackson/src/test/resources/vendorlist/v2/purposes-fr.json @@ -0,0 +1 @@ +{"vendorListVersion":29,"lastUpdated":"2020-03-12T16:40:38Z","purposes":{"1":{"id":1,"name":"Stocker et/ou acc\u00e9der \u00e0 des informations stock\u00e9es sur un terminal","description":"Les cookies, identifiants de votre terminal ou autres informations peuvent \u00eatre stock\u00e9s ou consult\u00e9s sur votre terminal pour les finalit\u00e9s qui vous sont pr\u00e9sent\u00e9es.","descriptionLegal":"Les partenaires peuvent :\n* Stocker des informations et acc\u00e9der \u00e0 des informations stock\u00e9es sur le terminal, comme les cookies et les identifiants du terminal pr\u00e9sent\u00e9s \u00e0 un utilisateur.\n"},"2":{"id":2,"name":"S\u00e9lectionner des publicit\u00e9s standard","description":"Les publicit\u00e9s peuvent vous \u00eatre pr\u00e9sent\u00e9es en fonction du contenu \u00e9ditorial que vous consultez, de l\u2019application que vous utilisez, de votre localisation approximative, ou de votre type de terminal\n","descriptionLegal":"Pour s\u00e9lectionner des publicit\u00e9s standard, les partenaires peuvent :\n* Utiliser des informations en temps r\u00e9el sur le contexte dans lequel la publicit\u00e9 sera affich\u00e9e, pour afficher la publicit\u00e9, y compris des informations sur le contenu et le terminal, telles que : type de terminal et capacit\u00e9s, user agent, URL, adresse IP \n* Utiliser des donn\u00e9es de g\u00e9olocalisation non-pr\u00e9cises d\u2019un utilisateur\n* Contr\u00f4ler la fr\u00e9quence de diffusion des publicit\u00e9s \u00e0 un utilisateur.\n* D\u00e9finir l\u2019ordre dans lequel les publicit\u00e9s sont pr\u00e9sent\u00e9es \u00e0 un utilisateur.\n* Emp\u00eacher une publicit\u00e9 de s\u2019afficher dans un contexte \u00e9ditorial inadapt\u00e9 (dangereux pour la marque)\nLes partenaires ne peuvent pas :\n* Cr\u00e9er un profil publicitaire personnalis\u00e9 \u00e0 l\u2019aide de ces informations pour la s\u00e9lection de publicit\u00e9s futures sans base l\u00e9gale distincte. \nN.B. \u00ab Non-pr\u00e9cises \u00bb signifie qu\u2019une g\u00e9olocalisation approximative dans un rayon d\u2019au moins 500 m\u00e8tres est autoris\u00e9e.\n"},"3":{"id":3,"name":"Cr\u00e9er un profil personnalis\u00e9 de publicit\u00e9s","description":"Un profil peut \u00eatre cr\u00e9\u00e9 sur vous et sur vos centres d\u2019int\u00e9r\u00eat pour vous pr\u00e9senter des publicit\u00e9s personnalis\u00e9es susceptibles de vous int\u00e9resser.","descriptionLegal":"Pour cr\u00e9er un profil de publicit\u00e9s personnalis\u00e9es, les partenaires peuvent :\n* Collecter des informations sur un utilisateur, notamment son activit\u00e9, ses centres d\u2019int\u00e9r\u00eat, les sites ou applications consult\u00e9s, les donn\u00e9es d\u00e9mographiques ou la g\u00e9olocalisation d\u2019un utilisateur, pour cr\u00e9er ou modifier un profil utilisateur \u00e0 utiliser dans des publicit\u00e9s personnalis\u00e9es.\n"},"4":{"id":4,"name":"S\u00e9lectionner des publicit\u00e9s personnalis\u00e9es","description":"Des publicit\u00e9s personnalis\u00e9es peuvent vous \u00eatre pr\u00e9sent\u00e9es sur la base d\u2019un profil cr\u00e9\u00e9 sur vous.","descriptionLegal":"Pour s\u00e9lectionner des publicit\u00e9s personnalis\u00e9es, les partenaires peuvent :\n* S\u00e9lectionner des publicit\u00e9s personnalis\u00e9es sur la base d\u2019un profil utilisateur ou d\u2019autres donn\u00e9es d\u2019utilisateur historiques, y compris l\u2019activit\u00e9 pass\u00e9e d\u2019un utilisateur, ses centres d\u2019int\u00e9r\u00eat, les sites qu\u2019il a visit\u00e9s ou les applications qu\u2019il a utilis\u00e9es, sa localisation ou ses donn\u00e9es d\u00e9mographiques.\n"},"5":{"id":5,"name":"Cr\u00e9er un profil pour afficher un contenu personnalis\u00e9","description":"Un profil peut \u00eatre cr\u00e9\u00e9 sur vous et sur vos centres d\u2019int\u00e9r\u00eat afin de vous pr\u00e9senter du contenu personnalis\u00e9 susceptible de vous int\u00e9resser.","descriptionLegal":"Pour cr\u00e9er un profil pour afficher du contenu personnalis\u00e9, les partenaires peuvent :\n* Collecter des informations sur un utilisateur, y compris l\u2019activit\u00e9 d\u2019un utilisateur, ses centres d\u2019int\u00e9r\u00eat, les sites qu\u2019il a visit\u00e9s ou les applications qu\u2019il a utilis\u00e9es, ses donn\u00e9es d\u00e9mographiques ou sa localisation, pour cr\u00e9er ou modifier un profil utilisateur pour afficher du contenu personnalis\u00e9.\n"},"6":{"id":6,"name":"S\u00e9lectionner du contenu personnalis\u00e9","description":"Du contenu personnalis\u00e9 peut vous \u00eatre pr\u00e9sent\u00e9 sur la base de votre profil utilisateur. ","descriptionLegal":"Pour s\u00e9lectionner du contenu personnalis\u00e9, les partenaires peuvent :\n* S\u00e9lectionner du contenu personnalis\u00e9 sur la base d\u2019un profil utilisateur induit des donn\u00e9es relatives \u00e0 son activit\u00e9 en ligne, ses centres d\u2019int\u00e9r\u00eat, les sites qu\u2019il a visit\u00e9s, les applications qu\u2019il a utilis\u00e9es, sa localisation ou ses donn\u00e9es socio-d\u00e9mographiques.\n"},"7":{"id":7,"name":"Mesurer la performance des publicit\u00e9s","description":"La performance et l\u2019efficacit\u00e9 des publicit\u00e9s que vous voyez ou avec lesquelles vous interagissez peuvent \u00eatre mesur\u00e9es.","descriptionLegal":"Pour mesurer la performance des publicit\u00e9s, les partenaires peuvent:\n* Mesurer si et comment des publicit\u00e9s ont \u00e9t\u00e9 pr\u00e9sent\u00e9e \u00e0 un utilisateur et comment celui-ci a interagi avec celles-ci\n* G\u00e9n\u00e9rer des rapports sur les publicit\u00e9s, notamment sur leur performance\n* G\u00e9n\u00e9rer des rapports sur les utilisateurs ayant interagi avec des publicit\u00e9s en utilisant des donn\u00e9es issues de cette interaction \n* Fournir des rapports aux \u00e9diteurs sur les publicit\u00e9s pr\u00e9sent\u00e9es/affich\u00e9es sur leurs propri\u00e9t\u00e9s num\u00e9riques \n* \u00c9valuer si une publicit\u00e9 diffus\u00e9e dans un contexte \u00e9ditorial appropri\u00e9 (conforme \u00e0 l\u2019image de la marque) sans danger pour la marque)\n* D\u00e9terminer le pourcentage du visionnage \u00e9ventuel de la publicit\u00e9 et sa dur\u00e9e \n* Combiner ces informations avec d\u2019autres informations collect\u00e9es au pr\u00e9alable, pouvant provenir de sites internet et applications\nLes partenaires ne peuvent pas: \n* Croiser des donn\u00e9es d\u2019audience, issues ou d\u00e9riv\u00e9es d\u2019un panel, avec des donn\u00e9es de mesure de performance, sans base l\u00e9gale pour titre \"Finalit\u00e9 9\". \n"},"8":{"id":8,"name":"Mesurer la performance du contenu","description":"La performance et l\u2019efficacit\u00e9 du contenu que vous voyez ou avec lequel vous interagissez peuvent \u00eatre mesur\u00e9es.","descriptionLegal":"Pour mesurer la performance du contenu, les partenaires peuvent:\n* Mesurer comment le contenu a \u00e9t\u00e9 diffus\u00e9 et comment les utilisateurs ont interagi avec, et g\u00e9n\u00e9rer des rapports.\n* G\u00e9n\u00e9rer des rapports \u00e0 l\u2019aide d\u2019informations directement mesurables ou connues, sur les utilisateurs qui ont interagi avec le contenu\nLes partenaires ne peuvent pas:\n* Mesurer si et comment des publicit\u00e9s (y compris des publicit\u00e9s natives) ont \u00e9t\u00e9 pr\u00e9sent\u00e9es \u00e0 un utilisateur et comment celui-ci a interagi avec, sans base l\u00e9gale distincte\n* Croiser des donn\u00e9es d\u2019audience, issues ou d\u00e9riv\u00e9es d\u2019un panel, avec des donn\u00e9es de mesure de performance, sans base l\u00e9gale pour titre \"Finalit\u00e9 9\u201d. "},"9":{"id":9,"name":"Exploiter des \u00e9tudes de march\u00e9 afin de g\u00e9n\u00e9rer des donn\u00e9es d\u2019audience","description":"Les \u00e9tudes de march\u00e9 peuvent servir \u00e0 en apprendre davantage sur les audiences qui visitent des sites/utilisent des applications et voient des publicit\u00e9s.","descriptionLegal":"Pour utiliser des \u00e9tudes de march\u00e9 afin de g\u00e9n\u00e9rer des donn\u00e9es d\u2019audience, les partenaires peuvent:\n* Fournir des rapports agr\u00e9g\u00e9s aux annonceurs ou \u00e0 leurs repr\u00e9sentants sur les audiences expos\u00e9es \u00e0 leurs publicit\u00e9s, en utilisant des donn\u00e9es issues d\u2019un panel ou d\u2019un autre dispositif.\n* Fournir des rapports agr\u00e9g\u00e9s aux \u00e9diteurs sur les audiences expos\u00e9es \u00e0 des contenus et/ou des publicit\u00e9s ou qui ont interagi avec des contenus et/ou les publicit\u00e9s sur leurs sites, en utilisant des donn\u00e9es issues d\u2019un panel ou d\u2019un autre dispositif. \n* Combiner des donn\u00e9es hors ligne \u00e0 celles d\u2019un utilisateur en ligne dans le cadre d\u2019\u00e9tudes de march\u00e9 pour g\u00e9n\u00e9rer des donn\u00e9es d\u2019audience si les partenaires ont d\u00e9clar\u00e9 faire correspondre et associer des sources de donn\u00e9es hors ligne (Fonctionnalit\u00e9 1)\n* Texte dans la version anglaise : Combiner ces informations avec des donn\u00e9es d\u00e9j\u00e0 collect\u00e9es que ce soit sur le web ou via des applications. \nLes partenaires ne peuvent pas : \n* Mesurer la performance et l\u2019efficacit\u00e9 des publicit\u00e9s qui ont \u00e9t\u00e9 pr\u00e9sent\u00e9es \u00e0 un utilisateur en particulier, ou avec lesquelles il a interagi, sans s\u2019appuyer sur une base l\u00e9gale sp\u00e9cifique pour la mesure de la performance publicitaire.\n* \u00c9valuer le contenu qui a \u00e9t\u00e9 pr\u00e9sent\u00e9 \u00e0 un utilisateur en particulier et la fa\u00e7on dont ce dernier a r\u00e9agi sans s\u2019appuyer sur une base l\u00e9gale sp\u00e9cifique pour la mesure de la performance des contenus.\n"},"10":{"id":10,"name":"D\u00e9velopper et am\u00e9liorer les produits","description":"Vos donn\u00e9es peuvent \u00eatre utilis\u00e9es pour am\u00e9liorer les syst\u00e8mes et logiciels existants et pour d\u00e9velopper de nouveaux produits.","descriptionLegal":"Pour d\u00e9velopper de nouveaux produits et am\u00e9liorer des produits existants, les partenaires peuvent:\n* Utiliser des informations pour am\u00e9liorer leurs produits existants en y ajoutant de nouvelles fonctionnalit\u00e9s et pour d\u00e9velopper de nouveaux produits\n* Cr\u00e9er de nouveaux mod\u00e8les et algorithmes gr\u00e2ce au machine-learning \nLes partenaires ne peuvent pas:\n* Effectuer toute autre op\u00e9ration de traitement des donn\u00e9es autoris\u00e9e par une autre finalit\u00e9 dans le cadre de cette finalit\u00e9\n"}},"specialPurposes":{"1":{"id":1,"name":"Assurer la s\u00e9curit\u00e9, pr\u00e9venir la fraude et d\u00e9boguer","description":"Vos donn\u00e9es peuvent \u00eatre utilis\u00e9es pour surveiller et pr\u00e9venir les activit\u00e9s frauduleuses, et s\u2019assurer que les syst\u00e8mes et processus fonctionnent correctement et en toute s\u00e9curit\u00e9.","descriptionLegal":"Pour garantir la s\u00e9curit\u00e9, pr\u00e9venir la fraude et d\u00e9boguer, les partenaires peuvent:\n* Veiller \u00e0 ce que les donn\u00e9es soient transmises en toute s\u00e9curit\u00e9 \n* D\u00e9tecter et pr\u00e9venir les activit\u00e9s malveillantes, frauduleuses, inappropri\u00e9es ou ill\u00e9gales.\n* Assurer un fonctionnement correct et efficace des syst\u00e8mes et des processus, y compris surveiller et am\u00e9liorer la performance des syst\u00e8mes et processus utilis\u00e9s pour des finalit\u00e9s autoris\u00e9es\nLes partenaires ne peuvent pas:\n* Effectuer, au titre de cette finalit\u00e9, toute autre op\u00e9ration de traitement des donn\u00e9es autoris\u00e9e pour une finalit\u00e9 diff\u00e9rente .\nRemarque: Les donn\u00e9es collect\u00e9es et utilis\u00e9es pour assurer la s\u00e9curit\u00e9, pr\u00e9venir la fraude et d\u00e9boguer peuvent inclure des caract\u00e9ristiques d\u2019appareil envoy\u00e9es automatiquement \u00e0 des fins d'identification, des donn\u00e9es de g\u00e9olocalisation pr\u00e9cises et des donn\u00e9es obtenues par l\u2019analyse active des caract\u00e9ristiques de l\u2019appareil \u00e0 des fins d\u2019identification sans notification distincte et/ou opt-in distinct \n"},"2":{"id":2,"name":"Diffuser techniquement les publicit\u00e9s ou le contenu","description":"Votre terminal peut recevoir et envoyer des informations qui vous permettent de voir des publicit\u00e9s et du contenu et d\u2019interagir avec eux.","descriptionLegal":"Pour fournir des informations et r\u00e9pondre aux appels techniques, les partenaires peuvent:\n* Utiliser l\u2019adresse IP d\u2019un utilisateur pour diffuser une publicit\u00e9 sur Internet\n* R\u00e9agir \u00e0 l\u2019interaction d\u2019un utilisateur avec une publicit\u00e9 en dirigeant l\u2019utilisateur vers une page d\u2019accueil\n* Utiliser l\u2019adresse IP d\u2019un utilisateur pour diffuser du contenu sur Internet\n* R\u00e9agir \u00e0 l\u2019interaction d\u2019un utilisateur avec du contenu en dirigeant l\u2019utilisateur vers une page d\u2019accueil\n* Utiliser des informations sur le type de terminal et les capacit\u00e9s du terminal pour pr\u00e9senter des publicit\u00e9s ou du contenu, par exemple, pour pr\u00e9senter une publicit\u00e9 \u00e0 la bonne taille ou une vid\u00e9o dans un format pris en charge par le terminal \nLes partenaires ne peuvent pas:\n* Effectuer, au titre de cette finalit\u00e9, toute autre op\u00e9ration de traitement des donn\u00e9es autoris\u00e9e pour une finalit\u00e9 diff\u00e9rente \n"}},"features":{"1":{"id":1,"name":"Mettre en correspondance et combiner des sources de donn\u00e9es hors ligne","description":"Les donn\u00e9es issues de sources de donn\u00e9es hors ligne peuvent \u00eatre combin\u00e9es \u00e0 votre activit\u00e9 en ligne \u00e0 l\u2019appui d\u2019une ou de plusieurs finalit\u00e9s.","descriptionLegal":"Les partenaires peuvent : \n* Combiner des donn\u00e9es obtenues hors ligne avec des donn\u00e9es collect\u00e9es en ligne \u00e0 l\u2019appui d\u2019une ou de plusieurs Finalit\u00e9s ou Finalit\u00e9s sp\u00e9ciales.\n"},"2":{"id":2,"name":"Relier diff\u00e9rents terminaux","description":"Diff\u00e9rents terminaux peuvent \u00eatre identifi\u00e9s comme vous appartenant ou appartenant \u00e0 votre foyer \u00e0 l\u2019appui d\u2019une ou de plusieurs finalit\u00e9s","descriptionLegal":"Les partnenaires peuvent :\n* D\u00e9terminer, selon une approche d\u00e9terministe, que deux terminaux ou plus appartiennent au m\u00eame utilisateur ou au m\u00eame foyer\n* D\u00e9terminer, selon une approche probabiliste, que deux terminaux ou plus appartiennent au m\u00eame utilisateur ou au m\u00eame foyer\n* Analyser activement les caract\u00e9ristiques du terminal pour l\u2019identification probabiliste si les utilisateurs ont autoris\u00e9 les partenanaires \u00e0 analyser activement les caract\u00e9ristiques du terminal pour l\u2019identification (Fonctionnalit\u00e9 sp\u00e9ciale 2)\n"},"3":{"id":3,"name":"Recevoir et utiliser des caract\u00e9ristiques d\u2019identification d\u2019appareil envoy\u00e9es automatiquement","description":"Votre appareil peut \u00eatre distingu\u00e9 d\u2019autres appareils en fonction des informations qu\u2019il envoie automatiquement, telles que l\u2019adresse IP ou le type de navigateur.","descriptionLegal":"Les partenaires peuvent :\n* Cr\u00e9er un identifiant \u00e0 l\u2019aide des donn\u00e9es collect\u00e9es automatiquement \u00e0 partir d\u2019un appareil pour des caract\u00e9ristiques sp\u00e9cifiques ; par ex., adresse IP, cha\u00eene d\u2019agent utilisateur.\n* Utiliser cet identifiant pour r\u00e9identifier un appareil.\nLes partenaires ne peuvent pas :\n* Cr\u00e9er un identifiant \u00e0 l\u2019aide des donn\u00e9es collect\u00e9es via une analyse active d\u2019un terminal pour l\u2019identification de caract\u00e9ristiques sp\u00e9cifiques (par exemple, des polices install\u00e9es ou la r\u00e9solution d\u2019\u00e9cran) sans une adh\u00e9sion distincte de l\u2019utilisateur \u00e0 l\u2019analyse active des caract\u00e9ristiques de l\u2019appareil \u00e0 des fins d\u2019identification.\n* Utiliser cet identifiant pour r\u00e9-identifier un terminal.\n"}},"specialFeatures":{"1":{"id":1,"name":"Utiliser des donn\u00e9es de g\u00e9olocalisation pr\u00e9cises","description":"Vos donn\u00e9es de g\u00e9olocalisation pr\u00e9cises peuvent \u00eatre utilis\u00e9es \u00e0 l\u2019appui d\u2019une ou de plusieurs finalit\u00e9s. Cela signifie que votre localisation peut \u00eatre pr\u00e9cise \u00e0 plusieurs m\u00e8tres pr\u00e8s.","descriptionLegal":"Les partnenaires peuvent :\n* Collecter et traiter des donn\u00e9es de g\u00e9olocalisation pr\u00e9cises \u00e0 l\u2019appui d\u2019une ou de plusieurs finalit\u00e9s.\nN.B. Une g\u00e9olocalisation pr\u00e9cise signifie qu\u2019il n\u2019y a aucune restriction \u00e0 la pr\u00e9cision de la localisation d\u2019un utilisateur ; elle peut \u00eatre pr\u00e9cise \u00e0 quelques m\u00e8tres pr\u00e8s.\n"},"2":{"id":2,"name":"Analyser activement les caract\u00e9ristiques du terminal pour l\u2019identification","description":"Votre terminal peut \u00eatre identifi\u00e9 sur la base d\u2019une analyse de la combinaison unique de caract\u00e9ristiques de votre terminal.","descriptionLegal":"Les partenaires peuvent :\n* Cr\u00e9er un identifiant \u00e0 l\u2019aide des donn\u00e9es collect\u00e9es via une analyse active d\u2019un terminal pour l\u2019identification de caract\u00e9ristiques sp\u00e9cifiques, par exemple des polices install\u00e9es ou la r\u00e9solution d\u2019\u00e9cran. \n* Utiliser cet identifiant pour r\u00e9-identifier un terminal.\n"}},"stacks":{"1":{"id":1,"purposes":[],"specialFeatures":[1,2],"name":"Donn\u00e9es de g\u00e9olocalisation pr\u00e9cises et identification par analyse du terminal","description":"Des informations de g\u00e9olocalisation pr\u00e9cises et des informations sur les caract\u00e9ristiques de l\u2019appareil peuvent \u00eatre utilis\u00e9es."},"2":{"id":2,"purposes":[2,7],"specialFeatures":[],"name":"Publicit\u00e9s standards et mesure de performance des publicit\u00e9s","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e."},"3":{"id":3,"purposes":[2,3,4],"specialFeatures":[],"name":"Publicit\u00e9s personnalis\u00e9es","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s."},"4":{"id":4,"purposes":[2,7,9],"specialFeatures":[],"name":"Publicit\u00e9s standards et mesure de performance des publicit\u00e9s","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"5":{"id":5,"purposes":[2,3,7],"specialFeatures":[],"name":"Publicit\u00e9s standards, profil de publicit\u00e9s personnalis\u00e9es et mesure de performance des publicit\u00e9s","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e."},"6":{"id":6,"purposes":[2,4,7],"specialFeatures":[],"name":"Affichage de publicit\u00e9s personnalis\u00e9es et mesure de performance des publicit\u00e9s","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e."},"7":{"id":7,"purposes":[2,4,7,9],"specialFeatures":[],"name":"Affichage de publicit\u00e9s personnalis\u00e9es, mesure de performance des publicit\u00e9s, et donn\u00e9es d\u2019audience","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"8":{"id":8,"purposes":[2,3,4,7],"specialFeatures":[],"name":"Publicit\u00e9s personnalis\u00e9es et mesure de performance des annonces","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e."},"9":{"id":9,"purposes":[2,3,4,7,9],"specialFeatures":[],"name":"Publicit\u00e9s personnalis\u00e9es, mesure de performance des publicit\u00e9s, et donn\u00e9es d\u2019audience","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"10":{"id":10,"purposes":[3,4],"specialFeatures":[],"name":"Profil de publicit\u00e9s personnalis\u00e9es et affichage","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s. "},"11":{"id":11,"purposes":[5,6],"specialFeatures":[],"name":"Contenu personnalis\u00e9","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu."},"12":{"id":12,"purposes":[6,8],"specialFeatures":[],"name":"Affichage de contenu personnalis\u00e9 et mesure de performance du contenu","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. La performance du contenu peut \u00eatre mesur\u00e9e."},"13":{"id":13,"purposes":[6,8,9],"specialFeatures":[],"name":"Affichage de contenu personnalis\u00e9, mesure de performance du contenu et donn\u00e9es d\u2019audience","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. La performance du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"14":{"id":14,"purposes":[5,6,8],"specialFeatures":[],"name":"Contenu personnalis\u00e9 et mesure de performance du contenu","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance du contenu peut \u00eatre mesur\u00e9e."},"15":{"id":15,"purposes":[5,6,8,9],"specialFeatures":[],"name":"Contenu personnalis\u00e9, mesure de performance du contenu et donn\u00e9es d\u2019audience","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"16":{"id":16,"purposes":[5,6,8,9,10],"specialFeatures":[],"name":"Contenu personnalis\u00e9, mesure de performance du contenu, donn\u00e9es d\u2019audience, et d\u00e9veloppement produit","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, des syst\u00e8mes et logiciels"},"17":{"id":17,"purposes":[7,8,9],"specialFeatures":[],"name":"Mesure de performance des annonces et du contenu et donn\u00e9es d\u2019audience","description":"La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"18":{"id":18,"purposes":[7,8],"specialFeatures":[],"name":"Mesure de performance des publicit\u00e9s et du contenu","description":"La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e."},"19":{"id":19,"purposes":[7,9],"specialFeatures":[],"name":"Mesure de performance des publicit\u00e9s et donn\u00e9es d\u2019audience","description":"La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu"},"20":{"id":20,"purposes":[7,8,9,10],"specialFeatures":[],"name":"Mesure de performance des publicit\u00e9s et du contenu, donn\u00e9es d\u2019audience, et d\u00e9veloppement produit","description":"La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"21":{"id":21,"purposes":[8,9,10],"specialFeatures":[],"name":"Mesure de performance du contenu, donn\u00e9es d\u2019audience, et d\u00e9veloppement produit.","description":"La performance du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"22":{"id":22,"purposes":[8,10],"specialFeatures":[],"name":"Mesure de performance du contenu, et d\u00e9veloppement produit","description":"La performance du contenu peut \u00eatre mesur\u00e9e. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"23":{"id":23,"purposes":[2,4,6,7,8],"specialFeatures":[],"name":"Affichage de publicit\u00e9s et de contenu personnalis\u00e9s, mesure de performance des publicit\u00e9s et du contenu","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e."},"24":{"id":24,"purposes":[2,4,6,7,8,9],"specialFeatures":[],"name":"Affichage de publicit\u00e9s et de contenu personnalis\u00e9s, mesure de performance des publicit\u00e9s et du contenu, et donn\u00e9es d\u2019audience","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"25":{"id":25,"purposes":[2,3,4,5,6,7,8],"specialFeatures":[],"name":"Publicit\u00e9s et contenu personnalis\u00e9s, mesure de performance des publicit\u00e9s et du contenu","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s et le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e."},"26":{"id":26,"purposes":[2,3,4,5,6,7,8,9],"specialFeatures":[],"name":"Publicit\u00e9s et contenu personnalis\u00e9s, mesure de performance des publicit\u00e9s et du contenu, et donn\u00e9es d\u2019audience","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s et le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"27":{"id":27,"purposes":[3,5],"specialFeatures":[],"name":"Publicit\u00e9s personnalis\u00e9es et profil de contenu","description":"Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour personnaliser les publicit\u00e9s et le contenu. "},"28":{"id":28,"purposes":[2,4,6],"specialFeatures":[],"name":"Affichage de publicit\u00e9s et de contenu personnalis\u00e9s","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. "},"29":{"id":29,"purposes":[2,7,8,9],"specialFeatures":[],"name":"Publicit\u00e9s standards, mesure de performance des publicit\u00e9s et du contenu, et donn\u00e9es d\u2019audience","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"30":{"id":30,"purposes":[2,4,5,6,7,8,9],"specialFeatures":[],"name":"Affichage de publicit\u00e9s personnalis\u00e9es, contenu personnalis\u00e9, mesure de performance des publicit\u00e9s et du contenu, et donn\u00e9es d\u2019audience","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"31":{"id":31,"purposes":[2,4,5,6,7,8,9,10],"specialFeatures":[],"name":"Affichage de publicit\u00e9s personnalis\u00e9es, contenu personnalis\u00e9, mesure de performance des publicit\u00e9s et du contenu, donn\u00e9es d\u2019audience et d\u00e9veloppement de produit","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"32":{"id":32,"purposes":[2,5,6,7,8,9],"specialFeatures":[],"name":"Publicit\u00e9s standards, contenu personnalis\u00e9, mesure de performance des publicit\u00e9s et du contenu, et donn\u00e9es d\u2019audience","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"33":{"id":33,"purposes":[2,5,6,7,8,9,10],"specialFeatures":[],"name":"Publicit\u00e9s standards, contenu personnalis\u00e9, mesure de performance des publicit\u00e9s et du contenu, donn\u00e9es d\u2019audience, et d\u00e9veloppement produit","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"34":{"id":34,"purposes":[2,5,6,8,9],"specialFeatures":[],"name":"Publicit\u00e9s standards, contenu personnalis\u00e9, mesure de performance du contenu, et donn\u00e9es d\u2019audience","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"35":{"id":35,"purposes":[2,5,6,8,9,10],"specialFeatures":[],"name":"Publicit\u00e9s standards, contenu personnalis\u00e9, mesure de performance du contenu, donn\u00e9es d\u2019audience et d\u00e9veloppement de produit ","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"36":{"id":36,"purposes":[2,5,6,7],"specialFeatures":[],"name":"Publicit\u00e9s standard, contenu personnalis\u00e9 et mesure de performance des publicit\u00e9s","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e."},"37":{"id":37,"purposes":[2,5,6,7,10],"specialFeatures":[],"name":"Publicit\u00e9s standards, contenu personnalis\u00e9, mesure de performance des publicit\u00e9s, et d\u00e9veloppement produit","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."}}} \ No newline at end of file diff --git a/iabgpp-extras-jackson/src/test/resources/vendorlist/v3.0/purposes-fr.json b/iabgpp-extras-jackson/src/test/resources/vendorlist/v3.0/purposes-fr.json new file mode 100644 index 00000000..98cfa81b --- /dev/null +++ b/iabgpp-extras-jackson/src/test/resources/vendorlist/v3.0/purposes-fr.json @@ -0,0 +1 @@ +{"vendorListVersion":29,"lastUpdated":"2020-03-12T16:40:38Z","purposes":{"1":{"id":1,"name":"Stocker et/ou acc\u00e9der \u00e0 des informations stock\u00e9es sur un terminal","description":"Les cookies, identifiants de votre terminal ou autres informations peuvent \u00eatre stock\u00e9s ou consult\u00e9s sur votre terminal pour les finalit\u00e9s qui vous sont pr\u00e9sent\u00e9es.","descriptionLegal":"Les partenaires peuvent :\n* Stocker des informations et acc\u00e9der \u00e0 des informations stock\u00e9es sur le terminal, comme les cookies et les identifiants du terminal pr\u00e9sent\u00e9s \u00e0 un utilisateur.\n"},"2":{"id":2,"name":"S\u00e9lectionner des publicit\u00e9s standard","description":"Les publicit\u00e9s peuvent vous \u00eatre pr\u00e9sent\u00e9es en fonction du contenu \u00e9ditorial que vous consultez, de l\u2019application que vous utilisez, de votre localisation approximative, ou de votre type de terminal\n","descriptionLegal":"Pour s\u00e9lectionner des publicit\u00e9s standard, les partenaires peuvent :\n* Utiliser des informations en temps r\u00e9el sur le contexte dans lequel la publicit\u00e9 sera affich\u00e9e, pour afficher la publicit\u00e9, y compris des informations sur le contenu et le terminal, telles que : type de terminal et capacit\u00e9s, user agent, URL, adresse IP \n* Utiliser des donn\u00e9es de g\u00e9olocalisation non-pr\u00e9cises d\u2019un utilisateur\n* Contr\u00f4ler la fr\u00e9quence de diffusion des publicit\u00e9s \u00e0 un utilisateur.\n* D\u00e9finir l\u2019ordre dans lequel les publicit\u00e9s sont pr\u00e9sent\u00e9es \u00e0 un utilisateur.\n* Emp\u00eacher une publicit\u00e9 de s\u2019afficher dans un contexte \u00e9ditorial inadapt\u00e9 (dangereux pour la marque)\nLes partenaires ne peuvent pas :\n* Cr\u00e9er un profil publicitaire personnalis\u00e9 \u00e0 l\u2019aide de ces informations pour la s\u00e9lection de publicit\u00e9s futures sans base l\u00e9gale distincte. \nN.B. \u00ab Non-pr\u00e9cises \u00bb signifie qu\u2019une g\u00e9olocalisation approximative dans un rayon d\u2019au moins 500 m\u00e8tres est autoris\u00e9e.\n"},"3":{"id":3,"name":"Cr\u00e9er un profil personnalis\u00e9 de publicit\u00e9s","description":"Un profil peut \u00eatre cr\u00e9\u00e9 sur vous et sur vos centres d\u2019int\u00e9r\u00eat pour vous pr\u00e9senter des publicit\u00e9s personnalis\u00e9es susceptibles de vous int\u00e9resser.","descriptionLegal":"Pour cr\u00e9er un profil de publicit\u00e9s personnalis\u00e9es, les partenaires peuvent :\n* Collecter des informations sur un utilisateur, notamment son activit\u00e9, ses centres d\u2019int\u00e9r\u00eat, les sites ou applications consult\u00e9s, les donn\u00e9es d\u00e9mographiques ou la g\u00e9olocalisation d\u2019un utilisateur, pour cr\u00e9er ou modifier un profil utilisateur \u00e0 utiliser dans des publicit\u00e9s personnalis\u00e9es.\n"},"4":{"id":4,"name":"S\u00e9lectionner des publicit\u00e9s personnalis\u00e9es","description":"Des publicit\u00e9s personnalis\u00e9es peuvent vous \u00eatre pr\u00e9sent\u00e9es sur la base d\u2019un profil cr\u00e9\u00e9 sur vous.","descriptionLegal":"Pour s\u00e9lectionner des publicit\u00e9s personnalis\u00e9es, les partenaires peuvent :\n* S\u00e9lectionner des publicit\u00e9s personnalis\u00e9es sur la base d\u2019un profil utilisateur ou d\u2019autres donn\u00e9es d\u2019utilisateur historiques, y compris l\u2019activit\u00e9 pass\u00e9e d\u2019un utilisateur, ses centres d\u2019int\u00e9r\u00eat, les sites qu\u2019il a visit\u00e9s ou les applications qu\u2019il a utilis\u00e9es, sa localisation ou ses donn\u00e9es d\u00e9mographiques.\n"},"5":{"id":5,"name":"Cr\u00e9er un profil pour afficher un contenu personnalis\u00e9","description":"Un profil peut \u00eatre cr\u00e9\u00e9 sur vous et sur vos centres d\u2019int\u00e9r\u00eat afin de vous pr\u00e9senter du contenu personnalis\u00e9 susceptible de vous int\u00e9resser.","descriptionLegal":"Pour cr\u00e9er un profil pour afficher du contenu personnalis\u00e9, les partenaires peuvent :\n* Collecter des informations sur un utilisateur, y compris l\u2019activit\u00e9 d\u2019un utilisateur, ses centres d\u2019int\u00e9r\u00eat, les sites qu\u2019il a visit\u00e9s ou les applications qu\u2019il a utilis\u00e9es, ses donn\u00e9es d\u00e9mographiques ou sa localisation, pour cr\u00e9er ou modifier un profil utilisateur pour afficher du contenu personnalis\u00e9.\n"},"6":{"id":6,"name":"S\u00e9lectionner du contenu personnalis\u00e9","description":"Du contenu personnalis\u00e9 peut vous \u00eatre pr\u00e9sent\u00e9 sur la base de votre profil utilisateur. ","descriptionLegal":"Pour s\u00e9lectionner du contenu personnalis\u00e9, les partenaires peuvent :\n* S\u00e9lectionner du contenu personnalis\u00e9 sur la base d\u2019un profil utilisateur induit des donn\u00e9es relatives \u00e0 son activit\u00e9 en ligne, ses centres d\u2019int\u00e9r\u00eat, les sites qu\u2019il a visit\u00e9s, les applications qu\u2019il a utilis\u00e9es, sa localisation ou ses donn\u00e9es socio-d\u00e9mographiques.\n"},"7":{"id":7,"name":"Mesurer la performance des publicit\u00e9s","description":"La performance et l\u2019efficacit\u00e9 des publicit\u00e9s que vous voyez ou avec lesquelles vous interagissez peuvent \u00eatre mesur\u00e9es.","descriptionLegal":"Pour mesurer la performance des publicit\u00e9s, les partenaires peuvent:\n* Mesurer si et comment des publicit\u00e9s ont \u00e9t\u00e9 pr\u00e9sent\u00e9e \u00e0 un utilisateur et comment celui-ci a interagi avec celles-ci\n* G\u00e9n\u00e9rer des rapports sur les publicit\u00e9s, notamment sur leur performance\n* G\u00e9n\u00e9rer des rapports sur les utilisateurs ayant interagi avec des publicit\u00e9s en utilisant des donn\u00e9es issues de cette interaction \n* Fournir des rapports aux \u00e9diteurs sur les publicit\u00e9s pr\u00e9sent\u00e9es/affich\u00e9es sur leurs propri\u00e9t\u00e9s num\u00e9riques \n* \u00c9valuer si une publicit\u00e9 diffus\u00e9e dans un contexte \u00e9ditorial appropri\u00e9 (conforme \u00e0 l\u2019image de la marque) sans danger pour la marque)\n* D\u00e9terminer le pourcentage du visionnage \u00e9ventuel de la publicit\u00e9 et sa dur\u00e9e \n* Combiner ces informations avec d\u2019autres informations collect\u00e9es au pr\u00e9alable, pouvant provenir de sites internet et applications\nLes partenaires ne peuvent pas: \n* Croiser des donn\u00e9es d\u2019audience, issues ou d\u00e9riv\u00e9es d\u2019un panel, avec des donn\u00e9es de mesure de performance, sans base l\u00e9gale pour titre \"Finalit\u00e9 9\". \n"},"8":{"id":8,"name":"Mesurer la performance du contenu","description":"La performance et l\u2019efficacit\u00e9 du contenu que vous voyez ou avec lequel vous interagissez peuvent \u00eatre mesur\u00e9es.","descriptionLegal":"Pour mesurer la performance du contenu, les partenaires peuvent:\n* Mesurer comment le contenu a \u00e9t\u00e9 diffus\u00e9 et comment les utilisateurs ont interagi avec, et g\u00e9n\u00e9rer des rapports.\n* G\u00e9n\u00e9rer des rapports \u00e0 l\u2019aide d\u2019informations directement mesurables ou connues, sur les utilisateurs qui ont interagi avec le contenu\nLes partenaires ne peuvent pas:\n* Mesurer si et comment des publicit\u00e9s (y compris des publicit\u00e9s natives) ont \u00e9t\u00e9 pr\u00e9sent\u00e9es \u00e0 un utilisateur et comment celui-ci a interagi avec, sans base l\u00e9gale distincte\n* Croiser des donn\u00e9es d\u2019audience, issues ou d\u00e9riv\u00e9es d\u2019un panel, avec des donn\u00e9es de mesure de performance, sans base l\u00e9gale pour titre \"Finalit\u00e9 9\u201d. "},"9":{"id":9,"name":"Exploiter des \u00e9tudes de march\u00e9 afin de g\u00e9n\u00e9rer des donn\u00e9es d\u2019audience","description":"Les \u00e9tudes de march\u00e9 peuvent servir \u00e0 en apprendre davantage sur les audiences qui visitent des sites/utilisent des applications et voient des publicit\u00e9s.","descriptionLegal":"Pour utiliser des \u00e9tudes de march\u00e9 afin de g\u00e9n\u00e9rer des donn\u00e9es d\u2019audience, les partenaires peuvent:\n* Fournir des rapports agr\u00e9g\u00e9s aux annonceurs ou \u00e0 leurs repr\u00e9sentants sur les audiences expos\u00e9es \u00e0 leurs publicit\u00e9s, en utilisant des donn\u00e9es issues d\u2019un panel ou d\u2019un autre dispositif.\n* Fournir des rapports agr\u00e9g\u00e9s aux \u00e9diteurs sur les audiences expos\u00e9es \u00e0 des contenus et/ou des publicit\u00e9s ou qui ont interagi avec des contenus et/ou les publicit\u00e9s sur leurs sites, en utilisant des donn\u00e9es issues d\u2019un panel ou d\u2019un autre dispositif. \n* Combiner des donn\u00e9es hors ligne \u00e0 celles d\u2019un utilisateur en ligne dans le cadre d\u2019\u00e9tudes de march\u00e9 pour g\u00e9n\u00e9rer des donn\u00e9es d\u2019audience si les partenaires ont d\u00e9clar\u00e9 faire correspondre et associer des sources de donn\u00e9es hors ligne (Fonctionnalit\u00e9 1)\n* Texte dans la version anglaise : Combiner ces informations avec des donn\u00e9es d\u00e9j\u00e0 collect\u00e9es que ce soit sur le web ou via des applications. \nLes partenaires ne peuvent pas : \n* Mesurer la performance et l\u2019efficacit\u00e9 des publicit\u00e9s qui ont \u00e9t\u00e9 pr\u00e9sent\u00e9es \u00e0 un utilisateur en particulier, ou avec lesquelles il a interagi, sans s\u2019appuyer sur une base l\u00e9gale sp\u00e9cifique pour la mesure de la performance publicitaire.\n* \u00c9valuer le contenu qui a \u00e9t\u00e9 pr\u00e9sent\u00e9 \u00e0 un utilisateur en particulier et la fa\u00e7on dont ce dernier a r\u00e9agi sans s\u2019appuyer sur une base l\u00e9gale sp\u00e9cifique pour la mesure de la performance des contenus.\n"},"10":{"id":10,"name":"D\u00e9velopper et am\u00e9liorer les produits","description":"Vos donn\u00e9es peuvent \u00eatre utilis\u00e9es pour am\u00e9liorer les syst\u00e8mes et logiciels existants et pour d\u00e9velopper de nouveaux produits.","descriptionLegal":"Pour d\u00e9velopper de nouveaux produits et am\u00e9liorer des produits existants, les partenaires peuvent:\n* Utiliser des informations pour am\u00e9liorer leurs produits existants en y ajoutant de nouvelles fonctionnalit\u00e9s et pour d\u00e9velopper de nouveaux produits\n* Cr\u00e9er de nouveaux mod\u00e8les et algorithmes gr\u00e2ce au machine-learning \nLes partenaires ne peuvent pas:\n* Effectuer toute autre op\u00e9ration de traitement des donn\u00e9es autoris\u00e9e par une autre finalit\u00e9 dans le cadre de cette finalit\u00e9\n"}},"specialPurposes":{"1":{"id":1,"name":"Assurer la s\u00e9curit\u00e9, pr\u00e9venir la fraude et d\u00e9boguer","description":"Vos donn\u00e9es peuvent \u00eatre utilis\u00e9es pour surveiller et pr\u00e9venir les activit\u00e9s frauduleuses, et s\u2019assurer que les syst\u00e8mes et processus fonctionnent correctement et en toute s\u00e9curit\u00e9.","descriptionLegal":"Pour garantir la s\u00e9curit\u00e9, pr\u00e9venir la fraude et d\u00e9boguer, les partenaires peuvent:\n* Veiller \u00e0 ce que les donn\u00e9es soient transmises en toute s\u00e9curit\u00e9 \n* D\u00e9tecter et pr\u00e9venir les activit\u00e9s malveillantes, frauduleuses, inappropri\u00e9es ou ill\u00e9gales.\n* Assurer un fonctionnement correct et efficace des syst\u00e8mes et des processus, y compris surveiller et am\u00e9liorer la performance des syst\u00e8mes et processus utilis\u00e9s pour des finalit\u00e9s autoris\u00e9es\nLes partenaires ne peuvent pas:\n* Effectuer, au titre de cette finalit\u00e9, toute autre op\u00e9ration de traitement des donn\u00e9es autoris\u00e9e pour une finalit\u00e9 diff\u00e9rente .\nRemarque: Les donn\u00e9es collect\u00e9es et utilis\u00e9es pour assurer la s\u00e9curit\u00e9, pr\u00e9venir la fraude et d\u00e9boguer peuvent inclure des caract\u00e9ristiques d\u2019appareil envoy\u00e9es automatiquement \u00e0 des fins d'identification, des donn\u00e9es de g\u00e9olocalisation pr\u00e9cises et des donn\u00e9es obtenues par l\u2019analyse active des caract\u00e9ristiques de l\u2019appareil \u00e0 des fins d\u2019identification sans notification distincte et/ou opt-in distinct \n"},"2":{"id":2,"name":"Diffuser techniquement les publicit\u00e9s ou le contenu","description":"Votre terminal peut recevoir et envoyer des informations qui vous permettent de voir des publicit\u00e9s et du contenu et d\u2019interagir avec eux.","descriptionLegal":"Pour fournir des informations et r\u00e9pondre aux appels techniques, les partenaires peuvent:\n* Utiliser l\u2019adresse IP d\u2019un utilisateur pour diffuser une publicit\u00e9 sur Internet\n* R\u00e9agir \u00e0 l\u2019interaction d\u2019un utilisateur avec une publicit\u00e9 en dirigeant l\u2019utilisateur vers une page d\u2019accueil\n* Utiliser l\u2019adresse IP d\u2019un utilisateur pour diffuser du contenu sur Internet\n* R\u00e9agir \u00e0 l\u2019interaction d\u2019un utilisateur avec du contenu en dirigeant l\u2019utilisateur vers une page d\u2019accueil\n* Utiliser des informations sur le type de terminal et les capacit\u00e9s du terminal pour pr\u00e9senter des publicit\u00e9s ou du contenu, par exemple, pour pr\u00e9senter une publicit\u00e9 \u00e0 la bonne taille ou une vid\u00e9o dans un format pris en charge par le terminal \nLes partenaires ne peuvent pas:\n* Effectuer, au titre de cette finalit\u00e9, toute autre op\u00e9ration de traitement des donn\u00e9es autoris\u00e9e pour une finalit\u00e9 diff\u00e9rente \n"}},"features":{"1":{"id":1,"name":"Mettre en correspondance et combiner des sources de donn\u00e9es hors ligne","description":"Les donn\u00e9es issues de sources de donn\u00e9es hors ligne peuvent \u00eatre combin\u00e9es \u00e0 votre activit\u00e9 en ligne \u00e0 l\u2019appui d\u2019une ou de plusieurs finalit\u00e9s.","descriptionLegal":"Les partenaires peuvent : \n* Combiner des donn\u00e9es obtenues hors ligne avec des donn\u00e9es collect\u00e9es en ligne \u00e0 l\u2019appui d\u2019une ou de plusieurs Finalit\u00e9s ou Finalit\u00e9s sp\u00e9ciales.\n"},"2":{"id":2,"name":"Relier diff\u00e9rents terminaux","description":"Diff\u00e9rents terminaux peuvent \u00eatre identifi\u00e9s comme vous appartenant ou appartenant \u00e0 votre foyer \u00e0 l\u2019appui d\u2019une ou de plusieurs finalit\u00e9s","descriptionLegal":"Les partnenaires peuvent :\n* D\u00e9terminer, selon une approche d\u00e9terministe, que deux terminaux ou plus appartiennent au m\u00eame utilisateur ou au m\u00eame foyer\n* D\u00e9terminer, selon une approche probabiliste, que deux terminaux ou plus appartiennent au m\u00eame utilisateur ou au m\u00eame foyer\n* Analyser activement les caract\u00e9ristiques du terminal pour l\u2019identification probabiliste si les utilisateurs ont autoris\u00e9 les partenanaires \u00e0 analyser activement les caract\u00e9ristiques du terminal pour l\u2019identification (Fonctionnalit\u00e9 sp\u00e9ciale 2)\n"},"3":{"id":3,"name":"Recevoir et utiliser des caract\u00e9ristiques d\u2019identification d\u2019appareil envoy\u00e9es automatiquement","description":"Votre appareil peut \u00eatre distingu\u00e9 d\u2019autres appareils en fonction des informations qu\u2019il envoie automatiquement, telles que l\u2019adresse IP ou le type de navigateur.","descriptionLegal":"Les partenaires peuvent :\n* Cr\u00e9er un identifiant \u00e0 l\u2019aide des donn\u00e9es collect\u00e9es automatiquement \u00e0 partir d\u2019un appareil pour des caract\u00e9ristiques sp\u00e9cifiques ; par ex., adresse IP, cha\u00eene d\u2019agent utilisateur.\n* Utiliser cet identifiant pour r\u00e9identifier un appareil.\nLes partenaires ne peuvent pas :\n* Cr\u00e9er un identifiant \u00e0 l\u2019aide des donn\u00e9es collect\u00e9es via une analyse active d\u2019un terminal pour l\u2019identification de caract\u00e9ristiques sp\u00e9cifiques (par exemple, des polices install\u00e9es ou la r\u00e9solution d\u2019\u00e9cran) sans une adh\u00e9sion distincte de l\u2019utilisateur \u00e0 l\u2019analyse active des caract\u00e9ristiques de l\u2019appareil \u00e0 des fins d\u2019identification.\n* Utiliser cet identifiant pour r\u00e9-identifier un terminal.\n"}},"specialFeatures":{"1":{"id":1,"name":"Utiliser des donn\u00e9es de g\u00e9olocalisation pr\u00e9cises","description":"Vos donn\u00e9es de g\u00e9olocalisation pr\u00e9cises peuvent \u00eatre utilis\u00e9es \u00e0 l\u2019appui d\u2019une ou de plusieurs finalit\u00e9s. Cela signifie que votre localisation peut \u00eatre pr\u00e9cise \u00e0 plusieurs m\u00e8tres pr\u00e8s.","descriptionLegal":"Les partnenaires peuvent :\n* Collecter et traiter des donn\u00e9es de g\u00e9olocalisation pr\u00e9cises \u00e0 l\u2019appui d\u2019une ou de plusieurs finalit\u00e9s.\nN.B. Une g\u00e9olocalisation pr\u00e9cise signifie qu\u2019il n\u2019y a aucune restriction \u00e0 la pr\u00e9cision de la localisation d\u2019un utilisateur ; elle peut \u00eatre pr\u00e9cise \u00e0 quelques m\u00e8tres pr\u00e8s.\n"},"2":{"id":2,"name":"Analyser activement les caract\u00e9ristiques du terminal pour l\u2019identification","description":"Votre terminal peut \u00eatre identifi\u00e9 sur la base d\u2019une analyse de la combinaison unique de caract\u00e9ristiques de votre terminal.","descriptionLegal":"Les partenaires peuvent :\n* Cr\u00e9er un identifiant \u00e0 l\u2019aide des donn\u00e9es collect\u00e9es via une analyse active d\u2019un terminal pour l\u2019identification de caract\u00e9ristiques sp\u00e9cifiques, par exemple des polices install\u00e9es ou la r\u00e9solution d\u2019\u00e9cran. \n* Utiliser cet identifiant pour r\u00e9-identifier un terminal.\n"}},"stacks":{"1":{"id":1,"purposes":[],"specialFeatures":[1,2],"name":"Donn\u00e9es de g\u00e9olocalisation pr\u00e9cises et identification par analyse du terminal","description":"Des informations de g\u00e9olocalisation pr\u00e9cises et des informations sur les caract\u00e9ristiques de l\u2019appareil peuvent \u00eatre utilis\u00e9es."},"2":{"id":2,"purposes":[2,7],"specialFeatures":[],"name":"Publicit\u00e9s standards et mesure de performance des publicit\u00e9s","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e."},"3":{"id":3,"purposes":[2,3,4],"specialFeatures":[],"name":"Publicit\u00e9s personnalis\u00e9es","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s."},"4":{"id":4,"purposes":[2,7,9],"specialFeatures":[],"name":"Publicit\u00e9s standards et mesure de performance des publicit\u00e9s","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"5":{"id":5,"purposes":[2,3,7],"specialFeatures":[],"name":"Publicit\u00e9s standards, profil de publicit\u00e9s personnalis\u00e9es et mesure de performance des publicit\u00e9s","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e."},"6":{"id":6,"purposes":[2,4,7],"specialFeatures":[],"name":"Affichage de publicit\u00e9s personnalis\u00e9es et mesure de performance des publicit\u00e9s","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e."},"7":{"id":7,"purposes":[2,4,7,9],"specialFeatures":[],"name":"Affichage de publicit\u00e9s personnalis\u00e9es, mesure de performance des publicit\u00e9s, et donn\u00e9es d\u2019audience","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"8":{"id":8,"purposes":[2,3,4,7],"specialFeatures":[],"name":"Publicit\u00e9s personnalis\u00e9es et mesure de performance des annonces","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e."},"9":{"id":9,"purposes":[2,3,4,7,9],"specialFeatures":[],"name":"Publicit\u00e9s personnalis\u00e9es, mesure de performance des publicit\u00e9s, et donn\u00e9es d\u2019audience","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"10":{"id":10,"purposes":[3,4],"specialFeatures":[],"name":"Profil de publicit\u00e9s personnalis\u00e9es et affichage","description":"Les publicit\u00e9s peuvent \u00eatre personnalis\u00e9es sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s. "},"11":{"id":11,"purposes":[5,6],"specialFeatures":[],"name":"Contenu personnalis\u00e9","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu."},"12":{"id":12,"purposes":[6,8],"specialFeatures":[],"name":"Affichage de contenu personnalis\u00e9 et mesure de performance du contenu","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. La performance du contenu peut \u00eatre mesur\u00e9e."},"13":{"id":13,"purposes":[6,8,9],"specialFeatures":[],"name":"Affichage de contenu personnalis\u00e9, mesure de performance du contenu et donn\u00e9es d\u2019audience","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. La performance du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"14":{"id":14,"purposes":[5,6,8],"specialFeatures":[],"name":"Contenu personnalis\u00e9 et mesure de performance du contenu","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance du contenu peut \u00eatre mesur\u00e9e."},"15":{"id":15,"purposes":[5,6,8,9],"specialFeatures":[],"name":"Contenu personnalis\u00e9, mesure de performance du contenu et donn\u00e9es d\u2019audience","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"16":{"id":16,"purposes":[5,6,8,9,10],"specialFeatures":[],"name":"Contenu personnalis\u00e9, mesure de performance du contenu, donn\u00e9es d\u2019audience, et d\u00e9veloppement produit","description":"Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, des syst\u00e8mes et logiciels"},"17":{"id":17,"purposes":[7,8,9],"specialFeatures":[],"name":"Mesure de performance des annonces et du contenu et donn\u00e9es d\u2019audience","description":"La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"18":{"id":18,"purposes":[7,8],"specialFeatures":[],"name":"Mesure de performance des publicit\u00e9s et du contenu","description":"La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e."},"19":{"id":19,"purposes":[7,9],"specialFeatures":[],"name":"Mesure de performance des publicit\u00e9s et donn\u00e9es d\u2019audience","description":"La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu"},"20":{"id":20,"purposes":[7,8,9,10],"specialFeatures":[],"name":"Mesure de performance des publicit\u00e9s et du contenu, donn\u00e9es d\u2019audience, et d\u00e9veloppement produit","description":"La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"21":{"id":21,"purposes":[8,9,10],"specialFeatures":[],"name":"Mesure de performance du contenu, donn\u00e9es d\u2019audience, et d\u00e9veloppement produit.","description":"La performance du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"22":{"id":22,"purposes":[8,10],"specialFeatures":[],"name":"Mesure de performance du contenu, et d\u00e9veloppement produit","description":"La performance du contenu peut \u00eatre mesur\u00e9e. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"23":{"id":23,"purposes":[2,4,6,7,8],"specialFeatures":[],"name":"Affichage de publicit\u00e9s et de contenu personnalis\u00e9s, mesure de performance des publicit\u00e9s et du contenu","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e."},"24":{"id":24,"purposes":[2,4,6,7,8,9],"specialFeatures":[],"name":"Affichage de publicit\u00e9s et de contenu personnalis\u00e9s, mesure de performance des publicit\u00e9s et du contenu, et donn\u00e9es d\u2019audience","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"25":{"id":25,"purposes":[2,3,4,5,6,7,8],"specialFeatures":[],"name":"Publicit\u00e9s et contenu personnalis\u00e9s, mesure de performance des publicit\u00e9s et du contenu","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s et le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e."},"26":{"id":26,"purposes":[2,3,4,5,6,7,8,9],"specialFeatures":[],"name":"Publicit\u00e9s et contenu personnalis\u00e9s, mesure de performance des publicit\u00e9s et du contenu, et donn\u00e9es d\u2019audience","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser les publicit\u00e9s et le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"27":{"id":27,"purposes":[3,5],"specialFeatures":[],"name":"Publicit\u00e9s personnalis\u00e9es et profil de contenu","description":"Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour personnaliser les publicit\u00e9s et le contenu. "},"28":{"id":28,"purposes":[2,4,6],"specialFeatures":[],"name":"Affichage de publicit\u00e9s et de contenu personnalis\u00e9s","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. "},"29":{"id":29,"purposes":[2,7,8,9],"specialFeatures":[],"name":"Publicit\u00e9s standards, mesure de performance des publicit\u00e9s et du contenu, et donn\u00e9es d\u2019audience","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"30":{"id":30,"purposes":[2,4,5,6,7,8,9],"specialFeatures":[],"name":"Affichage de publicit\u00e9s personnalis\u00e9es, contenu personnalis\u00e9, mesure de performance des publicit\u00e9s et du contenu, et donn\u00e9es d\u2019audience","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"31":{"id":31,"purposes":[2,4,5,6,7,8,9,10],"specialFeatures":[],"name":"Affichage de publicit\u00e9s personnalis\u00e9es, contenu personnalis\u00e9, mesure de performance des publicit\u00e9s et du contenu, donn\u00e9es d\u2019audience et d\u00e9veloppement de produit","description":"Les publicit\u00e9s et le contenu peuvent \u00eatre personnalis\u00e9s sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"32":{"id":32,"purposes":[2,5,6,7,8,9],"specialFeatures":[],"name":"Publicit\u00e9s standards, contenu personnalis\u00e9, mesure de performance des publicit\u00e9s et du contenu, et donn\u00e9es d\u2019audience","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"33":{"id":33,"purposes":[2,5,6,7,8,9,10],"specialFeatures":[],"name":"Publicit\u00e9s standards, contenu personnalis\u00e9, mesure de performance des publicit\u00e9s et du contenu, donn\u00e9es d\u2019audience, et d\u00e9veloppement produit","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"34":{"id":34,"purposes":[2,5,6,8,9],"specialFeatures":[],"name":"Publicit\u00e9s standards, contenu personnalis\u00e9, mesure de performance du contenu, et donn\u00e9es d\u2019audience","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s et du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu."},"35":{"id":35,"purposes":[2,5,6,8,9,10],"specialFeatures":[],"name":"Publicit\u00e9s standards, contenu personnalis\u00e9, mesure de performance du contenu, donn\u00e9es d\u2019audience et d\u00e9veloppement de produit ","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance du contenu peut \u00eatre mesur\u00e9e. Des informations peuvent \u00eatre g\u00e9n\u00e9r\u00e9es sur les audiences qui ont vu les publicit\u00e9s et le contenu. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."},"36":{"id":36,"purposes":[2,5,6,7],"specialFeatures":[],"name":"Publicit\u00e9s standard, contenu personnalis\u00e9 et mesure de performance des publicit\u00e9s","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e."},"37":{"id":37,"purposes":[2,5,6,7,10],"specialFeatures":[],"name":"Publicit\u00e9s standards, contenu personnalis\u00e9, mesure de performance des publicit\u00e9s, et d\u00e9veloppement produit","description":"Des publicit\u00e9s standards peuvent \u00eatre diffus\u00e9es. Le contenu peut \u00eatre personnalis\u00e9 sur la base d\u2019un profil. Des donn\u00e9es suppl\u00e9mentaires peuvent \u00eatre ajout\u00e9es pour mieux personnaliser le contenu. La performance des publicit\u00e9s peut \u00eatre mesur\u00e9e. Les donn\u00e9es peuvent \u00eatre utilis\u00e9es pour cr\u00e9er ou am\u00e9liorer l\u2019exp\u00e9rience utilisateur, les syst\u00e8mes et les logiciels."}}} \ No newline at end of file From a3f62d74355129beec699724d058ec9e5b1193f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Hoeksema?= <37441336+danielsao@users.noreply.github.com> Date: Thu, 11 Apr 2024 14:16:32 +0200 Subject: [PATCH 23/41] Update README.md (#46) Fix incorrect client-side API prefixes. https://github.com/InteractiveAdvertisingBureau/Global-Privacy-Platform/blob/main/Sections/Section%20Information.md is the authority. --- README.md | 170 +++++++++++++++++++++++++++--------------------------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index 5c6f166d..2bc63711 100644 --- a/README.md +++ b/README.md @@ -171,89 +171,89 @@ CmpList cmpList = loader.cmpList(cmpListContent); |uspv1|6|Notice|2 bit int| |uspv1|6|OptOutSale|2 bit int| |uspv1|6|LspaCovered|2 bit int| -|usnatv1|7|Version|6 bit int. Value is 1| -|usnatv1|7|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|SharingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|SensitiveDataProcessingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|SensitiveDataLimitUseNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|SharingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|SensitiveDataProcessing|2 bit int list of size 12. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|KnownChildSensitiveDataConsents|2 bit int list of size 2. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|PersonalDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usnatv1|7|GpcSegmentType|2 bit int. Value is 1| -|usnatv1|7|GpcSegmentIncluded|Boolean. Default value is true| -|usnatv1|7|Gpc|Boolean| -|uscav1|8|Version|6 bit int. Value is 1| -|uscav1|8|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscav1|8|SharingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscav1|8|SensitiveDataLimitUseNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscav1|8|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscav1|8|SharingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscav1|8|SensitiveDataProcessing|2 bit int list of size 9. 0=Not applicable, 1=Yes, 2=No| -|uscav1|8|KnownChildSensitiveDataConsents|2 bit int list of size 2. 0=Not applicable, 1=Yes, 2=No| -|uscav1|8|PersonalDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscav1|8|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscav1|8|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscav1|8|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscav1|8|GpcSegmentType|2 bit int. Value is 1| -|uscav1|8|GpcSegmentIncluded|Boolean. Default value is true| -|uscav1|8|Gpc|Boolean| -|usvav1|9|Version|6 bit int. Value is 1| -|usvav1|9|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usvav1|9|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usvav1|9|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usvav1|9|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usvav1|9|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usvav1|9|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| -|usvav1|9|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usvav1|9|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usvav1|9|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usvav1|9|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscov1|10|Version|6 bit int. Value is 1| -|uscov1|10|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscov1|10|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscov1|10|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscov1|10|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscov1|10|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscov1|10|SensitiveDataProcessing|2 bit int list of size 7. 0=Not applicable, 1=Yes, 2=No| -|uscov1|10|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscov1|10|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscov1|10|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscov1|10|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|uscov1|10|GpcSegmentType|2 bit int. Value is 1| -|uscov1|10|GpcSegmentIncluded|Boolean. Default value is true| -|uscov1|10|Gpc|Boolean| -|usutv1|11|Version|6 bit int. Value is 1| -|usutv1|11|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usutv1|11|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usutv1|11|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usutv1|11|SensitiveDataProcessingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usutv1|11|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usutv1|11|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usutv1|11|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| -|usutv1|11|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usutv1|11|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usutv1|11|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usutv1|11|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usctv1|12|Version|6 bit int. Value is 1| -|usctv1|12|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usctv1|12|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usctv1|12|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usctv1|12|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usctv1|12|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usctv1|12|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| -|usctv1|12|KnownChildSensitiveDataConsents|2 bit int list of size 3. 0=Not applicable, 1=Yes, 2=No| -|usctv1|12|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usctv1|12|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usctv1|12|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| -|usctv1|12|GpcSegmentType|2 bit int. Value is 1| -|usctv1|12|GpcSegmentIncluded|Boolean. Default value is true| -|usctv1|12|Gpc|Boolean| +|usnat|7|Version|6 bit int. Value is 1| +|usnat|7|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|SharingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|SensitiveDataProcessingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|SensitiveDataLimitUseNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|SharingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|SensitiveDataProcessing|2 bit int list of size 12. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|KnownChildSensitiveDataConsents|2 bit int list of size 2. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|PersonalDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usnat|7|GpcSegmentType|2 bit int. Value is 1| +|usnat|7|GpcSegmentIncluded|Boolean. Default value is true| +|usnat|7|Gpc|Boolean| +|usca|8|Version|6 bit int. Value is 1| +|usca|8|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usca|8|SharingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usca|8|SensitiveDataLimitUseNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usca|8|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usca|8|SharingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usca|8|SensitiveDataProcessing|2 bit int list of size 9. 0=Not applicable, 1=Yes, 2=No| +|usca|8|KnownChildSensitiveDataConsents|2 bit int list of size 2. 0=Not applicable, 1=Yes, 2=No| +|usca|8|PersonalDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usca|8|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usca|8|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usca|8|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usca|8|GpcSegmentType|2 bit int. Value is 1| +|usca|8|GpcSegmentIncluded|Boolean. Default value is true| +|usca|8|Gpc|Boolean| +|usva|9|Version|6 bit int. Value is 1| +|usva|9|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usva|9|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usva|9|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usva|9|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usva|9|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usva|9|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| +|usva|9|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usva|9|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usva|9|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usva|9|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usco|10|Version|6 bit int. Value is 1| +|usco|10|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usco|10|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usco|10|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usco|10|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usco|10|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usco|10|SensitiveDataProcessing|2 bit int list of size 7. 0=Not applicable, 1=Yes, 2=No| +|usco|10|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usco|10|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usco|10|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usco|10|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usco|10|GpcSegmentType|2 bit int. Value is 1| +|usco|10|GpcSegmentIncluded|Boolean. Default value is true| +|usco|10|Gpc|Boolean| +|usut|11|Version|6 bit int. Value is 1| +|usut|11|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usut|11|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usut|11|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usut|11|SensitiveDataProcessingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usut|11|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usut|11|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usut|11|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| +|usut|11|KnownChildSensitiveDataConsents|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usut|11|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usut|11|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usut|11|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usct|12|Version|6 bit int. Value is 1| +|usct|12|SharingNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usct|12|SaleOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usct|12|TargetedAdvertisingOptOutNotice|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usct|12|SaleOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usct|12|TargetedAdvertisingOptOut|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usct|12|SensitiveDataProcessing|2 bit int list of size 8. 0=Not applicable, 1=Yes, 2=No| +|usct|12|KnownChildSensitiveDataConsents|2 bit int list of size 3. 0=Not applicable, 1=Yes, 2=No| +|usct|12|MspaCoveredTransaction|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usct|12|MspaOptOutOptionMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usct|12|MspaServiceProviderMode|2 bit int. 0=Not applicable, 1=Yes, 2=No| +|usct|12|GpcSegmentType|2 bit int. Value is 1| +|usct|12|GpcSegmentIncluded|Boolean. Default value is true| +|usct|12|Gpc|Boolean| From d51c32439626d3a3cfb99ca62a140b0414fe62e3 Mon Sep 17 00:00:00 2001 From: chuff Date: Mon, 15 Apr 2024 08:27:31 -0600 Subject: [PATCH 24/41] Validation (#36) * lazy decoding * java 8 compatible gppmodel tests * rename missed multistate usp* methods to us* * lazier decoding * lazier decoding * tests for null and empty string constructor arguments * validation * fix typo * remove redundant validate call * default validate * remove empty validate method from header core segment * fix usct validator * deprecate multi-state usp* methods * remove deprecated usp methods * cleanup validators * encodeSection lazy fix --------- Co-authored-by: chad --- .../AbstractEncodableBitStringDataType.java | 28 +- .../encoder/datatype/EncodableBoolean.java | 1 - .../encoder/datatype/EncodableDatetime.java | 1 - .../EncodableFibonacciIntegerRange.java | 1 - .../datatype/EncodableFixedBitfield.java | 1 - .../datatype/EncodableFixedInteger.java | 1 - .../datatype/EncodableFixedIntegerList.java | 1 - .../datatype/EncodableFixedIntegerRange.java | 1 - .../datatype/EncodableFixedString.java | 1 - .../datatype/EncodableFlexibleBitfield.java | 1 - .../datatype/UnencodableCharacter.java | 27 +- .../encoder/datatype/UnencodableInteger.java | 27 +- .../encoder/FixedBitfieldEncoder.java | 5 + .../datatype/encoder/FixedIntegerEncoder.java | 9 +- .../encoder/FixedIntegerListEncoder.java | 5 + .../datatype/encoder/FixedLongEncoder.java | 6 + .../encoder/error/ValidationException.java | 18 + .../AbstractLazilyEncodableSegment.java | 4 +- .../gpp/encoder/segment/EncodableSegment.java | 5 +- .../encoder/segment/HeaderV1CoreSegment.java | 1 + .../encoder/segment/UsCaV1CoreSegment.java | 142 +++- .../encoder/segment/UsCoV1CoreSegment.java | 117 +++- .../encoder/segment/UsCtV1CoreSegment.java | 118 +++- .../encoder/segment/UsNatV1CoreSegment.java | 193 +++++- .../encoder/segment/UsUtV1CoreSegment.java | 120 +++- .../encoder/segment/UsVaV1CoreSegment.java | 117 +++- .../gpp/encoder/segment/UspV1CoreSegment.java | 8 +- .../com/iab/gpp/encoder/GppModelTest.java | 4 +- .../encoder/FixedBitfieldEncoderTest.java | 11 + .../encoder/FixedIntegerEncoderTest.java | 11 + .../encoder/FixedIntegerListEncoderTest.java | 11 + .../encoder/FixedLongEncoderTest.java | 12 + .../iab/gpp/encoder/section/UsCaV1Test.java | 486 +++++++++++++- .../iab/gpp/encoder/section/UsCoV1Test.java | 388 ++++++++++- .../iab/gpp/encoder/section/UsCtV1Test.java | 386 ++++++++++- .../iab/gpp/encoder/section/UsNatV1Test.java | 606 ++++++++++++++++-- .../iab/gpp/encoder/section/UsUtV1Test.java | 375 ++++++++++- .../iab/gpp/encoder/section/UsVaV1Test.java | 368 ++++++++++- 38 files changed, 3356 insertions(+), 261 deletions(-) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/ValidationException.java diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java index 12a6011b..827cf102 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java @@ -1,12 +1,23 @@ package com.iab.gpp.encoder.datatype; +import java.util.Collection; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import com.iab.gpp.encoder.error.ValidationException; + public abstract class AbstractEncodableBitStringDataType implements EncodableDataType { + protected Predicate validator; protected T value; protected AbstractEncodableBitStringDataType() { - + } - + + public AbstractEncodableBitStringDataType withValidator(Predicate validator) { + this.validator = validator; + return this; + } + public boolean hasValue() { return this.value != null; } @@ -17,7 +28,18 @@ public T getValue() { @SuppressWarnings("unchecked") public void setValue(Object value) { - this.value = (T) value; + T v = (T) value; + if (validator == null || validator.test(v)) { + this.value = v; + } else { + if (v instanceof Collection) { + throw new ValidationException("Invalid value '" + + ((Collection) v).stream().map(i -> i.toString()).collect(Collectors.joining(",")) + "'"); + } else { + throw new ValidationException("Invalid value '" + v + "'"); + } + } + } public abstract String substring(String str, int fromIndex); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java index a8f0b601..54211270 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java @@ -22,7 +22,6 @@ public void decode(String bitString) { } public String substring(String bitString, int fromIndex) { - // TODO: validate return bitString.substring(fromIndex, fromIndex + 1); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java index 4fdfd447..44530bb2 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java @@ -23,7 +23,6 @@ public void decode(String bitString) { } public String substring(String bitString, int fromIndex) { - // TODO: validate return bitString.substring(fromIndex, fromIndex + 36); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java index 48d69559..cb65ff66 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java @@ -27,7 +27,6 @@ public void decode(String bitString) { } public String substring(String bitString, int fromIndex) throws DecodingException { - // TODO: add some validation int count = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 12)); int index = fromIndex + 12; for (int i = 0; i < count; i++) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java index 5f4cd5e4..e723cf79 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java @@ -28,7 +28,6 @@ public void decode(String bitString) { } public String substring(String bitString, int fromIndex) { - // TODO: validate return bitString.substring(fromIndex, fromIndex + this.numElements); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java index 05802f65..0351dc90 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java @@ -26,7 +26,6 @@ public void decode(String bitString) { } public String substring(String bitString, int fromIndex) { - // TODO: validate return bitString.substring(fromIndex, fromIndex + this.bitStringLength); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java index 9ac06346..04ee34bc 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java @@ -31,7 +31,6 @@ public void decode(String bitString) { } public String substring(String bitString, int fromIndex) { - // TODO: validate return bitString.substring(fromIndex, fromIndex + (this.elementBitStringLength * numElements)); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java index d78f5186..fbfe8898 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java @@ -26,7 +26,6 @@ public void decode(String bitString) { } public String substring(String bitString, int fromIndex) { - // TODO: add some validation int count = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 12)); int index = fromIndex + 12; for (int i = 0; i < count; i++) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java index f7c92665..89e58ec2 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java @@ -26,7 +26,6 @@ public void decode(String bitString) { } public String substring(String bitString, int fromIndex) { - // TODO: validate return bitString.substring(fromIndex, fromIndex + this.stringLength * 6); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java index b38235ac..ec1ee316 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java @@ -29,7 +29,6 @@ public void decode(String bitString) { } public String substring(String bitString, int fromIndex) { - // TODO: validate return bitString.substring(fromIndex, fromIndex + this.getLengthSupplier.getAsInt()); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableCharacter.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableCharacter.java index 31fd0caa..4ef9c256 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableCharacter.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableCharacter.java @@ -1,13 +1,31 @@ package com.iab.gpp.encoder.datatype; +import java.util.function.Predicate; +import com.iab.gpp.encoder.error.ValidationException; + public class UnencodableCharacter implements DataType { + private Predicate validator; private Character value = null; + public UnencodableCharacter() { + this.validator = v -> true; + } + public UnencodableCharacter(Character value) { - this.value = value; + this.validator = v -> true; + setValue(value); } + public UnencodableCharacter(Character value, Predicate validator) { + this.validator = validator; + setValue(value); + } + + public void setValidator(Predicate validator) { + this.validator = validator; + } + @Override public boolean hasValue() { return this.value != null; @@ -20,7 +38,12 @@ public Character getValue() { @Override public void setValue(Object value) { - this.value = value.toString().charAt(0); + Character c = (Character)value.toString().charAt(0); + if(validator.test(c)) { + this.value = c; + } else { + throw new ValidationException("Invalid value '" + c + "'"); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableInteger.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableInteger.java index 7435ff2d..60dcddfd 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableInteger.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/UnencodableInteger.java @@ -1,13 +1,31 @@ package com.iab.gpp.encoder.datatype; +import java.util.function.Predicate; +import com.iab.gpp.encoder.error.ValidationException; + public class UnencodableInteger implements DataType { + private Predicate validator; private Integer value = null; + public UnencodableInteger() { + this.validator = v -> true; + } + public UnencodableInteger(Integer value) { - this.value = value; + this.validator = v -> true; + setValue(value); } + public UnencodableInteger(Integer value, Predicate validator) { + this.validator = validator; + setValue(value); + } + + public void setValidator(Predicate validator) { + this.validator = validator; + } + @Override public boolean hasValue() { return this.value != null; @@ -20,7 +38,12 @@ public Integer getValue() { @Override public void setValue(Object value) { - this.value = (Integer)value; + Integer i = (Integer)value; + if(validator.test(i)) { + this.value = i; + } else { + throw new ValidationException("Invalid value '" + i + "'"); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoder.java index 05c53dcd..6c922263 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoder.java @@ -4,12 +4,17 @@ import java.util.List; import java.util.regex.Pattern; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class FixedBitfieldEncoder { private static Pattern BITSTRING_VERIFICATION_PATTERN = Pattern.compile("^[0-1]*$", Pattern.CASE_INSENSITIVE); public static String encode(List value, int bitStringLength) { + if (value.size() > bitStringLength) { + throw new EncodingException("Too many values '" + value.size() + "'"); + } + String bitString = ""; for (int i = 0; i < value.size(); i++) { bitString += BooleanEncoder.encode(value.get(i)); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoder.java index 2870af60..dfc6802f 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoder.java @@ -2,6 +2,7 @@ import java.util.regex.Pattern; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class FixedIntegerEncoder { @@ -20,6 +21,11 @@ public static String encode(int value, int bitStringLength) { value = value >> 1; } + if (bitString.length() > bitStringLength) { + throw new EncodingException( + "Numeric value '" + value + "' is too large for a bit string length of '" + bitStringLength + "'"); + } + while (bitString.length() < bitStringLength) { bitString = "0" + bitString; } @@ -31,9 +37,6 @@ public static int decode(String bitString) throws DecodingException { if (!BITSTRING_VERIFICATION_PATTERN.matcher(bitString).matches()) { throw new DecodingException("Undecodable FixedInteger '" + bitString + "'"); } - - // return parseInt(bitString, 2); - int value = 0; for (int i = 0; i < bitString.length(); i++) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java index e130f50d..044dfe26 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoder.java @@ -4,12 +4,17 @@ import java.util.List; import java.util.regex.Pattern; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class FixedIntegerListEncoder { private static Pattern BITSTRING_VERIFICATION_PATTERN = Pattern.compile("^[0-1]*$", Pattern.CASE_INSENSITIVE); public static String encode(List value, int elementBitStringLength, int numElements) { + if(value.size() > numElements) { + throw new EncodingException("Too many values '" + value.size() + "'"); + } + String bitString = ""; for (int i = 0; i < value.size(); i++) { bitString += FixedIntegerEncoder.encode(value.get(i), elementBitStringLength); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoder.java index 76ef8baf..c244a601 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoder.java @@ -2,6 +2,7 @@ import java.util.regex.Pattern; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class FixedLongEncoder { @@ -18,6 +19,11 @@ public static String encode(long value, int bitStringLength) { value = value >> 1; } + if (bitString.length() > bitStringLength) { + throw new EncodingException( + "Numeric value '" + value + "' is too large for a bit string length of '" + bitStringLength + "'"); + } + while (bitString.length() < bitStringLength) { bitString = "0" + bitString; } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/ValidationException.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/ValidationException.java new file mode 100644 index 00000000..733a740b --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/error/ValidationException.java @@ -0,0 +1,18 @@ +package com.iab.gpp.encoder.error; + +public class ValidationException extends DecodingException { + + private static final long serialVersionUID = 2098268445119981680L; + + public ValidationException(String msg) { + super(msg); + } + + public ValidationException(Exception e) { + super(e); + } + + public ValidationException(String msg, Exception e) { + super(msg, e); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java index 44e6bc9f..7c505f73 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java @@ -21,7 +21,7 @@ public AbstractLazilyEncodableSegment() { protected abstract String encodeSegment(T fields); protected abstract void decodeSegment(String encodedString, T Fields); - + public boolean hasField(String fieldName) { return this.fields.containsKey(fieldName); } @@ -57,6 +57,7 @@ public void setFieldValue(String fieldName, Object value) { public String encode() { if (this.encodedString == null || this.encodedString.isEmpty() || this.dirty) { + this.validate(); this.encodedString = encodeSegment(this.fields); this.dirty = false; this.decoded = true; @@ -71,5 +72,4 @@ public void decode(String encodedString) { this.decoded = false; } - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java index abdde319..6f533463 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java @@ -5,7 +5,7 @@ public interface EncodableSegment { List getFieldNames(); - + boolean hasField(String fieldName); Object getFieldValue(String fieldName); @@ -15,4 +15,7 @@ public interface EncodableSegment { String encode(); void decode(String encodedString); + + default void validate() {}; + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java index 44e18bbf..1154d1f6 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java @@ -54,4 +54,5 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java index 4350e694..9c322764 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java @@ -2,11 +2,13 @@ import java.util.Arrays; import java.util.List; +import java.util.function.Predicate; import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCaV1Field; import com.iab.gpp.encoder.section.UsCaV1; @@ -32,20 +34,42 @@ public List getFieldNames() { @Override protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + EncodableBitStringFields fields = new EncodableBitStringFields(); fields.put(UsCaV1Field.VERSION, new EncodableFixedInteger(6, UsCaV1.VERSION)); - fields.put(UsCaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCaV1Field.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCaV1Field.SHARING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCaV1Field.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCaV1Field.SHARING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); fields.put(UsCaV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); - fields.put(UsCaV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsCaV1Field.PERSONAL_DATA_CONSENTS, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCaV1Field.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -58,10 +82,104 @@ protected String encodeSegment(EncodableBitStringFields fields) { @Override protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { - if(encodedString == null || encodedString.isEmpty()) { + if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } + + @Override + public void validate() { + Integer sharingOptOutNotice = ((EncodableFixedInteger) fields.get(UsCaV1Field.SHARING_OPT_OUT_NOTICE)).getValue(); + Integer sharingOptOut = ((EncodableFixedInteger) fields.get(UsCaV1Field.SHARING_OPT_OUT)).getValue(); + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCaV1Field.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCaV1Field.SALE_OPT_OUT)).getValue(); + Integer mspaServiceProviderMode = + ((EncodableFixedInteger) fields.get(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + Integer mspaOptOutOptionMode = + ((EncodableFixedInteger) fields.get(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + Integer sensitiveDataLimtUserNotice = + ((EncodableFixedInteger) fields.get(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE)).getValue(); + + if (sharingOptOutNotice == 0) { + if (sharingOptOut != 0) { + throw new ValidationException( + "Invalid usca sharing notice / opt out combination: {" + sharingOptOutNotice + " / " + sharingOptOut + "}"); + } + } else if (sharingOptOutNotice == 1) { + if (sharingOptOut != 1 && sharingOptOut != 2) { + throw new ValidationException( + "Invalid usca sharing notice / opt out combination: {" + sharingOptOutNotice + " / " + sharingOptOut + "}"); + } + } else if (sharingOptOutNotice == 2) { + if (sharingOptOut != 1) { + throw new ValidationException( + "Invalid usca sharing notice / opt out combination: {" + sharingOptOutNotice + " / " + sharingOptOut + "}"); + } + } + + if (saleOptOutNotice == 0) { + if (saleOptOut != 0) { + throw new ValidationException( + "Invalid usca sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException( + "Invalid usca sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException( + "Invalid usca sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } + + if (mspaServiceProviderMode == 0) { + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usca mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + + if (sharingOptOutNotice != 0) { + throw new ValidationException("Invalid usca mspa service provider mode / sharing opt out notice combination: {" + + mspaServiceProviderMode + " / " + sharingOptOutNotice + "}"); + } + + if (sensitiveDataLimtUserNotice != 0) { + throw new ValidationException( + "Invalid usca mspa service provider mode / sensitive data limit use notice combination: {" + + mspaServiceProviderMode + " / " + sensitiveDataLimtUserNotice + "}"); + } + } else if (mspaServiceProviderMode == 1) { + if (mspaOptOutOptionMode != 2) { + throw new ValidationException("Invalid usca mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); + } + + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usca mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + + if (sharingOptOutNotice != 0) { + throw new ValidationException("Invalid usca mspa service provider mode / sharing opt out notice combination: {" + + mspaServiceProviderMode + " / " + sharingOptOutNotice + "}"); + } + + if (sensitiveDataLimtUserNotice != 0) { + throw new ValidationException( + "Invalid usca mspa service provider mode / sensitive data limit use notice combination: {" + + mspaServiceProviderMode + " / " + sensitiveDataLimtUserNotice + "}"); + } + } else if (mspaServiceProviderMode == 2) { + if (mspaOptOutOptionMode != 1) { + throw new ValidationException("Invalid usca mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); + } + } + } + + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java index 4885f8f6..0a8f5cd8 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java @@ -2,11 +2,13 @@ import java.util.Arrays; import java.util.List; +import java.util.function.Predicate; import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCoV1Field; import com.iab.gpp.encoder.section.UsCoV1; @@ -32,19 +34,40 @@ public List getFieldNames() { @Override protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + EncodableBitStringFields fields = new EncodableBitStringFields(); fields.put(UsCoV1Field.VERSION, new EncodableFixedInteger(6, UsCoV1.VERSION)); - fields.put(UsCoV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCoV1Field.SHARING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCoV1Field.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCoV1Field.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); fields.put(UsCoV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0))); - fields.put(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCoV1Field.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -57,10 +80,82 @@ protected String encodeSegment(EncodableBitStringFields fields) { @Override protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { - if(encodedString == null || encodedString.isEmpty()) { + if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } + + @Override + public void validate() { + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCoV1Field.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCoV1Field.SALE_OPT_OUT)).getValue(); + Integer targetedAdvertisingOptOutNotice = + ((EncodableFixedInteger) fields.get(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + Integer targetedAdvertisingOptOut = + ((EncodableFixedInteger) fields.get(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + Integer mspaServiceProviderMode = + ((EncodableFixedInteger) fields.get(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + Integer mspaOptOutOptionMode = + ((EncodableFixedInteger) fields.get(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + + if (saleOptOutNotice == 0) { + if (saleOptOut != 0) { + throw new ValidationException( + "Invalid usco sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException( + "Invalid usco sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException( + "Invalid usco sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } + + if (targetedAdvertisingOptOutNotice == 0) { + if (targetedAdvertisingOptOut != 0) { + throw new ValidationException("Invalid usco targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException("Invalid usco targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException("Invalid usco targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } + + if (mspaServiceProviderMode == 0) { + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usco mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 1) { + if (mspaOptOutOptionMode != 2) { + throw new ValidationException("Invalid usco mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); + } + + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usco mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 2) { + if (mspaOptOutOptionMode != 1) { + throw new ValidationException("Invalid usco mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); + } + } + } + + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java index 22a44d61..25870edf 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java @@ -2,11 +2,13 @@ import java.util.Arrays; import java.util.List; +import java.util.function.Predicate; import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCtV1Field; import com.iab.gpp.encoder.section.UsCtV1; @@ -32,20 +34,40 @@ public List getFieldNames() { @Override protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + EncodableBitStringFields fields = new EncodableBitStringFields(); fields.put(UsCtV1Field.VERSION, new EncodableFixedInteger(6, UsCtV1.VERSION)); - fields.put(UsCtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsCtV1Field.SHARING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCtV1Field.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCtV1Field.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); fields.put(UsCtV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0))); - fields.put(UsCtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsCtV1Field.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -58,10 +80,82 @@ protected String encodeSegment(EncodableBitStringFields fields) { @Override protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { - if(encodedString == null || encodedString.isEmpty()) { + if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } + + @Override + public void validate() { + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCtV1Field.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCtV1Field.SALE_OPT_OUT)).getValue(); + Integer targetedAdvertisingOptOutNotice = + ((EncodableFixedInteger) fields.get(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + Integer targetedAdvertisingOptOut = + ((EncodableFixedInteger) fields.get(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + Integer mspaServiceProviderMode = + ((EncodableFixedInteger) fields.get(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + Integer mspaOptOutOptionMode = + ((EncodableFixedInteger) fields.get(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + + if (saleOptOutNotice == 0) { + if (saleOptOut != 0) { + throw new ValidationException( + "Invalid usct sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException( + "Invalid usct sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException( + "Invalid usct sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } + + if (targetedAdvertisingOptOutNotice == 0) { + if (targetedAdvertisingOptOut != 0) { + throw new ValidationException("Invalid usct targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException("Invalid usct targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException("Invalid usct targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } + + if (mspaServiceProviderMode == 0) { + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usct mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 1) { + if (mspaOptOutOptionMode != 2) { + throw new ValidationException("Invalid usct mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); + } + + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usct mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 2) { + if (mspaOptOutOptionMode != 1) { + throw new ValidationException("Invalid usct mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); + } + } + } + + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java index ee664225..6bd5ee54 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java @@ -2,11 +2,13 @@ import java.util.Arrays; import java.util.List; +import java.util.function.Predicate; import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsNatV1Field; import com.iab.gpp.encoder.section.UsNatV1; @@ -32,24 +34,50 @@ public List getFieldNames() { @Override protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + EncodableBitStringFields fields = new EncodableBitStringFields(); fields.put(UsNatV1Field.VERSION, new EncodableFixedInteger(6, UsNatV1.VERSION)); - fields.put(UsNatV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsNatV1Field.SHARING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNatV1Field.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNatV1Field.SHARING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNatV1Field.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNatV1Field.SHARING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); fields.put(UsNatV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0))); - fields.put(UsNatV1Field.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsNatV1Field.PERSONAL_DATA_CONSENTS, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNatV1Field.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -62,10 +90,143 @@ protected String encodeSegment(EncodableBitStringFields fields) { @Override protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { - if(encodedString == null || encodedString.isEmpty()) { + if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } + + @Override + public void validate() { + Integer sharingNotice = ((EncodableFixedInteger) fields.get(UsNatV1Field.SHARING_NOTICE)).getValue(); + Integer sharingOptOutNotice = ((EncodableFixedInteger) fields.get(UsNatV1Field.SHARING_OPT_OUT_NOTICE)).getValue(); + Integer sharingOptOut = ((EncodableFixedInteger) fields.get(UsNatV1Field.SHARING_OPT_OUT)).getValue(); + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsNatV1Field.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsNatV1Field.SALE_OPT_OUT)).getValue(); + Integer targetedAdvertisingOptOutNotice = + ((EncodableFixedInteger) fields.get(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + Integer targetedAdvertisingOptOut = + ((EncodableFixedInteger) fields.get(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + Integer mspaServiceProviderMode = + ((EncodableFixedInteger) fields.get(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + Integer mspaOptOutOptionMode = + ((EncodableFixedInteger) fields.get(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + Integer sensitiveDataLimtUserNotice = + ((EncodableFixedInteger) fields.get(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE)).getValue(); + + if (sharingNotice == 0) { + if (sharingOptOut != 0) { + throw new ValidationException( + "Invalid usnat sharing notice / opt out combination: {" + sharingNotice + " / " + sharingOptOut + "}"); + } + } else if (sharingNotice == 1) { + if (sharingOptOut != 1 && sharingOptOut != 2) { + throw new ValidationException( + "Invalid usnat sharing notice / opt out combination: {" + sharingNotice + " / " + sharingOptOut + "}"); + } + } else if (sharingNotice == 2) { + if (sharingOptOut != 1) { + throw new ValidationException( + "Invalid usnat sharing notice / opt out combination: {" + sharingNotice + " / " + sharingOptOut + "}"); + } + } + + if (sharingOptOutNotice == 0) { + if (sharingOptOut != 0) { + throw new ValidationException("Invalid usnat sharing notice / opt out combination: {" + sharingOptOutNotice + + " / " + sharingOptOut + "}"); + } + } else if (sharingOptOutNotice == 1) { + if (sharingOptOut != 1 && sharingOptOut != 2) { + throw new ValidationException("Invalid usnat sharing notice / opt out combination: {" + sharingOptOutNotice + + " / " + sharingOptOut + "}"); + } + } else if (sharingOptOutNotice == 2) { + if (sharingOptOut != 1) { + throw new ValidationException("Invalid usnat sharing notice / opt out combination: {" + sharingOptOutNotice + + " / " + sharingOptOut + "}"); + } + } + + if (saleOptOutNotice == 0) { + if (saleOptOut != 0) { + throw new ValidationException( + "Invalid usnat sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException( + "Invalid usnat sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException( + "Invalid usnat sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } + + if (targetedAdvertisingOptOutNotice == 0) { + if (targetedAdvertisingOptOut != 0) { + throw new ValidationException("Invalid usnat targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException("Invalid usnat targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException("Invalid usnat targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } + + if (mspaServiceProviderMode == 0) { + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usnat mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + + if (sharingOptOutNotice != 0) { + throw new ValidationException("Invalid usnat mspa service provider mode / sharing opt out notice combination: {" + + mspaServiceProviderMode + " / " + sharingOptOutNotice + "}"); + } + + if (sensitiveDataLimtUserNotice != 0) { + throw new ValidationException( + "Invalid usnat mspa service provider mode / sensitive data limit use notice combination: {" + + mspaServiceProviderMode + " / " + sensitiveDataLimtUserNotice + "}"); + } + } else if (mspaServiceProviderMode == 1) { + if (mspaOptOutOptionMode != 2) { + throw new ValidationException("Invalid usnat mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); + } + + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usnat mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + + if (sharingOptOutNotice != 0) { + throw new ValidationException("Invalid usnat mspa service provider mode / sharing opt out notice combination: {" + + mspaServiceProviderMode + " / " + sharingOptOutNotice + "}"); + } + + if (sensitiveDataLimtUserNotice != 0) { + throw new ValidationException( + "Invalid usnat mspa service provider mode / sensitive data limit use notice combination: {" + + mspaServiceProviderMode + " / " + sensitiveDataLimtUserNotice + "}"); + } + } else if (mspaServiceProviderMode == 2) { + if (mspaOptOutOptionMode != 1) { + throw new ValidationException("Invalid usnat mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); + } + } + } + + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java index 21c941b5..e1b6ae75 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java @@ -2,11 +2,13 @@ import java.util.Arrays; import java.util.List; +import java.util.function.Predicate; import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsUtV1Field; import com.iab.gpp.encoder.section.UsUtV1; @@ -32,20 +34,42 @@ public List getFieldNames() { @Override protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + EncodableBitStringFields fields = new EncodableBitStringFields(); fields.put(UsUtV1Field.VERSION, new EncodableFixedInteger(6, UsUtV1.VERSION)); - fields.put(UsUtV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsUtV1Field.SHARING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsUtV1Field.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsUtV1Field.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); fields.put(UsUtV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsUtV1Field.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -58,10 +82,82 @@ protected String encodeSegment(EncodableBitStringFields fields) { @Override protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { - if(encodedString == null || encodedString.isEmpty()) { + if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } + + @Override + public void validate() { + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsUtV1Field.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsUtV1Field.SALE_OPT_OUT)).getValue(); + Integer targetedAdvertisingOptOutNotice = + ((EncodableFixedInteger) fields.get(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + Integer targetedAdvertisingOptOut = + ((EncodableFixedInteger) fields.get(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + Integer mspaServiceProviderMode = + ((EncodableFixedInteger) fields.get(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + Integer mspaOptOutOptionMode = + ((EncodableFixedInteger) fields.get(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + + if (saleOptOutNotice == 0) { + if (saleOptOut != 0) { + throw new ValidationException( + "Invalid usut sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException( + "Invalid usut sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException( + "Invalid usut sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } + + if (targetedAdvertisingOptOutNotice == 0) { + if (targetedAdvertisingOptOut != 0) { + throw new ValidationException("Invalid usut targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException("Invalid usut targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException("Invalid usut targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } + + if (mspaServiceProviderMode == 0) { + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usut mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 1) { + if (mspaOptOutOptionMode != 2) { + throw new ValidationException("Invalid usut mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); + } + + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usut mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 2) { + if (mspaOptOutOptionMode != 1) { + throw new ValidationException("Invalid usut mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); + } + } + } + + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java index c52f7ba6..997521d1 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java @@ -2,11 +2,13 @@ import java.util.Arrays; import java.util.List; +import java.util.function.Predicate; import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsVaV1Field; import com.iab.gpp.encoder.section.UsVaV1; @@ -32,19 +34,40 @@ public List getFieldNames() { @Override protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + EncodableBitStringFields fields = new EncodableBitStringFields(); fields.put(UsVaV1Field.VERSION, new EncodableFixedInteger(6, UsVaV1.VERSION)); - fields.put(UsVaV1Field.SHARING_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.SALE_OPT_OUT, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0)); + fields.put(UsVaV1Field.SHARING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsVaV1Field.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsVaV1Field.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); fields.put(UsVaV1Field.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0))); - fields.put(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0)); - fields.put(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0)); + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsVaV1Field.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -57,10 +80,82 @@ protected String encodeSegment(EncodableBitStringFields fields) { @Override protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { - if(encodedString == null || encodedString.isEmpty()) { + if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } + + @Override + public void validate() { + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsVaV1Field.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsVaV1Field.SALE_OPT_OUT)).getValue(); + Integer targetedAdvertisingOptOutNotice = + ((EncodableFixedInteger) fields.get(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + Integer targetedAdvertisingOptOut = + ((EncodableFixedInteger) fields.get(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + Integer mspaServiceProviderMode = + ((EncodableFixedInteger) fields.get(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + Integer mspaOptOutOptionMode = + ((EncodableFixedInteger) fields.get(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + + if (saleOptOutNotice == 0) { + if (saleOptOut != 0) { + throw new ValidationException( + "Invalid usva sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException( + "Invalid usva sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException( + "Invalid usva sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } + + if (targetedAdvertisingOptOutNotice == 0) { + if (targetedAdvertisingOptOut != 0) { + throw new ValidationException("Invalid usva targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException("Invalid usva targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException("Invalid usva targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } + + if (mspaServiceProviderMode == 0) { + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usva mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 1) { + if (mspaOptOutOptionMode != 2) { + throw new ValidationException("Invalid usva mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); + } + + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usva mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 2) { + if (mspaOptOutOptionMode != 1) { + throw new ValidationException("Invalid usva mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); + } + } + } + + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java index d7ec8525..6c07675d 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java @@ -28,9 +28,9 @@ public List getFieldNames() { protected GenericFields initializeFields() { GenericFields fields = new GenericFields(); fields.put(UspV1Field.VERSION, new UnencodableInteger(UspV1.VERSION)); - fields.put(UspV1Field.NOTICE, new UnencodableCharacter('-')); - fields.put(UspV1Field.OPT_OUT_SALE, new UnencodableCharacter('-')); - fields.put(UspV1Field.LSPA_COVERED, new UnencodableCharacter('-')); + fields.put(UspV1Field.NOTICE, new UnencodableCharacter('-', (v -> v == 'Y' || v == 'N' || v == '-'))); + fields.put(UspV1Field.OPT_OUT_SALE, new UnencodableCharacter('-', (v -> v == 'Y' || v == 'N' || v == '-'))); + fields.put(UspV1Field.LSPA_COVERED, new UnencodableCharacter('-', (v -> v == 'Y' || v == 'N' || v == '-'))); return fields; } @@ -49,7 +49,7 @@ protected void decodeSegment(String encodedString, GenericFields fields) { if (encodedString == null || encodedString.length() != 4) { throw new DecodingException("Invalid uspv1 string: '" + encodedString + "'"); } - + fields.get(UspV1Field.VERSION).setValue(Integer.parseInt(encodedString.substring(0, 1))); fields.get(UspV1Field.NOTICE).setValue(encodedString.charAt(1)); fields.get(UspV1Field.OPT_OUT_SALE).setValue(encodedString.charAt(2)); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 2799e551..dbcd3d9a 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -108,7 +108,7 @@ public void testEncodeDefaultAll() { String gppString = gppModel.encode(); Assertions.assertEquals( - "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAAA.QA~BAAAAAAA.QA~BAAAAAA~BAAAAAA.QA~BAAAAAAA~BAAAAAAA.QA", + "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAQA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA", gppString); } @@ -369,7 +369,7 @@ public void testDecodeDefaults() { @Test public void testDecodeDefaultsAll() { String gppString = - "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAAA.QA~BAAAAAAA.QA~BAAAAAA~BAAAAAA.QA~BAAAAAAA~BAAAAAAA.QA"; + "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAQA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java index 9ded962f..d66e3538 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedBitfieldEncoderTest.java @@ -5,6 +5,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class FixedBitfieldEncoderTest { @@ -43,6 +44,16 @@ public void testEncode7() { Assertions.assertEquals("11", FixedBitfieldEncoder.encode(Arrays.asList(true, true), 2)); } + @Test + public void testEncode8() { + try { + FixedBitfieldEncoder.encode(Arrays.asList(true, true, true), 2); + Assertions.fail("EncodingException expected"); + } catch (EncodingException e) { + + } + } + @Test public void testDecode1() { Assertions.assertEquals(new ArrayList<>(), FixedBitfieldEncoder.decode("")); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoderTest.java index cc8cc48b..a30b882b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoderTest.java @@ -3,6 +3,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class FixedIntegerEncoderTest { @@ -30,6 +31,16 @@ public void testEncode4() { public void testEncode5() { Assertions.assertEquals("00000111", FixedIntegerEncoder.encode(7, 8)); } + + @Test + public void testEncode6() { + try { + FixedIntegerEncoder.encode(8, 1); + Assertions.fail("EncodingException expected"); + } catch (EncodingException e) { + + } + } @Test public void testDecode1() throws DecodingException { diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java index df656eeb..25de7e17 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerListEncoderTest.java @@ -5,6 +5,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class FixedIntegerListEncoderTest { @@ -98,6 +99,16 @@ public void testEncode18() { Assertions.assertEquals("1111", FixedIntegerListEncoder.encode(Arrays.asList(3, 3), 2, 2)); } + @Test + public void testEncode19() { + try { + FixedIntegerListEncoder.encode(Arrays.asList(3, 3), 1, 1); + Assertions.fail("EncodingException expected"); + } catch (EncodingException e) { + + } + } + @Test public void testDecode1() { Assertions.assertEquals(Arrays.asList(0, 0), FixedIntegerListEncoder.decode("", 2, 2)); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoderTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoderTest.java index b762f314..9a90a6dd 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoderTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/encoder/FixedLongEncoderTest.java @@ -3,6 +3,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class FixedLongEncoderTest { @@ -31,10 +32,21 @@ public void testEncode5() { Assertions.assertEquals("00000111", FixedLongEncoder.encode(7, 8)); } + @Test public void testEncode6() { Assertions.assertEquals("001111011111010001110101111011110101", FixedLongEncoder.encode(16630898421L, 36)); } + + @Test + public void testEncode7() { + try { + FixedIntegerEncoder.encode(8, 1); + Assertions.fail("EncodingException expected"); + } catch (EncodingException e) { + + } + } @Test public void testDecode1() throws DecodingException { diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java index f33a1e94..0022210c 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java @@ -4,6 +4,7 @@ import java.util.Arrays; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.UsCaV1Field; public class UsCaV1Test { @@ -12,7 +13,7 @@ public class UsCaV1Test { public void testEncode1() { UsCaV1 usCaV1 = new UsCaV1(); - Assertions.assertEquals("BAAAAAAA.QA", usCaV1.encode()); + Assertions.assertEquals("BAAAAABA.QA", usCaV1.encode()); } @Test @@ -20,19 +21,19 @@ public void testEncode2() { UsCaV1 usCaV1 = new UsCaV1(); usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 2); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0)); - usCaV1.setFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 1)); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 1); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0)); + usCaV1.setFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); usCaV1.setFieldValue(UsCaV1Field.PERSONAL_DATA_CONSENTS, 1); - usCaV1.setFieldValue(UsCaV1Field.MSPA_COVERED_TRANSACTION, 3); + usCaV1.setFieldValue(UsCaV1Field.MSPA_COVERED_TRANSACTION, 1); usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); usCaV1.setFieldValue(UsCaV1Field.GPC, true); - Assertions.assertEquals("BbYbGwXY.YA", usCaV1.encode()); + Assertions.assertEquals("BVWSSSVY.YA", usCaV1.encode()); } @Test @@ -41,41 +42,464 @@ public void testEncode3() { usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 2); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 2); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0)); - usCaV1.setFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 0)); - usCaV1.setFieldValue(UsCaV1Field.PERSONAL_DATA_CONSENTS, 0); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 1); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 1); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0)); + usCaV1.setFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); + usCaV1.setFieldValue(UsCaV1Field.PERSONAL_DATA_CONSENTS, 1); usCaV1.setFieldValue(UsCaV1Field.MSPA_COVERED_TRANSACTION, 1); usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); usCaV1.setFieldValue(UsCaV1Field.GPC, true); - Assertions.assertEquals("BUoAAABQ.YA", usCaV1.encode()); + Assertions.assertEquals("BVWSSSVY.YA", usCaV1.encode()); } + + @Test + public void testSetInvalidValues() { + UsCaV1 usCaV1 = new UsCaV1(); + try { + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 0, 0, 0, 3, 0, 0, 0, 0)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 3)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.PERSONAL_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testValidateSharing() { + UsCaV1 usCaV1 = new UsCaV1(); + + try { + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 1); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 2); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 0); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 0); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 2); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 0); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 1); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 2); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 1); + usCaV1.encode(); + } + + @Test + public void testValidateSale() { + UsCaV1 usCaV1 = new UsCaV1(); + + try { + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 1); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 2); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 0); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 0); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 2); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 0); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 1); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 2); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 1); + usCaV1.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsCaV1 usCaV1 = new UsCaV1(); + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usCaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCaV1.encode(); + + + usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usCaV1.encode(); + + usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); + usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); + usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usCaV1.encode(); + } + @Test public void testEncodeWithGpcSegmentExcluded() { UsCaV1 usCaV1 = new UsCaV1(); usCaV1.setFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAAAA", usCaV1.encode()); + Assertions.assertEquals("BAAAAABA", usCaV1.encode()); } @Test public void testDecode1() { - UsCaV1 usCaV1 = new UsCaV1("BbYbGwXY.YA"); + UsCaV1 usCaV1 = new UsCaV1("BVWSSSVY.YA"); Assertions.assertEquals(1, usCaV1.getSaleOptOutNotice()); - Assertions.assertEquals(2, usCaV1.getSharingOptOut()); - Assertions.assertEquals(3, usCaV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usCaV1.getSharingOptOut()); + Assertions.assertEquals(1, usCaV1.getSensitiveDataLimitUseNotice()); Assertions.assertEquals(1, usCaV1.getSaleOptOut()); - Assertions.assertEquals(2, usCaV1.getSharingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0), usCaV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(0, 1), usCaV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCaV1.getSharingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0), usCaV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1), usCaV1.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usCaV1.getPersonalDataConsents()); - Assertions.assertEquals(3, usCaV1.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usCaV1.getMspaCoveredTransaction()); Assertions.assertEquals(1, usCaV1.getMspaOptOutOptionMode()); Assertions.assertEquals(2, usCaV1.getMspaServiceProviderMode()); Assertions.assertEquals(true, usCaV1.getGpc()); @@ -83,17 +507,17 @@ public void testDecode1() { @Test public void testDecodeWithGpcSegmentExcluded() { - UsCaV1 usCaV1 = new UsCaV1("BbYbGwXY"); + UsCaV1 usCaV1 = new UsCaV1("BVWSSSVY"); Assertions.assertEquals(1, usCaV1.getSaleOptOutNotice()); - Assertions.assertEquals(2, usCaV1.getSharingOptOut()); - Assertions.assertEquals(3, usCaV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usCaV1.getSharingOptOut()); + Assertions.assertEquals(1, usCaV1.getSensitiveDataLimitUseNotice()); Assertions.assertEquals(1, usCaV1.getSaleOptOut()); - Assertions.assertEquals(2, usCaV1.getSharingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0), usCaV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(0, 1), usCaV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCaV1.getSharingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0), usCaV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1), usCaV1.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usCaV1.getPersonalDataConsents()); - Assertions.assertEquals(3, usCaV1.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usCaV1.getMspaCoveredTransaction()); Assertions.assertEquals(1, usCaV1.getMspaOptOutOptionMode()); Assertions.assertEquals(2, usCaV1.getMspaServiceProviderMode()); Assertions.assertEquals(false, usCaV1.getGpcSegmentIncluded()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java index f00b108b..efe5a2ef 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java @@ -4,6 +4,7 @@ import java.util.Arrays; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.UsCoV1Field; public class UsCoV1Test { @@ -11,7 +12,7 @@ public class UsCoV1Test { @Test public void testEncode1() { UsCoV1 usCoV1 = new UsCoV1(); - Assertions.assertEquals("BAAAAAA.QA", usCoV1.encode()); + Assertions.assertEquals("BAAAAEA.QA", usCoV1.encode()); } @Test @@ -19,58 +20,393 @@ public void testEncode2() { UsCoV1 usCoV1 = new UsCoV1(); usCoV1.setFieldValue(UsCoV1Field.SHARING_NOTICE, 1); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 1); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usCoV1.setFieldValue(UsCoV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2)); - usCoV1.setFieldValue(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usCoV1.setFieldValue(UsCoV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2)); + usCoV1.setFieldValue(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); usCoV1.setFieldValue(UsCoV1Field.MSPA_COVERED_TRANSACTION, 1); - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); usCoV1.setFieldValue(UsCoV1Field.GPC, true); - Assertions.assertEquals("BbYbG2w.YA", usCoV1.encode()); + Assertions.assertEquals("BVWSSVg.YA", usCoV1.encode()); + } + + @Test + public void testSetInvalidValues() { + UsCoV1 usCoV1 = new UsCoV1(); + + try { + usCoV1.setFieldValue(UsCoV1Field.SHARING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 5); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + } + + @Test + public void testValidateSale() { + UsCoV1 usCoV1 = new UsCoV1(); + + try { + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 1); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 2); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 0); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 0); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 2); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 0); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 1); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 2); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 1); + usCoV1.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsCoV1 usCoV1 = new UsCoV1(); + + try { + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usCoV1.encode(); } + + @Test + public void testValidateMspaServiceProviderMode() { + UsCoV1 usCoV1 = new UsCoV1(); + + try { + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); + usCoV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); + + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCoV1.encode(); + + + usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); + usCoV1.encode(); + + usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); + usCoV1.encode(); + } + @Test public void testEncodeWithGpcSegmentExcluded() { UsCoV1 usCoV1 = new UsCoV1(); usCoV1.setFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAAA", usCoV1.encode()); + Assertions.assertEquals("BAAAAEA", usCoV1.encode()); } @Test public void testDecode1() { - UsCoV1 usCoV1 = new UsCoV1("BbYbG2wA.YA"); + UsCoV1 usCoV1 = new UsCoV1("BVWSSVg.YA"); Assertions.assertEquals(1, usCoV1.getSharingNotice()); - Assertions.assertEquals(2, usCoV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, usCoV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCoV1.getSaleOptOutNotice()); + Assertions.assertEquals(1, usCoV1.getTargetedAdvertisingOptOutNotice()); Assertions.assertEquals(1, usCoV1.getSaleOptOut()); - Assertions.assertEquals(2, usCoV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2), usCoV1.getSensitiveDataProcessing()); - Assertions.assertEquals(3, usCoV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCoV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2), usCoV1.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usCoV1.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usCoV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, usCoV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, usCoV1.getMspaServiceProviderMode()); + Assertions.assertEquals(1, usCoV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCoV1.getMspaServiceProviderMode()); Assertions.assertEquals(true, usCoV1.getGpc()); } @Test public void testDecodeWithGpcSegmentExcluded() { - UsCoV1 usCoV1 = new UsCoV1("BbYbG2wA"); + UsCoV1 usCoV1 = new UsCoV1("BVWSSVg"); Assertions.assertEquals(1, usCoV1.getSharingNotice()); - Assertions.assertEquals(2, usCoV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, usCoV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCoV1.getSaleOptOutNotice()); + Assertions.assertEquals(1, usCoV1.getTargetedAdvertisingOptOutNotice()); Assertions.assertEquals(1, usCoV1.getSaleOptOut()); - Assertions.assertEquals(2, usCoV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2), usCoV1.getSensitiveDataProcessing()); - Assertions.assertEquals(3, usCoV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCoV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2), usCoV1.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usCoV1.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usCoV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, usCoV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, usCoV1.getMspaServiceProviderMode()); + Assertions.assertEquals(1, usCoV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCoV1.getMspaServiceProviderMode()); Assertions.assertEquals(false, usCoV1.getGpcSegmentIncluded()); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java index 864a1966..af353058 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java @@ -5,6 +5,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.UsCtV1Field; public class UsCtV1Test { @@ -12,7 +13,7 @@ public class UsCtV1Test { @Test public void testEncode1() { UsCtV1 usCtV1 = new UsCtV1(); - Assertions.assertEquals("BAAAAAAA.QA", usCtV1.encode()); + Assertions.assertEquals("BAAAAAEA.QA", usCtV1.encode()); } @Test @@ -20,58 +21,391 @@ public void testEncode2() { UsCtV1 usCtV1 = new UsCtV1(); usCtV1.setFieldValue(UsCtV1Field.SHARING_NOTICE, 1); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 1); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usCtV1.setFieldValue(UsCtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); - usCtV1.setFieldValue(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usCtV1.setFieldValue(UsCtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usCtV1.setFieldValue(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1, 0)); usCtV1.setFieldValue(UsCtV1Field.MSPA_COVERED_TRANSACTION, 1); - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); usCtV1.setFieldValue(UsCtV1Field.GPC, true); - Assertions.assertEquals("BbYbG22w.YA", usCtV1.encode()); + Assertions.assertEquals("BVWSSZFg.YA", usCtV1.encode()); + } + + @Test + public void testSetInvalidValues() { + UsCtV1 usCtV1 = new UsCtV1(); + + try { + usCtV1.setFieldValue(UsCtV1Field.SHARING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testValidateSale() { + UsCtV1 usCtV1 = new UsCtV1(); + + try { + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 1); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 2); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 0); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 0); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 2); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 0); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 1); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 2); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 1); + usCtV1.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsCtV1 usCtV1 = new UsCtV1(); + + try { + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usCtV1.encode(); } + + @Test + public void testValidateMspaServiceProviderMode() { + UsCtV1 usCtV1 = new UsCtV1(); + + try { + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + try { + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); + usCtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); + + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usCtV1.encode(); + + + usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); + usCtV1.encode(); + + usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); + usCtV1.encode(); + } + @Test public void testEncodeWithGpcSegmentExcluded() { UsCtV1 usCtV1 = new UsCtV1(); usCtV1.setFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAAAA", usCtV1.encode()); + Assertions.assertEquals("BAAAAAEA", usCtV1.encode()); } @Test public void testDecode1() throws DecodingException { - UsCtV1 usCtV1 = new UsCtV1("BbYbG22w.YAAA"); + UsCtV1 usCtV1 = new UsCtV1("BVWSSZFg.YA"); Assertions.assertEquals(1, usCtV1.getSharingNotice()); - Assertions.assertEquals(2, usCtV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, usCtV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCtV1.getSaleOptOutNotice()); + Assertions.assertEquals(1, usCtV1.getTargetedAdvertisingOptOutNotice()); Assertions.assertEquals(1, usCtV1.getSaleOptOut()); - Assertions.assertEquals(2, usCtV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), usCtV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(1, 2, 3), usCtV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCtV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usCtV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usCtV1.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usCtV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, usCtV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, usCtV1.getMspaServiceProviderMode()); + Assertions.assertEquals(1, usCtV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCtV1.getMspaServiceProviderMode()); Assertions.assertEquals(true, usCtV1.getGpc()); } @Test public void testDecodeWithGpcSegmentExcluded() throws DecodingException { - UsCtV1 usCtV1 = new UsCtV1("BbYbG22w"); + UsCtV1 usCtV1 = new UsCtV1("BVWSSZFg"); Assertions.assertEquals(1, usCtV1.getSharingNotice()); - Assertions.assertEquals(2, usCtV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, usCtV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCtV1.getSaleOptOutNotice()); + Assertions.assertEquals(1, usCtV1.getTargetedAdvertisingOptOutNotice()); Assertions.assertEquals(1, usCtV1.getSaleOptOut()); - Assertions.assertEquals(2, usCtV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), usCtV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(1, 2, 3), usCtV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCtV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usCtV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usCtV1.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usCtV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, usCtV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, usCtV1.getMspaServiceProviderMode()); + Assertions.assertEquals(1, usCtV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCtV1.getMspaServiceProviderMode()); Assertions.assertEquals(false, usCtV1.getGpcSegmentIncluded()); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java index 379752e6..ac3cd9ab 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java @@ -5,6 +5,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.UsNatV1Field; public class UsNatV1Test { @@ -13,7 +14,7 @@ public class UsNatV1Test { public void testEncode1() { UsNatV1 usNatV1 = new UsNatV1(); - Assertions.assertEquals("BAAAAAAAAAA.QA", usNatV1.encode()); + Assertions.assertEquals("BAAAAAAAAQA.QA", usNatV1.encode()); } @Test @@ -21,25 +22,546 @@ public void testEncode2() { UsNatV1 usNatV1 = new UsNatV1(); usNatV1.setFieldValue(UsNatV1Field.SHARING_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 3); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 2); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3)); - usNatV1.setFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 1)); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 1); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0)); + usNatV1.setFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); usNatV1.setFieldValue(UsNatV1Field.PERSONAL_DATA_CONSENTS, 1); usNatV1.setFieldValue(UsNatV1Field.MSPA_COVERED_TRANSACTION, 1); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); usNatV1.setFieldValue(UsNatV1Field.GPC, true); - Assertions.assertEquals("BbbbGxsbFbA.YA", usNatV1.encode()); + Assertions.assertEquals("BVVVkkkklWA.YA", usNatV1.encode()); + } + + @Test + public void testSetInvalidValues() { + UsNatV1 usNatV1 = new UsNatV1(); + + try { + usNatV1.setFieldValue(UsNatV1Field.SHARING_NOTICE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 0, 0, 1, 2, 0)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 3)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.PERSONAL_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + } + @Test + public void testValidateSharing() { + UsNatV1 usNatV1 = new UsNatV1(); + + try { + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 1); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 0); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 0); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 0); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 1); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 2); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 1); + usNatV1.encode(); + } + + @Test + public void testValidateSale() { + UsNatV1 usNatV1 = new UsNatV1(); + + try { + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 0); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 0); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 0); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 2); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); + usNatV1.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsNatV1 usNatV1 = new UsNatV1(); + + try { + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usNatV1.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsNatV1 usNatV1 = new UsNatV1(); + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usNatV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usNatV1.encode(); + + + usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usNatV1.encode(); + + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usNatV1.encode(); + } + + @Test public void testEncode3() { UsNatV1 usNatV1 = new UsNatV1(); @@ -48,20 +570,20 @@ public void testEncode3() { usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 1); usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); - usNatV1.setFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 0)); - usNatV1.setFieldValue(UsNatV1Field.PERSONAL_DATA_CONSENTS, 0); + usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0)); + usNatV1.setFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); + usNatV1.setFieldValue(UsNatV1Field.PERSONAL_DATA_CONSENTS, 1); usNatV1.setFieldValue(UsNatV1Field.MSPA_COVERED_TRANSACTION, 1); usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); usNatV1.setFieldValue(UsNatV1Field.GPC, true); - Assertions.assertEquals("BVQVAAAAAUA.YA", usNatV1.encode()); + Assertions.assertEquals("BVVVkkkklWA.YA", usNatV1.encode()); } @Test @@ -69,50 +591,50 @@ public void testEncodeWithGpcSegmentIncluded() { UsNatV1 usNatV1 = new UsNatV1(); usNatV1.setFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAAAAAAA", usNatV1.encode()); + Assertions.assertEquals("BAAAAAAAAQA", usNatV1.encode()); } @Test public void testDecode1() throws DecodingException { - UsNatV1 usNatV1 = new UsNatV1("BbbbGxsbFbA.YA"); + UsNatV1 usNatV1 = new UsNatV1("BVVVkkkklWA.YA"); Assertions.assertEquals(1, usNatV1.getSharingNotice()); - Assertions.assertEquals(2, usNatV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, usNatV1.getSharingOptOutNotice()); + Assertions.assertEquals(1, usNatV1.getSaleOptOutNotice()); + Assertions.assertEquals(1, usNatV1.getSharingOptOutNotice()); Assertions.assertEquals(1, usNatV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(2, usNatV1.getSensitiveDataProcessingOptOutNotice()); - Assertions.assertEquals(3, usNatV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usNatV1.getSensitiveDataProcessingOptOutNotice()); + Assertions.assertEquals(1, usNatV1.getSensitiveDataLimitUseNotice()); Assertions.assertEquals(1, usNatV1.getSaleOptOut()); - Assertions.assertEquals(2, usNatV1.getSharingOptOut()); - Assertions.assertEquals(3, usNatV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3), usNatV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(0, 1), usNatV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNatV1.getSharingOptOut()); + Assertions.assertEquals(1, usNatV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0), usNatV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1), usNatV1.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usNatV1.getPersonalDataConsents()); Assertions.assertEquals(1, usNatV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, usNatV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, usNatV1.getMspaServiceProviderMode()); + Assertions.assertEquals(1, usNatV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usNatV1.getMspaServiceProviderMode()); Assertions.assertEquals(true, usNatV1.getGpc()); } @Test public void testDecodeWithGpcSegmentExcluded() throws DecodingException { - UsNatV1 usNatV1 = new UsNatV1("BbbbGxsbFbA"); + UsNatV1 usNatV1 = new UsNatV1("BVVVkkkklWA"); Assertions.assertEquals(1, usNatV1.getSharingNotice()); - Assertions.assertEquals(2, usNatV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, usNatV1.getSharingOptOutNotice()); + Assertions.assertEquals(1, usNatV1.getSaleOptOutNotice()); + Assertions.assertEquals(1, usNatV1.getSharingOptOutNotice()); Assertions.assertEquals(1, usNatV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(2, usNatV1.getSensitiveDataProcessingOptOutNotice()); - Assertions.assertEquals(3, usNatV1.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usNatV1.getSensitiveDataProcessingOptOutNotice()); + Assertions.assertEquals(1, usNatV1.getSensitiveDataLimitUseNotice()); Assertions.assertEquals(1, usNatV1.getSaleOptOut()); - Assertions.assertEquals(2, usNatV1.getSharingOptOut()); - Assertions.assertEquals(3, usNatV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3), usNatV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(0, 1), usNatV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNatV1.getSharingOptOut()); + Assertions.assertEquals(1, usNatV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0), usNatV1.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1), usNatV1.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usNatV1.getPersonalDataConsents()); Assertions.assertEquals(1, usNatV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, usNatV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, usNatV1.getMspaServiceProviderMode()); + Assertions.assertEquals(1, usNatV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usNatV1.getMspaServiceProviderMode()); Assertions.assertEquals(false, usNatV1.getGpcSegmentIncluded()); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java index ac647a6b..d42eaddc 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java @@ -5,6 +5,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.UsUtV1Field; public class UsUtV1Test { @@ -12,7 +13,7 @@ public class UsUtV1Test { @Test public void testEncode1() { UsUtV1 usUtV1 = new UsUtV1(); - Assertions.assertEquals("BAAAAAAA", usUtV1.encode()); + Assertions.assertEquals("BAAAAAQA", usUtV1.encode()); } @Test @@ -20,33 +21,373 @@ public void testEncode2() { UsUtV1 usUtV1 = new UsUtV1(); usUtV1.setFieldValue(UsUtV1Field.SHARING_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 1); usUtV1.setFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usUtV1.setFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); - usUtV1.setFieldValue(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usUtV1.setFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usUtV1.setFieldValue(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); usUtV1.setFieldValue(UsUtV1Field.MSPA_COVERED_TRANSACTION, 1); - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + + Assertions.assertEquals("BVVkklWA", usUtV1.encode()); + } + + @Test + public void testSetInvalidValues() { + UsUtV1 usUtV1 = new UsUtV1(); - Assertions.assertEquals("BbWGxvbA", usUtV1.encode()); + try { + usUtV1.setFieldValue(UsUtV1Field.SHARING_NOTICE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 0)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + @Test + public void testValidateSale() { + UsUtV1 usUtV1 = new UsUtV1(); + + try { + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 1); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 2); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 0); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 0); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 2); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 0); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 1); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 2); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 1); + usUtV1.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsUtV1 usUtV1 = new UsUtV1(); + + try { + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usUtV1.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsUtV1 usUtV1 = new UsUtV1(); + + try { + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); + usUtV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); + + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usUtV1.encode(); + + + usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); + usUtV1.encode(); + + usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); + usUtV1.encode(); + } + @Test public void testDecode1() throws DecodingException { - UsUtV1 usUtV1 = new UsUtV1("BbWGxvbA"); + UsUtV1 usUtV1 = new UsUtV1("BVVkklWA"); Assertions.assertEquals(1, usUtV1.getSharingNotice()); - Assertions.assertEquals(2, usUtV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, usUtV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usUtV1.getSaleOptOutNotice()); + Assertions.assertEquals(1, usUtV1.getTargetedAdvertisingOptOutNotice()); Assertions.assertEquals(1, usUtV1.getSaleOptOut()); - Assertions.assertEquals(2, usUtV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), usUtV1.getSensitiveDataProcessing()); - Assertions.assertEquals(3, usUtV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usUtV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usUtV1.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usUtV1.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usUtV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, usUtV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, usUtV1.getMspaServiceProviderMode()); + Assertions.assertEquals(1, usUtV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usUtV1.getMspaServiceProviderMode()); } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java index 06b5165f..0a446cd2 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java @@ -7,6 +7,7 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.UsVaV1Field; public class UsVaV1Test { @@ -14,7 +15,7 @@ public class UsVaV1Test { @Test public void testEncode1() { UsVaV1 usVaV1 = new UsVaV1(); - Assertions.assertEquals("BAAAAAA", usVaV1.encode()); + Assertions.assertEquals("BAAAABA", usVaV1.encode()); } @Test @@ -23,35 +24,368 @@ public void testEncode2() { try { usVaV1.setFieldValue(UsVaV1Field.SHARING_NOTICE, 1); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 1); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usVaV1.setFieldValue(UsVaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3)); - usVaV1.setFieldValue(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usVaV1.setFieldValue(UsVaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usVaV1.setFieldValue(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); usVaV1.setFieldValue(UsVaV1Field.MSPA_COVERED_TRANSACTION, 1); - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); } catch (InvalidFieldException e) { throw new EncodingException(e); } - Assertions.assertEquals("BbYbG9s", usVaV1.encode()); + Assertions.assertEquals("BVWSSVY", usVaV1.encode()); + } + + @Test + public void testSetInvalidValues() { + UsVaV1 usVaV1 = new UsVaV1(); + + try { + usVaV1.setFieldValue(UsVaV1Field.SHARING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + } + + @Test + public void testValidateSale() { + UsVaV1 usVaV1 = new UsVaV1(); + + try { + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 1); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 2); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 0); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 0); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 2); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 0); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 1); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 2); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 1); + usVaV1.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsVaV1 usVaV1 = new UsVaV1(); + + try { + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); + usVaV1.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsVaV1 usVaV1 = new UsVaV1(); + + try { + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); + usVaV1.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); + + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); + usVaV1.encode(); + + + usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); + + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); + usVaV1.encode(); + + usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); + usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); + usVaV1.encode(); } @Test public void testDecode1() throws DecodingException { - UsVaV1 usVaV1 = new UsVaV1("BbYbG9s"); + UsVaV1 usVaV1 = new UsVaV1("BVWSSVY"); Assertions.assertEquals(1, usVaV1.getSharingNotice()); - Assertions.assertEquals(2, usVaV1.getSaleOptOutNotice()); - Assertions.assertEquals(3, usVaV1.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usVaV1.getSaleOptOutNotice()); + Assertions.assertEquals(1, usVaV1.getTargetedAdvertisingOptOutNotice()); Assertions.assertEquals(1, usVaV1.getSaleOptOut()); - Assertions.assertEquals(2, usVaV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(0, 1, 2, 3, 0, 1, 2, 3), usVaV1.getSensitiveDataProcessing()); - Assertions.assertEquals(3, usVaV1.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usVaV1.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usVaV1.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usVaV1.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usVaV1.getMspaCoveredTransaction()); - Assertions.assertEquals(2, usVaV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(3, usVaV1.getMspaServiceProviderMode()); + Assertions.assertEquals(1, usVaV1.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usVaV1.getMspaServiceProviderMode()); } } From 3e70a3e44f6b912a142875b4f57c05a111106c35 Mon Sep 17 00:00:00 2001 From: chuff Date: Mon, 15 Apr 2024 12:05:01 -0600 Subject: [PATCH 25/41] tcfca pub restrictions and disclosed vendors (#39) * rename missed multistate usp* methods to us* * 3.1.1 * 3.1.2-SNAPSHOT * tcfca publisher restrictions and disclosed vendors * deprecate multi-state usp* methods * substring error handling * remove deprecated usp methods * Update README * tcfeu pub restrictions fix * pub restrictions getters * tcfeu pub restirctions fix * cleanup * pub restrictions fix --------- Co-authored-by: chad --- README.md | 3 + .../java/com/iab/gpp/encoder/GppModel.java | 97 ++++++++------- .../encoder/bitstring/BitStringEncoder.java | 17 ++- .../AbstractEncodableBitStringDataType.java | 19 ++- .../EncodableArrayOfFixedIntegerRanges.java | 110 ++++++++++++++++++ .../encoder/datatype/EncodableBoolean.java | 31 ++++- .../encoder/datatype/EncodableDatetime.java | 31 ++++- .../datatype/EncodableFibonacciInteger.java | 39 +++++-- .../EncodableFibonacciIntegerRange.java | 44 ++++--- .../datatype/EncodableFixedBitfield.java | 37 +++++- .../datatype/EncodableFixedInteger.java | 32 ++++- .../datatype/EncodableFixedIntegerList.java | 33 +++++- .../datatype/EncodableFixedIntegerRange.java | 45 ++++--- .../datatype/EncodableFixedString.java | 32 ++++- .../datatype/EncodableFlexibleBitfield.java | 32 ++++- .../EncodableOptimizedFibonacciRange.java | 71 +++++------ .../EncodableOptimizedFixedRange.java | 74 +++++------- .../iab/gpp/encoder/datatype/RangeEntry.java | 42 +++++++ .../encoder/datatype/SubstringException.java | 18 +++ .../encoder/ArrayOfRangesEntryEncoder.java | 43 +++++++ .../OptimizedFibonacciRangeEncoder.java | 56 +++++++++ .../encoder/OptimizedFixedRangeEncoder.java | 57 +++++++++ .../iab/gpp/encoder/field/TcfCaV1Field.java | 14 ++- ...actEncodableSegmentedBitStringSection.java | 110 ++++++++++++++++++ .../com/iab/gpp/encoder/section/TcfCaV1.java | 32 ++++- .../com/iab/gpp/encoder/section/TcfEuV2.java | 8 +- .../AbstractLazilyEncodableSegment.java | 1 + .../gpp/encoder/segment/EncodableSegment.java | 1 - .../encoder/segment/HeaderV1CoreSegment.java | 9 +- .../encoder/segment/TcfCaV1CoreSegment.java | 11 +- .../TcfCaV1DisclosedVendorsSegment.java | 60 ++++++++++ .../TcfCaV1PublisherPurposesSegment.java | 9 +- .../encoder/segment/TcfEuV2CoreSegment.java | 13 ++- .../TcfEuV2PublisherPurposesSegment.java | 9 +- .../segment/TcfEuV2VendorsAllowedSegment.java | 9 +- .../TcfEuV2VendorsDisclosedSegment.java | 9 +- .../encoder/segment/UsCaV1CoreSegment.java | 9 +- .../gpp/encoder/segment/UsCaV1GpcSegment.java | 9 +- .../encoder/segment/UsCoV1CoreSegment.java | 9 +- .../gpp/encoder/segment/UsCoV1GpcSegment.java | 9 +- .../encoder/segment/UsCtV1CoreSegment.java | 9 +- .../gpp/encoder/segment/UsCtV1GpcSegment.java | 9 +- .../encoder/segment/UsNatV1CoreSegment.java | 9 +- .../encoder/segment/UsNatV1GpcSegment.java | 9 +- .../encoder/segment/UsUtV1CoreSegment.java | 9 +- .../encoder/segment/UsVaV1CoreSegment.java | 9 +- .../gpp/encoder/segment/UspV1CoreSegment.java | 12 +- .../com/iab/gpp/encoder/GppModelTest.java | 73 +++++++----- .../datatype/EncodableBooleanTest.java | 4 +- .../datatype/EncodableDatetimeTest.java | 4 +- .../EncodableFibonacciIntegerRangeTest.java | 2 +- .../EncodableFibonacciIntegerTest.java | 2 +- .../datatype/EncodableFixedBitfieldTest.java | 4 +- .../EncodableFixedIntegerListTest.java | 4 +- .../EncodableFixedIntegerRangeTest.java | 9 +- .../datatype/EncodableFixedIntegerTest.java | 4 +- .../datatype/EncodableFixedStringTest.java | 4 +- .../EncodableOptimizedFixedRangeTest.java | 4 +- .../gpp/encoder/section/.UsNatV1Test.java.swp | Bin 0 -> 16384 bytes .../iab/gpp/encoder/section/HeaderV1Test.java | 8 ++ .../iab/gpp/encoder/section/TcfCaV1Test.java | 77 +++++++++++- .../iab/gpp/encoder/section/TcfEuV2Test.java | 59 ++++++++++ .../iab/gpp/encoder/section/UsCaV1Test.java | 8 ++ .../iab/gpp/encoder/section/UsCoV1Test.java | 8 ++ .../iab/gpp/encoder/section/UsCtV1Test.java | 7 ++ .../iab/gpp/encoder/section/UsNatV1Test.java | 7 ++ .../iab/gpp/encoder/section/UsUtV1Test.java | 7 ++ .../iab/gpp/encoder/section/UsVaV1Test.java | 7 ++ 68 files changed, 1347 insertions(+), 315 deletions(-) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableArrayOfFixedIntegerRanges.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/RangeEntry.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/SubstringException.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/ArrayOfRangesEntryEncoder.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/OptimizedFibonacciRangeEncoder.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/OptimizedFixedRangeEncoder.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1DisclosedVendorsSegment.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/.UsNatV1Test.java.swp diff --git a/README.md b/README.md index 2bc63711..98496f3d 100644 --- a/README.md +++ b/README.md @@ -161,12 +161,15 @@ CmpList cmpList = loader.cmpList(cmpListContent); |tcfcav1|5|PurposesImpliedConsent|Boolean list of size 24| |tcfcav1|5|VendorExpressConsent|Integer list of variable size| |tcfcav1|5|VendorImpliedConsent|Integer list of variable size| +|tcfcav1|5|PubRestrictions|RangeEntry list of variable size| |tcfcav1|5|PubPurposesSegmentType|3 bit int. Value is 3| |tcfcav1|5|PubPurposesExpressConsent|Boolean list of size 24| |tcfcav1|5|PubPurposesImpliedConsent|Boolean list of size 24| |tcfcav1|5|NumCustomPurposes|6 bit int| |tcfcav1|5|CustomPurposesExpressConsent|Boolean list where size is set by the NumCustomPurposes field| |tcfcav1|5|CustomPurposesImpliedConsent|Boolean list where size is set by the NumCustomPurposes field| +|tcfcav1|5|DisclosedVendorsSegmentType|3 bit int. Value is 1| +|tcfcav1|5|DisclosedVendors|Integer list of variable size| |uspv1|6|Version|6 bit int. Value is 1| |uspv1|6|Notice|2 bit int| |uspv1|6|OptOutSale|2 bit int| diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index 90c46d10..f4a8bf94 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -1,12 +1,15 @@ package com.iab.gpp.encoder; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.field.HeaderV1Field; import com.iab.gpp.encoder.section.EncodableSection; import com.iab.gpp.encoder.section.HeaderV1; import com.iab.gpp.encoder.section.Sections; @@ -276,48 +279,64 @@ protected String encodeModel(Map sections) { } protected Map decodeModel(String str) { - Map sections = new HashMap<>(); - - if(str != null && !str.isEmpty()) { - String[] encodedSections = str.split("~"); - HeaderV1 header = new HeaderV1(encodedSections[0]); - sections.put(HeaderV1.NAME, header); - - @SuppressWarnings("unchecked") - List sectionIds = (List) header.getFieldValue("SectionIds"); - for (int i = 0; i < sectionIds.size(); i++) { - if (sectionIds.get(i).equals(TcfEuV2.ID)) { - TcfEuV2 section = new TcfEuV2(encodedSections[i + 1]); - sections.put(TcfEuV2.NAME, section); - } else if (sectionIds.get(i).equals(TcfCaV1.ID)) { - TcfCaV1 section = new TcfCaV1(encodedSections[i + 1]); - sections.put(TcfCaV1.NAME, section); - } else if (sectionIds.get(i).equals(UspV1.ID)) { - UspV1 section = new UspV1(encodedSections[i + 1]); - sections.put(UspV1.NAME, section); - } else if (sectionIds.get(i).equals(UsCaV1.ID)) { - UsCaV1 section = new UsCaV1(encodedSections[i + 1]); - sections.put(UsCaV1.NAME, section); - } else if (sectionIds.get(i).equals(UsNatV1.ID)) { - UsNatV1 section = new UsNatV1(encodedSections[i + 1]); - sections.put(UsNatV1.NAME, section); - } else if (sectionIds.get(i).equals(UsVaV1.ID)) { - UsVaV1 section = new UsVaV1(encodedSections[i + 1]); - sections.put(UsVaV1.NAME, section); - } else if (sectionIds.get(i).equals(UsCoV1.ID)) { - UsCoV1 section = new UsCoV1(encodedSections[i + 1]); - sections.put(UsCoV1.NAME, section); - } else if (sectionIds.get(i).equals(UsUtV1.ID)) { - UsUtV1 section = new UsUtV1(encodedSections[i + 1]); - sections.put(UsUtV1.NAME, section); - } else if (sectionIds.get(i).equals(UsCtV1.ID)) { - UsCtV1 section = new UsCtV1(encodedSections[i + 1]); - sections.put(UsCtV1.NAME, section); + if(str == null || str.isEmpty() || str.startsWith("D")) { + Map sections = new HashMap<>(); + + if(str != null && !str.isEmpty()) { + String[] encodedSections = str.split("~"); + HeaderV1 header = new HeaderV1(encodedSections[0]); + sections.put(HeaderV1.NAME, header); + + @SuppressWarnings("unchecked") + List sectionIds = (List) header.getFieldValue("SectionIds"); + for (int i = 0; i < sectionIds.size(); i++) { + if (sectionIds.get(i).equals(TcfEuV2.ID)) { + TcfEuV2 section = new TcfEuV2(encodedSections[i + 1]); + sections.put(TcfEuV2.NAME, section); + } else if (sectionIds.get(i).equals(TcfCaV1.ID)) { + TcfCaV1 section = new TcfCaV1(encodedSections[i + 1]); + sections.put(TcfCaV1.NAME, section); + } else if (sectionIds.get(i).equals(UspV1.ID)) { + UspV1 section = new UspV1(encodedSections[i + 1]); + sections.put(UspV1.NAME, section); + } else if (sectionIds.get(i).equals(UsCaV1.ID)) { + UsCaV1 section = new UsCaV1(encodedSections[i + 1]); + sections.put(UsCaV1.NAME, section); + } else if (sectionIds.get(i).equals(UsNatV1.ID)) { + UsNatV1 section = new UsNatV1(encodedSections[i + 1]); + sections.put(UsNatV1.NAME, section); + } else if (sectionIds.get(i).equals(UsVaV1.ID)) { + UsVaV1 section = new UsVaV1(encodedSections[i + 1]); + sections.put(UsVaV1.NAME, section); + } else if (sectionIds.get(i).equals(UsCoV1.ID)) { + UsCoV1 section = new UsCoV1(encodedSections[i + 1]); + sections.put(UsCoV1.NAME, section); + } else if (sectionIds.get(i).equals(UsUtV1.ID)) { + UsUtV1 section = new UsUtV1(encodedSections[i + 1]); + sections.put(UsUtV1.NAME, section); + } else if (sectionIds.get(i).equals(UsCtV1.ID)) { + UsCtV1 section = new UsCtV1(encodedSections[i + 1]); + sections.put(UsCtV1.NAME, section); + } } } + + return sections; + } else if(str.startsWith("C")) { + // old tcfeu only string + Map sections = new HashMap<>(); + + TcfEuV2 section = new TcfEuV2(str); + sections.put(TcfEuV2.NAME, section); + + HeaderV1 header = new HeaderV1(); + header.setFieldValue(HeaderV1Field.SECTION_IDS, Arrays.asList(2)); + sections.put(HeaderV1.NAME, section); + + return sections; + } else { + throw new DecodingException("Unable to decode '" + str + "'"); } - - return sections; } public String encodeSection(int sectionId) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/bitstring/BitStringEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/bitstring/BitStringEncoder.java index 20ef6fdd..12bcb182 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/bitstring/BitStringEncoder.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/bitstring/BitStringEncoder.java @@ -2,6 +2,7 @@ import java.util.List; import com.iab.gpp.encoder.datatype.AbstractEncodableBitStringDataType; +import com.iab.gpp.encoder.datatype.SubstringException; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.EncodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; @@ -39,9 +40,19 @@ public void decode(String bitString, List fieldNames, EncodableBitString String fieldName = fieldNames.get(i); if (fields.containsKey(fieldName)) { AbstractEncodableBitStringDataType field = fields.get(fieldName); - String substring = field.substring(bitString, index); - field.decode(substring); - index += substring.length(); + try { + String substring = field.substring(bitString, index); + field.decode(substring); + index += substring.length(); + } catch (SubstringException e) { + if(field.getHardFailIfMissing()) { + throw new DecodingException("Unable to decode " + fieldName, e); + } else { + return; + } + } catch (Exception e) { + throw new DecodingException("Unable to decode " + fieldName, e); + } } else { throw new DecodingException("Field not found: '" + fieldName + "'"); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java index 827cf102..07d9588c 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/AbstractEncodableBitStringDataType.java @@ -6,11 +6,13 @@ import com.iab.gpp.encoder.error.ValidationException; public abstract class AbstractEncodableBitStringDataType implements EncodableDataType { - protected Predicate validator; + //this if for backwards compatibility with the newer fields + protected boolean hardFailIfMissing = true; + protected Predicate validator = null; protected T value; - protected AbstractEncodableBitStringDataType() { - + protected AbstractEncodableBitStringDataType(boolean hardFailIfMissing) { + this.hardFailIfMissing = hardFailIfMissing; } public AbstractEncodableBitStringDataType withValidator(Predicate validator) { @@ -42,5 +44,14 @@ public void setValue(Object value) { } - public abstract String substring(String str, int fromIndex); + public boolean getHardFailIfMissing() { + return this.hardFailIfMissing; + } + + public abstract String encode(); + + public abstract void decode(String bitString); + + public abstract String substring(String bitString, int fromIndex) throws SubstringException; + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableArrayOfFixedIntegerRanges.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableArrayOfFixedIntegerRanges.java new file mode 100644 index 00000000..699e0d26 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableArrayOfFixedIntegerRanges.java @@ -0,0 +1,110 @@ +package com.iab.gpp.encoder.datatype; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; +import com.iab.gpp.encoder.datatype.encoder.FixedIntegerRangeEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; + +public class EncodableArrayOfFixedIntegerRanges extends AbstractEncodableBitStringDataType> { + + private int keyBitStringLength; + private int typeBitStringLength; + + protected EncodableArrayOfFixedIntegerRanges(int keyBitStringLength, int typeBitStringLength) { + super(true); + this.keyBitStringLength = keyBitStringLength; + this.typeBitStringLength = typeBitStringLength; + } + + public EncodableArrayOfFixedIntegerRanges(int keyBitStringLength, int typeBitStringLength, List value) { + super(true); + this.keyBitStringLength = keyBitStringLength; + this.typeBitStringLength = typeBitStringLength; + setValue(value); + } + + public EncodableArrayOfFixedIntegerRanges(int keyBitStringLength, int typeBitStringLength, List value, boolean hardFailIfMissing) { + super(hardFailIfMissing); + this.keyBitStringLength = keyBitStringLength; + this.typeBitStringLength = typeBitStringLength; + setValue(value); + } + + @Override + public String encode() { + try { + List entries = this.value; + + StringBuilder sb = new StringBuilder(); + sb.append(FixedIntegerEncoder.encode(entries.size(), 12)); + for (RangeEntry entry : entries) { + sb.append(FixedIntegerEncoder.encode(entry.getKey(), keyBitStringLength)) + .append(FixedIntegerEncoder.encode(entry.getType(), typeBitStringLength)) + .append(FixedIntegerRangeEncoder.encode(entry.getIds())); + } + + return sb.toString(); + } catch (Exception e) { + throw new EncodingException(e); + } + } + + @Override + public void decode(String bitString) { + try { + List entries = new ArrayList<>(); + + int size = FixedIntegerEncoder.decode(bitString.substring(0, 12)); + int index = 12; + for (int i = 0; i < size; i++) { + int key = FixedIntegerEncoder.decode(bitString.substring(index, index + keyBitStringLength)); + index += keyBitStringLength; + + int type = FixedIntegerEncoder.decode(bitString.substring(index, index + typeBitStringLength)); + index += typeBitStringLength; + + String substring = new EncodableFixedIntegerRange().substring(bitString, index); + List ids = FixedIntegerRangeEncoder.decode(substring); + index += substring.length(); + + entries.add(new RangeEntry(key, type, ids)); + } + + this.value = entries; + } catch (Exception e) { + throw new DecodingException(e); + } + } + + @Override + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + StringBuilder sb = new StringBuilder(); + sb.append(bitString.substring(fromIndex, fromIndex + 12)); + + int size = FixedIntegerEncoder.decode(sb.toString()); + + int index = fromIndex + sb.length(); + for (int i = 0; i < size; i++) { + String keySubstring = bitString.substring(index, index + keyBitStringLength); + index += keySubstring.length(); + sb.append(keySubstring); + + String typeSubstring = bitString.substring(index, index + typeBitStringLength); + index += typeSubstring.length(); + sb.append(typeSubstring); + + String rangeSubstring = new EncodableFixedIntegerRange().substring(bitString, index); + index += rangeSubstring.length(); + sb.append(rangeSubstring); + } + + return sb.toString(); + } catch (Exception e) { + throw new SubstringException(e); + } + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java index 54211270..340be3ab 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableBoolean.java @@ -1,27 +1,46 @@ package com.iab.gpp.encoder.datatype; import com.iab.gpp.encoder.datatype.encoder.BooleanEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableBoolean extends AbstractEncodableBitStringDataType { protected EncodableBoolean() { - super(); + super(true); } public EncodableBoolean(Boolean value) { - super(); + super(true); + setValue(value); + } + + public EncodableBoolean(Boolean value, boolean hardFailIfMissing) { + super(hardFailIfMissing); setValue(value); } public String encode() { - return BooleanEncoder.encode(this.value); + try { + return BooleanEncoder.encode(this.value); + } catch (Exception e) { + throw new EncodingException(e); + } } public void decode(String bitString) { - this.value = BooleanEncoder.decode(bitString); + try { + this.value = BooleanEncoder.decode(bitString); + } catch (Exception e) { + throw new DecodingException(e); + } } - public String substring(String bitString, int fromIndex) { - return bitString.substring(fromIndex, fromIndex + 1); + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + return bitString.substring(fromIndex, fromIndex + 1); + } catch (Exception e) { + throw new SubstringException(e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java index 44530bb2..a96c46f4 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableDatetime.java @@ -2,27 +2,46 @@ import java.time.ZonedDateTime; import com.iab.gpp.encoder.datatype.encoder.DatetimeEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableDatetime extends AbstractEncodableBitStringDataType { protected EncodableDatetime() { - super(); + super(true); } public EncodableDatetime(ZonedDateTime value) { - super(); + super(true); + setValue(value); + } + + public EncodableDatetime(ZonedDateTime value, boolean hardFailIfMissing) { + super(hardFailIfMissing); setValue(value); } public String encode() { - return DatetimeEncoder.encode(this.value); + try { + return DatetimeEncoder.encode(this.value); + } catch (Exception e) { + throw new EncodingException(e); + } } public void decode(String bitString) { - this.value = DatetimeEncoder.decode(bitString); + try { + this.value = DatetimeEncoder.decode(bitString); + } catch (Exception e) { + throw new DecodingException(e); + } } - public String substring(String bitString, int fromIndex) { - return bitString.substring(fromIndex, fromIndex + 36); + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + return bitString.substring(fromIndex, fromIndex + 36); + } catch (Exception e) { + throw new SubstringException(e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java index dc413368..3da64a15 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciInteger.java @@ -1,32 +1,51 @@ package com.iab.gpp.encoder.datatype; import com.iab.gpp.encoder.datatype.encoder.FibonacciIntegerEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableFibonacciInteger extends AbstractEncodableBitStringDataType { protected EncodableFibonacciInteger() { - super(); + super(true); } public EncodableFibonacciInteger(Integer value) { - super(); + super(true); + setValue(value); + } + + public EncodableFibonacciInteger(Integer value, boolean hardFailIfMissing) { + super(hardFailIfMissing); setValue(value); } public String encode() { - return FibonacciIntegerEncoder.encode(this.value); + try { + return FibonacciIntegerEncoder.encode(this.value); + } catch (Exception e) { + throw new EncodingException(e); + } } public void decode(String bitString) { - this.value = FibonacciIntegerEncoder.decode(bitString); + try { + this.value = FibonacciIntegerEncoder.decode(bitString); + } catch (Exception e) { + throw new DecodingException(e); + } } - public String substring(String bitString, int fromIndex) { - int index = bitString.indexOf("11", fromIndex); - if (index > 0) { - return bitString.substring(fromIndex, index + 2); - } else { - return bitString; + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + int index = bitString.indexOf("11", fromIndex); + if (index > 0) { + return bitString.substring(fromIndex, index + 2); + } else { + return bitString; + } + } catch (Exception e) { + throw new SubstringException(e); } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java index cb65ff66..53ab2eb2 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRange.java @@ -6,37 +6,55 @@ import com.iab.gpp.encoder.datatype.encoder.FibonacciIntegerRangeEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableFibonacciIntegerRange extends AbstractEncodableBitStringDataType> { protected EncodableFibonacciIntegerRange() { - super(); + super(true); } public EncodableFibonacciIntegerRange(List value) { - super(); + super(true); setValue(value); } + public EncodableFibonacciIntegerRange(List value, boolean hardFailIfMissing) { + super(hardFailIfMissing); + setValue(value); + } + public String encode() { - return FibonacciIntegerRangeEncoder.encode(this.value); + try { + return FibonacciIntegerRangeEncoder.encode(this.value); + } catch (Exception e) { + throw new EncodingException(e); + } } public void decode(String bitString) { - this.value = FibonacciIntegerRangeEncoder.decode(bitString); + try { + this.value = FibonacciIntegerRangeEncoder.decode(bitString); + } catch (Exception e) { + throw new DecodingException(e); + } } - public String substring(String bitString, int fromIndex) throws DecodingException { - int count = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 12)); - int index = fromIndex + 12; - for (int i = 0; i < count; i++) { - if (bitString.charAt(index) == '1') { - index = bitString.indexOf("11", bitString.indexOf("11", index + 1) + 2) + 2; - } else { - index = bitString.indexOf("11", index + 1) + 2; + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + int count = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 12)); + int index = fromIndex + 12; + for (int i = 0; i < count; i++) { + if (bitString.charAt(index) == '1') { + index = bitString.indexOf("11", bitString.indexOf("11", index + 1) + 2) + 2; + } else { + index = bitString.indexOf("11", index + 1) + 2; + } } + return bitString.substring(fromIndex, index); + } catch (Exception e) { + throw new SubstringException(e); } - return bitString.substring(fromIndex, index); } @SuppressWarnings("unchecked") diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java index e723cf79..5e6890d9 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfield.java @@ -3,32 +3,57 @@ import java.util.ArrayList; import java.util.List; import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableFixedBitfield extends AbstractEncodableBitStringDataType> { private int numElements; protected EncodableFixedBitfield(int numElements) { - super(); + super(true); + this.numElements = numElements; + } + + protected EncodableFixedBitfield(int numElements, boolean hardFailIfMissing) { + super(hardFailIfMissing); this.numElements = numElements; } public EncodableFixedBitfield(List value) { - super(); + super(true); + this.numElements = value.size(); + setValue(value); + } + + public EncodableFixedBitfield(List value, boolean hardFailIfMissing) { + super(hardFailIfMissing); this.numElements = value.size(); setValue(value); } public String encode() { - return FixedBitfieldEncoder.encode(this.value, this.numElements); + try { + return FixedBitfieldEncoder.encode(this.value, this.numElements); + } catch (Exception e) { + throw new EncodingException(e); + } } public void decode(String bitString) { - this.value = FixedBitfieldEncoder.decode(bitString); + try { + this.value = FixedBitfieldEncoder.decode(bitString); + } catch (Exception e) { + throw new DecodingException(e); + } } - public String substring(String bitString, int fromIndex) { - return bitString.substring(fromIndex, fromIndex + this.numElements); + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + return bitString.substring(fromIndex, fromIndex + this.numElements); + } catch (Exception e) { + throw new SubstringException(e); + } } @SuppressWarnings("unchecked") diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java index 0351dc90..9fd25fb0 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedInteger.java @@ -1,31 +1,51 @@ package com.iab.gpp.encoder.datatype; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableFixedInteger extends AbstractEncodableBitStringDataType { private int bitStringLength; protected EncodableFixedInteger(int bitStringLength) { - super(); + super(true); this.bitStringLength = bitStringLength; } public EncodableFixedInteger(int bitStringLength, Integer value) { - super(); + super(true); + this.bitStringLength = bitStringLength; + setValue(value); + } + + public EncodableFixedInteger(int bitStringLength, Integer value, boolean hardFailIfMissing) { + super(hardFailIfMissing); this.bitStringLength = bitStringLength; setValue(value); } public String encode() { - return FixedIntegerEncoder.encode(this.value, this.bitStringLength); + try { + return FixedIntegerEncoder.encode(this.value, this.bitStringLength); + } catch (Exception e) { + throw new EncodingException(e); + } } public void decode(String bitString) { - this.value = FixedIntegerEncoder.decode(bitString); + try { + this.value = FixedIntegerEncoder.decode(bitString); + } catch (Exception e) { + throw new DecodingException(e); + } } - public String substring(String bitString, int fromIndex) { - return bitString.substring(fromIndex, fromIndex + this.bitStringLength); + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + return bitString.substring(fromIndex, fromIndex + this.bitStringLength); + } catch (Exception e) { + throw new SubstringException(e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java index 04ee34bc..f491e5ee 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerList.java @@ -3,6 +3,8 @@ import java.util.ArrayList; import java.util.List; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerListEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableFixedIntegerList extends AbstractEncodableBitStringDataType> { @@ -10,28 +12,47 @@ public class EncodableFixedIntegerList extends AbstractEncodableBitStringDataTyp private int numElements; protected EncodableFixedIntegerList(int elementBitStringLength, int numElements) { - super(); + super(true); this.elementBitStringLength = elementBitStringLength; this.numElements = numElements; } public EncodableFixedIntegerList(int elementBitStringLength, List value) { - super(); + super(true); + this.elementBitStringLength = elementBitStringLength; + this.numElements = value.size(); + setValue(value); + } + + public EncodableFixedIntegerList(int elementBitStringLength, List value, boolean hardFailIfMissing) { + super(hardFailIfMissing); this.elementBitStringLength = elementBitStringLength; this.numElements = value.size(); setValue(value); } public String encode() { - return FixedIntegerListEncoder.encode(this.value, this.elementBitStringLength, this.numElements); + try { + return FixedIntegerListEncoder.encode(this.value, this.elementBitStringLength, this.numElements); + } catch (Exception e) { + throw new EncodingException(e); + } } public void decode(String bitString) { - this.value = FixedIntegerListEncoder.decode(bitString, this.elementBitStringLength, this.numElements); + try { + this.value = FixedIntegerListEncoder.decode(bitString, this.elementBitStringLength, this.numElements); + } catch (Exception e) { + throw new DecodingException(e); + } } - public String substring(String bitString, int fromIndex) { - return bitString.substring(fromIndex, fromIndex + (this.elementBitStringLength * numElements)); + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + return bitString.substring(fromIndex, fromIndex + (this.elementBitStringLength * numElements)); + } catch (Exception e) { + throw new SubstringException(e); + } } @SuppressWarnings("unchecked") diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java index fbfe8898..7fdbd5a8 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRange.java @@ -5,37 +5,56 @@ import java.util.TreeSet; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerRangeEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableFixedIntegerRange extends AbstractEncodableBitStringDataType> { protected EncodableFixedIntegerRange() { - super(); + super(true); } public EncodableFixedIntegerRange(List value) { - super(); + super(true); + setValue(value); + } + + public EncodableFixedIntegerRange(List value, boolean hardFailIfMissing) { + super(hardFailIfMissing); setValue(value); } public String encode() { - return FixedIntegerRangeEncoder.encode(this.value); + try { + return FixedIntegerRangeEncoder.encode(this.value); + } catch (Exception e) { + throw new EncodingException(e); + } } public void decode(String bitString) { - this.value = FixedIntegerRangeEncoder.decode(bitString); + try { + this.value = FixedIntegerRangeEncoder.decode(bitString); + } catch (Exception e) { + throw new DecodingException(e); + } } - public String substring(String bitString, int fromIndex) { - int count = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 12)); - int index = fromIndex + 12; - for (int i = 0; i < count; i++) { - if (bitString.charAt(index) == '1') { - index += 33; - } else { - index += 17; + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + int count = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 12)); + int index = fromIndex + 12; + for (int i = 0; i < count; i++) { + if (bitString.charAt(index) == '1') { + index += 33; + } else { + index += 17; + } } + return bitString.substring(fromIndex, index); + } catch (Exception e) { + throw new SubstringException(e); } - return bitString.substring(fromIndex, index); } @SuppressWarnings("unchecked") diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java index 89e58ec2..4cea9b48 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFixedString.java @@ -1,31 +1,51 @@ package com.iab.gpp.encoder.datatype; import com.iab.gpp.encoder.datatype.encoder.FixedStringEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableFixedString extends AbstractEncodableBitStringDataType { private int stringLength; protected EncodableFixedString(int stringLength) { - super(); + super(true); this.stringLength = stringLength; } public EncodableFixedString(int stringLength, String value) { - super(); + super(true); + this.stringLength = stringLength; + setValue(value); + } + + public EncodableFixedString(int stringLength, String value, boolean hardFailIfMissing) { + super(hardFailIfMissing); this.stringLength = stringLength; setValue(value); } public String encode() { - return FixedStringEncoder.encode(this.value, this.stringLength); + try { + return FixedStringEncoder.encode(this.value, this.stringLength); + } catch (Exception e) { + throw new EncodingException(e); + } } public void decode(String bitString) { - this.value = FixedStringEncoder.decode(bitString); + try { + this.value = FixedStringEncoder.decode(bitString); + } catch (Exception e) { + throw new DecodingException(e); + } } - public String substring(String bitString, int fromIndex) { - return bitString.substring(fromIndex, fromIndex + this.stringLength * 6); + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + return bitString.substring(fromIndex, fromIndex + this.stringLength * 6); + } catch (Exception e) { + throw new SubstringException(e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java index ec1ee316..cb1a0991 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableFlexibleBitfield.java @@ -4,32 +4,52 @@ import java.util.List; import java.util.function.IntSupplier; import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableFlexibleBitfield extends AbstractEncodableBitStringDataType> { private IntSupplier getLengthSupplier; protected EncodableFlexibleBitfield(IntSupplier getLengthSupplier) { - super(); + super(true); this.getLengthSupplier = getLengthSupplier; } public EncodableFlexibleBitfield(IntSupplier getLengthSupplier, List value) { - super(); + super(true); + this.getLengthSupplier = getLengthSupplier; + this.setValue(value); + } + + public EncodableFlexibleBitfield(IntSupplier getLengthSupplier, List value, boolean hardFailIfMissing) { + super(hardFailIfMissing); this.getLengthSupplier = getLengthSupplier; this.setValue(value); } public String encode() { - return FixedBitfieldEncoder.encode(this.value, this.getLengthSupplier.getAsInt()); + try { + return FixedBitfieldEncoder.encode(this.value, this.getLengthSupplier.getAsInt()); + } catch (Exception e) { + throw new EncodingException(e); + } } public void decode(String bitString) { - this.value = FixedBitfieldEncoder.decode(bitString); + try { + this.value = FixedBitfieldEncoder.decode(bitString); + } catch (Exception e) { + throw new DecodingException(e); + } } - public String substring(String bitString, int fromIndex) { - return bitString.substring(fromIndex, fromIndex + this.getLengthSupplier.getAsInt()); + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + return bitString.substring(fromIndex, fromIndex + this.getLengthSupplier.getAsInt()); + } catch (Exception e) { + throw new SubstringException(e); + } } @SuppressWarnings("unchecked") diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java index 891ff673..2e49855f 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFibonacciRange.java @@ -3,69 +3,54 @@ import java.util.ArrayList; import java.util.List; import java.util.TreeSet; -import com.iab.gpp.encoder.datatype.encoder.FibonacciIntegerRangeEncoder; -import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; +import com.iab.gpp.encoder.datatype.encoder.OptimizedFibonacciRangeEncoder; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableOptimizedFibonacciRange extends AbstractEncodableBitStringDataType> { protected EncodableOptimizedFibonacciRange() { - super(); + super(true); } public EncodableOptimizedFibonacciRange(List value) { - super(); + super(true); setValue(value); } - public String encode() { - // TODO: encoding the range before choosing the shortest is inefficient. There is probably a way - // to identify in advance which will be shorter based on the array length and values - int max = this.value.size() > 0 ? this.value.get(this.value.size() - 1) : 0; - String rangeBitString = FibonacciIntegerRangeEncoder.encode(this.value); - int rangeLength = rangeBitString.length(); - int bitFieldLength = max; + public EncodableOptimizedFibonacciRange(List value, boolean hardFailIfMissing) { + super(hardFailIfMissing); + setValue(value); + } - if (rangeLength <= bitFieldLength) { - return FixedIntegerEncoder.encode(max, 16) + "1" + rangeBitString; - } else { - List bits = new ArrayList<>(); - int index = 0; - for (int i = 0; i < max; i++) { - if (i == this.value.get(index) - 1) { - bits.add(true); - index++; - } else { - bits.add(false); - } - } - return FixedIntegerEncoder.encode(max, 16) + "0" + FixedBitfieldEncoder.encode(bits, bitFieldLength); + public String encode() { + try { + return OptimizedFibonacciRangeEncoder.encode(this.value); + } catch (Exception e) { + throw new EncodingException(e); } } public void decode(String bitString) { - if (bitString.charAt(16) == '1') { - this.value = FibonacciIntegerRangeEncoder.decode(bitString.substring(17)); - } else { - List value = new ArrayList<>(); - List bits = FixedBitfieldEncoder.decode(bitString.substring(17)); - for (int i = 0; i < bits.size(); i++) { - if (bits.get(i) == true) { - value.add(i + 1); - } - } - this.value = value; + try { + this.value = OptimizedFibonacciRangeEncoder.decode(bitString); + } catch (Exception e) { + throw new DecodingException(e); } } - public String substring(String bitString, int fromIndex) throws DecodingException { - int max = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 16)); - if (bitString.charAt(fromIndex + 16) == '1') { - return (bitString.substring(fromIndex, fromIndex + 17) - + new EncodableFibonacciIntegerRange().substring(bitString, fromIndex + 17)); - } else { - return bitString.substring(fromIndex, fromIndex + 17 + max); + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + int max = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 16)); + if (bitString.charAt(fromIndex + 16) == '1') { + return (bitString.substring(fromIndex, fromIndex + 17) + + new EncodableFibonacciIntegerRange().substring(bitString, fromIndex + 17)); + } else { + return bitString.substring(fromIndex, fromIndex + 17 + max); + } + } catch (Exception e) { + throw new SubstringException(e); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java index 9dbbf5ae..57f4b8e9 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRange.java @@ -3,69 +3,55 @@ import java.util.ArrayList; import java.util.List; import java.util.TreeSet; -import com.iab.gpp.encoder.datatype.encoder.FixedBitfieldEncoder; import com.iab.gpp.encoder.datatype.encoder.FixedIntegerEncoder; -import com.iab.gpp.encoder.datatype.encoder.FixedIntegerRangeEncoder; +import com.iab.gpp.encoder.datatype.encoder.OptimizedFixedRangeEncoder; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; + public class EncodableOptimizedFixedRange extends AbstractEncodableBitStringDataType> { protected EncodableOptimizedFixedRange() { - super(); + super(true); } public EncodableOptimizedFixedRange(List value) { - super(); + super(true); setValue(value); } - public String encode() { - // TODO: encoding the range before choosing the shortest is inefficient. There is probably a way - // to identify in advance which will be shorter based on the array length and values - int max = this.value.size() > 0 ? this.value.get(this.value.size() - 1) : 0; - String rangeBitString = FixedIntegerRangeEncoder.encode(this.value); - int rangeLength = rangeBitString.length(); - int bitFieldLength = max; - - if (rangeLength <= bitFieldLength) { - return FixedIntegerEncoder.encode(max, 16) + "1" + rangeBitString; - } else { - List bits = new ArrayList<>(); - int index = 0; - for (int i = 0; i < max; i++) { - if (i == this.value.get(index) - 1) { - bits.add(true); - index++; - } else { - bits.add(false); - } - } + public EncodableOptimizedFixedRange(List value, boolean hardFailIfMissing) { + super(hardFailIfMissing); + setValue(value); + } - return FixedIntegerEncoder.encode(max, 16) + "0" + FixedBitfieldEncoder.encode(bits, bitFieldLength); + public String encode() { + try { + return OptimizedFixedRangeEncoder.encode(this.value); + } catch (Exception e) { + throw new EncodingException(e); } } public void decode(String bitString) { - if (bitString.charAt(16) == '1') { - this.value = FixedIntegerRangeEncoder.decode(bitString.substring(17)); - } else { - List value = new ArrayList<>(); - List bits = FixedBitfieldEncoder.decode(bitString.substring(17)); - for (int i = 0; i < bits.size(); i++) { - if (bits.get(i) == true) { - value.add(i + 1); - } - } - this.value = value; + try { + this.value = OptimizedFixedRangeEncoder.decode(bitString); + } catch (Exception e) { + throw new DecodingException(e); } } - public String substring(String bitString, int fromIndex) { - int max = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 16)); - if (bitString.charAt(fromIndex + 16) == '1') { - return bitString.substring(fromIndex, fromIndex + 17) - + new EncodableFixedIntegerRange().substring(bitString, fromIndex + 17); - } else { - return bitString.substring(fromIndex, fromIndex + 17 + max); + public String substring(String bitString, int fromIndex) throws SubstringException { + try { + int max = FixedIntegerEncoder.decode(bitString.substring(fromIndex, fromIndex + 16)); + if (bitString.charAt(fromIndex + 16) == '1') { + return bitString.substring(fromIndex, fromIndex + 17) + + new EncodableFixedIntegerRange().substring(bitString, fromIndex + 17); + } else { + return bitString.substring(fromIndex, fromIndex + 17 + max); + } + } catch (Exception e) { + throw new SubstringException(e); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/RangeEntry.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/RangeEntry.java new file mode 100644 index 00000000..0237ed18 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/RangeEntry.java @@ -0,0 +1,42 @@ +package com.iab.gpp.encoder.datatype; + +import java.util.List; + +public class RangeEntry { + + private int key; + private int type; + private List ids; + + public RangeEntry(int key, int type, List ids) { + super(); + this.key = key; + this.type = type; + this.ids = ids; + } + + public int getKey() { + return key; + } + + public void setKey(int key) { + this.key = key; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/SubstringException.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/SubstringException.java new file mode 100644 index 00000000..e9df8ca6 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/SubstringException.java @@ -0,0 +1,18 @@ +package com.iab.gpp.encoder.datatype; + +public class SubstringException extends Exception { + + private static final long serialVersionUID = 1825100490468259890L; + + public SubstringException(String msg) { + super(msg); + } + + public SubstringException(Exception e) { + super(e); + } + + public SubstringException(String msg, Exception e) { + super(msg, e); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/ArrayOfRangesEntryEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/ArrayOfRangesEntryEncoder.java new file mode 100644 index 00000000..de1449b3 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/ArrayOfRangesEntryEncoder.java @@ -0,0 +1,43 @@ +package com.iab.gpp.encoder.datatype.encoder; + +import java.util.regex.Pattern; +import com.iab.gpp.encoder.error.DecodingException; + +public class ArrayOfRangesEntryEncoder { + + private static Pattern BITSTRING_VERIFICATION_PATTERN = Pattern.compile("^[0-1]*$", Pattern.CASE_INSENSITIVE); + + public static String encode(long value, int bitStringLength) { + String bitString = ""; + while (value > 0) { + if ((value & 1) == 1) { + bitString = "1" + bitString; + } else { + bitString = "0" + bitString; + } + value = value >> 1; + } + + while (bitString.length() < bitStringLength) { + bitString = "0" + bitString; + } + + return bitString; + } + + public static long decode(String bitString) throws DecodingException { + if (!BITSTRING_VERIFICATION_PATTERN.matcher(bitString).matches()) { + throw new DecodingException("Undecodable FixedLong '" + bitString + "'"); + } + + long value = 0; + + for (int i = 0; i < bitString.length(); i++) { + if (bitString.charAt(bitString.length() - (i + 1)) == '1') { + value += 1L << i; + } + } + + return value; + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/OptimizedFibonacciRangeEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/OptimizedFibonacciRangeEncoder.java new file mode 100644 index 00000000..3492fbcc --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/OptimizedFibonacciRangeEncoder.java @@ -0,0 +1,56 @@ +package com.iab.gpp.encoder.datatype.encoder; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; + +public class OptimizedFibonacciRangeEncoder { + + private static Pattern BITSTRING_VERIFICATION_PATTERN = Pattern.compile("^[0-1]*$", Pattern.CASE_INSENSITIVE); + + public static String encode(List value) throws EncodingException { + // TODO: encoding the range before choosing the shortest is inefficient. There is probably a way + // to identify in advance which will be shorter based on the array length and values + int max = value.size() > 0 ? value.get(value.size() - 1) : 0; + String rangeBitString = FibonacciIntegerRangeEncoder.encode(value); + int rangeLength = rangeBitString.length(); + int bitFieldLength = max; + + if (rangeLength <= bitFieldLength) { + return FixedIntegerEncoder.encode(max, 16) + "1" + rangeBitString; + } else { + List bits = new ArrayList<>(); + int index = 0; + for (int i = 0; i < max; i++) { + if (i == value.get(index) - 1) { + bits.add(true); + index++; + } else { + bits.add(false); + } + } + return FixedIntegerEncoder.encode(max, 16) + "0" + FixedBitfieldEncoder.encode(bits, bitFieldLength); + } + } + + public static List decode(String bitString) throws DecodingException { + if (!BITSTRING_VERIFICATION_PATTERN.matcher(bitString).matches() || bitString.length() < 12) { + throw new DecodingException("Undecodable FibonacciIntegerRange '" + bitString + "'"); + } + + if (bitString.charAt(16) == '1') { + return FibonacciIntegerRangeEncoder.decode(bitString.substring(17)); + } else { + List value = new ArrayList<>(); + List bits = FixedBitfieldEncoder.decode(bitString.substring(17)); + for (int i = 0; i < bits.size(); i++) { + if (bits.get(i) == true) { + value.add(i + 1); + } + } + return value; + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/OptimizedFixedRangeEncoder.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/OptimizedFixedRangeEncoder.java new file mode 100644 index 00000000..73fb5e68 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/OptimizedFixedRangeEncoder.java @@ -0,0 +1,57 @@ +package com.iab.gpp.encoder.datatype.encoder; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; + +public class OptimizedFixedRangeEncoder { + + private static Pattern BITSTRING_VERIFICATION_PATTERN = Pattern.compile("^[0-1]*$", Pattern.CASE_INSENSITIVE); + + public static String encode(List value) throws EncodingException { + // TODO: encoding the range before choosing the shortest is inefficient. There is probably a way + // to identify in advance which will be shorter based on the array length and values + int max = value.size() > 0 ? value.get(value.size() - 1) : 0; + String rangeBitString = FixedIntegerRangeEncoder.encode(value); + int rangeLength = rangeBitString.length(); + int bitFieldLength = max; + + if (rangeLength <= bitFieldLength) { + return FixedIntegerEncoder.encode(max, 16) + "1" + rangeBitString; + } else { + List bits = new ArrayList<>(); + int index = 0; + for (int i = 0; i < max; i++) { + if (i == value.get(index) - 1) { + bits.add(true); + index++; + } else { + bits.add(false); + } + } + + return FixedIntegerEncoder.encode(max, 16) + "0" + FixedBitfieldEncoder.encode(bits, bitFieldLength); + } + } + + public static List decode(String bitString) throws DecodingException { + if (!BITSTRING_VERIFICATION_PATTERN.matcher(bitString).matches() || bitString.length() < 12) { + throw new DecodingException("Undecodable FixedIntegerRange '" + bitString + "'"); + } + + if (bitString.charAt(16) == '1') { + return FixedIntegerRangeEncoder.decode(bitString.substring(17)); + } else { + List value = new ArrayList<>(); + List bits = FixedBitfieldEncoder.decode(bitString.substring(17)); + for (int i = 0; i < bits.size(); i++) { + if (bits.get(i) == true) { + value.add(i + 1); + } + } + return value; + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV1Field.java index 4cacd6dc..c87e886d 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/TcfCaV1Field.java @@ -20,6 +20,7 @@ public class TcfCaV1Field { public static String PURPOSES_IMPLIED_CONSENT = "PurposesImpliedConsent"; public static String VENDOR_EXPRESS_CONSENT = "VendorExpressConsent"; public static String VENDOR_IMPLIED_CONSENT = "VendorImpliedConsent"; + public static String PUB_RESTRICTIONS = "PubRestrictions"; public static String PUB_PURPOSES_SEGMENT_TYPE = "PubPurposesSegmentType"; public static String PUB_PURPOSES_EXPRESS_CONSENT = "PubPurposesExpressConsent"; @@ -28,6 +29,9 @@ public class TcfCaV1Field { public static String CUSTOM_PURPOSES_EXPRESS_CONSENT = "CustomPurposesExpressConsent"; public static String CUSTOM_PURPOSES_IMPLIED_CONSENT = "CustomPurposesImpliedConsent"; + public static String DISCLOSED_VENDORS_SEGMENT_TYPE = "DisclosedVendorsSegmentType"; + public static String DISCLOSED_VENDORS = "DisclosedVendors"; + //@formatter:off public static List TCFCAV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { TcfCaV1Field.VERSION, @@ -44,7 +48,8 @@ public class TcfCaV1Field { TcfCaV1Field.PURPOSES_EXPRESS_CONSENT, TcfCaV1Field.PURPOSES_IMPLIED_CONSENT, TcfCaV1Field.VENDOR_EXPRESS_CONSENT, - TcfCaV1Field.VENDOR_IMPLIED_CONSENT + TcfCaV1Field.VENDOR_IMPLIED_CONSENT, + TcfCaV1Field.PUB_RESTRICTIONS }); //@formatter:on @@ -58,4 +63,11 @@ public class TcfCaV1Field { TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT, }); //@formatter:on + + //@formatter:off + public static List TCFCAV1_DISCLOSED_VENDORS_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + TcfCaV1Field.DISCLOSED_VENDORS_SEGMENT_TYPE, + TcfCaV1Field.DISCLOSED_VENDORS, + }); + //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java new file mode 100644 index 00000000..eb5d5459 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractEncodableSegmentedBitStringSection.java @@ -0,0 +1,110 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import com.iab.gpp.encoder.datatype.AbstractEncodableBitStringDataType; +import com.iab.gpp.encoder.datatype.SubstringException; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; + +public abstract class AbstractEncodableSegmentedBitStringSection implements EncodableSection { + protected Map> fields; + protected String[][] segments; + + @Override + public boolean hasField(String fieldName) { + return this.fields.containsKey(fieldName); + } + + @Override + public Object getFieldValue(String fieldName) { + if (this.fields.containsKey(fieldName)) { + return this.fields.get(fieldName).getValue(); + } else { + return null; + } + } + + @Override + public void setFieldValue(String fieldName, Object value) throws InvalidFieldException { + if (this.fields.containsKey(fieldName)) { + this.fields.get(fieldName).setValue(value); + } else { + throw new InvalidFieldException(fieldName + " not found"); + } + } + + public String[][] getSegments() { + return this.segments; + } + + public List encodeSegmentsToBitStrings() throws EncodingException { + List segmentBitStrings = new ArrayList<>(); + for (int i = 0; i < this.segments.length; i++) { + String segmentBitString = ""; + for (int j = 0; j < this.segments[i].length; j++) { + String fieldName = this.segments[i][j]; + if (this.fields.containsKey(fieldName)) { + try { + AbstractEncodableBitStringDataType field = this.fields.get(fieldName); + segmentBitString += field.encode(); + } catch (Exception e) { + throw new EncodingException("Unable to encode " + fieldName, e); + } + } else { + throw new EncodingException("Field not found: '" + fieldName + "'"); + } + } + segmentBitStrings.add(segmentBitString); + } + + return segmentBitStrings; + } + + public void decodeSegmentsFromBitStrings(List segmentBitStrings) throws DecodingException { + for (int i = 0; i < this.segments.length && i < segmentBitStrings.size(); i++) { + decodeSegmentFromBitString(segments[i], segmentBitStrings.get(i)); + } + } + + private void decodeSegmentFromBitString(String[] segment, String segmentBitString) throws DecodingException { + if (segmentBitString != null && segmentBitString.length() > 0) { + int index = 0; + for (int j = 0; j < segment.length; j++) { + String fieldName = segment[j]; + AbstractEncodableBitStringDataType field = this.fields.get(fieldName); + if (this.fields.containsKey(fieldName)) { + try { + String substring = field.substring(segmentBitString, index); + field.decode(substring); + index += substring.length(); + } catch (SubstringException e) { + if(field.getHardFailIfMissing()) { + throw new DecodingException("Unable to decode " + fieldName, e); + } else { + return; + } + } catch (Exception e) { + throw new DecodingException("Unable to decode " + fieldName, e); + } + } else { + throw new DecodingException("Field not found: '" + fieldName + "'"); + } + } + } + } + + @Override + public abstract String encode() throws EncodingException; + + @Override + public abstract void decode(String encodedString) throws DecodingException; + + @Override + public abstract int getId(); + + @Override + public abstract String getName(); +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java index 684aaee5..194a82dc 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfCaV1.java @@ -4,10 +4,13 @@ import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.List; +import com.iab.gpp.encoder.datatype.RangeEntry; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfCaV1Field; import com.iab.gpp.encoder.segment.EncodableSegment; import com.iab.gpp.encoder.segment.TcfCaV1CoreSegment; +import com.iab.gpp.encoder.segment.TcfCaV1DisclosedVendorsSegment; import com.iab.gpp.encoder.segment.TcfCaV1PublisherPurposesSegment; public class TcfCaV1 extends AbstractLazilyEncodableSection { @@ -45,6 +48,7 @@ protected List initializeSegments() { List segments = new ArrayList<>(); segments.add(new TcfCaV1CoreSegment()); segments.add(new TcfCaV1PublisherPurposesSegment()); + segments.add(new TcfCaV1DisclosedVendorsSegment()); return segments; } @@ -60,6 +64,7 @@ public List decodeSection(String encodedString) { * The first 3 bits contain the segment id. Rather than decode the entire string, just check the first character. * * A-H = '000' = 0 + * I-P = '001' = 1 * Y-Z,a-f = '011' = 3 * * Note that there is no segment id field for the core segment. Instead the first 6 bits are reserved @@ -72,8 +77,12 @@ public List decodeSection(String encodedString) { if(firstChar >= 'A' && firstChar <= 'H') { segments.get(0).decode(encodedSegments[i]); + } else if(firstChar >= 'I' && firstChar <= 'P') { + segments.get(2).decode(encodedSegments[i]); } else if((firstChar >= 'Y' && firstChar <= 'Z') || (firstChar >= 'a' && firstChar <= 'f')) { segments.get(1).decode(encodedSegments[i]); + } else { + throw new DecodingException("Invalid segment '" + encodedSegment + "'"); } } } @@ -85,9 +94,13 @@ public List decodeSection(String encodedString) { @Override public String encodeSection(List segments) { List encodedSegments = new ArrayList<>(); - for(EncodableSegment segment : segments) { - encodedSegments.add(segment.encode()); + + encodedSegments.add(segments.get(0).encode()); + encodedSegments.add(segments.get(1).encode()); + if(!this.getDisclosedVendors().isEmpty()) { + encodedSegments.add(segments.get(2).encode()); } + return String.join(".", encodedSegments); } @@ -165,6 +178,11 @@ public List getVendorImpliedConsent() { return (List) this.getFieldValue(TcfCaV1Field.VENDOR_IMPLIED_CONSENT); } + @SuppressWarnings("unchecked") + public List getPubRestrictions() { + return (List) this.getFieldValue(TcfCaV1Field.PUB_RESTRICTIONS); + } + public Integer getPubPurposesSegmentType() { return (Integer) this.getFieldValue(TcfCaV1Field.PUB_PURPOSES_SEGMENT_TYPE); } @@ -192,4 +210,14 @@ public List getCustomPurposesExpressConsent() { public List getCustomPurposesImpliedConsent() { return (List) this.getFieldValue(TcfCaV1Field.CUSTOM_PURPOSES_IMPLIED_CONSENT); } + + public Integer getDisclosedVendorsSegmentType() { + return (Integer) this.getFieldValue(TcfCaV1Field.DISCLOSED_VENDORS_SEGMENT_TYPE); + } + + @SuppressWarnings("unchecked") + public List getDisclosedVendors() { + return (List) this.getFieldValue(TcfCaV1Field.DISCLOSED_VENDORS); + } + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java index b9b643eb..1f7f2b1e 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/TcfEuV2.java @@ -4,6 +4,8 @@ import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.List; +import com.iab.gpp.encoder.datatype.RangeEntry; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfEuV2Field; import com.iab.gpp.encoder.segment.EncodableSegment; @@ -85,6 +87,8 @@ public List decodeSection(String encodedString) { segments.get(2).decode(encodedSegments[i]); } else if((firstChar >= 'Y' && firstChar <= 'Z') || (firstChar >= 'a' && firstChar <= 'f')) { segments.get(1).decode(encodedSegments[i]); + } else { + throw new DecodingException("Invalid segment '" + encodedSegment + "'"); } } } @@ -205,8 +209,8 @@ public List getVendorLegitimateInterests() { } @SuppressWarnings("unchecked") - public List getPublisherRestrictions() { - return (List) this.getFieldValue(TcfEuV2Field.PUBLISHER_RESTRICTIONS); + public List getPublisherRestrictions() { + return (List) this.getFieldValue(TcfEuV2Field.PUBLISHER_RESTRICTIONS); } public Integer getPublisherPurposesSegmentType() { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java index 7c505f73..8726e16d 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/AbstractLazilyEncodableSegment.java @@ -72,4 +72,5 @@ public void decode(String encodedString) { this.decoded = false; } + } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java index 6f533463..d2363a82 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/EncodableSegment.java @@ -17,5 +17,4 @@ public interface EncodableSegment { void decode(String encodedString); default void validate() {}; - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java index 1154d1f6..5f944d90 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/HeaderV1CoreSegment.java @@ -7,6 +7,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFibonacciIntegerRange; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.HeaderV1Field; import com.iab.gpp.encoder.section.HeaderV1; @@ -51,8 +52,12 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if(encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode HeaderV1CoreSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1CoreSegment.java index 069ec010..fbdc9479 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1CoreSegment.java @@ -7,12 +7,14 @@ import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableArrayOfFixedIntegerRanges; import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableDatetime; import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedString; import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.TcfCaV1Field; import com.iab.gpp.encoder.section.TcfCaV1; @@ -61,6 +63,7 @@ protected EncodableBitStringFields initializeFields() { false, false, false, false, false, false, false, false, false, false, false, false, false, false))); fields.put(TcfCaV1Field.VENDOR_EXPRESS_CONSENT, new EncodableOptimizedFixedRange(new ArrayList<>())); fields.put(TcfCaV1Field.VENDOR_IMPLIED_CONSENT, new EncodableOptimizedFixedRange(new ArrayList<>())); + fields.put(TcfCaV1Field.PUB_RESTRICTIONS, new EncodableArrayOfFixedIntegerRanges(6, 2, new ArrayList<>(), false)); return fields; } @@ -76,7 +79,11 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if(encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode TcfCaV1CoreSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1DisclosedVendorsSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1DisclosedVendorsSegment.java new file mode 100644 index 00000000..cbd7e90f --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1DisclosedVendorsSegment.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.segment; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.TcfCaV1Field; + +public class TcfCaV1DisclosedVendorsSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public TcfCaV1DisclosedVendorsSegment() { + super(); + } + + public TcfCaV1DisclosedVendorsSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return TcfCaV1Field.TCFCAV1_DISCLOSED_VENDORS_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(TcfCaV1Field.DISCLOSED_VENDORS_SEGMENT_TYPE, new EncodableFixedInteger(3, 1)); + fields.put(TcfCaV1Field.DISCLOSED_VENDORS, new EncodableOptimizedFixedRange(new ArrayList<>())); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if (encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode TcfCaV1DisclosedVendorsSegment '" + encodedString + "'", e); + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1PublisherPurposesSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1PublisherPurposesSegment.java index 89d63390..1ab89c0b 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1PublisherPurposesSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfCaV1PublisherPurposesSegment.java @@ -10,6 +10,7 @@ import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFlexibleBitfield; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.TcfCaV1Field; @@ -75,7 +76,11 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if(encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode TcfCaV1PublisherPurposesSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2CoreSegment.java index 5e894459..5b516bde 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2CoreSegment.java @@ -7,13 +7,14 @@ import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; import com.iab.gpp.encoder.base64.TraditionalBase64UrlEncoder; import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableArrayOfFixedIntegerRanges; import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableDatetime; import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; -import com.iab.gpp.encoder.datatype.EncodableFixedIntegerRange; import com.iab.gpp.encoder.datatype.EncodableFixedString; import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.TcfEuV2Field; import com.iab.gpp.encoder.section.TcfEuV2; @@ -66,7 +67,7 @@ protected EncodableBitStringFields initializeFields() { fields.put(TcfEuV2Field.VENDOR_CONSENTS, new EncodableOptimizedFixedRange(new ArrayList<>())); fields.put(TcfEuV2Field.VENDOR_LEGITIMATE_INTERESTS, new EncodableOptimizedFixedRange(new ArrayList<>())); - fields.put(TcfEuV2Field.PUBLISHER_RESTRICTIONS, new EncodableFixedIntegerRange(new ArrayList<>())); + fields.put(TcfEuV2Field.PUBLISHER_RESTRICTIONS, new EncodableArrayOfFixedIntegerRanges(6, 2, new ArrayList<>(), false)); return fields; } @@ -82,7 +83,11 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if(encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode TcfEuV2CoreSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2PublisherPurposesSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2PublisherPurposesSegment.java index 4d351f67..0b751017 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2PublisherPurposesSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2PublisherPurposesSegment.java @@ -10,6 +10,7 @@ import com.iab.gpp.encoder.datatype.EncodableFixedBitfield; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFlexibleBitfield; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.TcfEuV2Field; @@ -75,7 +76,11 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if(encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode TcfEuV2PublisherPurposesSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsAllowedSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsAllowedSegment.java index ffe382be..e09b48bb 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsAllowedSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsAllowedSegment.java @@ -7,6 +7,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.TcfEuV2Field; @@ -49,7 +50,11 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if(encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode TcfEuV2VendorsAllowedSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsDisclosedSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsDisclosedSegment.java index 1487eb5b..c66b012d 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsDisclosedSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/TcfEuV2VendorsDisclosedSegment.java @@ -7,6 +7,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableOptimizedFixedRange; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.TcfEuV2Field; @@ -49,7 +50,11 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if(encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode TcfEuV2VendorsDisclosedSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java index 9c322764..73738284 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java @@ -8,6 +8,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCaV1Field; @@ -85,8 +86,12 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsCaV1CoreSegment '" + encodedString + "'", e); + } } @Override diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1GpcSegment.java index d3b15593..b55e9a28 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1GpcSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1GpcSegment.java @@ -6,6 +6,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCaV1Field; @@ -49,7 +50,11 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if(encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsCaV1GpcSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java index 0a8f5cd8..5fc86ff3 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java @@ -8,6 +8,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCoV1Field; @@ -83,8 +84,12 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsCoV1CoreSegment '" + encodedString + "'", e); + } } @Override diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1GpcSegment.java index 6281419c..0d0594de 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1GpcSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1GpcSegment.java @@ -6,6 +6,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCoV1Field; @@ -49,7 +50,11 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if(encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsCoV1GpcSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java index 25870edf..a07bed72 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java @@ -8,6 +8,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCtV1Field; @@ -83,8 +84,12 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsCtV1CoreSegment '" + encodedString + "'", e); + } } @Override diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1GpcSegment.java index 6ff912c0..b10649a3 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1GpcSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1GpcSegment.java @@ -6,6 +6,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCtV1Field; @@ -49,7 +50,11 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if(encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsCtV1GpcSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java index 6bd5ee54..de3bc0dd 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java @@ -8,6 +8,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsNatV1Field; @@ -93,8 +94,12 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsNatV1CoreSegment '" + encodedString + "'", e); + } } @Override diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1GpcSegment.java index ea8d9746..848e360f 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1GpcSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1GpcSegment.java @@ -6,6 +6,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableBoolean; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsNatV1Field; @@ -49,7 +50,11 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if(encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsNatV1GpcSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java index e1b6ae75..1602e079 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java @@ -8,6 +8,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsUtV1Field; @@ -85,8 +86,12 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsUtV1CoreSegment '" + encodedString + "'", e); + } } @Override diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java index 997521d1..08a8a8dd 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java @@ -8,6 +8,7 @@ import com.iab.gpp.encoder.bitstring.BitStringEncoder; import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsVaV1Field; @@ -83,8 +84,12 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel if (encodedString == null || encodedString.isEmpty()) { this.fields.reset(fields); } - String bitString = base64UrlEncoder.decode(encodedString); - bitStringEncoder.decode(bitString, getFieldNames(), fields); + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsVaV1CoreSegment '" + encodedString + "'", e); + } } @Override diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java index 6c07675d..59b3c557 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UspV1CoreSegment.java @@ -50,10 +50,14 @@ protected void decodeSegment(String encodedString, GenericFields fields) { throw new DecodingException("Invalid uspv1 string: '" + encodedString + "'"); } - fields.get(UspV1Field.VERSION).setValue(Integer.parseInt(encodedString.substring(0, 1))); - fields.get(UspV1Field.NOTICE).setValue(encodedString.charAt(1)); - fields.get(UspV1Field.OPT_OUT_SALE).setValue(encodedString.charAt(2)); - fields.get(UspV1Field.LSPA_COVERED).setValue(encodedString.charAt(3)); + try { + fields.get(UspV1Field.VERSION).setValue(Integer.parseInt(encodedString.substring(0, 1))); + fields.get(UspV1Field.NOTICE).setValue(encodedString.charAt(1)); + fields.get(UspV1Field.OPT_OUT_SALE).setValue(encodedString.charAt(2)); + fields.get(UspV1Field.LSPA_COVERED).setValue(encodedString.charAt(3)); + } catch (Exception e) { + throw new DecodingException("Unable to decode UspV1CoreSegment '" + encodedString + "'", e); + } } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index dbcd3d9a..277eb83b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -56,18 +56,21 @@ public void testEncodeDefault() { } @Test - public void testLazyDecodingException() { - GppModel gppModel = new GppModel("invalid gpp string"); - try { - gppModel.getHeader(); - Assertions.fail("Expected DecodingException"); - } catch (DecodingException e) { - - } + public void testDecodingException() { + Assertions.assertThrows(DecodingException.class, () -> { + new GppModel("invalid gpp string").getHeader(); + }); } + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new GppModel("z").getUsCtV1Section(); + }); + } + @Test - public void testEncodeDefaultAll() { + public void testEncodeDefaultAll() { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); @@ -108,13 +111,13 @@ public void testEncodeDefaultAll() { String gppString = gppModel.encode(); Assertions.assertEquals( - "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAQA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA", + "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAQA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA", gppString); } @Test - public void testEncodeUspv1() { + public void testEncodeUspv1() { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -154,7 +157,7 @@ public void testEncodeUspv1() { } @Test - public void testEncodeTcfEuV2() { + public void testEncodeTcfEuV2() { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -204,7 +207,7 @@ public void testEncodeTcfEuV2() { } @Test - public void testEncodeUspV1AndTcfEuV2() { + public void testEncodeUspV1AndTcfEuV2() { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); @@ -249,8 +252,7 @@ public void testEncodeUspV1AndTcfEuV2() { } @Test - public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() - { + public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() { GppModel gppModel = new GppModel(); Assertions.assertEquals(false, gppModel.hasSection(UspV1.ID)); Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.ID)); @@ -336,7 +338,7 @@ public void testEncodeUspV1AndTcfEuV2AndTcfCaV1() String gppString = gppModel.encode(); Assertions.assertEquals( - "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao~1YNN", + "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACACAAA.fHHHA4444ao~1YNN", gppString); Assertions.assertEquals(4, gppString.split("~").length); @@ -516,7 +518,7 @@ public void testDecodeUspv1AndTcfEuV2() { @Test public void testDecodeUspv1AndTcfEuV2AndTcfCaV1() { String gppString = - "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao~1YNN"; + "DBACOeA~CPSG_8APSG_8ANwAAAENAwCAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACACAAA.fHHHA4444ao~1YNN"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(Arrays.asList(2, 5, 6), gppModel.getSectionIds()); @@ -595,7 +597,7 @@ public void testDecodeUspv1AndTcfEuV2AndTcfCaV1() { } @Test - public void testEncode1() { + public void testEncode1() { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(28)); @@ -606,7 +608,7 @@ public void testEncode1() { } @Test - public void testEncode2() { + public void testEncode2() { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(29)); @@ -617,7 +619,7 @@ public void testEncode2() { } @Test - public void testEncode3() { + public void testEncode3() { GppModel gppModel = new GppModel(); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS, Arrays.asList(1, 173, 722)); @@ -646,6 +648,13 @@ public void testDecode3() { Assertions.assertEquals(Arrays.asList(1, 173, 722), gppModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS)); } + + @Test + public void testDecode4() { + GppModel gppModel = new GppModel("DBABTA~1YYN"); + gppModel.getFieldValue(UspV1.NAME, UspV1Field.VERSION); + + } @Test public void testConsistency() { @@ -663,52 +672,52 @@ public void testConsistency() { GppModel decodedModel = new GppModel(fromObjectModel.encode()); Assertions.assertEquals( - Arrays.asList(true, true, true, true, true, true, true, true, true, true, false, false, false, false, - false, false, false, false, false, false, false, false, false, false), + Arrays.asList(true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, + false, false, false, false, false, false, false, false, false), decodedModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.PURPOSE_CONSENTS)); Assertions.assertEquals(Arrays.asList(21, 32, 81, 128, 173, 210, 238, 755), decodedModel.getFieldValue(TcfEuV2.NAME, TcfEuV2Field.VENDOR_CONSENTS)); } - + @Test public void testNullConstructor() { GppModel gppModel = new GppModel(null); Assertions.assertEquals("DBAA", gppModel.encode()); - + gppModel.setFieldValue("uspv1", UspV1Field.NOTICE, 'Y'); Assertions.assertEquals("DBABTA~1Y--", gppModel.encode()); } - + @Test public void testEmptyStringConstructor() { GppModel gppModel = new GppModel(""); Assertions.assertEquals("DBAA", gppModel.encode()); - + gppModel.setFieldValue("uspv1", UspV1Field.NOTICE, 'Y'); Assertions.assertEquals("DBABTA~1Y--", gppModel.encode()); } - + @Test public void testDecodingNull() { GppModel gppModel = new GppModel("DBABTA~1---"); Assertions.assertEquals("DBABTA~1---", gppModel.encode()); - + gppModel.decode(null); Assertions.assertEquals("DBAA", gppModel.encode()); - + gppModel.setFieldValue("uspv1", UspV1Field.NOTICE, 'Y'); Assertions.assertEquals("DBABTA~1Y--", gppModel.encode()); } - + @Test public void testDecodingEmptyString() { GppModel gppModel = new GppModel("DBABTA~1---"); Assertions.assertEquals("DBABTA~1---", gppModel.encode()); - + gppModel.decode(null); Assertions.assertEquals("DBAA", gppModel.encode()); - + gppModel.setFieldValue("uspv1", UspV1Field.NOTICE, 'Y'); Assertions.assertEquals("DBABTA~1Y--", gppModel.encode()); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableBooleanTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableBooleanTest.java index 3ea44dbb..d015acd1 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableBooleanTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableBooleanTest.java @@ -6,13 +6,13 @@ public class EncodableBooleanTest { @Test - public void testSubstring1() { + public void testSubstring1() throws SubstringException { Assertions.assertEquals("000000000000000000000000000000000000", new EncodableDatetime().substring("10000000000000000000000000000000000001", 1)); } @Test - public void testSubstring2() { + public void testSubstring2() throws SubstringException { Assertions.assertEquals("111111111111111111111111111111111111", new EncodableDatetime().substring("01111111111111111111111111111111111110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableDatetimeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableDatetimeTest.java index d7a6a759..43d271ba 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableDatetimeTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableDatetimeTest.java @@ -7,13 +7,13 @@ public class EncodableDatetimeTest { @Test - public void testSubstring1() throws DecodingException { + public void testSubstring1() throws DecodingException, SubstringException { Assertions.assertEquals("000000000000000000000000000000000000", new EncodableDatetime().substring("10000000000000000000000000000000000001", 1)); } @Test - public void testSubstring2() throws DecodingException { + public void testSubstring2() throws DecodingException, SubstringException { Assertions.assertEquals("111111111111111111111111111111111111", new EncodableDatetime().substring("01111111111111111111111111111111111110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRangeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRangeTest.java index faac8ddc..765d5154 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRangeTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerRangeTest.java @@ -7,7 +7,7 @@ public class EncodableFibonacciIntegerRangeTest { @Test - public void testSubstring1() throws DecodingException { + public void testSubstring1() throws DecodingException, SubstringException { Assertions.assertEquals("0000000000100001110110011", new EncodableFibonacciIntegerRange().substring("100000000001000011101100110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerTest.java index bb982c7f..61dd7d0a 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFibonacciIntegerTest.java @@ -7,7 +7,7 @@ public class EncodableFibonacciIntegerTest { @Test - public void testSubstring1() throws DecodingException { + public void testSubstring1() throws DecodingException, SubstringException { Assertions.assertEquals("0011", new EncodableFibonacciInteger().substring("100111", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfieldTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfieldTest.java index f448f433..89ad98af 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfieldTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedBitfieldTest.java @@ -6,12 +6,12 @@ public class EncodableFixedBitfieldTest { @Test - public void testSubstring1() { + public void testSubstring1() throws SubstringException { Assertions.assertEquals("000", new EncodableFixedBitfield(3).substring("10001", 1)); } @Test - public void testSubstring2() { + public void testSubstring2() throws SubstringException { Assertions.assertEquals("111", new EncodableFixedBitfield(3).substring("01110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java index 9d33e1da..7146cc01 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerListTest.java @@ -6,12 +6,12 @@ public class EncodableFixedIntegerListTest { @Test - public void testSubstring1() { + public void testSubstring1() throws SubstringException { Assertions.assertEquals("1000", new EncodableFixedIntegerList(2, 2).substring("10001", 0)); } @Test - public void testSubstring2() { + public void testSubstring2() throws SubstringException { Assertions.assertEquals("1110", new EncodableFixedIntegerList(2, 2).substring("01110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java index 51a16c39..0982aa40 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerRangeTest.java @@ -4,32 +4,33 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; public class EncodableFixedIntegerRangeTest { @Test - public void testSubstring1() throws DecodingException { + public void testSubstring1() throws DecodingException, SubstringException { Assertions.assertEquals("00000000001000000000000000011100000000000001010000000000001000", new EncodableFixedIntegerRange().substring("1000000000010000000000000000111000000000000010100000000000010001", 1)); } @Test - public void testSubstring2() throws DecodingException { + public void testSubstring2() throws DecodingException, SubstringException { Assertions.assertEquals("00000000000100000000000011101", new EncodableFixedIntegerRange().substring( "000010001111010010000110111111111100000000001111010010000110111111111100000000000000000000000000000000000000000100001101000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110110000000000010000000000001110100000000000000000000000000000", 230)); } @Test - public void testEncode1() { + public void testEncode1() throws EncodingException { EncodableFixedIntegerRange encodableFixedIntegerRange = new EncodableFixedIntegerRange(); encodableFixedIntegerRange.setValue(Arrays.asList(28)); Assertions.assertEquals("00000000000100000000000011100", encodableFixedIntegerRange.encode()); } @Test - public void testEncode2() { + public void testEncode2() throws EncodingException { EncodableFixedIntegerRange encodableFixedIntegerRange = new EncodableFixedIntegerRange(); encodableFixedIntegerRange.setValue(Arrays.asList(29)); Assertions.assertEquals("00000000000100000000000011101", encodableFixedIntegerRange.encode()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerTest.java index 1236da01..709fd156 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedIntegerTest.java @@ -6,12 +6,12 @@ public class EncodableFixedIntegerTest { @Test - public void testSubstring1() { + public void testSubstring1() throws SubstringException { Assertions.assertEquals("000", new EncodableFixedInteger(3).substring("10001", 1)); } @Test - public void testSubstring2() { + public void testSubstring2() throws SubstringException { Assertions.assertEquals("111", new EncodableFixedInteger(3).substring("01110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedStringTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedStringTest.java index a9014d8e..969a6c15 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedStringTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableFixedStringTest.java @@ -6,12 +6,12 @@ public class EncodableFixedStringTest { @Test - public void testSubstring1() { + public void testSubstring1() throws SubstringException { Assertions.assertEquals("000000000000", new EncodableFixedString(2).substring("10000000000001", 1)); } @Test - public void testSubstring2() { + public void testSubstring2() throws SubstringException { Assertions.assertEquals("111111111111", new EncodableFixedString(2).substring("01111111111110", 1)); } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java index 8036f13f..5551b3e4 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/datatype/EncodableOptimizedFixedRangeTest.java @@ -58,14 +58,14 @@ public void testDecode4() { } @Test - public void testSubstring1() { + public void testSubstring1() throws SubstringException { Assertions.assertEquals("000000000001110000000000000000000000000000001", encodableOptimizedFixedRange.substring( "000010001111010010000110111111111100000000001111010010000110111111111100000000000000000000000000000000000000000100001101000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000001000000000000000000000000000000", 213)); } @Test - public void testSubstring2() { + public void testSubstring2() throws SubstringException { Assertions.assertEquals("0000000000011101100000000000100000000000011101", encodableOptimizedFixedRange.substring( "000010001111010010000110111111111100000000001111010010000110111111111100000000000000000000000000000000000000000100001101000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110110000000000010000000000001110100000000000000000000000000000", 213)); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/.UsNatV1Test.java.swp b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/.UsNatV1Test.java.swp new file mode 100644 index 0000000000000000000000000000000000000000..686ae751e38ab4870c28793ce259a9eb4aa5eaa3 GIT binary patch literal 16384 zcmeI3UyKt)9LI;hry!v4pz+1E@X(re%N<4{M8nc9N5l0G-MylQr0#9!?w0Fy*WK+M z|4Dez7@v$WknrLQ2@fR3m|%19M8uaAy;=NC9qd!@9K z$ZGm-)0{{YY*Vb7x>oHdb<#JOoHp$V$I^6~G_(O@sMP|{<+)*_@!4=>Nkac9+K)-*fZ;m`GY}z=? zHQ@?y1-JrS0j>a7fGfZi;0kaB9wG%?tB;&Qf0wg9o9umA+xr7{)Y*BfE&Xqn9+dy3 zE&V=A56Y>mf}oyzEd6y>?pj;=Uo3ryrEg&k4$9wU=})nAt1X?K=5Jg9t^iknE5H@t z3UCFu0$c&E09Sx3z!i8X70@b#Jc*v)@)pu~{vWL0uWumaNALr<3eEr*>;h}R_4P;x zSHNX(37iFIfDQUV0>r@+YGcqBUK=587hwl$-FaKqAc zZe19iPu^bawW-{bi59VYD&OWbJvDmul(N4Edm!W>7vUZycI=nL{d2fS0S9x^f%oim z-KeVFcQ;zpA8rxLq*vjl1FN1h$6|#Tla^__0``rI*kmqZ-#GKqwm9l7Kt$FGf9h+gX#$TBlKH8Xmf z-o?6WRKLu~A|0Jb-dE*zMgPJ{pd-m2vPBexVHXAu}?~h=H_Z)^rrbZE-qBG$r zGW)#VZ~f^=KkxPEngyR9mY#n*XEUF56L{wqw?`YFcx(6rNo{7li-Vkk2JZ zXLu(T>fFAXIbBPQ8`X+JYmVU>Q}kcjpEYXK3@C+b57mhw(y8O%E4pB>!ULpgHU^tk zqzV*v4bMVjyt=f*E|A{JYE{}>!B*Laj7h^Cc4%;oE-<)Z8RihP(W;&-&M9n9) { + new HeaderV1("z").getSectionsIds(); + }); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java index a1762dee..3f53a288 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfCaV1Test.java @@ -3,9 +3,15 @@ import java.time.ZoneId; import java.time.ZonedDateTime; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.datatype.RangeEntry; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; import com.iab.gpp.encoder.field.TcfCaV1Field; public class TcfCaV1Test { @@ -16,7 +22,7 @@ public void testEncode1() { TcfCaV1 tcfCaV1 = new TcfCaV1(); tcfCaV1.setFieldValue(TcfCaV1Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); tcfCaV1.setFieldValue(TcfCaV1Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); - Assertions.assertEquals("BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA", tcfCaV1.encode()); + Assertions.assertEquals("BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA", tcfCaV1.encode()); } @Test @@ -50,12 +56,38 @@ public void testEncode2() { tcfCaV1.setFieldValue(TcfCaV1Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); tcfCaV1.setFieldValue(TcfCaV1Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); - Assertions.assertEquals("BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao", tcfCaV1.encode()); + Assertions.assertEquals("BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACACAAA.fHHHA4444ao", tcfCaV1.encode()); + } + + @Test + public void testEncode3() throws EncodingException, InvalidFieldException { + + TcfCaV1 tcfCaV1 = new TcfCaV1(); + tcfCaV1.setFieldValue(TcfCaV1Field.DISCLOSED_VENDORS, Arrays.asList(1, 2, 3, 5, 6, 7, 10, 11, 12)); + + tcfCaV1.setFieldValue(TcfCaV1Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); + tcfCaV1.setFieldValue(TcfCaV1Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); + + Assertions.assertEquals("BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA.IAGO5w", tcfCaV1.encode()); + } + + @Test + public void testEncode4() throws EncodingException, InvalidFieldException { + + List pubRestrictions = new ArrayList<>(); + pubRestrictions.add(new RangeEntry(1, 1, Arrays.asList(1, 2, 3, 5, 6, 7, 9))); + + TcfCaV1 tcfCaV1 = new TcfCaV1(); + tcfCaV1.setFieldValue(TcfCaV1Field.PUB_RESTRICTIONS, pubRestrictions); + + tcfCaV1.setFieldValue(TcfCaV1Field.CREATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); + tcfCaV1.setFieldValue(TcfCaV1Field.LAST_UPDATED, ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC"))); + Assertions.assertEquals("BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAACCgBwABAAOAAoADgAJA.YAAAAAAAAAA", tcfCaV1.encode()); } @Test public void testDecode1() { - TcfCaV1 tcfCaV1 = new TcfCaV1("CAAAAAAAAAAAAAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA"); + TcfCaV1 tcfCaV1 = new TcfCaV1("BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA"); Assertions.assertEquals(0, tcfCaV1.getCmpId()); Assertions.assertEquals(0, tcfCaV1.getCmpVersion()); @@ -87,8 +119,8 @@ public void testDecode1() { Assertions.assertEquals(0, tcfCaV1.getNumCustomPurposes()); Assertions.assertEquals(Arrays.asList(), tcfCaV1.getCustomPurposesExpressConsent()); Assertions.assertEquals(Arrays.asList(), tcfCaV1.getCustomPurposesImpliedConsent()); - Assertions.assertEquals(ZonedDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV1.getCreated()); - Assertions.assertEquals(ZonedDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV1.getLastUpdated()); + Assertions.assertEquals(ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV1.getCreated()); + Assertions.assertEquals(ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneId.of("UTC")), tcfCaV1.getLastUpdated()); Assertions.assertEquals("EN", tcfCaV1.getConsentLanguage()); Assertions.assertEquals(5, tcfCaV1.getId()); @@ -97,7 +129,7 @@ public void testDecode1() { @Test public void testDecode2() { - TcfCaV1 tcfCaV1 = new TcfCaV1("BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACAC.fHHHA4444ao"); + TcfCaV1 tcfCaV1 = new TcfCaV1("BPSG_8APSG_8AAyACAENGdCgf_gfgAfgfgBgABABAAABAB4AACACAAA.fHHHA4444ao"); Assertions.assertEquals(50, tcfCaV1.getCmpId()); Assertions.assertEquals(2, tcfCaV1.getCmpVersion()); @@ -133,4 +165,37 @@ public void testDecode2() { Assertions.assertEquals(5, tcfCaV1.getId()); Assertions.assertEquals(3, tcfCaV1.getPubPurposesSegmentType()); } + + @Test + public void testDecode3() throws DecodingException { + TcfCaV1 tcfCaV1 = new TcfCaV1("BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA.IAGO5w"); + + Assertions.assertEquals(1, tcfCaV1.getDisclosedVendorsSegmentType()); + Assertions.assertEquals(Arrays.asList(1, 2, 3, 5, 6, 7, 10, 11, 12), tcfCaV1.getDisclosedVendors()); + } + + @Test + public void testDecode4() throws DecodingException { + TcfCaV1 tcfCaV1 = new TcfCaV1("BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAACCgBwABAAOAAoADgAJA.YAAAAAAAAAA"); + + List pubRestictions = tcfCaV1.getPubRestrictions(); + Assertions.assertEquals(1, pubRestictions.size()); + Assertions.assertEquals(1, pubRestictions.get(0).getKey()); + Assertions.assertEquals(1, pubRestictions.get(0).getType()); + Assertions.assertEquals(Arrays.asList(1, 2, 3, 5, 6, 7, 9), pubRestictions.get(0).getIds()); + } + + @Test() + public void testDecodeGarbage1() { + Assertions.assertThrows(DecodingException.class, () -> { + new TcfCaV1("A").getPubRestrictions(); + }); + } + + @Test() + public void testDecodeGarbage2() { + Assertions.assertThrows(DecodingException.class, () -> { + new TcfCaV1("z").getPubRestrictions(); + }); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java index b11dbdbc..945f7468 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/TcfEuV2Test.java @@ -6,6 +6,8 @@ import java.util.List; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.datatype.RangeEntry; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.TcfEuV2Field; public class TcfEuV2Test { @@ -359,4 +361,61 @@ public void testDecode6() { Assertions.assertEquals(Arrays.asList(2, 6, 8, 12, 18, 23, 37, 42), tcfEuV2.getFieldValue("VendorLegitimateInterests")); } + + @Test + public void testDecode7() throws DecodingException { + TcfEuV2 tcfEuV2 = new TcfEuV2("COoC-kUOoC-kUAHABAENAwCoAIAAAELAAAwIF5wAoAAgAGAvMACX_ABBAAQAFA"); + + Assertions.assertEquals(2, tcfEuV2.getFieldValue("Version")); + Assertions.assertEquals("2019-10-07T05:17:54Z[UTC]", tcfEuV2.getFieldValue("Created").toString()); + Assertions.assertEquals("2019-10-07T05:17:54Z[UTC]", tcfEuV2.getFieldValue("LastUpdated").toString()); + Assertions.assertEquals(7, tcfEuV2.getFieldValue("CmpId")); + Assertions.assertEquals(1, tcfEuV2.getFieldValue("CmpVersion")); + Assertions.assertEquals(0, tcfEuV2.getFieldValue("ConsentScreen")); + Assertions.assertEquals("EN", tcfEuV2.getFieldValue("ConsentLanguage")); + Assertions.assertEquals(48, tcfEuV2.getFieldValue("VendorListVersion")); + Assertions.assertEquals(2, tcfEuV2.getFieldValue("PolicyVersion")); + Assertions.assertEquals(true, tcfEuV2.getFieldValue("IsServiceSpecific")); + Assertions.assertEquals(false, tcfEuV2.getFieldValue("UseNonStandardStacks")); + + Assertions.assertEquals( + Arrays.asList(true, false, false, false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("SpecialFeatureOptins")); + Assertions.assertEquals( + Arrays.asList(true, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("PurposeConsents")); + Assertions.assertEquals( + Arrays.asList(false, true, false, false, false, false, true, false, true, true, false, false, false, false, + false, false, false, false, false, false, false, false, false, false), + tcfEuV2.getFieldValue("PurposeLegitimateInterests")); + + Assertions.assertEquals(false, tcfEuV2.getFieldValue("PurposeOneTreatment")); + Assertions.assertEquals("GB", tcfEuV2.getFieldValue("PublisherCountryCode")); + + Assertions.assertEquals(Arrays.asList(1, 2, 3, 755), tcfEuV2.getFieldValue("VendorConsents")); + + Assertions.assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9), + tcfEuV2.getFieldValue("VendorLegitimateInterests")); + + Assertions.assertEquals(1, ((List)tcfEuV2.getFieldValue("PublisherRestrictions")).size()); + RangeEntry rangeEntry = ((List)tcfEuV2.getFieldValue("PublisherRestrictions")).get(0); + Assertions.assertEquals(1, rangeEntry.getKey()); + Assertions.assertEquals(0, rangeEntry.getType()); + Assertions.assertEquals(Arrays.asList(10), rangeEntry.getIds()); + } + + @Test() + public void testDecodeGarbage1() { + Assertions.assertThrows(DecodingException.class, () -> { + new TcfEuV2("A").getCreated(); + }); + } + + @Test() + public void testDecodeGarbage2() { + Assertions.assertThrows(DecodingException.class, () -> { + new TcfEuV2("z").getCreated(); + }); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java index 0022210c..4615a866 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java @@ -4,6 +4,7 @@ import java.util.Arrays; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.UsCaV1Field; @@ -522,4 +523,11 @@ public void testDecodeWithGpcSegmentExcluded() { Assertions.assertEquals(2, usCaV1.getMspaServiceProviderMode()); Assertions.assertEquals(false, usCaV1.getGpcSegmentIncluded()); } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsCaV1("z").getPersonalDataConsents(); + }); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java index efe5a2ef..dd238be3 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java @@ -4,6 +4,7 @@ import java.util.Arrays; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.UsCoV1Field; @@ -409,4 +410,11 @@ public void testDecodeWithGpcSegmentExcluded() { Assertions.assertEquals(2, usCoV1.getMspaServiceProviderMode()); Assertions.assertEquals(false, usCoV1.getGpcSegmentIncluded()); } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsCoV1("z").getTargetedAdvertisingOptOut(); + }); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java index af353058..9276651c 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java @@ -408,4 +408,11 @@ public void testDecodeWithGpcSegmentExcluded() throws DecodingException { Assertions.assertEquals(2, usCtV1.getMspaServiceProviderMode()); Assertions.assertEquals(false, usCtV1.getGpcSegmentIncluded()); } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsCtV1("z").getSharingNotice(); + }); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java index ac3cd9ab..4a5b549b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java @@ -637,4 +637,11 @@ public void testDecodeWithGpcSegmentExcluded() throws DecodingException { Assertions.assertEquals(2, usNatV1.getMspaServiceProviderMode()); Assertions.assertEquals(false, usNatV1.getGpcSegmentIncluded()); } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsNatV1("z").getSharingNotice(); + }); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java index d42eaddc..b2dd77b3 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java @@ -390,4 +390,11 @@ public void testDecode1() throws DecodingException { Assertions.assertEquals(1, usUtV1.getMspaOptOutOptionMode()); Assertions.assertEquals(2, usUtV1.getMspaServiceProviderMode()); } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsUtV1("z").getKnownChildSensitiveDataConsents(); + }); + } } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java index 0a446cd2..7c232941 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java @@ -388,4 +388,11 @@ public void testDecode1() throws DecodingException { Assertions.assertEquals(1, usVaV1.getMspaOptOutOptionMode()); Assertions.assertEquals(2, usVaV1.getMspaServiceProviderMode()); } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsVaV1("z").getMspaCoveredTransaction(); + }); + } } From 310ae4d792e5cef47d429de617b8787a678ef9db Mon Sep 17 00:00:00 2001 From: Chad Huff Date: Mon, 15 Apr 2024 22:26:11 -0600 Subject: [PATCH 26/41] 3.2.0 --- iabgpp-encoder/pom.xml | 2 +- iabgpp-extras-jackson/pom.xml | 4 ++-- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index fe7ebc3b..599909f6 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.2-SNAPSHOT + 3.2.0 iabgpp-encoder diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index 92075406..ba20d559 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.1.2-SNAPSHOT + 3.2.0 iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.1.2-SNAPSHOT + 3.2.0 diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index d82bb0d9..993ad5a5 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.2-SNAPSHOT + 3.2.0 iabgpp-extras diff --git a/pom.xml b/pom.xml index 42a5e198..a9039d2b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.1.2-SNAPSHOT + 3.2.0 IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From cae4e3c5536aef3915b8d1a985988a55f17ede6e Mon Sep 17 00:00:00 2001 From: Chad Huff Date: Mon, 15 Apr 2024 22:27:01 -0600 Subject: [PATCH 27/41] 3.2.1-SNAPSHOT --- iabgpp-encoder/pom.xml | 2 +- iabgpp-extras-jackson/pom.xml | 4 ++-- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index 599909f6..bbfffad3 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.0 + 3.2.1-SNAPSHOT iabgpp-encoder diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index ba20d559..bb1659db 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.2.0 + 3.2.1-SNAPSHOT iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.2.0 + 3.2.1-SNAPSHOT diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index 993ad5a5..90cced1a 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.0 + 3.2.1-SNAPSHOT iabgpp-extras diff --git a/pom.xml b/pom.xml index a9039d2b..d8bc78ed 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.2.0 + 3.2.1-SNAPSHOT IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From fcd606121f5795080620099a9dc51dac0482f46f Mon Sep 17 00:00:00 2001 From: chuff Date: Tue, 16 Apr 2024 14:14:25 -0600 Subject: [PATCH 28/41] Versioning (#47) * 3.1.1 * 3.1.2-SNAPSHOT * 3.2.0 * 3.2.1-SNAPSHOT --------- Co-authored-by: chad --- iabgpp-encoder/pom.xml | 2 +- iabgpp-extras-jackson/pom.xml | 4 ++-- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index fe7ebc3b..bbfffad3 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.2-SNAPSHOT + 3.2.1-SNAPSHOT iabgpp-encoder diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index 92075406..bb1659db 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.1.2-SNAPSHOT + 3.2.1-SNAPSHOT iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.1.2-SNAPSHOT + 3.2.1-SNAPSHOT diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index d82bb0d9..90cced1a 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.1.2-SNAPSHOT + 3.2.1-SNAPSHOT iabgpp-extras diff --git a/pom.xml b/pom.xml index 42a5e198..d8bc78ed 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.1.2-SNAPSHOT + 3.2.1-SNAPSHOT IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From 4c113b6025d62e7c568bdafbc3d133cceb5d95d8 Mon Sep 17 00:00:00 2001 From: chuff Date: Fri, 11 Oct 2024 07:52:51 -0600 Subject: [PATCH 29/41] Remove multistate version (#60) * lazy decoding * java 8 compatible gppmodel tests * rename missed multistate usp* methods to us* * lazier decoding * lazier decoding * tests for null and empty string constructor arguments * validation * fix typo * remove redundant validate call * default validate * remove empty validate method from header core segment * fix usct validator * 3.1.1 * 3.1.2-SNAPSHOT * tcfca publisher restrictions and disclosed vendors * deprecate multi-state usp* methods * substring error handling * remove deprecated usp methods * remove deprecated usp methods * remove deprecated usp methods * cleanup validators * Better decoding exception messaging * remove unused classes * Update README * add support for the old headerless tcfeuv2 strings * encodeSection fix * encodeSection lazy fix * tcfeu pub restrictions fix * pub restrictions getters * tcfeu pub restirctions fix * cleanup * pub restrictions fix * optimize bitstring padding * 3.2.0 * 3.2.1-SNAPSHOT * fl mt or tx * remove version from multistate resources --------- Co-authored-by: chad --- .../java/com/iab/gpp/encoder/GppModel.java | 200 ++++-- .../{UsCaV1Field.java => UsCaField.java} | 34 +- .../{UsCoV1Field.java => UsCoField.java} | 32 +- .../{UsCtV1Field.java => UsCtField.java} | 32 +- .../com/iab/gpp/encoder/field/UsFlField.java | 37 + .../com/iab/gpp/encoder/field/UsMtField.java | 48 ++ .../{UsNatV1Field.java => UsNatField.java} | 42 +- .../com/iab/gpp/encoder/field/UsOrField.java | 48 ++ .../com/iab/gpp/encoder/field/UsTxField.java | 48 ++ .../{UsUtV1Field.java => UsUtField.java} | 28 +- .../{UsVaV1Field.java => UsVaField.java} | 26 +- .../com/iab/gpp/encoder/section/Sections.java | 16 +- .../section/{UsCaV1.java => UsCa.java} | 58 +- .../section/{UsCoV1.java => UsCo.java} | 56 +- .../section/{UsCtV1.java => UsCt.java} | 56 +- .../com/iab/gpp/encoder/section/UsFl.java | 118 ++++ .../com/iab/gpp/encoder/section/UsMt.java | 142 ++++ .../section/{UsNatV1.java => UsNat.java} | 66 +- .../com/iab/gpp/encoder/section/UsOr.java | 142 ++++ .../com/iab/gpp/encoder/section/UsTx.java | 141 ++++ .../section/{UsUtV1.java => UsUt.java} | 42 +- .../section/{UsVaV1.java => UsVa.java} | 40 +- ...1CoreSegment.java => UsCaCoreSegment.java} | 52 +- ...tV1GpcSegment.java => UsCaGpcSegment.java} | 18 +- ...1CoreSegment.java => UsCoCoreSegment.java} | 48 +- ...oV1GpcSegment.java => UsCoGpcSegment.java} | 18 +- ...1CoreSegment.java => UsCtCoreSegment.java} | 48 +- ...aV1GpcSegment.java => UsCtGpcSegment.java} | 18 +- .../gpp/encoder/segment/UsFlCoreSegment.java | 168 +++++ .../gpp/encoder/segment/UsMtCoreSegment.java | 168 +++++ ...tV1GpcSegment.java => UsMtGpcSegment.java} | 18 +- ...CoreSegment.java => UsNatCoreSegment.java} | 66 +- .../gpp/encoder/segment/UsNatGpcSegment.java | 60 ++ .../gpp/encoder/segment/UsOrCoreSegment.java | 168 +++++ .../gpp/encoder/segment/UsOrGpcSegment.java | 60 ++ .../gpp/encoder/segment/UsTxCoreSegment.java | 169 +++++ .../gpp/encoder/segment/UsTxGpcSegment.java | 60 ++ ...1CoreSegment.java => UsUtCoreSegment.java} | 50 +- ...1CoreSegment.java => UsVaCoreSegment.java} | 48 +- .../com/iab/gpp/encoder/GppModelTest.java | 96 ++- .../com/iab/gpp/encoder/section/UsCaTest.java | 533 +++++++++++++++ .../iab/gpp/encoder/section/UsCaV1Test.java | 533 --------------- .../com/iab/gpp/encoder/section/UsCoTest.java | 420 ++++++++++++ .../iab/gpp/encoder/section/UsCoV1Test.java | 420 ------------ .../com/iab/gpp/encoder/section/UsCtTest.java | 418 +++++++++++ .../iab/gpp/encoder/section/UsCtV1Test.java | 418 ----------- .../com/iab/gpp/encoder/section/UsFlTest.java | 407 +++++++++++ .../com/iab/gpp/encoder/section/UsMtTest.java | 428 ++++++++++++ .../iab/gpp/encoder/section/UsNatTest.java | 647 ++++++++++++++++++ .../iab/gpp/encoder/section/UsNatV1Test.java | 647 ------------------ .../com/iab/gpp/encoder/section/UsOrTest.java | 428 ++++++++++++ .../com/iab/gpp/encoder/section/UsTxTest.java | 428 ++++++++++++ .../com/iab/gpp/encoder/section/UsUtTest.java | 400 +++++++++++ .../iab/gpp/encoder/section/UsUtV1Test.java | 400 ----------- .../com/iab/gpp/encoder/section/UsVaTest.java | 398 +++++++++++ .../iab/gpp/encoder/section/UsVaV1Test.java | 398 ----------- 56 files changed, 6728 insertions(+), 3380 deletions(-) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UsCaV1Field.java => UsCaField.java} (60%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UsCoV1Field.java => UsCoField.java} (60%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UsCtV1Field.java => UsCtField.java} (60%) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsFlField.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsMtField.java rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UsNatV1Field.java => UsNatField.java} (60%) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsOrField.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsTxField.java rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UsUtV1Field.java => UsUtField.java} (61%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/{UsVaV1Field.java => UsVaField.java} (61%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/{UsCaV1.java => UsCa.java} (56%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/{UsCoV1.java => UsCo.java} (56%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/{UsCtV1.java => UsCt.java} (56%) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsFl.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsMt.java rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/{UsNatV1.java => UsNat.java} (53%) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsOr.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsTx.java rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/{UsUtV1.java => UsUt.java} (60%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/{UsVaV1.java => UsVa.java} (61%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/{UsCaV1CoreSegment.java => UsCaCoreSegment.java} (81%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/{UsCtV1GpcSegment.java => UsCaGpcSegment.java} (72%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/{UsCoV1CoreSegment.java => UsCoCoreSegment.java} (80%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/{UsCoV1GpcSegment.java => UsCoGpcSegment.java} (72%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/{UsCtV1CoreSegment.java => UsCtCoreSegment.java} (79%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/{UsCaV1GpcSegment.java => UsCtGpcSegment.java} (72%) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsFlCoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsMtCoreSegment.java rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/{UsNatV1GpcSegment.java => UsMtGpcSegment.java} (71%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/{UsNatV1CoreSegment.java => UsNatCoreSegment.java} (81%) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatGpcSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrCoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrGpcSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxCoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxGpcSegment.java rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/{UsUtV1CoreSegment.java => UsUtCoreSegment.java} (79%) rename iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/{UsVaV1CoreSegment.java => UsVaCoreSegment.java} (80%) create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaTest.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoTest.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtTest.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsFlTest.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsMtTest.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsOrTest.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTxTest.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtTest.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaTest.java delete mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index f4a8bf94..430a60ca 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -15,12 +15,16 @@ import com.iab.gpp.encoder.section.Sections; import com.iab.gpp.encoder.section.TcfCaV1; import com.iab.gpp.encoder.section.TcfEuV2; -import com.iab.gpp.encoder.section.UsCaV1; -import com.iab.gpp.encoder.section.UsCoV1; -import com.iab.gpp.encoder.section.UsCtV1; -import com.iab.gpp.encoder.section.UsNatV1; -import com.iab.gpp.encoder.section.UsUtV1; -import com.iab.gpp.encoder.section.UsVaV1; +import com.iab.gpp.encoder.section.UsCa; +import com.iab.gpp.encoder.section.UsCo; +import com.iab.gpp.encoder.section.UsCt; +import com.iab.gpp.encoder.section.UsFl; +import com.iab.gpp.encoder.section.UsMt; +import com.iab.gpp.encoder.section.UsNat; +import com.iab.gpp.encoder.section.UsOr; +import com.iab.gpp.encoder.section.UsTx; +import com.iab.gpp.encoder.section.UsUt; +import com.iab.gpp.encoder.section.UsVa; import com.iab.gpp.encoder.section.UspV1; public class GppModel { @@ -61,24 +65,36 @@ public void setFieldValue(String sectionName, String fieldName, Object value) { } else if (sectionName.equals(UspV1.NAME)) { section = new UspV1(); this.sections.put(UspV1.NAME, section); - } else if (sectionName.equals(UsNatV1.NAME)) { - section = new UsNatV1(); - this.sections.put(UsNatV1.NAME, section); - } else if (sectionName.equals(UsCaV1.NAME)) { - section = new UsCaV1(); - this.sections.put(UsCaV1.NAME, section); - } else if (sectionName.equals(UsVaV1.NAME)) { - section = new UsVaV1(); - this.sections.put(UsVaV1.NAME, section); - } else if (sectionName.equals(UsCoV1.NAME)) { - section = new UsCoV1(); - this.sections.put(UsCoV1.NAME, section); - } else if (sectionName.equals(UsUtV1.NAME)) { - section = new UsUtV1(); - this.sections.put(UsUtV1.NAME, section); - } else if (sectionName.equals(UsCtV1.NAME)) { - section = new UsCtV1(); - this.sections.put(UsCtV1.NAME, section); + } else if (sectionName.equals(UsNat.NAME)) { + section = new UsNat(); + this.sections.put(UsNat.NAME, section); + } else if (sectionName.equals(UsCa.NAME)) { + section = new UsCa(); + this.sections.put(UsCa.NAME, section); + } else if (sectionName.equals(UsVa.NAME)) { + section = new UsVa(); + this.sections.put(UsVa.NAME, section); + } else if (sectionName.equals(UsCo.NAME)) { + section = new UsCo(); + this.sections.put(UsCo.NAME, section); + } else if (sectionName.equals(UsUt.NAME)) { + section = new UsUt(); + this.sections.put(UsUt.NAME, section); + } else if (sectionName.equals(UsCt.NAME)) { + section = new UsCt(); + this.sections.put(UsCt.NAME, section); + } else if (sectionName.equals(UsFl.NAME)) { + section = new UsFl(); + this.sections.put(UsFl.NAME, section); + } else if (sectionName.equals(UsMt.NAME)) { + section = new UsMt(); + this.sections.put(UsMt.NAME, section); + } else if (sectionName.equals(UsOr.NAME)) { + section = new UsOr(); + this.sections.put(UsOr.NAME, section); + } else if (sectionName.equals(UsTx.NAME)) { + section = new UsTx(); + this.sections.put(UsTx.NAME, section); } } else { section = this.sections.get(sectionName); @@ -212,28 +228,44 @@ public UspV1 getUspV1Section() { return (UspV1) getSection(UspV1.NAME); } - public UsNatV1 getUsNatV1Section() { - return (UsNatV1) getSection(UsNatV1.NAME); + public UsNat getUsNatSection() { + return (UsNat) getSection(UsNat.NAME); } - public UsCaV1 getUsCaV1Section() { - return (UsCaV1) getSection(UsCaV1.NAME); + public UsCa getUsCaSection() { + return (UsCa) getSection(UsCa.NAME); } - public UsVaV1 getUsVaV1Section() { - return (UsVaV1) getSection(UsVaV1.NAME); + public UsVa getUsVaSection() { + return (UsVa) getSection(UsVa.NAME); } - public UsCoV1 getUsCoV1Section() { - return (UsCoV1) getSection(UsCoV1.NAME); + public UsCo getUsCoSection() { + return (UsCo) getSection(UsCo.NAME); } - public UsUtV1 getUsUtV1Section() { - return (UsUtV1) getSection(UsUtV1.NAME); + public UsUt getUsUtSection() { + return (UsUt) getSection(UsUt.NAME); } - public UsCtV1 getUsCtV1Section() { - return (UsCtV1) getSection(UsCtV1.NAME); + public UsCt getUsCtSection() { + return (UsCt) getSection(UsCt.NAME); + } + + public UsFl getUsFlSection() { + return (UsFl) getSection(UsFl.NAME); + } + + public UsMt getUsMtSection() { + return (UsMt) getSection(UsMt.NAME); + } + + public UsOr getUsOrSection() { + return (UsOr) getSection(UsOr.NAME); + } + + public UsTx getUsTxSection() { + return (UsTx) getSection(UsTx.NAME); } public List getSectionIds() { @@ -299,24 +331,36 @@ protected Map decodeModel(String str) { } else if (sectionIds.get(i).equals(UspV1.ID)) { UspV1 section = new UspV1(encodedSections[i + 1]); sections.put(UspV1.NAME, section); - } else if (sectionIds.get(i).equals(UsCaV1.ID)) { - UsCaV1 section = new UsCaV1(encodedSections[i + 1]); - sections.put(UsCaV1.NAME, section); - } else if (sectionIds.get(i).equals(UsNatV1.ID)) { - UsNatV1 section = new UsNatV1(encodedSections[i + 1]); - sections.put(UsNatV1.NAME, section); - } else if (sectionIds.get(i).equals(UsVaV1.ID)) { - UsVaV1 section = new UsVaV1(encodedSections[i + 1]); - sections.put(UsVaV1.NAME, section); - } else if (sectionIds.get(i).equals(UsCoV1.ID)) { - UsCoV1 section = new UsCoV1(encodedSections[i + 1]); - sections.put(UsCoV1.NAME, section); - } else if (sectionIds.get(i).equals(UsUtV1.ID)) { - UsUtV1 section = new UsUtV1(encodedSections[i + 1]); - sections.put(UsUtV1.NAME, section); - } else if (sectionIds.get(i).equals(UsCtV1.ID)) { - UsCtV1 section = new UsCtV1(encodedSections[i + 1]); - sections.put(UsCtV1.NAME, section); + } else if (sectionIds.get(i).equals(UsCa.ID)) { + UsCa section = new UsCa(encodedSections[i + 1]); + sections.put(UsCa.NAME, section); + } else if (sectionIds.get(i).equals(UsNat.ID)) { + UsNat section = new UsNat(encodedSections[i + 1]); + sections.put(UsNat.NAME, section); + } else if (sectionIds.get(i).equals(UsVa.ID)) { + UsVa section = new UsVa(encodedSections[i + 1]); + sections.put(UsVa.NAME, section); + } else if (sectionIds.get(i).equals(UsCo.ID)) { + UsCo section = new UsCo(encodedSections[i + 1]); + sections.put(UsCo.NAME, section); + } else if (sectionIds.get(i).equals(UsUt.ID)) { + UsUt section = new UsUt(encodedSections[i + 1]); + sections.put(UsUt.NAME, section); + } else if (sectionIds.get(i).equals(UsCt.ID)) { + UsCt section = new UsCt(encodedSections[i + 1]); + sections.put(UsCt.NAME, section); + } else if (sectionIds.get(i).equals(UsFl.ID)) { + UsFl section = new UsFl(encodedSections[i + 1]); + sections.put(UsFl.NAME, section); + } else if (sectionIds.get(i).equals(UsMt.ID)) { + UsMt section = new UsMt(encodedSections[i + 1]); + sections.put(UsMt.NAME, section); + } else if (sectionIds.get(i).equals(UsOr.ID)) { + UsOr section = new UsOr(encodedSections[i + 1]); + sections.put(UsOr.NAME, section); + } else if (sectionIds.get(i).equals(UsTx.ID)) { + UsTx section = new UsTx(encodedSections[i + 1]); + sections.put(UsTx.NAME, section); } } } @@ -373,24 +417,36 @@ public void decodeSection(String sectionName, String encodedString) { } else if (sectionName.equals(UspV1.NAME)) { section = new UspV1(); this.sections.put(UspV1.NAME, section); - } else if (sectionName.equals(UsNatV1.NAME)) { - section = new UsNatV1(); - this.sections.put(UsNatV1.NAME, section); - } else if (sectionName.equals(UsCaV1.NAME)) { - section = new UsCaV1(); - this.sections.put(UsCaV1.NAME, section); - } else if (sectionName.equals(UsVaV1.NAME)) { - section = new UsVaV1(); - this.sections.put(UsVaV1.NAME, section); - } else if (sectionName.equals(UsCoV1.NAME)) { - section = new UsCoV1(); - this.sections.put(UsCoV1.NAME, section); - } else if (sectionName.equals(UsUtV1.NAME)) { - section = new UsUtV1(); - this.sections.put(UsUtV1.NAME, section); - } else if (sectionName.equals(UsCtV1.NAME)) { - section = new UsCtV1(); - this.sections.put(UsCtV1.NAME, section); + } else if (sectionName.equals(UsNat.NAME)) { + section = new UsNat(); + this.sections.put(UsNat.NAME, section); + } else if (sectionName.equals(UsCa.NAME)) { + section = new UsCa(); + this.sections.put(UsCa.NAME, section); + } else if (sectionName.equals(UsVa.NAME)) { + section = new UsVa(); + this.sections.put(UsVa.NAME, section); + } else if (sectionName.equals(UsCo.NAME)) { + section = new UsCo(); + this.sections.put(UsCo.NAME, section); + } else if (sectionName.equals(UsUt.NAME)) { + section = new UsUt(); + this.sections.put(UsUt.NAME, section); + } else if (sectionName.equals(UsCt.NAME)) { + section = new UsCt(); + this.sections.put(UsCt.NAME, section); + } else if (sectionName.equals(UsFl.NAME)) { + section = new UsFl(); + this.sections.put(UsFl.NAME, section); + } else if (sectionName.equals(UsMt.NAME)) { + section = new UsMt(); + this.sections.put(UsMt.NAME, section); + } else if (sectionName.equals(UsOr.NAME)) { + section = new UsOr(); + this.sections.put(UsOr.NAME, section); + } else if (sectionName.equals(UsTx.NAME)) { + section = new UsTx(); + this.sections.put(UsTx.NAME, section); } } else { section = this.sections.get(sectionName); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaField.java similarity index 60% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaField.java index 07c1a13f..934f57ac 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCaField.java @@ -3,7 +3,7 @@ import java.util.Arrays; import java.util.List; -public class UsCaV1Field { +public class UsCaField { public static String VERSION = "Version"; public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; @@ -23,26 +23,26 @@ public class UsCaV1Field { public static String GPC = "Gpc"; //@formatter:off - public static List USCAV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { - UsCaV1Field.VERSION, - UsCaV1Field.SALE_OPT_OUT_NOTICE, - UsCaV1Field.SHARING_OPT_OUT_NOTICE, - UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, - UsCaV1Field.SALE_OPT_OUT, - UsCaV1Field.SHARING_OPT_OUT, - UsCaV1Field.SENSITIVE_DATA_PROCESSING, - UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsCaV1Field.PERSONAL_DATA_CONSENTS, - UsCaV1Field.MSPA_COVERED_TRANSACTION, - UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE + public static List USCA_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCaField.VERSION, + UsCaField.SALE_OPT_OUT_NOTICE, + UsCaField.SHARING_OPT_OUT_NOTICE, + UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, + UsCaField.SALE_OPT_OUT, + UsCaField.SHARING_OPT_OUT, + UsCaField.SENSITIVE_DATA_PROCESSING, + UsCaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsCaField.PERSONAL_DATA_CONSENTS, + UsCaField.MSPA_COVERED_TRANSACTION, + UsCaField.MSPA_OPT_OUT_OPTION_MODE, + UsCaField.MSPA_SERVICE_PROVIDER_MODE }); //@formatter:on //@formatter:off - public static List USCAV1_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { - UsCaV1Field.GPC_SEGMENT_TYPE, - UsCaV1Field.GPC + public static List USCA_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCaField.GPC_SEGMENT_TYPE, + UsCaField.GPC }); //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoField.java similarity index 60% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoField.java index 36489c13..cae4e769 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCoField.java @@ -3,7 +3,7 @@ import java.util.Arrays; import java.util.List; -public class UsCoV1Field { +public class UsCoField { public static String VERSION = "Version"; public static String SHARING_NOTICE = "SharingNotice"; @@ -22,25 +22,25 @@ public class UsCoV1Field { public static String GPC = "Gpc"; //@formatter:off - public static List USCOV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { - UsCoV1Field.VERSION, - UsCoV1Field.SHARING_NOTICE, - UsCoV1Field.SALE_OPT_OUT_NOTICE, - UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UsCoV1Field.SALE_OPT_OUT, - UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, - UsCoV1Field.SENSITIVE_DATA_PROCESSING, - UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsCoV1Field.MSPA_COVERED_TRANSACTION, - UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE + public static List USCO_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCoField.VERSION, + UsCoField.SHARING_NOTICE, + UsCoField.SALE_OPT_OUT_NOTICE, + UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsCoField.SALE_OPT_OUT, + UsCoField.TARGETED_ADVERTISING_OPT_OUT, + UsCoField.SENSITIVE_DATA_PROCESSING, + UsCoField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsCoField.MSPA_COVERED_TRANSACTION, + UsCoField.MSPA_OPT_OUT_OPTION_MODE, + UsCoField.MSPA_SERVICE_PROVIDER_MODE }); //@formatter:on //@formatter:off - public static List USCOV1_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { - UsCoV1Field.GPC_SEGMENT_TYPE, - UsCoV1Field.GPC + public static List USCO_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCoField.GPC_SEGMENT_TYPE, + UsCoField.GPC }); //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtField.java similarity index 60% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtField.java index 31e67a69..9662e1e3 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsCtField.java @@ -3,7 +3,7 @@ import java.util.Arrays; import java.util.List; -public class UsCtV1Field { +public class UsCtField { public static String VERSION = "Version"; public static String SHARING_NOTICE = "SharingNotice"; @@ -22,25 +22,25 @@ public class UsCtV1Field { public static String GPC = "Gpc"; //@formatter:off - public static List USCTV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { - UsCtV1Field.VERSION, - UsCtV1Field.SHARING_NOTICE, - UsCtV1Field.SALE_OPT_OUT_NOTICE, - UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UsCtV1Field.SALE_OPT_OUT, - UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, - UsCtV1Field.SENSITIVE_DATA_PROCESSING, - UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsCtV1Field.MSPA_COVERED_TRANSACTION, - UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE + public static List USCT_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCtField.VERSION, + UsCtField.SHARING_NOTICE, + UsCtField.SALE_OPT_OUT_NOTICE, + UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsCtField.SALE_OPT_OUT, + UsCtField.TARGETED_ADVERTISING_OPT_OUT, + UsCtField.SENSITIVE_DATA_PROCESSING, + UsCtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsCtField.MSPA_COVERED_TRANSACTION, + UsCtField.MSPA_OPT_OUT_OPTION_MODE, + UsCtField.MSPA_SERVICE_PROVIDER_MODE }); //@formatter:on //@formatter:off - public static List USCTV1_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { - UsCtV1Field.GPC_SEGMENT_TYPE, - UsCtV1Field.GPC + public static List USCT_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsCtField.GPC_SEGMENT_TYPE, + UsCtField.GPC }); //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsFlField.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsFlField.java new file mode 100644 index 00000000..f3647a79 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsFlField.java @@ -0,0 +1,37 @@ +package com.iab.gpp.encoder.field; + +import java.util.Arrays; +import java.util.List; + +public class UsFlField { + + public static String VERSION = "Version"; + public static String PROCESSING_NOTICE = "ProcessingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String ADDITIONAL_DATA_PROCESSING_CONSENT = "AdditionalDataProcessingConsent"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + //@formatter:off + public static List USFL_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsFlField.VERSION, + UsFlField.PROCESSING_NOTICE, + UsFlField.SALE_OPT_OUT_NOTICE, + UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsFlField.SALE_OPT_OUT, + UsFlField.TARGETED_ADVERTISING_OPT_OUT, + UsFlField.SENSITIVE_DATA_PROCESSING, + UsFlField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsFlField.ADDITIONAL_DATA_PROCESSING_CONSENT, + UsFlField.MSPA_COVERED_TRANSACTION, + UsFlField.MSPA_OPT_OUT_OPTION_MODE, + UsFlField.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsMtField.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsMtField.java new file mode 100644 index 00000000..6b785f73 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsMtField.java @@ -0,0 +1,48 @@ +package com.iab.gpp.encoder.field; + +import java.util.Arrays; +import java.util.List; + +public class UsMtField { + + public static String VERSION = "Version"; + public static String SHARING_NOTICE = "SharingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String ADDITIONAL_DATA_PROCESSING_CONSENT = "AdditionalDataProcessingConsent"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; + public static String GPC = "Gpc"; + + //@formatter:off + public static List USMT_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsMtField.VERSION, + UsMtField.SHARING_NOTICE, + UsMtField.SALE_OPT_OUT_NOTICE, + UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsMtField.SALE_OPT_OUT, + UsMtField.TARGETED_ADVERTISING_OPT_OUT, + UsMtField.SENSITIVE_DATA_PROCESSING, + UsMtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsMtField.ADDITIONAL_DATA_PROCESSING_CONSENT, + UsMtField.MSPA_COVERED_TRANSACTION, + UsMtField.MSPA_OPT_OUT_OPTION_MODE, + UsMtField.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USMT_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsMtField.GPC_SEGMENT_TYPE, + UsMtField.GPC + }); + //@formatter:on +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatField.java similarity index 60% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatField.java index 0bdf0fb6..e18427b1 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNatField.java @@ -3,7 +3,7 @@ import java.util.Arrays; import java.util.List; -public class UsNatV1Field { +public class UsNatField { public static String VERSION = "Version"; public static String SHARING_NOTICE = "SharingNotice"; @@ -27,30 +27,30 @@ public class UsNatV1Field { public static String GPC = "Gpc"; //@formatter:off - public static List USNATV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { - UsNatV1Field.VERSION, - UsNatV1Field.SHARING_NOTICE, - UsNatV1Field.SALE_OPT_OUT_NOTICE, - UsNatV1Field.SHARING_OPT_OUT_NOTICE, - UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, - UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, - UsNatV1Field.SALE_OPT_OUT, - UsNatV1Field.SHARING_OPT_OUT, - UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, - UsNatV1Field.SENSITIVE_DATA_PROCESSING, - UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsNatV1Field.PERSONAL_DATA_CONSENTS, - UsNatV1Field.MSPA_COVERED_TRANSACTION, - UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE + public static List USNAT_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsNatField.VERSION, + UsNatField.SHARING_NOTICE, + UsNatField.SALE_OPT_OUT_NOTICE, + UsNatField.SHARING_OPT_OUT_NOTICE, + UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsNatField.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, + UsNatField.SALE_OPT_OUT, + UsNatField.SHARING_OPT_OUT, + UsNatField.TARGETED_ADVERTISING_OPT_OUT, + UsNatField.SENSITIVE_DATA_PROCESSING, + UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsNatField.PERSONAL_DATA_CONSENTS, + UsNatField.MSPA_COVERED_TRANSACTION, + UsNatField.MSPA_OPT_OUT_OPTION_MODE, + UsNatField.MSPA_SERVICE_PROVIDER_MODE }); //@formatter:on //@formatter:off - public static List USNATV1_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { - UsNatV1Field.GPC_SEGMENT_TYPE, - UsNatV1Field.GPC + public static List USNAT_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsNatField.GPC_SEGMENT_TYPE, + UsNatField.GPC }); //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsOrField.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsOrField.java new file mode 100644 index 00000000..3e9021c2 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsOrField.java @@ -0,0 +1,48 @@ +package com.iab.gpp.encoder.field; + +import java.util.Arrays; +import java.util.List; + +public class UsOrField { + + public static String VERSION = "Version"; + public static String PROCESSING_NOTICE = "ProcessingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String ADDITIONAL_DATA_PROCESSING_CONSENT = "AdditionalDataProcessingConsent"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; + public static String GPC = "Gpc"; + + //@formatter:off + public static List USOR_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsOrField.VERSION, + UsOrField.PROCESSING_NOTICE, + UsOrField.SALE_OPT_OUT_NOTICE, + UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsOrField.SALE_OPT_OUT, + UsOrField.TARGETED_ADVERTISING_OPT_OUT, + UsOrField.SENSITIVE_DATA_PROCESSING, + UsOrField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsOrField.ADDITIONAL_DATA_PROCESSING_CONSENT, + UsOrField.MSPA_COVERED_TRANSACTION, + UsOrField.MSPA_OPT_OUT_OPTION_MODE, + UsOrField.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USOR_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsOrField.GPC_SEGMENT_TYPE, + UsOrField.GPC + }); + //@formatter:on +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsTxField.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsTxField.java new file mode 100644 index 00000000..44ec7d69 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsTxField.java @@ -0,0 +1,48 @@ +package com.iab.gpp.encoder.field; + +import java.util.Arrays; +import java.util.List; + +public class UsTxField { + + public static String VERSION = "Version"; + public static String PROCESSING_NOTICE = "ProcessingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String ADDITIONAL_DATA_PROCESSING_CONSENT = "AdditionalDataProcessingConsent"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; + public static String GPC = "Gpc"; + + //@formatter:off + public static List USTX_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsTxField.VERSION, + UsTxField.PROCESSING_NOTICE, + UsTxField.SALE_OPT_OUT_NOTICE, + UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsTxField.SALE_OPT_OUT, + UsTxField.TARGETED_ADVERTISING_OPT_OUT, + UsTxField.SENSITIVE_DATA_PROCESSING, + UsTxField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsTxField.ADDITIONAL_DATA_PROCESSING_CONSENT, + UsTxField.MSPA_COVERED_TRANSACTION, + UsTxField.MSPA_OPT_OUT_OPTION_MODE, + UsTxField.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USTX_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsTxField.GPC_SEGMENT_TYPE, + UsTxField.GPC + }); + //@formatter:on +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtField.java similarity index 61% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtField.java index be7584a4..01cedc67 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsUtField.java @@ -3,7 +3,7 @@ import java.util.Arrays; import java.util.List; -public class UsUtV1Field { +public class UsUtField { public static String VERSION = "Version"; public static String SHARING_NOTICE = "SharingNotice"; @@ -19,19 +19,19 @@ public class UsUtV1Field { public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; //@formatter:off - public static List USUTV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { - UsUtV1Field.VERSION, - UsUtV1Field.SHARING_NOTICE, - UsUtV1Field.SALE_OPT_OUT_NOTICE, - UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, - UsUtV1Field.SALE_OPT_OUT, - UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, - UsUtV1Field.SENSITIVE_DATA_PROCESSING, - UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsUtV1Field.MSPA_COVERED_TRANSACTION, - UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE + public static List USUT_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsUtField.VERSION, + UsUtField.SHARING_NOTICE, + UsUtField.SALE_OPT_OUT_NOTICE, + UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsUtField.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + UsUtField.SALE_OPT_OUT, + UsUtField.TARGETED_ADVERTISING_OPT_OUT, + UsUtField.SENSITIVE_DATA_PROCESSING, + UsUtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsUtField.MSPA_COVERED_TRANSACTION, + UsUtField.MSPA_OPT_OUT_OPTION_MODE, + UsUtField.MSPA_SERVICE_PROVIDER_MODE }); //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaV1Field.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaField.java similarity index 61% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaV1Field.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaField.java index e926b916..46cb4dbb 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaV1Field.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsVaField.java @@ -3,7 +3,7 @@ import java.util.Arrays; import java.util.List; -public class UsVaV1Field { +public class UsVaField { public static String VERSION = "Version"; public static String SHARING_NOTICE = "SharingNotice"; @@ -18,18 +18,18 @@ public class UsVaV1Field { public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; //@formatter:off - public static List USVAV1_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { - UsVaV1Field.VERSION, - UsVaV1Field.SHARING_NOTICE, - UsVaV1Field.SALE_OPT_OUT_NOTICE, - UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, - UsVaV1Field.SALE_OPT_OUT, - UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, - UsVaV1Field.SENSITIVE_DATA_PROCESSING, - UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, - UsVaV1Field.MSPA_COVERED_TRANSACTION, - UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, - UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE + public static List USVA_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsVaField.VERSION, + UsVaField.SHARING_NOTICE, + UsVaField.SALE_OPT_OUT_NOTICE, + UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsVaField.SALE_OPT_OUT, + UsVaField.TARGETED_ADVERTISING_OPT_OUT, + UsVaField.SENSITIVE_DATA_PROCESSING, + UsVaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsVaField.MSPA_COVERED_TRANSACTION, + UsVaField.MSPA_OPT_OUT_OPTION_MODE, + UsVaField.MSPA_SERVICE_PROVIDER_MODE }); //@formatter:on } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java index 15647355..7a867374 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java @@ -18,12 +18,16 @@ public class Sections { SECTION_ID_NAME_MAP.put(TcfEuV2.ID, TcfEuV2.NAME); SECTION_ID_NAME_MAP.put(TcfCaV1.ID, TcfCaV1.NAME); SECTION_ID_NAME_MAP.put(UspV1.ID, UspV1.NAME); - SECTION_ID_NAME_MAP.put(UsNatV1.ID, UsNatV1.NAME); - SECTION_ID_NAME_MAP.put(UsCaV1.ID, UsCaV1.NAME); - SECTION_ID_NAME_MAP.put(UsVaV1.ID, UsVaV1.NAME); - SECTION_ID_NAME_MAP.put(UsCoV1.ID, UsCoV1.NAME); - SECTION_ID_NAME_MAP.put(UsUtV1.ID, UsUtV1.NAME); - SECTION_ID_NAME_MAP.put(UsCtV1.ID, UsCtV1.NAME); + SECTION_ID_NAME_MAP.put(UsNat.ID, UsNat.NAME); + SECTION_ID_NAME_MAP.put(UsCa.ID, UsCa.NAME); + SECTION_ID_NAME_MAP.put(UsVa.ID, UsVa.NAME); + SECTION_ID_NAME_MAP.put(UsCo.ID, UsCo.NAME); + SECTION_ID_NAME_MAP.put(UsUt.ID, UsUt.NAME); + SECTION_ID_NAME_MAP.put(UsCt.ID, UsCt.NAME); + SECTION_ID_NAME_MAP.put(UsFl.ID, UsFl.NAME); + SECTION_ID_NAME_MAP.put(UsMt.ID, UsMt.NAME); + SECTION_ID_NAME_MAP.put(UsOr.ID, UsOr.NAME); + SECTION_ID_NAME_MAP.put(UsTx.ID, UsTx.NAME); SECTION_ORDER = new ArrayList(SECTION_ID_NAME_MAP.keySet()).stream().sorted() .map(id -> SECTION_ID_NAME_MAP.get(id)).collect(Collectors.toList()); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCa.java similarity index 56% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCaV1.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCa.java index 03442533..e80c4680 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCa.java @@ -2,46 +2,46 @@ import java.util.ArrayList; import java.util.List; -import com.iab.gpp.encoder.field.UsCaV1Field; +import com.iab.gpp.encoder.field.UsCaField; import com.iab.gpp.encoder.segment.EncodableSegment; -import com.iab.gpp.encoder.segment.UsCaV1CoreSegment; -import com.iab.gpp.encoder.segment.UsCaV1GpcSegment; +import com.iab.gpp.encoder.segment.UsCaCoreSegment; +import com.iab.gpp.encoder.segment.UsCaGpcSegment; -public class UsCaV1 extends AbstractLazilyEncodableSection { +public class UsCa extends AbstractLazilyEncodableSection { public static int ID = 8; public static int VERSION = 1; - public static String NAME = "uscav1"; + public static String NAME = "usca"; - public UsCaV1() { + public UsCa() { super(); } - public UsCaV1(String encodedString) { + public UsCa(String encodedString) { super(); decode(encodedString); } @Override public int getId() { - return UsCaV1.ID; + return UsCa.ID; } @Override public String getName() { - return UsCaV1.NAME; + return UsCa.NAME; } @Override public int getVersion() { - return UsCaV1.VERSION; + return UsCa.VERSION; } @Override protected List initializeSegments() { List segments = new ArrayList<>(); - segments.add(new UsCaV1CoreSegment()); - segments.add(new UsCaV1GpcSegment()); + segments.add(new UsCaCoreSegment()); + segments.add(new UsCaGpcSegment()); return segments; } @@ -57,10 +57,10 @@ protected List decodeSection(String encodedString) { } if(encodedSegments.length > 1) { - segments.get(1).setFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED, true); + segments.get(1).setFieldValue(UsCaField.GPC_SEGMENT_INCLUDED, true); segments.get(1).decode(encodedSegments[1]); } else { - segments.get(1).setFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED, false); + segments.get(1).setFieldValue(UsCaField.GPC_SEGMENT_INCLUDED, false); } } @@ -73,7 +73,7 @@ protected String encodeSection(List segments) { if(!segments.isEmpty()) { encodedSegments.add(segments.get(0).encode()); - if(segments.size() >= 2 && segments.get(1).getFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED).equals(true)) { + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsCaField.GPC_SEGMENT_INCLUDED).equals(true)) { encodedSegments.add(segments.get(1).encode()); } } @@ -83,60 +83,60 @@ protected String encodeSection(List segments) { public Integer getSaleOptOutNotice() { - return (Integer) this.getFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsCaField.SALE_OPT_OUT_NOTICE); } public Integer getSensitiveDataLimitUseNotice() { - return (Integer) this.getFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE); + return (Integer) this.getFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE); } public Integer getSharingOptOutNotice() { - return (Integer) this.getFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.getFieldValue(UsCaV1Field.SALE_OPT_OUT); + return (Integer) this.getFieldValue(UsCaField.SALE_OPT_OUT); } public Integer getSharingOptOut() { - return (Integer) this.getFieldValue(UsCaV1Field.SHARING_OPT_OUT); + return (Integer) this.getFieldValue(UsCaField.SHARING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.getFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING); + return (List) this.getFieldValue(UsCaField.SENSITIVE_DATA_PROCESSING); } @SuppressWarnings("unchecked") public List getKnownChildSensitiveDataConsents() { - return (List) this.getFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + return (List) this.getFieldValue(UsCaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getPersonalDataConsents() { - return (Integer) this.getFieldValue(UsCaV1Field.PERSONAL_DATA_CONSENTS); + return (Integer) this.getFieldValue(UsCaField.PERSONAL_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.getFieldValue(UsCaV1Field.MSPA_COVERED_TRANSACTION); + return (Integer) this.getFieldValue(UsCaField.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.getFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE); + return (Integer) this.getFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.getFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE); + return (Integer) this.getFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE); } public Integer getGpcSegmentType() { - return (Integer) this.getFieldValue(UsCaV1Field.GPC_SEGMENT_TYPE); + return (Integer) this.getFieldValue(UsCaField.GPC_SEGMENT_TYPE); } public Boolean getGpcSegmentIncluded() { - return (Boolean) this.getFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED); + return (Boolean) this.getFieldValue(UsCaField.GPC_SEGMENT_INCLUDED); } public Boolean getGpc() { - return (Boolean) this.getFieldValue(UsCaV1Field.GPC); + return (Boolean) this.getFieldValue(UsCaField.GPC); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCoV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCo.java similarity index 56% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCoV1.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCo.java index 22bd56a6..9e5495c0 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCoV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCo.java @@ -2,46 +2,46 @@ import java.util.ArrayList; import java.util.List; -import com.iab.gpp.encoder.field.UsCoV1Field; +import com.iab.gpp.encoder.field.UsCoField; import com.iab.gpp.encoder.segment.EncodableSegment; -import com.iab.gpp.encoder.segment.UsCoV1CoreSegment; -import com.iab.gpp.encoder.segment.UsCoV1GpcSegment; +import com.iab.gpp.encoder.segment.UsCoCoreSegment; +import com.iab.gpp.encoder.segment.UsCoGpcSegment; -public class UsCoV1 extends AbstractLazilyEncodableSection { +public class UsCo extends AbstractLazilyEncodableSection { public static int ID = 10; public static int VERSION = 1; - public static String NAME = "uscov1"; + public static String NAME = "usco"; - public UsCoV1() { + public UsCo() { super(); } - public UsCoV1(String encodedString) { + public UsCo(String encodedString) { super(); decode(encodedString); } @Override public int getId() { - return UsCoV1.ID; + return UsCo.ID; } @Override public String getName() { - return UsCoV1.NAME; + return UsCo.NAME; } @Override public int getVersion() { - return UsCoV1.VERSION; + return UsCo.VERSION; } @Override protected List initializeSegments() { List segments = new ArrayList<>(); - segments.add(new UsCoV1CoreSegment()); - segments.add(new UsCoV1GpcSegment()); + segments.add(new UsCoCoreSegment()); + segments.add(new UsCoGpcSegment()); return segments; } @@ -57,10 +57,10 @@ protected List decodeSection(String encodedString) { } if(encodedSegments.length > 1) { - segments.get(1).setFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED, true); + segments.get(1).setFieldValue(UsCoField.GPC_SEGMENT_INCLUDED, true); segments.get(1).decode(encodedSegments[1]); } else { - segments.get(1).setFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED, false); + segments.get(1).setFieldValue(UsCoField.GPC_SEGMENT_INCLUDED, false); } } @@ -73,7 +73,7 @@ protected String encodeSection(List segments) { if(!segments.isEmpty()) { encodedSegments.add(segments.get(0).encode()); - if(segments.size() >= 2 && segments.get(1).getFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED).equals(true)) { + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsCoField.GPC_SEGMENT_INCLUDED).equals(true)) { encodedSegments.add(segments.get(1).encode()); } } @@ -83,55 +83,55 @@ protected String encodeSection(List segments) { public Integer getSharingNotice() { - return (Integer) this.getFieldValue(UsCoV1Field.SHARING_NOTICE); + return (Integer) this.getFieldValue(UsCoField.SHARING_NOTICE); } public Integer getSaleOptOutNotice() { - return (Integer) this.getFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsCoField.SALE_OPT_OUT_NOTICE); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.getFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.getFieldValue(UsCoV1Field.SALE_OPT_OUT); + return (Integer) this.getFieldValue(UsCoField.SALE_OPT_OUT); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.getFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT); + return (Integer) this.getFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.getFieldValue(UsCoV1Field.SENSITIVE_DATA_PROCESSING); + return (List) this.getFieldValue(UsCoField.SENSITIVE_DATA_PROCESSING); } public Integer getKnownChildSensitiveDataConsents() { - return (Integer) this.getFieldValue(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + return (Integer) this.getFieldValue(UsCoField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.getFieldValue(UsCoV1Field.MSPA_COVERED_TRANSACTION); + return (Integer) this.getFieldValue(UsCoField.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.getFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE); + return (Integer) this.getFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.getFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE); + return (Integer) this.getFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE); } public Integer getGpcSegmentType() { - return (Integer) this.getFieldValue(UsCoV1Field.GPC_SEGMENT_TYPE); + return (Integer) this.getFieldValue(UsCoField.GPC_SEGMENT_TYPE); } public Boolean getGpcSegmentIncluded() { - return (Boolean) this.getFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED); + return (Boolean) this.getFieldValue(UsCoField.GPC_SEGMENT_INCLUDED); } public Boolean getGpc() { - return (Boolean) this.getFieldValue(UsCoV1Field.GPC); + return (Boolean) this.getFieldValue(UsCoField.GPC); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCt.java similarity index 56% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCtV1.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCt.java index 2acd3f2f..0f2f9569 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsCt.java @@ -2,46 +2,46 @@ import java.util.ArrayList; import java.util.List; -import com.iab.gpp.encoder.field.UsCtV1Field; +import com.iab.gpp.encoder.field.UsCtField; import com.iab.gpp.encoder.segment.EncodableSegment; -import com.iab.gpp.encoder.segment.UsCtV1CoreSegment; -import com.iab.gpp.encoder.segment.UsCtV1GpcSegment; +import com.iab.gpp.encoder.segment.UsCtCoreSegment; +import com.iab.gpp.encoder.segment.UsCtGpcSegment; -public class UsCtV1 extends AbstractLazilyEncodableSection { +public class UsCt extends AbstractLazilyEncodableSection { public static int ID = 12; public static int VERSION = 1; - public static String NAME = "usctv1"; + public static String NAME = "usct"; - public UsCtV1() { + public UsCt() { super(); } - public UsCtV1(String encodedString) { + public UsCt(String encodedString) { super(); decode(encodedString); } @Override public int getId() { - return UsCtV1.ID; + return UsCt.ID; } @Override public String getName() { - return UsCtV1.NAME; + return UsCt.NAME; } @Override public int getVersion() { - return UsCtV1.VERSION; + return UsCt.VERSION; } @Override protected List initializeSegments() { List segments = new ArrayList<>(); - segments.add(new UsCtV1CoreSegment()); - segments.add(new UsCtV1GpcSegment()); + segments.add(new UsCtCoreSegment()); + segments.add(new UsCtGpcSegment()); return segments; } @@ -57,10 +57,10 @@ protected List decodeSection(String encodedString) { } if(encodedSegments.length > 1) { - segments.get(1).setFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED, true); + segments.get(1).setFieldValue(UsCtField.GPC_SEGMENT_INCLUDED, true); segments.get(1).decode(encodedSegments[1]); } else { - segments.get(1).setFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED, false); + segments.get(1).setFieldValue(UsCtField.GPC_SEGMENT_INCLUDED, false); } } @@ -73,7 +73,7 @@ protected String encodeSection(List segments) { if(!segments.isEmpty()) { encodedSegments.add(segments.get(0).encode()); - if(segments.size() >= 2 && segments.get(1).getFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED).equals(true)) { + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsCtField.GPC_SEGMENT_INCLUDED).equals(true)) { encodedSegments.add(segments.get(1).encode()); } } @@ -83,56 +83,56 @@ protected String encodeSection(List segments) { public Integer getSharingNotice() { - return (Integer) this.getFieldValue(UsCtV1Field.SHARING_NOTICE); + return (Integer) this.getFieldValue(UsCtField.SHARING_NOTICE); } public Integer getSaleOptOutNotice() { - return (Integer) this.getFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsCtField.SALE_OPT_OUT_NOTICE); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.getFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.getFieldValue(UsCtV1Field.SALE_OPT_OUT); + return (Integer) this.getFieldValue(UsCtField.SALE_OPT_OUT); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.getFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT); + return (Integer) this.getFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.getFieldValue(UsCtV1Field.SENSITIVE_DATA_PROCESSING); + return (List) this.getFieldValue(UsCtField.SENSITIVE_DATA_PROCESSING); } @SuppressWarnings("unchecked") public List getKnownChildSensitiveDataConsents() { - return (List) this.getFieldValue(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + return (List) this.getFieldValue(UsCtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.getFieldValue(UsCtV1Field.MSPA_COVERED_TRANSACTION); + return (Integer) this.getFieldValue(UsCtField.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.getFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE); + return (Integer) this.getFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.getFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE); + return (Integer) this.getFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE); } public Integer getGpcSegmentType() { - return (Integer) this.getFieldValue(UsCtV1Field.GPC_SEGMENT_TYPE); + return (Integer) this.getFieldValue(UsCtField.GPC_SEGMENT_TYPE); } public Boolean getGpcSegmentIncluded() { - return (Boolean) this.getFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED); + return (Boolean) this.getFieldValue(UsCtField.GPC_SEGMENT_INCLUDED); } public Boolean getGpc() { - return (Boolean) this.getFieldValue(UsCtV1Field.GPC); + return (Boolean) this.getFieldValue(UsCtField.GPC); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsFl.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsFl.java new file mode 100644 index 00000000..8c568479 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsFl.java @@ -0,0 +1,118 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.field.UsFlField; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsFlCoreSegment; + +public class UsFl extends AbstractLazilyEncodableSection { + + public static int ID = 13; + public static int VERSION = 1; + public static String NAME = "usfl"; + + public UsFl() { + super(); + } + + public UsFl(String encodedString) { + super(); + decode(encodedString); + } + + @Override + public int getId() { + return UsFl.ID; + } + + @Override + public String getName() { + return UsFl.NAME; + } + + @Override + public int getVersion() { + return UsFl.VERSION; + } + + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsFlCoreSegment()); + return segments; + } + + @Override + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + for (int i = 0; i < segments.size(); i++) { + if (encodedSegments.length > i) { + segments.get(i).decode(encodedSegments[i]); + } + } + } + + return segments; + } + + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + for (EncodableSegment segment : segments) { + encodedSegments.add(segment.encode()); + } + return String.join(".", encodedSegments); + } + + + public Integer getProcessingNotice() { + return (Integer) this.getFieldValue(UsFlField.PROCESSING_NOTICE); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.getFieldValue(UsFlField.SALE_OPT_OUT_NOTICE); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.getFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + } + + public Integer getSaleOptOut() { + return (Integer) this.getFieldValue(UsFlField.SALE_OPT_OUT); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.getFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.getFieldValue(UsFlField.SENSITIVE_DATA_PROCESSING); + } + + @SuppressWarnings("unchecked") + public List getKnownChildSensitiveDataConsents() { + return (List) this.getFieldValue(UsFlField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + } + + public Integer getAdditionalDataProcessingConsent() { + return (Integer) this.getFieldValue(UsFlField.ADDITIONAL_DATA_PROCESSING_CONSENT); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.getFieldValue(UsFlField.MSPA_COVERED_TRANSACTION); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.getFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.getFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsMt.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsMt.java new file mode 100644 index 00000000..faf5a235 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsMt.java @@ -0,0 +1,142 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.field.UsMtField; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsMtCoreSegment; +import com.iab.gpp.encoder.segment.UsMtGpcSegment; + +public class UsMt extends AbstractLazilyEncodableSection { + + public static int ID = 14; + public static int VERSION = 1; + public static String NAME = "usmt"; + + public UsMt() { + super(); + } + + public UsMt(String encodedString) { + super(); + decode(encodedString); + } + + @Override + public int getId() { + return UsMt.ID; + } + + @Override + public String getName() { + return UsMt.NAME; + } + + @Override + public int getVersion() { + return UsMt.VERSION; + } + + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsMtCoreSegment()); + segments.add(new UsMtGpcSegment()); + return segments; + } + + @Override + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if(encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if(encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsMtField.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsMtField.GPC_SEGMENT_INCLUDED, false); + } + } + + return segments; + } + + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if(!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsMtField.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); + } + + + public Integer getSharingNotice() { + return (Integer) this.getFieldValue(UsMtField.SHARING_NOTICE); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.getFieldValue(UsMtField.SALE_OPT_OUT_NOTICE); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.getFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + } + + public Integer getSaleOptOut() { + return (Integer) this.getFieldValue(UsMtField.SALE_OPT_OUT); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.getFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.getFieldValue(UsMtField.SENSITIVE_DATA_PROCESSING); + } + + @SuppressWarnings("unchecked") + public List getKnownChildSensitiveDataConsents() { + return (List) this.getFieldValue(UsMtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + } + + public Integer getAdditionalDataProcessingConsent() { + return (Integer) this.getFieldValue(UsMtField.ADDITIONAL_DATA_PROCESSING_CONSENT); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.getFieldValue(UsMtField.MSPA_COVERED_TRANSACTION); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.getFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.getFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE); + } + + public Integer getGpcSegmentType() { + return (Integer) this.getFieldValue(UsMtField.GPC_SEGMENT_TYPE); + } + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.getFieldValue(UsMtField.GPC_SEGMENT_INCLUDED); + } + + public Boolean getGpc() { + return (Boolean) this.getFieldValue(UsMtField.GPC); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNatV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNat.java similarity index 53% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNatV1.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNat.java index 0f0811cf..a32950d8 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNatV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNat.java @@ -2,46 +2,46 @@ import java.util.ArrayList; import java.util.List; -import com.iab.gpp.encoder.field.UsNatV1Field; +import com.iab.gpp.encoder.field.UsNatField; import com.iab.gpp.encoder.segment.EncodableSegment; -import com.iab.gpp.encoder.segment.UsNatV1CoreSegment; -import com.iab.gpp.encoder.segment.UsNatV1GpcSegment; +import com.iab.gpp.encoder.segment.UsNatCoreSegment; +import com.iab.gpp.encoder.segment.UsNatGpcSegment; -public class UsNatV1 extends AbstractLazilyEncodableSection { +public class UsNat extends AbstractLazilyEncodableSection { public static int ID = 7; public static int VERSION = 1; - public static String NAME = "usnatv1"; + public static String NAME = "usnat"; - public UsNatV1() { + public UsNat() { super(); } - public UsNatV1(String encodedString) { + public UsNat(String encodedString) { super(); decode(encodedString); } @Override public int getId() { - return UsNatV1.ID; + return UsNat.ID; } @Override public String getName() { - return UsNatV1.NAME; + return UsNat.NAME; } @Override public int getVersion() { - return UsNatV1.VERSION; + return UsNat.VERSION; } @Override protected List initializeSegments() { List segments = new ArrayList<>(); - segments.add(new UsNatV1CoreSegment()); - segments.add(new UsNatV1GpcSegment()); + segments.add(new UsNatCoreSegment()); + segments.add(new UsNatGpcSegment()); return segments; } @@ -57,10 +57,10 @@ protected List decodeSection(String encodedString) { } if(encodedSegments.length > 1) { - segments.get(1).setFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED, true); + segments.get(1).setFieldValue(UsNatField.GPC_SEGMENT_INCLUDED, true); segments.get(1).decode(encodedSegments[1]); } else { - segments.get(1).setFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED, false); + segments.get(1).setFieldValue(UsNatField.GPC_SEGMENT_INCLUDED, false); } } @@ -73,7 +73,7 @@ protected String encodeSection(List segments) { if(!segments.isEmpty()) { encodedSegments.add(segments.get(0).encode()); - if(segments.size() >= 2 && segments.get(1).getFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED).equals(true)) { + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsNatField.GPC_SEGMENT_INCLUDED).equals(true)) { encodedSegments.add(segments.get(1).encode()); } } @@ -83,76 +83,76 @@ protected String encodeSection(List segments) { public Integer getSharingNotice() { - return (Integer) this.getFieldValue(UsNatV1Field.SHARING_NOTICE); + return (Integer) this.getFieldValue(UsNatField.SHARING_NOTICE); } public Integer getSaleOptOutNotice() { - return (Integer) this.getFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsNatField.SALE_OPT_OUT_NOTICE); } public Integer getSharingOptOutNotice() { - return (Integer) this.getFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.getFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); } public Integer getSensitiveDataProcessingOptOutNotice() { - return (Integer) this.getFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE); } public Integer getSensitiveDataLimitUseNotice() { - return (Integer) this.getFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE); + return (Integer) this.getFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.getFieldValue(UsNatV1Field.SALE_OPT_OUT); + return (Integer) this.getFieldValue(UsNatField.SALE_OPT_OUT); } public Integer getSharingOptOut() { - return (Integer) this.getFieldValue(UsNatV1Field.SHARING_OPT_OUT); + return (Integer) this.getFieldValue(UsNatField.SHARING_OPT_OUT); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.getFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT); + return (Integer) this.getFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.getFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING); + return (List) this.getFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING); } @SuppressWarnings("unchecked") public List getKnownChildSensitiveDataConsents() { - return (List) this.getFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + return (List) this.getFieldValue(UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getPersonalDataConsents() { - return (Integer) this.getFieldValue(UsNatV1Field.PERSONAL_DATA_CONSENTS); + return (Integer) this.getFieldValue(UsNatField.PERSONAL_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.getFieldValue(UsNatV1Field.MSPA_COVERED_TRANSACTION); + return (Integer) this.getFieldValue(UsNatField.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.getFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE); + return (Integer) this.getFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.getFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE); + return (Integer) this.getFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE); } public Integer getGpcSegmentType() { - return (Integer) this.getFieldValue(UsNatV1Field.GPC_SEGMENT_TYPE); + return (Integer) this.getFieldValue(UsNatField.GPC_SEGMENT_TYPE); } public Boolean getGpcSegmentIncluded() { - return (Boolean) this.getFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED); + return (Boolean) this.getFieldValue(UsNatField.GPC_SEGMENT_INCLUDED); } public Boolean getGpc() { - return (Boolean) this.getFieldValue(UsNatV1Field.GPC); + return (Boolean) this.getFieldValue(UsNatField.GPC); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsOr.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsOr.java new file mode 100644 index 00000000..632e455f --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsOr.java @@ -0,0 +1,142 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.field.UsOrField; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsOrCoreSegment; +import com.iab.gpp.encoder.segment.UsOrGpcSegment; + +public class UsOr extends AbstractLazilyEncodableSection { + + public static int ID = 15; + public static int VERSION = 1; + public static String NAME = "usor"; + + public UsOr() { + super(); + } + + public UsOr(String encodedString) { + super(); + decode(encodedString); + } + + @Override + public int getId() { + return UsOr.ID; + } + + @Override + public String getName() { + return UsOr.NAME; + } + + @Override + public int getVersion() { + return UsOr.VERSION; + } + + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsOrCoreSegment()); + segments.add(new UsOrGpcSegment()); + return segments; + } + + @Override + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if(encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if(encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsOrField.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsOrField.GPC_SEGMENT_INCLUDED, false); + } + } + + return segments; + } + + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if(!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsOrField.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); + } + + + public Integer getProcessingNotice() { + return (Integer) this.getFieldValue(UsOrField.PROCESSING_NOTICE); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.getFieldValue(UsOrField.SALE_OPT_OUT_NOTICE); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.getFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + } + + public Integer getSaleOptOut() { + return (Integer) this.getFieldValue(UsOrField.SALE_OPT_OUT); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.getFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.getFieldValue(UsOrField.SENSITIVE_DATA_PROCESSING); + } + + @SuppressWarnings("unchecked") + public List getKnownChildSensitiveDataConsents() { + return (List) this.getFieldValue(UsOrField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + } + + public Integer getAdditionalDataProcessingConsent() { + return (Integer) this.getFieldValue(UsOrField.ADDITIONAL_DATA_PROCESSING_CONSENT); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.getFieldValue(UsOrField.MSPA_COVERED_TRANSACTION); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.getFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.getFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE); + } + + public Integer getGpcSegmentType() { + return (Integer) this.getFieldValue(UsOrField.GPC_SEGMENT_TYPE); + } + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.getFieldValue(UsOrField.GPC_SEGMENT_INCLUDED); + } + + public Boolean getGpc() { + return (Boolean) this.getFieldValue(UsOrField.GPC); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsTx.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsTx.java new file mode 100644 index 00000000..ea4fc86e --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsTx.java @@ -0,0 +1,141 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.field.UsTxField; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsTxCoreSegment; +import com.iab.gpp.encoder.segment.UsTxGpcSegment; + +public class UsTx extends AbstractLazilyEncodableSection { + + public static int ID = 16; + public static int VERSION = 1; + public static String NAME = "ustx"; + + public UsTx() { + super(); + } + + public UsTx(String encodedString) { + super(); + decode(encodedString); + } + + @Override + public int getId() { + return UsTx.ID; + } + + @Override + public String getName() { + return UsTx.NAME; + } + + @Override + public int getVersion() { + return UsTx.VERSION; + } + + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsTxCoreSegment()); + segments.add(new UsTxGpcSegment()); + return segments; + } + + @Override + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if(encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if(encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsTxField.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsTxField.GPC_SEGMENT_INCLUDED, false); + } + } + + return segments; + } + + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if(!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsTxField.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); + } + + + public Integer getProcessingNotice() { + return (Integer) this.getFieldValue(UsTxField.PROCESSING_NOTICE); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.getFieldValue(UsTxField.SALE_OPT_OUT_NOTICE); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.getFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + } + + public Integer getSaleOptOut() { + return (Integer) this.getFieldValue(UsTxField.SALE_OPT_OUT); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.getFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.getFieldValue(UsTxField.SENSITIVE_DATA_PROCESSING); + } + + public Integer getKnownChildSensitiveDataConsents() { + return (Integer) this.getFieldValue(UsTxField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + } + + public Integer getAdditionalDataProcessingConsent() { + return (Integer) this.getFieldValue(UsTxField.ADDITIONAL_DATA_PROCESSING_CONSENT); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.getFieldValue(UsTxField.MSPA_COVERED_TRANSACTION); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.getFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.getFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE); + } + + public Integer getGpcSegmentType() { + return (Integer) this.getFieldValue(UsTxField.GPC_SEGMENT_TYPE); + } + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.getFieldValue(UsTxField.GPC_SEGMENT_INCLUDED); + } + + public Boolean getGpc() { + return (Boolean) this.getFieldValue(UsTxField.GPC); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUtV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUt.java similarity index 60% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUtV1.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUt.java index a73a0b6f..1c605fec 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUtV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsUt.java @@ -2,44 +2,44 @@ import java.util.ArrayList; import java.util.List; -import com.iab.gpp.encoder.field.UsUtV1Field; +import com.iab.gpp.encoder.field.UsUtField; import com.iab.gpp.encoder.segment.EncodableSegment; -import com.iab.gpp.encoder.segment.UsUtV1CoreSegment; +import com.iab.gpp.encoder.segment.UsUtCoreSegment; -public class UsUtV1 extends AbstractLazilyEncodableSection { +public class UsUt extends AbstractLazilyEncodableSection { public static int ID = 11; public static int VERSION = 1; - public static String NAME = "usutv1"; + public static String NAME = "usut"; - public UsUtV1() { + public UsUt() { super(); } - public UsUtV1(String encodedString) { + public UsUt(String encodedString) { super(); decode(encodedString); } @Override public int getId() { - return UsUtV1.ID; + return UsUt.ID; } @Override public String getName() { - return UsUtV1.NAME; + return UsUt.NAME; } @Override public int getVersion() { - return UsUtV1.VERSION; + return UsUt.VERSION; } @Override protected List initializeSegments() { List segments = new ArrayList<>(); - segments.add(new UsUtV1CoreSegment()); + segments.add(new UsUtCoreSegment()); return segments; } @@ -71,48 +71,48 @@ protected String encodeSection(List segments) { public Integer getSharingNotice() { - return (Integer) this.getFieldValue(UsUtV1Field.SHARING_NOTICE); + return (Integer) this.getFieldValue(UsUtField.SHARING_NOTICE); } public Integer getSaleOptOutNotice() { - return (Integer) this.getFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsUtField.SALE_OPT_OUT_NOTICE); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.getFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); } public Integer getSensitiveDataProcessingOptOutNotice() { - return (Integer) this.getFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsUtField.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.getFieldValue(UsUtV1Field.SALE_OPT_OUT); + return (Integer) this.getFieldValue(UsUtField.SALE_OPT_OUT); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.getFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT); + return (Integer) this.getFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.getFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING); + return (List) this.getFieldValue(UsUtField.SENSITIVE_DATA_PROCESSING); } public Integer getKnownChildSensitiveDataConsents() { - return (Integer) this.getFieldValue(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + return (Integer) this.getFieldValue(UsUtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.getFieldValue(UsUtV1Field.MSPA_COVERED_TRANSACTION); + return (Integer) this.getFieldValue(UsUtField.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.getFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE); + return (Integer) this.getFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.getFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE); + return (Integer) this.getFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE); } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVaV1.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVa.java similarity index 61% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVaV1.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVa.java index 6695b943..568c6575 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVaV1.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsVa.java @@ -2,44 +2,44 @@ import java.util.ArrayList; import java.util.List; -import com.iab.gpp.encoder.field.UsVaV1Field; +import com.iab.gpp.encoder.field.UsVaField; import com.iab.gpp.encoder.segment.EncodableSegment; -import com.iab.gpp.encoder.segment.UsVaV1CoreSegment; +import com.iab.gpp.encoder.segment.UsVaCoreSegment; -public class UsVaV1 extends AbstractLazilyEncodableSection { +public class UsVa extends AbstractLazilyEncodableSection { public static int ID = 9; public static int VERSION = 1; - public static String NAME = "usvav1"; + public static String NAME = "usva"; - public UsVaV1() { + public UsVa() { super(); } - public UsVaV1(String encodedString) { + public UsVa(String encodedString) { super(); decode(encodedString); } @Override public int getId() { - return UsVaV1.ID; + return UsVa.ID; } @Override public String getName() { - return UsVaV1.NAME; + return UsVa.NAME; } @Override public int getVersion() { - return UsVaV1.VERSION; + return UsVa.VERSION; } @Override protected List initializeSegments() { List segments = new ArrayList<>(); - segments.add(new UsVaV1CoreSegment()); + segments.add(new UsVaCoreSegment()); return segments; } @@ -71,43 +71,43 @@ protected String encodeSection(List segments) { public Integer getSharingNotice() { - return (Integer) this.getFieldValue(UsVaV1Field.SHARING_NOTICE); + return (Integer) this.getFieldValue(UsVaField.SHARING_NOTICE); } public Integer getSaleOptOutNotice() { - return (Integer) this.getFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsVaField.SALE_OPT_OUT_NOTICE); } public Integer getTargetedAdvertisingOptOutNotice() { - return (Integer) this.getFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + return (Integer) this.getFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); } public Integer getSaleOptOut() { - return (Integer) this.getFieldValue(UsVaV1Field.SALE_OPT_OUT); + return (Integer) this.getFieldValue(UsVaField.SALE_OPT_OUT); } public Integer getTargetedAdvertisingOptOut() { - return (Integer) this.getFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT); + return (Integer) this.getFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT); } @SuppressWarnings("unchecked") public List getSensitiveDataProcessing() { - return (List) this.getFieldValue(UsVaV1Field.SENSITIVE_DATA_PROCESSING); + return (List) this.getFieldValue(UsVaField.SENSITIVE_DATA_PROCESSING); } public Integer getKnownChildSensitiveDataConsents() { - return (Integer) this.getFieldValue(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + return (Integer) this.getFieldValue(UsVaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); } public Integer getMspaCoveredTransaction() { - return (Integer) this.getFieldValue(UsVaV1Field.MSPA_COVERED_TRANSACTION); + return (Integer) this.getFieldValue(UsVaField.MSPA_COVERED_TRANSACTION); } public Integer getMspaOptOutOptionMode() { - return (Integer) this.getFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE); + return (Integer) this.getFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE); } public Integer getMspaServiceProviderMode() { - return (Integer) this.getFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE); + return (Integer) this.getFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE); } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaCoreSegment.java similarity index 81% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaCoreSegment.java index 73738284..19cebffd 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaCoreSegment.java @@ -11,26 +11,26 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; -import com.iab.gpp.encoder.field.UsCaV1Field; -import com.iab.gpp.encoder.section.UsCaV1; +import com.iab.gpp.encoder.field.UsCaField; +import com.iab.gpp.encoder.section.UsCa; -public class UsCaV1CoreSegment extends AbstractLazilyEncodableSegment { +public class UsCaCoreSegment extends AbstractLazilyEncodableSegment { private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); - public UsCaV1CoreSegment() { + public UsCaCoreSegment() { super(); } - public UsCaV1CoreSegment(String encodedString) { + public UsCaCoreSegment(String encodedString) { super(); this.decode(encodedString); } @Override public List getFieldNames() { - return UsCaV1Field.USCAV1_CORE_SEGMENT_FIELD_NAMES; + return UsCaField.USCA_CORE_SEGMENT_FIELD_NAMES; } @Override @@ -47,29 +47,29 @@ protected EncodableBitStringFields initializeFields() { }); EncodableBitStringFields fields = new EncodableBitStringFields(); - fields.put(UsCaV1Field.VERSION, new EncodableFixedInteger(6, UsCaV1.VERSION)); - fields.put(UsCaV1Field.SALE_OPT_OUT_NOTICE, + fields.put(UsCaField.VERSION, new EncodableFixedInteger(6, UsCa.VERSION)); + fields.put(UsCaField.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCaV1Field.SHARING_OPT_OUT_NOTICE, + fields.put(UsCaField.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, + fields.put(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCaV1Field.SALE_OPT_OUT, + fields.put(UsCaField.SALE_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCaV1Field.SHARING_OPT_OUT, + fields.put(UsCaField.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCaV1Field.SENSITIVE_DATA_PROCESSING, + fields.put(UsCaField.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0)) .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); - fields.put(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0)) + fields.put(UsCaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0)) .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); - fields.put(UsCaV1Field.PERSONAL_DATA_CONSENTS, + fields.put(UsCaField.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCaV1Field.MSPA_COVERED_TRANSACTION, + fields.put(UsCaField.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, + fields.put(UsCaField.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, + fields.put(UsCaField.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -90,22 +90,22 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } catch (Exception e) { - throw new DecodingException("Unable to decode UsCaV1CoreSegment '" + encodedString + "'", e); + throw new DecodingException("Unable to decode UsCaCoreSegment '" + encodedString + "'", e); } } @Override public void validate() { - Integer sharingOptOutNotice = ((EncodableFixedInteger) fields.get(UsCaV1Field.SHARING_OPT_OUT_NOTICE)).getValue(); - Integer sharingOptOut = ((EncodableFixedInteger) fields.get(UsCaV1Field.SHARING_OPT_OUT)).getValue(); - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCaV1Field.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCaV1Field.SALE_OPT_OUT)).getValue(); + Integer sharingOptOutNotice = ((EncodableFixedInteger) fields.get(UsCaField.SHARING_OPT_OUT_NOTICE)).getValue(); + Integer sharingOptOut = ((EncodableFixedInteger) fields.get(UsCaField.SHARING_OPT_OUT)).getValue(); + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCaField.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCaField.SALE_OPT_OUT)).getValue(); Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsCaField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsCaField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); Integer sensitiveDataLimtUserNotice = - ((EncodableFixedInteger) fields.get(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE)).getValue(); + ((EncodableFixedInteger) fields.get(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE)).getValue(); if (sharingOptOutNotice == 0) { if (sharingOptOut != 0) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaGpcSegment.java similarity index 72% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1GpcSegment.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaGpcSegment.java index b10649a3..19a36702 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1GpcSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaGpcSegment.java @@ -8,33 +8,33 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; -import com.iab.gpp.encoder.field.UsCtV1Field; +import com.iab.gpp.encoder.field.UsCaField; -public class UsCtV1GpcSegment extends AbstractLazilyEncodableSegment { +public class UsCaGpcSegment extends AbstractLazilyEncodableSegment { private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); - public UsCtV1GpcSegment() { + public UsCaGpcSegment() { super(); } - public UsCtV1GpcSegment(String encodedString) { + public UsCaGpcSegment(String encodedString) { super(); this.decode(encodedString); } @Override public List getFieldNames() { - return UsCtV1Field.USCTV1_GPC_SEGMENT_FIELD_NAMES; + return UsCaField.USCA_GPC_SEGMENT_FIELD_NAMES; } @Override protected EncodableBitStringFields initializeFields() { EncodableBitStringFields fields = new EncodableBitStringFields(); - fields.put(UsCtV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UsCtV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UsCtV1Field.GPC, new EncodableBoolean(false)); + fields.put(UsCaField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsCaField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsCaField.GPC, new EncodableBoolean(false)); return fields; } @@ -54,7 +54,7 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } catch (Exception e) { - throw new DecodingException("Unable to decode UsCtV1GpcSegment '" + encodedString + "'", e); + throw new DecodingException("Unable to decode UsCaGpcSegment '" + encodedString + "'", e); } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoCoreSegment.java similarity index 80% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoCoreSegment.java index 5fc86ff3..16ef9cd1 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoCoreSegment.java @@ -11,26 +11,26 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; -import com.iab.gpp.encoder.field.UsCoV1Field; -import com.iab.gpp.encoder.section.UsCoV1; +import com.iab.gpp.encoder.field.UsCoField; +import com.iab.gpp.encoder.section.UsCo; -public class UsCoV1CoreSegment extends AbstractLazilyEncodableSegment { +public class UsCoCoreSegment extends AbstractLazilyEncodableSegment { private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); - public UsCoV1CoreSegment() { + public UsCoCoreSegment() { super(); } - public UsCoV1CoreSegment(String encodedString) { + public UsCoCoreSegment(String encodedString) { super(); this.decode(encodedString); } @Override public List getFieldNames() { - return UsCoV1Field.USCOV1_CORE_SEGMENT_FIELD_NAMES; + return UsCoField.USCO_CORE_SEGMENT_FIELD_NAMES; } @Override @@ -47,27 +47,27 @@ protected EncodableBitStringFields initializeFields() { }); EncodableBitStringFields fields = new EncodableBitStringFields(); - fields.put(UsCoV1Field.VERSION, new EncodableFixedInteger(6, UsCoV1.VERSION)); - fields.put(UsCoV1Field.SHARING_NOTICE, + fields.put(UsCoField.VERSION, new EncodableFixedInteger(6, UsCo.VERSION)); + fields.put(UsCoField.SHARING_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCoV1Field.SALE_OPT_OUT_NOTICE, + fields.put(UsCoField.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + fields.put(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCoV1Field.SALE_OPT_OUT, + fields.put(UsCoField.SALE_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, + fields.put(UsCoField.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCoV1Field.SENSITIVE_DATA_PROCESSING, + fields.put(UsCoField.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0)) .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); - fields.put(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + fields.put(UsCoField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCoV1Field.MSPA_COVERED_TRANSACTION, + fields.put(UsCoField.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, + fields.put(UsCoField.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, + fields.put(UsCoField.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -88,22 +88,22 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } catch (Exception e) { - throw new DecodingException("Unable to decode UsCoV1CoreSegment '" + encodedString + "'", e); + throw new DecodingException("Unable to decode UsCoCoreSegment '" + encodedString + "'", e); } } @Override public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCoV1Field.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCoV1Field.SALE_OPT_OUT)).getValue(); + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCoField.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCoField.SALE_OPT_OUT)).getValue(); Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + ((EncodableFixedInteger) fields.get(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + ((EncodableFixedInteger) fields.get(UsCoField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsCoField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsCoField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); if (saleOptOutNotice == 0) { if (saleOptOut != 0) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoGpcSegment.java similarity index 72% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1GpcSegment.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoGpcSegment.java index 0d0594de..7be0d974 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoV1GpcSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoGpcSegment.java @@ -8,33 +8,33 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; -import com.iab.gpp.encoder.field.UsCoV1Field; +import com.iab.gpp.encoder.field.UsCoField; -public class UsCoV1GpcSegment extends AbstractLazilyEncodableSegment { +public class UsCoGpcSegment extends AbstractLazilyEncodableSegment { private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); - public UsCoV1GpcSegment() { + public UsCoGpcSegment() { super(); } - public UsCoV1GpcSegment(String encodedString) { + public UsCoGpcSegment(String encodedString) { super(); this.decode(encodedString); } @Override public List getFieldNames() { - return UsCoV1Field.USCOV1_GPC_SEGMENT_FIELD_NAMES; + return UsCoField.USCO_GPC_SEGMENT_FIELD_NAMES; } @Override protected EncodableBitStringFields initializeFields() { EncodableBitStringFields fields = new EncodableBitStringFields(); - fields.put(UsCoV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UsCoV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UsCoV1Field.GPC, new EncodableBoolean(false)); + fields.put(UsCoField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsCoField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsCoField.GPC, new EncodableBoolean(false)); return fields; } @@ -54,7 +54,7 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } catch (Exception e) { - throw new DecodingException("Unable to decode UsCoV1GpcSegment '" + encodedString + "'", e); + throw new DecodingException("Unable to decode UsCoGpcSegment '" + encodedString + "'", e); } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtCoreSegment.java similarity index 79% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtCoreSegment.java index a07bed72..7b9504e7 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtCoreSegment.java @@ -11,26 +11,26 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; -import com.iab.gpp.encoder.field.UsCtV1Field; -import com.iab.gpp.encoder.section.UsCtV1; +import com.iab.gpp.encoder.field.UsCtField; +import com.iab.gpp.encoder.section.UsCt; -public class UsCtV1CoreSegment extends AbstractLazilyEncodableSegment { +public class UsCtCoreSegment extends AbstractLazilyEncodableSegment { private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); - public UsCtV1CoreSegment() { + public UsCtCoreSegment() { super(); } - public UsCtV1CoreSegment(String encodedString) { + public UsCtCoreSegment(String encodedString) { super(); this.decode(encodedString); } @Override public List getFieldNames() { - return UsCtV1Field.USCTV1_CORE_SEGMENT_FIELD_NAMES; + return UsCtField.USCT_CORE_SEGMENT_FIELD_NAMES; } @Override @@ -47,27 +47,27 @@ protected EncodableBitStringFields initializeFields() { }); EncodableBitStringFields fields = new EncodableBitStringFields(); - fields.put(UsCtV1Field.VERSION, new EncodableFixedInteger(6, UsCtV1.VERSION)); - fields.put(UsCtV1Field.SHARING_NOTICE, + fields.put(UsCtField.VERSION, new EncodableFixedInteger(6, UsCt.VERSION)); + fields.put(UsCtField.SHARING_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCtV1Field.SALE_OPT_OUT_NOTICE, + fields.put(UsCtField.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + fields.put(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCtV1Field.SALE_OPT_OUT, + fields.put(UsCtField.SALE_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, + fields.put(UsCtField.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCtV1Field.SENSITIVE_DATA_PROCESSING, + fields.put(UsCtField.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); - fields.put(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0)) + fields.put(UsCtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0)) .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); - fields.put(UsCtV1Field.MSPA_COVERED_TRANSACTION, + fields.put(UsCtField.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, + fields.put(UsCtField.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, + fields.put(UsCtField.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -88,22 +88,22 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } catch (Exception e) { - throw new DecodingException("Unable to decode UsCtV1CoreSegment '" + encodedString + "'", e); + throw new DecodingException("Unable to decode UsCtCoreSegment '" + encodedString + "'", e); } } @Override public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCtV1Field.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCtV1Field.SALE_OPT_OUT)).getValue(); + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCtField.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCtField.SALE_OPT_OUT)).getValue(); Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + ((EncodableFixedInteger) fields.get(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + ((EncodableFixedInteger) fields.get(UsCtField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsCtField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsCtField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); if (saleOptOutNotice == 0) { if (saleOptOut != 0) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtGpcSegment.java similarity index 72% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1GpcSegment.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtGpcSegment.java index b55e9a28..fb009c89 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaV1GpcSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtGpcSegment.java @@ -8,33 +8,33 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; -import com.iab.gpp.encoder.field.UsCaV1Field; +import com.iab.gpp.encoder.field.UsCtField; -public class UsCaV1GpcSegment extends AbstractLazilyEncodableSegment { +public class UsCtGpcSegment extends AbstractLazilyEncodableSegment { private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); - public UsCaV1GpcSegment() { + public UsCtGpcSegment() { super(); } - public UsCaV1GpcSegment(String encodedString) { + public UsCtGpcSegment(String encodedString) { super(); this.decode(encodedString); } @Override public List getFieldNames() { - return UsCaV1Field.USCAV1_GPC_SEGMENT_FIELD_NAMES; + return UsCtField.USCT_GPC_SEGMENT_FIELD_NAMES; } @Override protected EncodableBitStringFields initializeFields() { EncodableBitStringFields fields = new EncodableBitStringFields(); - fields.put(UsCaV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UsCaV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UsCaV1Field.GPC, new EncodableBoolean(false)); + fields.put(UsCtField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsCtField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsCtField.GPC, new EncodableBoolean(false)); return fields; } @@ -54,7 +54,7 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } catch (Exception e) { - throw new DecodingException("Unable to decode UsCaV1GpcSegment '" + encodedString + "'", e); + throw new DecodingException("Unable to decode UsCtGpcSegment '" + encodedString + "'", e); } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsFlCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsFlCoreSegment.java new file mode 100644 index 00000000..4402c94c --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsFlCoreSegment.java @@ -0,0 +1,168 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsFlField; +import com.iab.gpp.encoder.section.UsFl; + +public class UsFlCoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsFlCoreSegment() { + super(); + } + + public UsFlCoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsFlField.USFL_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsFlField.VERSION, new EncodableFixedInteger(6, UsFl.VERSION)); + fields.put(UsFlField.PROCESSING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsFlField.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsFlField.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsFlField.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsFlField.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsFlField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsFlField.ADDITIONAL_DATA_PROCESSING_CONSENT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsFlField.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsFlField.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsFlField.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if (encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsFlCoreSegment '" + encodedString + "'", e); + } + } + + @Override + public void validate() { + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsFlField.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsFlField.SALE_OPT_OUT)).getValue(); + Integer targetedAdvertisingOptOutNotice = + ((EncodableFixedInteger) fields.get(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + Integer targetedAdvertisingOptOut = + ((EncodableFixedInteger) fields.get(UsFlField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + Integer mspaServiceProviderMode = + ((EncodableFixedInteger) fields.get(UsFlField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + Integer mspaOptOutOptionMode = + ((EncodableFixedInteger) fields.get(UsFlField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + + if (saleOptOutNotice == 0) { + if (saleOptOut != 0) { + throw new ValidationException( + "Invalid usfl sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException( + "Invalid usfl sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException( + "Invalid usfl sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } + + if (targetedAdvertisingOptOutNotice == 0) { + if (targetedAdvertisingOptOut != 0) { + throw new ValidationException("Invalid usfl targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException("Invalid usfl targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException("Invalid usfl targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } + + if (mspaServiceProviderMode == 0) { + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usfl mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 1) { + if (mspaOptOutOptionMode != 2) { + throw new ValidationException("Invalid usfl mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); + } + + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usfl mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 2) { + if (mspaOptOutOptionMode != 1) { + throw new ValidationException("Invalid usfl mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); + } + } + } + + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsMtCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsMtCoreSegment.java new file mode 100644 index 00000000..716ee444 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsMtCoreSegment.java @@ -0,0 +1,168 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsMtField; +import com.iab.gpp.encoder.section.UsMt; + +public class UsMtCoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsMtCoreSegment() { + super(); + } + + public UsMtCoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsMtField.USMT_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsMtField.VERSION, new EncodableFixedInteger(6, UsMt.VERSION)); + fields.put(UsMtField.SHARING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsMtField.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsMtField.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsMtField.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsMtField.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsMtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsMtField.ADDITIONAL_DATA_PROCESSING_CONSENT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsMtField.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsMtField.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsMtField.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if (encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsMtCoreSegment '" + encodedString + "'", e); + } + } + + @Override + public void validate() { + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsMtField.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsMtField.SALE_OPT_OUT)).getValue(); + Integer targetedAdvertisingOptOutNotice = + ((EncodableFixedInteger) fields.get(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + Integer targetedAdvertisingOptOut = + ((EncodableFixedInteger) fields.get(UsMtField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + Integer mspaServiceProviderMode = + ((EncodableFixedInteger) fields.get(UsMtField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + Integer mspaOptOutOptionMode = + ((EncodableFixedInteger) fields.get(UsMtField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + + if (saleOptOutNotice == 0) { + if (saleOptOut != 0) { + throw new ValidationException( + "Invalid usmt sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException( + "Invalid usmt sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException( + "Invalid usmt sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } + + if (targetedAdvertisingOptOutNotice == 0) { + if (targetedAdvertisingOptOut != 0) { + throw new ValidationException("Invalid usmt targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException("Invalid usmt targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException("Invalid usmt targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } + + if (mspaServiceProviderMode == 0) { + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usmt mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 1) { + if (mspaOptOutOptionMode != 2) { + throw new ValidationException("Invalid usmt mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); + } + + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usmt mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 2) { + if (mspaOptOutOptionMode != 1) { + throw new ValidationException("Invalid usmt mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); + } + } + } + + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1GpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsMtGpcSegment.java similarity index 71% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1GpcSegment.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsMtGpcSegment.java index 848e360f..99be5310 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1GpcSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsMtGpcSegment.java @@ -8,33 +8,33 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.EncodableBitStringFields; -import com.iab.gpp.encoder.field.UsNatV1Field; +import com.iab.gpp.encoder.field.UsMtField; -public class UsNatV1GpcSegment extends AbstractLazilyEncodableSegment { +public class UsMtGpcSegment extends AbstractLazilyEncodableSegment { private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); - public UsNatV1GpcSegment() { + public UsMtGpcSegment() { super(); } - public UsNatV1GpcSegment(String encodedString) { + public UsMtGpcSegment(String encodedString) { super(); this.decode(encodedString); } @Override public List getFieldNames() { - return UsNatV1Field.USNATV1_GPC_SEGMENT_FIELD_NAMES; + return UsMtField.USMT_GPC_SEGMENT_FIELD_NAMES; } @Override protected EncodableBitStringFields initializeFields() { EncodableBitStringFields fields = new EncodableBitStringFields(); - fields.put(UsNatV1Field.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); - fields.put(UsNatV1Field.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); - fields.put(UsNatV1Field.GPC, new EncodableBoolean(false)); + fields.put(UsMtField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsMtField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsMtField.GPC, new EncodableBoolean(false)); return fields; } @@ -54,7 +54,7 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } catch (Exception e) { - throw new DecodingException("Unable to decode UsNatV1GpcSegment '" + encodedString + "'", e); + throw new DecodingException("Unable to decode UsMtGpcSegment '" + encodedString + "'", e); } } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java similarity index 81% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java index de3bc0dd..6b148ea9 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java @@ -11,26 +11,26 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; -import com.iab.gpp.encoder.field.UsNatV1Field; -import com.iab.gpp.encoder.section.UsNatV1; +import com.iab.gpp.encoder.field.UsNatField; +import com.iab.gpp.encoder.section.UsNat; -public class UsNatV1CoreSegment extends AbstractLazilyEncodableSegment { +public class UsNatCoreSegment extends AbstractLazilyEncodableSegment { private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); - public UsNatV1CoreSegment() { + public UsNatCoreSegment() { super(); } - public UsNatV1CoreSegment(String encodedString) { + public UsNatCoreSegment(String encodedString) { super(); this.decode(encodedString); } @Override public List getFieldNames() { - return UsNatV1Field.USNATV1_CORE_SEGMENT_FIELD_NAMES; + return UsNatField.USNAT_CORE_SEGMENT_FIELD_NAMES; } @Override @@ -47,37 +47,37 @@ protected EncodableBitStringFields initializeFields() { }); EncodableBitStringFields fields = new EncodableBitStringFields(); - fields.put(UsNatV1Field.VERSION, new EncodableFixedInteger(6, UsNatV1.VERSION)); - fields.put(UsNatV1Field.SHARING_NOTICE, + fields.put(UsNatField.VERSION, new EncodableFixedInteger(6, UsNat.VERSION)); + fields.put(UsNatField.SHARING_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.SALE_OPT_OUT_NOTICE, + fields.put(UsNatField.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.SHARING_OPT_OUT_NOTICE, + fields.put(UsNatField.SHARING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + fields.put(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + fields.put(UsNatField.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, + fields.put(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.SALE_OPT_OUT, + fields.put(UsNatField.SALE_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.SHARING_OPT_OUT, + fields.put(UsNatField.SHARING_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, + fields.put(UsNatField.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.SENSITIVE_DATA_PROCESSING, + fields.put(UsNatField.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); - fields.put(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0)) + fields.put(UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0)) .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); - fields.put(UsNatV1Field.PERSONAL_DATA_CONSENTS, + fields.put(UsNatField.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.MSPA_COVERED_TRANSACTION, + fields.put(UsNatField.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, + fields.put(UsNatField.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, + fields.put(UsNatField.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -98,27 +98,27 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } catch (Exception e) { - throw new DecodingException("Unable to decode UsNatV1CoreSegment '" + encodedString + "'", e); + throw new DecodingException("Unable to decode UsNatCoreSegment '" + encodedString + "'", e); } } @Override public void validate() { - Integer sharingNotice = ((EncodableFixedInteger) fields.get(UsNatV1Field.SHARING_NOTICE)).getValue(); - Integer sharingOptOutNotice = ((EncodableFixedInteger) fields.get(UsNatV1Field.SHARING_OPT_OUT_NOTICE)).getValue(); - Integer sharingOptOut = ((EncodableFixedInteger) fields.get(UsNatV1Field.SHARING_OPT_OUT)).getValue(); - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsNatV1Field.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsNatV1Field.SALE_OPT_OUT)).getValue(); + Integer sharingNotice = ((EncodableFixedInteger) fields.get(UsNatField.SHARING_NOTICE)).getValue(); + Integer sharingOptOutNotice = ((EncodableFixedInteger) fields.get(UsNatField.SHARING_OPT_OUT_NOTICE)).getValue(); + Integer sharingOptOut = ((EncodableFixedInteger) fields.get(UsNatField.SHARING_OPT_OUT)).getValue(); + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsNatField.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsNatField.SALE_OPT_OUT)).getValue(); Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + ((EncodableFixedInteger) fields.get(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + ((EncodableFixedInteger) fields.get(UsNatField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsNatField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsNatField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); Integer sensitiveDataLimtUserNotice = - ((EncodableFixedInteger) fields.get(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE)).getValue(); + ((EncodableFixedInteger) fields.get(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE)).getValue(); if (sharingNotice == 0) { if (sharingOptOut != 0) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatGpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatGpcSegment.java new file mode 100644 index 00000000..54fc1d40 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatGpcSegment.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsNatField; + +public class UsNatGpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsNatGpcSegment() { + super(); + } + + public UsNatGpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsNatField.USNAT_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsNatField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsNatField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsNatField.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsNatGpcSegment '" + encodedString + "'", e); + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrCoreSegment.java new file mode 100644 index 00000000..97d64b41 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrCoreSegment.java @@ -0,0 +1,168 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsOrField; +import com.iab.gpp.encoder.section.UsOr; + +public class UsOrCoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsOrCoreSegment() { + super(); + } + + public UsOrCoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsOrField.USOR_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsOrField.VERSION, new EncodableFixedInteger(6, UsOr.VERSION)); + fields.put(UsOrField.PROCESSING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsOrField.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsOrField.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsOrField.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsOrField.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsOrField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsOrField.ADDITIONAL_DATA_PROCESSING_CONSENT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsOrField.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsOrField.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsOrField.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if (encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsOrCoreSegment '" + encodedString + "'", e); + } + } + + @Override + public void validate() { + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsOrField.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsOrField.SALE_OPT_OUT)).getValue(); + Integer targetedAdvertisingOptOutNotice = + ((EncodableFixedInteger) fields.get(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + Integer targetedAdvertisingOptOut = + ((EncodableFixedInteger) fields.get(UsOrField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + Integer mspaServiceProviderMode = + ((EncodableFixedInteger) fields.get(UsOrField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + Integer mspaOptOutOptionMode = + ((EncodableFixedInteger) fields.get(UsOrField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + + if (saleOptOutNotice == 0) { + if (saleOptOut != 0) { + throw new ValidationException( + "Invalid usor sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException( + "Invalid usor sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException( + "Invalid usor sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } + + if (targetedAdvertisingOptOutNotice == 0) { + if (targetedAdvertisingOptOut != 0) { + throw new ValidationException("Invalid usor targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException("Invalid usor targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException("Invalid usor targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } + + if (mspaServiceProviderMode == 0) { + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usor mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 1) { + if (mspaOptOutOptionMode != 2) { + throw new ValidationException("Invalid usor mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); + } + + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid usor mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 2) { + if (mspaOptOutOptionMode != 1) { + throw new ValidationException("Invalid usor mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); + } + } + } + + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrGpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrGpcSegment.java new file mode 100644 index 00000000..6818e7de --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrGpcSegment.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsOrField; + +public class UsOrGpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsOrGpcSegment() { + super(); + } + + public UsOrGpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsOrField.USOR_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsOrField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsOrField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsOrField.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsOrGpcSegment '" + encodedString + "'", e); + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxCoreSegment.java new file mode 100644 index 00000000..224f1b99 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxCoreSegment.java @@ -0,0 +1,169 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsTxField; +import com.iab.gpp.encoder.field.UsVaField; +import com.iab.gpp.encoder.section.UsTx; + +public class UsTxCoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsTxCoreSegment() { + super(); + } + + public UsTxCoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsTxField.USTX_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsTxField.VERSION, new EncodableFixedInteger(6, UsTx.VERSION)); + fields.put(UsTxField.PROCESSING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTxField.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTxField.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTxField.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTxField.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsVaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTxField.ADDITIONAL_DATA_PROCESSING_CONSENT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTxField.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTxField.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTxField.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if (encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsTxCoreSegment '" + encodedString + "'", e); + } + } + + @Override + public void validate() { + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsTxField.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsTxField.SALE_OPT_OUT)).getValue(); + Integer targetedAdvertisingOptOutNotice = + ((EncodableFixedInteger) fields.get(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + Integer targetedAdvertisingOptOut = + ((EncodableFixedInteger) fields.get(UsTxField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + Integer mspaServiceProviderMode = + ((EncodableFixedInteger) fields.get(UsTxField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + Integer mspaOptOutOptionMode = + ((EncodableFixedInteger) fields.get(UsTxField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + + if (saleOptOutNotice == 0) { + if (saleOptOut != 0) { + throw new ValidationException( + "Invalid ustx sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException( + "Invalid ustx sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } else if (saleOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException( + "Invalid ustx sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); + } + } + + if (targetedAdvertisingOptOutNotice == 0) { + if (targetedAdvertisingOptOut != 0) { + throw new ValidationException("Invalid ustx targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 1) { + if (saleOptOut != 1 && saleOptOut != 2) { + throw new ValidationException("Invalid ustx targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } else if (targetedAdvertisingOptOutNotice == 2) { + if (saleOptOut != 1) { + throw new ValidationException("Invalid ustx targeted advertising notice / opt out combination: {" + + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); + } + } + + if (mspaServiceProviderMode == 0) { + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid ustx mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 1) { + if (mspaOptOutOptionMode != 2) { + throw new ValidationException("Invalid ustx mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); + } + + if (saleOptOutNotice != 0) { + throw new ValidationException("Invalid ustx mspa service provider mode / sale opt out notice combination: {" + + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); + } + } else if (mspaServiceProviderMode == 2) { + if (mspaOptOutOptionMode != 1) { + throw new ValidationException("Invalid ustx mspa service provider / opt out option modes combination: {" + + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); + } + } + } + + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxGpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxGpcSegment.java new file mode 100644 index 00000000..df936b51 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxGpcSegment.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsTxField; + +public class UsTxGpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsTxGpcSegment() { + super(); + } + + public UsTxGpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsTxField.USTX_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsTxField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsTxField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsTxField.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsTxGpcSegment '" + encodedString + "'", e); + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtCoreSegment.java similarity index 79% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtCoreSegment.java index 1602e079..6126c3cb 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtCoreSegment.java @@ -11,26 +11,26 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; -import com.iab.gpp.encoder.field.UsUtV1Field; -import com.iab.gpp.encoder.section.UsUtV1; +import com.iab.gpp.encoder.field.UsUtField; +import com.iab.gpp.encoder.section.UsUt; -public class UsUtV1CoreSegment extends AbstractLazilyEncodableSegment { +public class UsUtCoreSegment extends AbstractLazilyEncodableSegment { private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); - public UsUtV1CoreSegment() { + public UsUtCoreSegment() { super(); } - public UsUtV1CoreSegment(String encodedString) { + public UsUtCoreSegment(String encodedString) { super(); this.decode(encodedString); } @Override public List getFieldNames() { - return UsUtV1Field.USUTV1_CORE_SEGMENT_FIELD_NAMES; + return UsUtField.USUT_CORE_SEGMENT_FIELD_NAMES; } @Override @@ -47,29 +47,29 @@ protected EncodableBitStringFields initializeFields() { }); EncodableBitStringFields fields = new EncodableBitStringFields(); - fields.put(UsUtV1Field.VERSION, new EncodableFixedInteger(6, UsUtV1.VERSION)); - fields.put(UsUtV1Field.SHARING_NOTICE, + fields.put(UsUtField.VERSION, new EncodableFixedInteger(6, UsUt.VERSION)); + fields.put(UsUtField.SHARING_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsUtV1Field.SALE_OPT_OUT_NOTICE, + fields.put(UsUtField.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + fields.put(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, + fields.put(UsUtField.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsUtV1Field.SALE_OPT_OUT, + fields.put(UsUtField.SALE_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, + fields.put(UsUtField.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsUtV1Field.SENSITIVE_DATA_PROCESSING, + fields.put(UsUtField.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); - fields.put(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + fields.put(UsUtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsUtV1Field.MSPA_COVERED_TRANSACTION, + fields.put(UsUtField.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, + fields.put(UsUtField.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, + fields.put(UsUtField.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -90,22 +90,22 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } catch (Exception e) { - throw new DecodingException("Unable to decode UsUtV1CoreSegment '" + encodedString + "'", e); + throw new DecodingException("Unable to decode UsUtCoreSegment '" + encodedString + "'", e); } } @Override public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsUtV1Field.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsUtV1Field.SALE_OPT_OUT)).getValue(); + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsUtField.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsUtField.SALE_OPT_OUT)).getValue(); Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + ((EncodableFixedInteger) fields.get(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + ((EncodableFixedInteger) fields.get(UsUtField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsUtField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsUtField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); if (saleOptOutNotice == 0) { if (saleOptOut != 0) { diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaCoreSegment.java similarity index 80% rename from iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java rename to iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaCoreSegment.java index 08a8a8dd..e39316e7 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaV1CoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaCoreSegment.java @@ -11,26 +11,26 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; -import com.iab.gpp.encoder.field.UsVaV1Field; -import com.iab.gpp.encoder.section.UsVaV1; +import com.iab.gpp.encoder.field.UsVaField; +import com.iab.gpp.encoder.section.UsVa; -public class UsVaV1CoreSegment extends AbstractLazilyEncodableSegment { +public class UsVaCoreSegment extends AbstractLazilyEncodableSegment { private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); - public UsVaV1CoreSegment() { + public UsVaCoreSegment() { super(); } - public UsVaV1CoreSegment(String encodedString) { + public UsVaCoreSegment(String encodedString) { super(); this.decode(encodedString); } @Override public List getFieldNames() { - return UsVaV1Field.USVAV1_CORE_SEGMENT_FIELD_NAMES; + return UsVaField.USVA_CORE_SEGMENT_FIELD_NAMES; } @Override @@ -47,27 +47,27 @@ protected EncodableBitStringFields initializeFields() { }); EncodableBitStringFields fields = new EncodableBitStringFields(); - fields.put(UsVaV1Field.VERSION, new EncodableFixedInteger(6, UsVaV1.VERSION)); - fields.put(UsVaV1Field.SHARING_NOTICE, + fields.put(UsVaField.VERSION, new EncodableFixedInteger(6, UsVa.VERSION)); + fields.put(UsVaField.SHARING_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsVaV1Field.SALE_OPT_OUT_NOTICE, + fields.put(UsVaField.SALE_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + fields.put(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsVaV1Field.SALE_OPT_OUT, + fields.put(UsVaField.SALE_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, + fields.put(UsVaField.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsVaV1Field.SENSITIVE_DATA_PROCESSING, + fields.put(UsVaField.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); - fields.put(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + fields.put(UsVaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsVaV1Field.MSPA_COVERED_TRANSACTION, + fields.put(UsVaField.MSPA_COVERED_TRANSACTION, new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, + fields.put(UsVaField.MSPA_OPT_OUT_OPTION_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, + fields.put(UsVaField.MSPA_SERVICE_PROVIDER_MODE, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); return fields; } @@ -88,22 +88,22 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel String bitString = base64UrlEncoder.decode(encodedString); bitStringEncoder.decode(bitString, getFieldNames(), fields); } catch (Exception e) { - throw new DecodingException("Unable to decode UsVaV1CoreSegment '" + encodedString + "'", e); + throw new DecodingException("Unable to decode UsVaCoreSegment '" + encodedString + "'", e); } } @Override public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsVaV1Field.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsVaV1Field.SALE_OPT_OUT)).getValue(); + Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsVaField.SALE_OPT_OUT_NOTICE)).getValue(); + Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsVaField.SALE_OPT_OUT)).getValue(); Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); + ((EncodableFixedInteger) fields.get(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT)).getValue(); + ((EncodableFixedInteger) fields.get(UsVaField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsVaField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + ((EncodableFixedInteger) fields.get(UsVaField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); if (saleOptOutNotice == 0) { if (saleOptOut != 0) { diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 277eb83b..8e83b800 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -9,21 +9,29 @@ import com.iab.gpp.encoder.error.DecodingException; import com.iab.gpp.encoder.field.TcfCaV1Field; import com.iab.gpp.encoder.field.TcfEuV2Field; -import com.iab.gpp.encoder.field.UsCaV1Field; -import com.iab.gpp.encoder.field.UsCoV1Field; -import com.iab.gpp.encoder.field.UsCtV1Field; -import com.iab.gpp.encoder.field.UsNatV1Field; -import com.iab.gpp.encoder.field.UsUtV1Field; -import com.iab.gpp.encoder.field.UsVaV1Field; +import com.iab.gpp.encoder.field.UsCaField; +import com.iab.gpp.encoder.field.UsCoField; +import com.iab.gpp.encoder.field.UsCtField; +import com.iab.gpp.encoder.field.UsFlField; +import com.iab.gpp.encoder.field.UsMtField; +import com.iab.gpp.encoder.field.UsNatField; +import com.iab.gpp.encoder.field.UsOrField; +import com.iab.gpp.encoder.field.UsTxField; +import com.iab.gpp.encoder.field.UsUtField; +import com.iab.gpp.encoder.field.UsVaField; import com.iab.gpp.encoder.field.UspV1Field; import com.iab.gpp.encoder.section.TcfCaV1; import com.iab.gpp.encoder.section.TcfEuV2; -import com.iab.gpp.encoder.section.UsCaV1; -import com.iab.gpp.encoder.section.UsCoV1; -import com.iab.gpp.encoder.section.UsCtV1; -import com.iab.gpp.encoder.section.UsNatV1; -import com.iab.gpp.encoder.section.UsUtV1; -import com.iab.gpp.encoder.section.UsVaV1; +import com.iab.gpp.encoder.section.UsCa; +import com.iab.gpp.encoder.section.UsCo; +import com.iab.gpp.encoder.section.UsCt; +import com.iab.gpp.encoder.section.UsFl; +import com.iab.gpp.encoder.section.UsMt; +import com.iab.gpp.encoder.section.UsNat; +import com.iab.gpp.encoder.section.UsOr; +import com.iab.gpp.encoder.section.UsTx; +import com.iab.gpp.encoder.section.UsUt; +import com.iab.gpp.encoder.section.UsVa; import com.iab.gpp.encoder.section.UspV1; public class GppModelTest { @@ -65,7 +73,7 @@ public void testDecodingException() { @Test() public void testDecodeGarbage() { Assertions.assertThrows(DecodingException.class, () -> { - new GppModel("z").getUsCtV1Section(); + new GppModel("z").getUsCtSection(); }); } @@ -76,12 +84,16 @@ public void testEncodeDefaultAll() { Assertions.assertEquals(false, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(false, gppModel.hasSection(TcfCaV1.NAME)); Assertions.assertEquals(false, gppModel.hasSection(UspV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UsNatV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UsCaV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UsVaV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UsCoV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UsUtV1.NAME)); - Assertions.assertEquals(false, gppModel.hasSection(UsCtV1.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsNat.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsCa.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsVa.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsCo.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsUt.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsCt.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsFl.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsMt.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsOr.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsTx.NAME)); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VERSION, TcfEuV2.VERSION); gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); @@ -90,28 +102,36 @@ public void testEncodeDefaultAll() { gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.CREATED, utcDateTime); gppModel.setFieldValue(TcfCaV1.NAME, TcfCaV1Field.LAST_UPDATED, utcDateTime); gppModel.setFieldValue(UspV1.NAME, UspV1Field.VERSION, UspV1.VERSION); - gppModel.setFieldValue(UsNatV1.NAME, UsNatV1Field.VERSION, UsNatV1.VERSION); - gppModel.setFieldValue(UsCaV1.NAME, UsCaV1Field.VERSION, UsCaV1.VERSION); - gppModel.setFieldValue(UsVaV1.NAME, UsVaV1Field.VERSION, UsVaV1.VERSION); - gppModel.setFieldValue(UsCoV1.NAME, UsCoV1Field.VERSION, UsCoV1.VERSION); - gppModel.setFieldValue(UsUtV1.NAME, UsUtV1Field.VERSION, UsUtV1.VERSION); - gppModel.setFieldValue(UsCtV1.NAME, UsCtV1Field.VERSION, UsCtV1.VERSION); + gppModel.setFieldValue(UsNat.NAME, UsNatField.VERSION, UsNat.VERSION); + gppModel.setFieldValue(UsCa.NAME, UsCaField.VERSION, UsCa.VERSION); + gppModel.setFieldValue(UsVa.NAME, UsVaField.VERSION, UsVa.VERSION); + gppModel.setFieldValue(UsCo.NAME, UsCoField.VERSION, UsCo.VERSION); + gppModel.setFieldValue(UsUt.NAME, UsUtField.VERSION, UsUt.VERSION); + gppModel.setFieldValue(UsCt.NAME, UsCtField.VERSION, UsCt.VERSION); + gppModel.setFieldValue(UsFl.NAME, UsFlField.VERSION, UsFl.VERSION); + gppModel.setFieldValue(UsMt.NAME, UsMtField.VERSION, UsMt.VERSION); + gppModel.setFieldValue(UsOr.NAME, UsOrField.VERSION, UsOr.VERSION); + gppModel.setFieldValue(UsTx.NAME, UsTxField.VERSION, UsTx.VERSION); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsNatV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsCaV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsVaV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsCoV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsUtV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsCtV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsNat.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCa.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsVa.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCo.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsUt.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCt.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsFl.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsMt.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsOr.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsTx.NAME)); String gppString = gppModel.encode(); Assertions.assertEquals( - "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAQA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA", + "DBACOZY~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAQA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA~BAAAAABA~BAAAAABA.QA~BAAAAAABAA.QA~BAAAAAQA.QA", gppString); } @@ -377,12 +397,12 @@ public void testDecodeDefaultsAll() { Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsNatV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsCaV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsVaV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsCoV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsUtV1.NAME)); - Assertions.assertEquals(true, gppModel.hasSection(UsCtV1.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsNat.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCa.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsVa.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCo.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsUt.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsCt.NAME)); } @Test diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaTest.java new file mode 100644 index 00000000..ae73963e --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaTest.java @@ -0,0 +1,533 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsCaField; + +public class UsCaTest { + + @Test + public void testEncode1() { + + UsCa usCa = new UsCa(); + Assertions.assertEquals("BAAAAABA.QA", usCa.encode()); + } + + @Test + public void testEncode2() { + UsCa usCa = new UsCa(); + + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 1); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 1); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0)); + usCa.setFieldValue(UsCaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); + usCa.setFieldValue(UsCaField.PERSONAL_DATA_CONSENTS, 1); + usCa.setFieldValue(UsCaField.MSPA_COVERED_TRANSACTION, 1); + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCa.setFieldValue(UsCaField.GPC, true); + + Assertions.assertEquals("BVWSSSVY.YA", usCa.encode()); + } + + @Test + public void testEncode3() { + UsCa usCa = new UsCa(); + + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 1); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 1); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0)); + usCa.setFieldValue(UsCaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); + usCa.setFieldValue(UsCaField.PERSONAL_DATA_CONSENTS, 1); + usCa.setFieldValue(UsCaField.MSPA_COVERED_TRANSACTION, 1); + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCa.setFieldValue(UsCaField.GPC, true); + + Assertions.assertEquals("BVWSSSVY.YA", usCa.encode()); + } + + @Test + public void testSetInvalidValues() { + UsCa usCa = new UsCa(); + + try { + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 0, 0, 0, 3, 0, 0, 0, 0)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 3)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.PERSONAL_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testValidateSharing() { + UsCa usCa = new UsCa(); + + try { + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 1); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 2); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 0); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 0); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 2); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 0); + usCa.encode(); + + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 1); + usCa.encode(); + + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 2); + usCa.encode(); + + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 1); + usCa.encode(); + } + + @Test + public void testValidateSale() { + UsCa usCa = new UsCa(); + + try { + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 1); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 2); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 0); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 0); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 2); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 0); + usCa.encode(); + + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 1); + usCa.encode(); + + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 2); + usCa.encode(); + + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 1); + usCa.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsCa usCa = new UsCa(); + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 0); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 0); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 2); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usCa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 0); + usCa.encode(); + + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCa.encode(); + + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 2); + usCa.encode(); + + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 2); + usCa.encode(); + + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCa.encode(); + + + usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 0); + + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usCa.encode(); + + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usCa.encode(); + + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usCa.encode(); + + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usCa.encode(); + + usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); + usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); + usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usCa.encode(); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + + UsCa usCa = new UsCa(); + usCa.setFieldValue(UsCaField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAABA", usCa.encode()); + } + + @Test + public void testDecode1() { + UsCa usCa = new UsCa("BVWSSSVY.YA"); + + Assertions.assertEquals(1, usCa.getSaleOptOutNotice()); + Assertions.assertEquals(1, usCa.getSharingOptOut()); + Assertions.assertEquals(1, usCa.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usCa.getSaleOptOut()); + Assertions.assertEquals(1, usCa.getSharingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0), usCa.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1), usCa.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCa.getPersonalDataConsents()); + Assertions.assertEquals(1, usCa.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usCa.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCa.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usCa.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() { + UsCa usCa = new UsCa("BVWSSSVY"); + + Assertions.assertEquals(1, usCa.getSaleOptOutNotice()); + Assertions.assertEquals(1, usCa.getSharingOptOut()); + Assertions.assertEquals(1, usCa.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usCa.getSaleOptOut()); + Assertions.assertEquals(1, usCa.getSharingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0), usCa.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1), usCa.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCa.getPersonalDataConsents()); + Assertions.assertEquals(1, usCa.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usCa.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCa.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usCa.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsCa("z").getPersonalDataConsents(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java deleted file mode 100644 index 4615a866..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaV1Test.java +++ /dev/null @@ -1,533 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; -import com.iab.gpp.encoder.field.UsCaV1Field; - -public class UsCaV1Test { - - @Test - public void testEncode1() { - - UsCaV1 usCaV1 = new UsCaV1(); - Assertions.assertEquals("BAAAAABA.QA", usCaV1.encode()); - } - - @Test - public void testEncode2() { - UsCaV1 usCaV1 = new UsCaV1(); - - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 1); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0)); - usCaV1.setFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); - usCaV1.setFieldValue(UsCaV1Field.PERSONAL_DATA_CONSENTS, 1); - usCaV1.setFieldValue(UsCaV1Field.MSPA_COVERED_TRANSACTION, 1); - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCaV1.setFieldValue(UsCaV1Field.GPC, true); - - Assertions.assertEquals("BVWSSSVY.YA", usCaV1.encode()); - } - - @Test - public void testEncode3() { - UsCaV1 usCaV1 = new UsCaV1(); - - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 1); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0)); - usCaV1.setFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); - usCaV1.setFieldValue(UsCaV1Field.PERSONAL_DATA_CONSENTS, 1); - usCaV1.setFieldValue(UsCaV1Field.MSPA_COVERED_TRANSACTION, 1); - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCaV1.setFieldValue(UsCaV1Field.GPC, true); - - Assertions.assertEquals("BVWSSSVY.YA", usCaV1.encode()); - } - - @Test - public void testSetInvalidValues() { - UsCaV1 usCaV1 = new UsCaV1(); - - try { - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, -1); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 0, 0, 0, 3, 0, 0, 0, 0)); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 3)); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.PERSONAL_DATA_CONSENTS, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_COVERED_TRANSACTION, 0); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - } - - @Test - public void testValidateSharing() { - UsCaV1 usCaV1 = new UsCaV1(); - - try { - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 1); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 2); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 0); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 0); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 2); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 0); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 1); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 2); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT, 1); - usCaV1.encode(); - } - - @Test - public void testValidateSale() { - UsCaV1 usCaV1 = new UsCaV1(); - - try { - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 1); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 2); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 0); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 0); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 2); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 0); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 1); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 2); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT, 1); - usCaV1.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsCaV1 usCaV1 = new UsCaV1(); - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usCaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCaV1.encode(); - - - usCaV1.setFieldValue(UsCaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 0); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 1); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usCaV1.encode(); - - usCaV1.setFieldValue(UsCaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCaV1.setFieldValue(UsCaV1Field.SALE_OPT_OUT_NOTICE, 2); - usCaV1.setFieldValue(UsCaV1Field.SHARING_OPT_OUT_NOTICE, 2); - usCaV1.setFieldValue(UsCaV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usCaV1.encode(); - } - - @Test - public void testEncodeWithGpcSegmentExcluded() { - - UsCaV1 usCaV1 = new UsCaV1(); - usCaV1.setFieldValue(UsCaV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAABA", usCaV1.encode()); - } - - @Test - public void testDecode1() { - UsCaV1 usCaV1 = new UsCaV1("BVWSSSVY.YA"); - - Assertions.assertEquals(1, usCaV1.getSaleOptOutNotice()); - Assertions.assertEquals(1, usCaV1.getSharingOptOut()); - Assertions.assertEquals(1, usCaV1.getSensitiveDataLimitUseNotice()); - Assertions.assertEquals(1, usCaV1.getSaleOptOut()); - Assertions.assertEquals(1, usCaV1.getSharingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0), usCaV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(2, 1), usCaV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, usCaV1.getPersonalDataConsents()); - Assertions.assertEquals(1, usCaV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, usCaV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, usCaV1.getMspaServiceProviderMode()); - Assertions.assertEquals(true, usCaV1.getGpc()); - } - - @Test - public void testDecodeWithGpcSegmentExcluded() { - UsCaV1 usCaV1 = new UsCaV1("BVWSSSVY"); - - Assertions.assertEquals(1, usCaV1.getSaleOptOutNotice()); - Assertions.assertEquals(1, usCaV1.getSharingOptOut()); - Assertions.assertEquals(1, usCaV1.getSensitiveDataLimitUseNotice()); - Assertions.assertEquals(1, usCaV1.getSaleOptOut()); - Assertions.assertEquals(1, usCaV1.getSharingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0), usCaV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(2, 1), usCaV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, usCaV1.getPersonalDataConsents()); - Assertions.assertEquals(1, usCaV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, usCaV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, usCaV1.getMspaServiceProviderMode()); - Assertions.assertEquals(false, usCaV1.getGpcSegmentIncluded()); - } - - @Test() - public void testDecodeGarbage() { - Assertions.assertThrows(DecodingException.class, () -> { - new UsCaV1("z").getPersonalDataConsents(); - }); - } -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoTest.java new file mode 100644 index 00000000..470536ea --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoTest.java @@ -0,0 +1,420 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsCoField; + +public class UsCoTest { + + @Test + public void testEncode1() { + UsCo usCo = new UsCo(); + Assertions.assertEquals("BAAAAEA.QA", usCo.encode()); + } + + @Test + public void testEncode2() { + UsCo usCo = new UsCo(); + + usCo.setFieldValue(UsCoField.SHARING_NOTICE, 1); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 1); + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 1); + usCo.setFieldValue(UsCoField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2)); + usCo.setFieldValue(UsCoField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); + usCo.setFieldValue(UsCoField.MSPA_COVERED_TRANSACTION, 1); + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCo.setFieldValue(UsCoField.GPC, true); + + Assertions.assertEquals("BVWSSVg.YA", usCo.encode()); + } + + @Test + public void testSetInvalidValues() { + UsCo usCo = new UsCo(); + + try { + usCo.setFieldValue(UsCoField.SHARING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 5); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + } + + @Test + public void testValidateSale() { + UsCo usCo = new UsCo(); + + try { + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 1); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 2); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 0); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 0); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 2); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 0); + usCo.encode(); + + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 1); + usCo.encode(); + + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 2); + usCo.encode(); + + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 1); + usCo.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsCo usCo = new UsCo(); + + try { + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 1); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 2); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 0); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 0); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 2); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 0); + usCo.encode(); + + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 1); + usCo.encode(); + + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 2); + usCo.encode(); + + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 1); + usCo.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsCo usCo = new UsCo(); + + try { + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 0); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 0); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 2); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + + try { + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); + usCo.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); + + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 0); + usCo.encode(); + + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCo.encode(); + + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 2); + usCo.encode(); + + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 2); + usCo.encode(); + + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCo.encode(); + + + usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 0); + + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); + usCo.encode(); + + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); + usCo.encode(); + + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); + usCo.encode(); + + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); + usCo.encode(); + + usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); + usCo.encode(); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + UsCo usCo = new UsCo(); + usCo.setFieldValue(UsCoField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAEA", usCo.encode()); + } + + @Test + public void testDecode1() { + UsCo usCo = new UsCo("BVWSSVg.YA"); + + Assertions.assertEquals(1, usCo.getSharingNotice()); + Assertions.assertEquals(1, usCo.getSaleOptOutNotice()); + Assertions.assertEquals(1, usCo.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCo.getSaleOptOut()); + Assertions.assertEquals(1, usCo.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2), usCo.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usCo.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCo.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usCo.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCo.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usCo.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() { + UsCo usCo = new UsCo("BVWSSVg"); + + Assertions.assertEquals(1, usCo.getSharingNotice()); + Assertions.assertEquals(1, usCo.getSaleOptOutNotice()); + Assertions.assertEquals(1, usCo.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCo.getSaleOptOut()); + Assertions.assertEquals(1, usCo.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2), usCo.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usCo.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCo.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usCo.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCo.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usCo.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsCo("z").getTargetedAdvertisingOptOut(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java deleted file mode 100644 index dd238be3..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoV1Test.java +++ /dev/null @@ -1,420 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; -import com.iab.gpp.encoder.field.UsCoV1Field; - -public class UsCoV1Test { - - @Test - public void testEncode1() { - UsCoV1 usCoV1 = new UsCoV1(); - Assertions.assertEquals("BAAAAEA.QA", usCoV1.encode()); - } - - @Test - public void testEncode2() { - UsCoV1 usCoV1 = new UsCoV1(); - - usCoV1.setFieldValue(UsCoV1Field.SHARING_NOTICE, 1); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 1); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usCoV1.setFieldValue(UsCoV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2)); - usCoV1.setFieldValue(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); - usCoV1.setFieldValue(UsCoV1Field.MSPA_COVERED_TRANSACTION, 1); - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCoV1.setFieldValue(UsCoV1Field.GPC, true); - - Assertions.assertEquals("BVWSSVg.YA", usCoV1.encode()); - } - - @Test - public void testSetInvalidValues() { - UsCoV1 usCoV1 = new UsCoV1(); - - try { - usCoV1.setFieldValue(UsCoV1Field.SHARING_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2)); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.MSPA_COVERED_TRANSACTION, 0); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, -1); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 5); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - } - - @Test - public void testValidateSale() { - UsCoV1 usCoV1 = new UsCoV1(); - - try { - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 1); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 2); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 0); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 0); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 2); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 0); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 1); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 2); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT, 1); - usCoV1.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsCoV1 usCoV1 = new UsCoV1(); - - try { - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCoV1.setFieldValue(UsCoV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usCoV1.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsCoV1 usCoV1 = new UsCoV1(); - - try { - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - - try { - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); - usCoV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); - - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCoV1.encode(); - - - usCoV1.setFieldValue(UsCoV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 0); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 1); - usCoV1.encode(); - - usCoV1.setFieldValue(UsCoV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCoV1.setFieldValue(UsCoV1Field.SALE_OPT_OUT_NOTICE, 2); - usCoV1.encode(); - } - - @Test - public void testEncodeWithGpcSegmentExcluded() { - UsCoV1 usCoV1 = new UsCoV1(); - usCoV1.setFieldValue(UsCoV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAEA", usCoV1.encode()); - } - - @Test - public void testDecode1() { - UsCoV1 usCoV1 = new UsCoV1("BVWSSVg.YA"); - - Assertions.assertEquals(1, usCoV1.getSharingNotice()); - Assertions.assertEquals(1, usCoV1.getSaleOptOutNotice()); - Assertions.assertEquals(1, usCoV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, usCoV1.getSaleOptOut()); - Assertions.assertEquals(1, usCoV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2), usCoV1.getSensitiveDataProcessing()); - Assertions.assertEquals(1, usCoV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, usCoV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, usCoV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, usCoV1.getMspaServiceProviderMode()); - Assertions.assertEquals(true, usCoV1.getGpc()); - } - - @Test - public void testDecodeWithGpcSegmentExcluded() { - UsCoV1 usCoV1 = new UsCoV1("BVWSSVg"); - - Assertions.assertEquals(1, usCoV1.getSharingNotice()); - Assertions.assertEquals(1, usCoV1.getSaleOptOutNotice()); - Assertions.assertEquals(1, usCoV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, usCoV1.getSaleOptOut()); - Assertions.assertEquals(1, usCoV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2), usCoV1.getSensitiveDataProcessing()); - Assertions.assertEquals(1, usCoV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, usCoV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, usCoV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, usCoV1.getMspaServiceProviderMode()); - Assertions.assertEquals(false, usCoV1.getGpcSegmentIncluded()); - } - - @Test() - public void testDecodeGarbage() { - Assertions.assertThrows(DecodingException.class, () -> { - new UsCoV1("z").getTargetedAdvertisingOptOut(); - }); - } -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtTest.java new file mode 100644 index 00000000..e23aec4a --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtTest.java @@ -0,0 +1,418 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsCtField; + +public class UsCtTest { + + @Test + public void testEncode1() { + UsCt usCt = new UsCt(); + Assertions.assertEquals("BAAAAAEA.QA", usCt.encode()); + } + + @Test + public void testEncode2() { + UsCt usCt = new UsCt(); + + usCt.setFieldValue(UsCtField.SHARING_NOTICE, 1); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 1); + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usCt.setFieldValue(UsCtField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usCt.setFieldValue(UsCtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1, 0)); + usCt.setFieldValue(UsCtField.MSPA_COVERED_TRANSACTION, 1); + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCt.setFieldValue(UsCtField.GPC, true); + + Assertions.assertEquals("BVWSSZFg.YA", usCt.encode()); + } + + @Test + public void testSetInvalidValues() { + UsCt usCt = new UsCt(); + + try { + usCt.setFieldValue(UsCtField.SHARING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testValidateSale() { + UsCt usCt = new UsCt(); + + try { + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 1); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 2); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 0); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 0); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 2); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 0); + usCt.encode(); + + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 1); + usCt.encode(); + + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 2); + usCt.encode(); + + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 1); + usCt.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsCt usCt = new UsCt(); + + try { + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 2); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 0); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 0); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 2); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 0); + usCt.encode(); + + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usCt.encode(); + + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 2); + usCt.encode(); + + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usCt.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsCt usCt = new UsCt(); + + try { + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 0); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 0); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 2); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); + usCt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); + + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 0); + usCt.encode(); + + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCt.encode(); + + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 2); + usCt.encode(); + + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 2); + usCt.encode(); + + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usCt.encode(); + + + usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 0); + + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); + usCt.encode(); + + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); + usCt.encode(); + + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); + usCt.encode(); + + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); + usCt.encode(); + + usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); + usCt.encode(); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + UsCt usCt = new UsCt(); + usCt.setFieldValue(UsCtField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAEA", usCt.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsCt usCt = new UsCt("BVWSSZFg.YA"); + + Assertions.assertEquals(1, usCt.getSharingNotice()); + Assertions.assertEquals(1, usCt.getSaleOptOutNotice()); + Assertions.assertEquals(1, usCt.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCt.getSaleOptOut()); + Assertions.assertEquals(1, usCt.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usCt.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usCt.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCt.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usCt.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCt.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usCt.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsCt usCt = new UsCt("BVWSSZFg"); + + Assertions.assertEquals(1, usCt.getSharingNotice()); + Assertions.assertEquals(1, usCt.getSaleOptOutNotice()); + Assertions.assertEquals(1, usCt.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usCt.getSaleOptOut()); + Assertions.assertEquals(1, usCt.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usCt.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usCt.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usCt.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usCt.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usCt.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usCt.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsCt("z").getSharingNotice(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java deleted file mode 100644 index 9276651c..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtV1Test.java +++ /dev/null @@ -1,418 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; -import com.iab.gpp.encoder.field.UsCtV1Field; - -public class UsCtV1Test { - - @Test - public void testEncode1() { - UsCtV1 usCtV1 = new UsCtV1(); - Assertions.assertEquals("BAAAAAEA.QA", usCtV1.encode()); - } - - @Test - public void testEncode2() { - UsCtV1 usCtV1 = new UsCtV1(); - - usCtV1.setFieldValue(UsCtV1Field.SHARING_NOTICE, 1); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 1); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usCtV1.setFieldValue(UsCtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); - usCtV1.setFieldValue(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1, 0)); - usCtV1.setFieldValue(UsCtV1Field.MSPA_COVERED_TRANSACTION, 1); - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCtV1.setFieldValue(UsCtV1Field.GPC, true); - - Assertions.assertEquals("BVWSSZFg.YA", usCtV1.encode()); - } - - @Test - public void testSetInvalidValues() { - UsCtV1 usCtV1 = new UsCtV1(); - - try { - usCtV1.setFieldValue(UsCtV1Field.SHARING_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, -1); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.MSPA_COVERED_TRANSACTION, 0); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 4); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, -1); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - } - - @Test - public void testValidateSale() { - UsCtV1 usCtV1 = new UsCtV1(); - - try { - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 1); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 2); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 0); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 0); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 2); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 0); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 1); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 2); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT, 1); - usCtV1.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsCtV1 usCtV1 = new UsCtV1(); - - try { - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCtV1.setFieldValue(UsCtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usCtV1.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsCtV1 usCtV1 = new UsCtV1(); - - try { - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); - usCtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); - - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usCtV1.encode(); - - - usCtV1.setFieldValue(UsCtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 0); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 1); - usCtV1.encode(); - - usCtV1.setFieldValue(UsCtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usCtV1.setFieldValue(UsCtV1Field.SALE_OPT_OUT_NOTICE, 2); - usCtV1.encode(); - } - - @Test - public void testEncodeWithGpcSegmentExcluded() { - UsCtV1 usCtV1 = new UsCtV1(); - usCtV1.setFieldValue(UsCtV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAAEA", usCtV1.encode()); - } - - @Test - public void testDecode1() throws DecodingException { - UsCtV1 usCtV1 = new UsCtV1("BVWSSZFg.YA"); - - Assertions.assertEquals(1, usCtV1.getSharingNotice()); - Assertions.assertEquals(1, usCtV1.getSaleOptOutNotice()); - Assertions.assertEquals(1, usCtV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, usCtV1.getSaleOptOut()); - Assertions.assertEquals(1, usCtV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usCtV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(2, 1, 0), usCtV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, usCtV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, usCtV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, usCtV1.getMspaServiceProviderMode()); - Assertions.assertEquals(true, usCtV1.getGpc()); - } - - @Test - public void testDecodeWithGpcSegmentExcluded() throws DecodingException { - UsCtV1 usCtV1 = new UsCtV1("BVWSSZFg"); - - Assertions.assertEquals(1, usCtV1.getSharingNotice()); - Assertions.assertEquals(1, usCtV1.getSaleOptOutNotice()); - Assertions.assertEquals(1, usCtV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, usCtV1.getSaleOptOut()); - Assertions.assertEquals(1, usCtV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usCtV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(2, 1, 0), usCtV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, usCtV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, usCtV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, usCtV1.getMspaServiceProviderMode()); - Assertions.assertEquals(false, usCtV1.getGpcSegmentIncluded()); - } - - @Test() - public void testDecodeGarbage() { - Assertions.assertThrows(DecodingException.class, () -> { - new UsCtV1("z").getSharingNotice(); - }); - } -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsFlTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsFlTest.java new file mode 100644 index 00000000..2feba5f0 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsFlTest.java @@ -0,0 +1,407 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsFlField; + +public class UsFlTest { + + @Test + public void testEncode1() { + UsFl usFl = new UsFl(); + Assertions.assertEquals("BAAAAABA", usFl.encode()); + } + + @Test + public void testEncode2() { + UsFl usFl = new UsFl(); + + try { + usFl.setFieldValue(UsFlField.PROCESSING_NOTICE, 1); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 1); + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 1); + usFl.setFieldValue(UsFlField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usFl.setFieldValue(UsFlField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1, 2)); + usFl.setFieldValue(UsFlField.ADDITIONAL_DATA_PROCESSING_CONSENT, 1); + usFl.setFieldValue(UsFlField.MSPA_COVERED_TRANSACTION, 1); + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 1); + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); + } catch (InvalidFieldException e) { + throw new EncodingException(e); + } + + Assertions.assertEquals("BVWSSZlY", usFl.encode()); + } + + @Test + public void testSetInvalidValues() { + UsFl usFl = new UsFl(); + + try { + usFl.setFieldValue(UsFlField.PROCESSING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 3, 0)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.ADDITIONAL_DATA_PROCESSING_CONSENT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + } + + @Test + public void testValidateSale() { + UsFl usFl = new UsFl(); + + try { + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 1); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 2); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 0); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 0); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 2); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 0); + usFl.encode(); + + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 1); + usFl.encode(); + + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 2); + usFl.encode(); + + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 1); + usFl.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsFl usFl = new UsFl(); + + try { + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 1); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 2); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 0); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 0); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 2); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 0); + usFl.encode(); + + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 1); + usFl.encode(); + + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 2); + usFl.encode(); + + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 1); + usFl.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsFl usFl = new UsFl(); + + try { + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 0); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 1); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 0); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 2); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); + usFl.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); + + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 0); + usFl.encode(); + + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 1); + usFl.encode(); + + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 2); + usFl.encode(); + + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 2); + usFl.encode(); + + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 1); + usFl.encode(); + + + usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 0); + + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); + usFl.encode(); + + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); + usFl.encode(); + + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); + usFl.encode(); + + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); + usFl.encode(); + + usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); + usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); + usFl.encode(); + } + + @Test + public void testDecode1() throws DecodingException { + UsFl usFl = new UsFl("BVWSSZlY"); + + Assertions.assertEquals(1, usFl.getProcessingNotice()); + Assertions.assertEquals(1, usFl.getSaleOptOutNotice()); + Assertions.assertEquals(1, usFl.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usFl.getSaleOptOut()); + Assertions.assertEquals(1, usFl.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usFl.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 2), usFl.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usFl.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usFl.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usFl.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usFl.getMspaServiceProviderMode()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsFl("z").getMspaCoveredTransaction(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsMtTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsMtTest.java new file mode 100644 index 00000000..2708ed2f --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsMtTest.java @@ -0,0 +1,428 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsMtField; + +public class UsMtTest { + + @Test + public void testEncode1() { + UsMt usMt = new UsMt(); + Assertions.assertEquals("BAAAAABA.QA", usMt.encode()); + } + + @Test + public void testEncode2() { + UsMt usMt = new UsMt(); + + usMt.setFieldValue(UsMtField.SHARING_NOTICE, 1); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 1); + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usMt.setFieldValue(UsMtField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usMt.setFieldValue(UsMtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1, 0)); + usMt.setFieldValue(UsMtField.ADDITIONAL_DATA_PROCESSING_CONSENT, 1); + usMt.setFieldValue(UsMtField.MSPA_COVERED_TRANSACTION, 1); + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usMt.setFieldValue(UsMtField.GPC, true); + + Assertions.assertEquals("BVWSSZFY.YA", usMt.encode()); + } + + @Test + public void testSetInvalidValues() { + UsMt usMt = new UsMt(); + + try { + usMt.setFieldValue(UsMtField.SHARING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.ADDITIONAL_DATA_PROCESSING_CONSENT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testValidateSale() { + UsMt usMt = new UsMt(); + + try { + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 1); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 2); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 0); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 0); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 2); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 0); + usMt.encode(); + + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 1); + usMt.encode(); + + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 2); + usMt.encode(); + + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 1); + usMt.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsMt usMt = new UsMt(); + + try { + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 2); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 0); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 0); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 2); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 0); + usMt.encode(); + + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usMt.encode(); + + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 2); + usMt.encode(); + + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usMt.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsMt usMt = new UsMt(); + + try { + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 0); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 0); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 2); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); + usMt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); + + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 0); + usMt.encode(); + + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usMt.encode(); + + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 2); + usMt.encode(); + + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 2); + usMt.encode(); + + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usMt.encode(); + + + usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 0); + + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); + usMt.encode(); + + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); + usMt.encode(); + + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); + usMt.encode(); + + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); + usMt.encode(); + + usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); + usMt.encode(); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + UsMt usMt = new UsMt(); + usMt.setFieldValue(UsMtField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAABA", usMt.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsMt usMt = new UsMt("BVWSSZFY.YA"); + + Assertions.assertEquals(1, usMt.getSharingNotice()); + Assertions.assertEquals(1, usMt.getSaleOptOutNotice()); + Assertions.assertEquals(1, usMt.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usMt.getSaleOptOut()); + Assertions.assertEquals(1, usMt.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usMt.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usMt.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usMt.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usMt.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usMt.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usMt.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usMt.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsMt usMt = new UsMt("BVWSSZFY"); + + Assertions.assertEquals(1, usMt.getSharingNotice()); + Assertions.assertEquals(1, usMt.getSaleOptOutNotice()); + Assertions.assertEquals(1, usMt.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usMt.getSaleOptOut()); + Assertions.assertEquals(1, usMt.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usMt.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usMt.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usMt.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usMt.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usMt.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usMt.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usMt.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsMt("z").getSharingNotice(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java new file mode 100644 index 00000000..52c8f589 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java @@ -0,0 +1,647 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsNatField; + +public class UsNatTest { + + @Test + public void testEncode1() { + + UsNat usNat = new UsNat(); + Assertions.assertEquals("BAAAAAAAAQA.QA", usNat.encode()); + } + + @Test + public void testEncode2() { + UsNat usNat = new UsNat(); + + usNat.setFieldValue(UsNatField.SHARING_NOTICE, 1); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 1); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 1); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 1); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0)); + usNat.setFieldValue(UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); + usNat.setFieldValue(UsNatField.PERSONAL_DATA_CONSENTS, 1); + usNat.setFieldValue(UsNatField.MSPA_COVERED_TRANSACTION, 1); + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 1); + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); + usNat.setFieldValue(UsNatField.GPC, true); + + Assertions.assertEquals("BVVVkkkklWA.YA", usNat.encode()); + } + + @Test + public void testSetInvalidValues() { + UsNat usNat = new UsNat(); + + try { + usNat.setFieldValue(UsNatField.SHARING_NOTICE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 0, 0, 1, 2, 0)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 3)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.PERSONAL_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + } + + @Test + public void testValidateSharing() { + UsNat usNat = new UsNat(); + + try { + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 1); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 0); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 0); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 0); + usNat.encode(); + + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 1); + usNat.encode(); + + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 2); + usNat.encode(); + + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 1); + usNat.encode(); + } + + @Test + public void testValidateSale() { + UsNat usNat = new UsNat(); + + try { + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 1); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 0); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 0); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 0); + usNat.encode(); + + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 1); + usNat.encode(); + + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 2); + usNat.encode(); + + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 1); + usNat.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsNat usNat = new UsNat(); + + try { + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 1); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 0); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 0); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 0); + usNat.encode(); + + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 1); + usNat.encode(); + + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 2); + usNat.encode(); + + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 1); + usNat.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsNat usNat = new UsNat(); + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 0); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 1); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 0); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usNat.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 0); + usNat.encode(); + + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 1); + usNat.encode(); + + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 2); + usNat.encode(); + + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 2); + usNat.encode(); + + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 1); + usNat.encode(); + + + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 0); + + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usNat.encode(); + + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usNat.encode(); + + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); + usNat.encode(); + + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usNat.encode(); + + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); + usNat.encode(); + } + + + @Test + public void testEncode3() { + UsNat usNat = new UsNat(); + + usNat.setFieldValue(UsNatField.SHARING_NOTICE, 1); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); + usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 1); + usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 1); + usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 1); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0)); + usNat.setFieldValue(UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); + usNat.setFieldValue(UsNatField.PERSONAL_DATA_CONSENTS, 1); + usNat.setFieldValue(UsNatField.MSPA_COVERED_TRANSACTION, 1); + usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 1); + usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); + usNat.setFieldValue(UsNatField.GPC, true); + + Assertions.assertEquals("BVVVkkkklWA.YA", usNat.encode()); + } + + @Test + public void testEncodeWithGpcSegmentIncluded() { + + UsNat usNat = new UsNat(); + usNat.setFieldValue(UsNatField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAAAAQA", usNat.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsNat usNat = new UsNat("BVVVkkkklWA.YA"); + + Assertions.assertEquals(1, usNat.getSharingNotice()); + Assertions.assertEquals(1, usNat.getSaleOptOutNotice()); + Assertions.assertEquals(1, usNat.getSharingOptOutNotice()); + Assertions.assertEquals(1, usNat.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usNat.getSensitiveDataProcessingOptOutNotice()); + Assertions.assertEquals(1, usNat.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usNat.getSaleOptOut()); + Assertions.assertEquals(1, usNat.getSharingOptOut()); + Assertions.assertEquals(1, usNat.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0), usNat.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1), usNat.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNat.getPersonalDataConsents()); + Assertions.assertEquals(1, usNat.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usNat.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usNat.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usNat.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsNat usNat = new UsNat("BVVVkkkklWA"); + + Assertions.assertEquals(1, usNat.getSharingNotice()); + Assertions.assertEquals(1, usNat.getSaleOptOutNotice()); + Assertions.assertEquals(1, usNat.getSharingOptOutNotice()); + Assertions.assertEquals(1, usNat.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usNat.getSensitiveDataProcessingOptOutNotice()); + Assertions.assertEquals(1, usNat.getSensitiveDataLimitUseNotice()); + Assertions.assertEquals(1, usNat.getSaleOptOut()); + Assertions.assertEquals(1, usNat.getSharingOptOut()); + Assertions.assertEquals(1, usNat.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0), usNat.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1), usNat.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNat.getPersonalDataConsents()); + Assertions.assertEquals(1, usNat.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usNat.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usNat.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usNat.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsNat("z").getSharingNotice(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java deleted file mode 100644 index 4a5b549b..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatV1Test.java +++ /dev/null @@ -1,647 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; -import com.iab.gpp.encoder.field.UsNatV1Field; - -public class UsNatV1Test { - - @Test - public void testEncode1() { - - UsNatV1 usNatV1 = new UsNatV1(); - Assertions.assertEquals("BAAAAAAAAQA.QA", usNatV1.encode()); - } - - @Test - public void testEncode2() { - UsNatV1 usNatV1 = new UsNatV1(); - - usNatV1.setFieldValue(UsNatV1Field.SHARING_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 1); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0)); - usNatV1.setFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); - usNatV1.setFieldValue(UsNatV1Field.PERSONAL_DATA_CONSENTS, 1); - usNatV1.setFieldValue(UsNatV1Field.MSPA_COVERED_TRANSACTION, 1); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usNatV1.setFieldValue(UsNatV1Field.GPC, true); - - Assertions.assertEquals("BVVVkkkklWA.YA", usNatV1.encode()); - } - - @Test - public void testSetInvalidValues() { - UsNatV1 usNatV1 = new UsNatV1(); - - try { - usNatV1.setFieldValue(UsNatV1Field.SHARING_NOTICE, -1); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 4); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 0, 0, 1, 2, 0)); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(0, 3)); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.PERSONAL_DATA_CONSENTS, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_COVERED_TRANSACTION, 0); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - } - - @Test - public void testValidateSharing() { - UsNatV1 usNatV1 = new UsNatV1(); - - try { - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 1); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 0); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 0); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 0); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 1); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 2); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 1); - usNatV1.encode(); - } - - @Test - public void testValidateSale() { - UsNatV1 usNatV1 = new UsNatV1(); - - try { - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 0); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 0); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 0); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 2); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); - usNatV1.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsNatV1 usNatV1 = new UsNatV1(); - - try { - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usNatV1.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsNatV1 usNatV1 = new UsNatV1(); - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usNatV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usNatV1.encode(); - - - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 0); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usNatV1.encode(); - - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 2); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usNatV1.encode(); - } - - - @Test - public void testEncode3() { - UsNatV1 usNatV1 = new UsNatV1(); - - usNatV1.setFieldValue(UsNatV1Field.SHARING_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usNatV1.setFieldValue(UsNatV1Field.SALE_OPT_OUT, 1); - usNatV1.setFieldValue(UsNatV1Field.SHARING_OPT_OUT, 1); - usNatV1.setFieldValue(UsNatV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usNatV1.setFieldValue(UsNatV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0)); - usNatV1.setFieldValue(UsNatV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); - usNatV1.setFieldValue(UsNatV1Field.PERSONAL_DATA_CONSENTS, 1); - usNatV1.setFieldValue(UsNatV1Field.MSPA_COVERED_TRANSACTION, 1); - usNatV1.setFieldValue(UsNatV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usNatV1.setFieldValue(UsNatV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usNatV1.setFieldValue(UsNatV1Field.GPC, true); - - Assertions.assertEquals("BVVVkkkklWA.YA", usNatV1.encode()); - } - - @Test - public void testEncodeWithGpcSegmentIncluded() { - - UsNatV1 usNatV1 = new UsNatV1(); - usNatV1.setFieldValue(UsNatV1Field.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAAAAAQA", usNatV1.encode()); - } - - @Test - public void testDecode1() throws DecodingException { - UsNatV1 usNatV1 = new UsNatV1("BVVVkkkklWA.YA"); - - Assertions.assertEquals(1, usNatV1.getSharingNotice()); - Assertions.assertEquals(1, usNatV1.getSaleOptOutNotice()); - Assertions.assertEquals(1, usNatV1.getSharingOptOutNotice()); - Assertions.assertEquals(1, usNatV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, usNatV1.getSensitiveDataProcessingOptOutNotice()); - Assertions.assertEquals(1, usNatV1.getSensitiveDataLimitUseNotice()); - Assertions.assertEquals(1, usNatV1.getSaleOptOut()); - Assertions.assertEquals(1, usNatV1.getSharingOptOut()); - Assertions.assertEquals(1, usNatV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0), usNatV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(2, 1), usNatV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, usNatV1.getPersonalDataConsents()); - Assertions.assertEquals(1, usNatV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, usNatV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, usNatV1.getMspaServiceProviderMode()); - Assertions.assertEquals(true, usNatV1.getGpc()); - } - - @Test - public void testDecodeWithGpcSegmentExcluded() throws DecodingException { - UsNatV1 usNatV1 = new UsNatV1("BVVVkkkklWA"); - - Assertions.assertEquals(1, usNatV1.getSharingNotice()); - Assertions.assertEquals(1, usNatV1.getSaleOptOutNotice()); - Assertions.assertEquals(1, usNatV1.getSharingOptOutNotice()); - Assertions.assertEquals(1, usNatV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, usNatV1.getSensitiveDataProcessingOptOutNotice()); - Assertions.assertEquals(1, usNatV1.getSensitiveDataLimitUseNotice()); - Assertions.assertEquals(1, usNatV1.getSaleOptOut()); - Assertions.assertEquals(1, usNatV1.getSharingOptOut()); - Assertions.assertEquals(1, usNatV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0), usNatV1.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(2, 1), usNatV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, usNatV1.getPersonalDataConsents()); - Assertions.assertEquals(1, usNatV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, usNatV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, usNatV1.getMspaServiceProviderMode()); - Assertions.assertEquals(false, usNatV1.getGpcSegmentIncluded()); - } - - @Test() - public void testDecodeGarbage() { - Assertions.assertThrows(DecodingException.class, () -> { - new UsNatV1("z").getSharingNotice(); - }); - } -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsOrTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsOrTest.java new file mode 100644 index 00000000..4f386f49 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsOrTest.java @@ -0,0 +1,428 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsOrField; + +public class UsOrTest { + + @Test + public void testEncode1() { + UsOr usOr = new UsOr(); + Assertions.assertEquals("BAAAAAABAA.QA", usOr.encode()); + } + + @Test + public void testEncode2() { + UsOr usOr = new UsOr(); + + usOr.setFieldValue(UsOrField.PROCESSING_NOTICE, 1); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 1); + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 1); + usOr.setFieldValue(UsOrField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 1, 2)); + usOr.setFieldValue(UsOrField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1, 0)); + usOr.setFieldValue(UsOrField.ADDITIONAL_DATA_PROCESSING_CONSENT, 1); + usOr.setFieldValue(UsOrField.MSPA_COVERED_TRANSACTION, 1); + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 1); + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); + usOr.setFieldValue(UsOrField.GPC, true); + + Assertions.assertEquals("BVWSSRpFYA.YA", usOr.encode()); + } + + @Test + public void testSetInvalidValues() { + UsOr usOr = new UsOr(); + + try { + usOr.setFieldValue(UsOrField.PROCESSING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.ADDITIONAL_DATA_PROCESSING_CONSENT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testValidateSale() { + UsOr usOr = new UsOr(); + + try { + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 1); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 2); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 0); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 0); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 2); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 0); + usOr.encode(); + + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 1); + usOr.encode(); + + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 2); + usOr.encode(); + + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 1); + usOr.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsOr usOr = new UsOr(); + + try { + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 1); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 2); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 0); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 0); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 2); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 0); + usOr.encode(); + + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 1); + usOr.encode(); + + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 2); + usOr.encode(); + + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 1); + usOr.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsOr usOr = new UsOr(); + + try { + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 0); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 1); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 0); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 2); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); + usOr.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); + + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 0); + usOr.encode(); + + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 1); + usOr.encode(); + + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 2); + usOr.encode(); + + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 2); + usOr.encode(); + + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 1); + usOr.encode(); + + + usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 0); + + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); + usOr.encode(); + + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); + usOr.encode(); + + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); + usOr.encode(); + + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); + usOr.encode(); + + usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); + usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); + usOr.encode(); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + UsOr usOr = new UsOr(); + usOr.setFieldValue(UsOrField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAABAA", usOr.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsOr usOr = new UsOr("BVWSSRpFYA.YA"); + + Assertions.assertEquals(1, usOr.getProcessingNotice()); + Assertions.assertEquals(1, usOr.getSaleOptOutNotice()); + Assertions.assertEquals(1, usOr.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usOr.getSaleOptOut()); + Assertions.assertEquals(1, usOr.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 1, 2), usOr.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usOr.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usOr.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usOr.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usOr.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usOr.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usOr.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsOr usOr = new UsOr("BVWSSRpFYA"); + + Assertions.assertEquals(1, usOr.getProcessingNotice()); + Assertions.assertEquals(1, usOr.getSaleOptOutNotice()); + Assertions.assertEquals(1, usOr.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usOr.getSaleOptOut()); + Assertions.assertEquals(1, usOr.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 1, 2), usOr.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usOr.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usOr.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usOr.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usOr.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usOr.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usOr.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsOr("z").getProcessingNotice(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTxTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTxTest.java new file mode 100644 index 00000000..bc3c345a --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTxTest.java @@ -0,0 +1,428 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsTxField; + +public class UsTxTest { + + @Test + public void testEncode1() { + UsTx usTx = new UsTx(); + Assertions.assertEquals("BAAAAAQA.QA", usTx.encode()); + } + + @Test + public void testEncode2() { + UsTx usTx = new UsTx(); + + usTx.setFieldValue(UsTxField.PROCESSING_NOTICE, 1); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 1); + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 1); + usTx.setFieldValue(UsTxField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usTx.setFieldValue(UsTxField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); + usTx.setFieldValue(UsTxField.ADDITIONAL_DATA_PROCESSING_CONSENT, 1); + usTx.setFieldValue(UsTxField.MSPA_COVERED_TRANSACTION, 1); + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 1); + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); + usTx.setFieldValue(UsTxField.GPC, true); + + Assertions.assertEquals("BVWSSVWA.YA", usTx.encode()); + } + + @Test + public void testSetInvalidValues() { + UsTx usTx = new UsTx(); + + try { + usTx.setFieldValue(UsTxField.PROCESSING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.ADDITIONAL_DATA_PROCESSING_CONSENT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testValidateSale() { + UsTx usTx = new UsTx(); + + try { + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 1); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 2); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 0); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 0); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 2); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 0); + usTx.encode(); + + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 1); + usTx.encode(); + + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 2); + usTx.encode(); + + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 1); + usTx.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsTx usTx = new UsTx(); + + try { + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 1); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 2); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 0); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 0); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 2); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 0); + usTx.encode(); + + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 1); + usTx.encode(); + + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 2); + usTx.encode(); + + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 1); + usTx.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsTx usTx = new UsTx(); + + try { + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 0); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 1); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 0); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 2); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); + usTx.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); + + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 0); + usTx.encode(); + + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 1); + usTx.encode(); + + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 2); + usTx.encode(); + + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 2); + usTx.encode(); + + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 1); + usTx.encode(); + + + usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 0); + + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); + usTx.encode(); + + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); + usTx.encode(); + + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); + usTx.encode(); + + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); + usTx.encode(); + + usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); + usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); + usTx.encode(); + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + UsTx usTx = new UsTx(); + usTx.setFieldValue(UsTxField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAQA", usTx.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsTx usTx = new UsTx("BVWSSVWA.YA"); + + Assertions.assertEquals(1, usTx.getProcessingNotice()); + Assertions.assertEquals(1, usTx.getSaleOptOutNotice()); + Assertions.assertEquals(1, usTx.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usTx.getSaleOptOut()); + Assertions.assertEquals(1, usTx.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usTx.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usTx.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usTx.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usTx.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usTx.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usTx.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usTx.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsTx usTx = new UsTx("BVWSSVWA"); + + Assertions.assertEquals(1, usTx.getProcessingNotice()); + Assertions.assertEquals(1, usTx.getSaleOptOutNotice()); + Assertions.assertEquals(1, usTx.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usTx.getSaleOptOut()); + Assertions.assertEquals(1, usTx.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usTx.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usTx.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usTx.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usTx.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usTx.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usTx.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usTx.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsTx("z").getProcessingNotice(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtTest.java new file mode 100644 index 00000000..dda8a6cc --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtTest.java @@ -0,0 +1,400 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsUtField; + +public class UsUtTest { + + @Test + public void testEncode1() { + UsUt usUt = new UsUt(); + Assertions.assertEquals("BAAAAAQA", usUt.encode()); + } + + @Test + public void testEncode2() { + UsUt usUt = new UsUt(); + + usUt.setFieldValue(UsUtField.SHARING_NOTICE, 1); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 1); + usUt.setFieldValue(UsUtField.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usUt.setFieldValue(UsUtField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usUt.setFieldValue(UsUtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); + usUt.setFieldValue(UsUtField.MSPA_COVERED_TRANSACTION, 1); + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); + + Assertions.assertEquals("BVVkklWA", usUt.encode()); + } + + @Test + public void testSetInvalidValues() { + UsUt usUt = new UsUt(); + + try { + usUt.setFieldValue(UsUtField.SHARING_NOTICE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 0)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + } + + @Test + public void testValidateSale() { + UsUt usUt = new UsUt(); + + try { + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 1); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 2); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 0); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 0); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 2); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 0); + usUt.encode(); + + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 1); + usUt.encode(); + + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 2); + usUt.encode(); + + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 1); + usUt.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsUt usUt = new UsUt(); + + try { + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 2); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 0); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 0); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 2); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 0); + usUt.encode(); + + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usUt.encode(); + + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 2); + usUt.encode(); + + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 1); + usUt.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsUt usUt = new UsUt(); + + try { + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 0); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 0); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 2); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); + usUt.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); + + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 0); + usUt.encode(); + + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usUt.encode(); + + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 2); + usUt.encode(); + + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 2); + usUt.encode(); + + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 1); + usUt.encode(); + + + usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 0); + + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); + usUt.encode(); + + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); + usUt.encode(); + + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); + usUt.encode(); + + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); + usUt.encode(); + + usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); + usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); + usUt.encode(); + } + + @Test + public void testDecode1() throws DecodingException { + UsUt usUt = new UsUt("BVVkklWA"); + + Assertions.assertEquals(1, usUt.getSharingNotice()); + Assertions.assertEquals(1, usUt.getSaleOptOutNotice()); + Assertions.assertEquals(1, usUt.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usUt.getSaleOptOut()); + Assertions.assertEquals(1, usUt.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usUt.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usUt.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usUt.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usUt.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usUt.getMspaServiceProviderMode()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsUt("z").getKnownChildSensitiveDataConsents(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java deleted file mode 100644 index b2dd77b3..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtV1Test.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; -import com.iab.gpp.encoder.field.UsUtV1Field; - -public class UsUtV1Test { - - @Test - public void testEncode1() { - UsUtV1 usUtV1 = new UsUtV1(); - Assertions.assertEquals("BAAAAAQA", usUtV1.encode()); - } - - @Test - public void testEncode2() { - UsUtV1 usUtV1 = new UsUtV1(); - - usUtV1.setFieldValue(UsUtV1Field.SHARING_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 1); - usUtV1.setFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usUtV1.setFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); - usUtV1.setFieldValue(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); - usUtV1.setFieldValue(UsUtV1Field.MSPA_COVERED_TRANSACTION, 1); - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - - Assertions.assertEquals("BVVkklWA", usUtV1.encode()); - } - - @Test - public void testSetInvalidValues() { - UsUtV1 usUtV1 = new UsUtV1(); - - try { - usUtV1.setFieldValue(UsUtV1Field.SHARING_NOTICE, -1); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 4); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING_OPT_OUT_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 0, 1, 2, 0)); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.MSPA_COVERED_TRANSACTION, 0); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - } - - @Test - public void testValidateSale() { - UsUtV1 usUtV1 = new UsUtV1(); - - try { - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 1); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 2); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 0); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 0); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 2); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 0); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 1); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 2); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT, 1); - usUtV1.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsUtV1 usUtV1 = new UsUtV1(); - - try { - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usUtV1.setFieldValue(UsUtV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usUtV1.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsUtV1 usUtV1 = new UsUtV1(); - - try { - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); - usUtV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); - - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usUtV1.encode(); - - - usUtV1.setFieldValue(UsUtV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 0); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 1); - usUtV1.encode(); - - usUtV1.setFieldValue(UsUtV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usUtV1.setFieldValue(UsUtV1Field.SALE_OPT_OUT_NOTICE, 2); - usUtV1.encode(); - } - - @Test - public void testDecode1() throws DecodingException { - UsUtV1 usUtV1 = new UsUtV1("BVVkklWA"); - - Assertions.assertEquals(1, usUtV1.getSharingNotice()); - Assertions.assertEquals(1, usUtV1.getSaleOptOutNotice()); - Assertions.assertEquals(1, usUtV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, usUtV1.getSaleOptOut()); - Assertions.assertEquals(1, usUtV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usUtV1.getSensitiveDataProcessing()); - Assertions.assertEquals(1, usUtV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, usUtV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, usUtV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, usUtV1.getMspaServiceProviderMode()); - } - - @Test() - public void testDecodeGarbage() { - Assertions.assertThrows(DecodingException.class, () -> { - new UsUtV1("z").getKnownChildSensitiveDataConsents(); - }); - } -} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaTest.java new file mode 100644 index 00000000..6d8f3d22 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaTest.java @@ -0,0 +1,398 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.EncodingException; +import com.iab.gpp.encoder.error.InvalidFieldException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsVaField; + +public class UsVaTest { + + @Test + public void testEncode1() { + UsVa usVa = new UsVa(); + Assertions.assertEquals("BAAAABA", usVa.encode()); + } + + @Test + public void testEncode2() { + UsVa usVa = new UsVa(); + + try { + usVa.setFieldValue(UsVaField.SHARING_NOTICE, 1); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 1); + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 1); + usVa.setFieldValue(UsVaField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usVa.setFieldValue(UsVaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); + usVa.setFieldValue(UsVaField.MSPA_COVERED_TRANSACTION, 1); + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 1); + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); + } catch (InvalidFieldException e) { + throw new EncodingException(e); + } + + Assertions.assertEquals("BVWSSVY", usVa.encode()); + } + + @Test + public void testSetInvalidValues() { + UsVa usVa = new UsVa(); + + try { + usVa.setFieldValue(UsVaField.SHARING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + } + + @Test + public void testValidateSale() { + UsVa usVa = new UsVa(); + + try { + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 1); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 2); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 0); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 0); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 2); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 0); + usVa.encode(); + + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 1); + usVa.encode(); + + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 2); + usVa.encode(); + + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 1); + usVa.encode(); + } + + @Test + public void testValidateTargetedAdvertising() { + UsVa usVa = new UsVa(); + + try { + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 1); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 2); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 0); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 0); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 2); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 0); + usVa.encode(); + + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 1); + usVa.encode(); + + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 2); + usVa.encode(); + + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); + usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 1); + usVa.encode(); + } + + @Test + public void testValidateMspaServiceProviderMode() { + UsVa usVa = new UsVa(); + + try { + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 0); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 1); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 0); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 2); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + + try { + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); + usVa.encode(); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); + + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 0); + usVa.encode(); + + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 1); + usVa.encode(); + + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 2); + usVa.encode(); + + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 2); + usVa.encode(); + + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 1); + usVa.encode(); + + + usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 0); + + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); + usVa.encode(); + + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); + usVa.encode(); + + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); + usVa.encode(); + + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); + usVa.encode(); + + usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); + usVa.encode(); + } + + @Test + public void testDecode1() throws DecodingException { + UsVa usVa = new UsVa("BVWSSVY"); + + Assertions.assertEquals(1, usVa.getSharingNotice()); + Assertions.assertEquals(1, usVa.getSaleOptOutNotice()); + Assertions.assertEquals(1, usVa.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usVa.getSaleOptOut()); + Assertions.assertEquals(1, usVa.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usVa.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usVa.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usVa.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usVa.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usVa.getMspaServiceProviderMode()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsVa("z").getMspaCoveredTransaction(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java deleted file mode 100644 index 7c232941..00000000 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaV1Test.java +++ /dev/null @@ -1,398 +0,0 @@ -package com.iab.gpp.encoder.section; - - -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.EncodingException; -import com.iab.gpp.encoder.error.InvalidFieldException; -import com.iab.gpp.encoder.error.ValidationException; -import com.iab.gpp.encoder.field.UsVaV1Field; - -public class UsVaV1Test { - - @Test - public void testEncode1() { - UsVaV1 usVaV1 = new UsVaV1(); - Assertions.assertEquals("BAAAABA", usVaV1.encode()); - } - - @Test - public void testEncode2() { - UsVaV1 usVaV1 = new UsVaV1(); - - try { - usVaV1.setFieldValue(UsVaV1Field.SHARING_NOTICE, 1); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 1); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usVaV1.setFieldValue(UsVaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); - usVaV1.setFieldValue(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); - usVaV1.setFieldValue(UsVaV1Field.MSPA_COVERED_TRANSACTION, 1); - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - } catch (InvalidFieldException e) { - throw new EncodingException(e); - } - - Assertions.assertEquals("BVWSSVY", usVaV1.encode()); - } - - @Test - public void testSetInvalidValues() { - UsVaV1 usVaV1 = new UsVaV1(); - - try { - usVaV1.setFieldValue(UsVaV1Field.SHARING_NOTICE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, -1); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 4); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.MSPA_COVERED_TRANSACTION, 0); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 3); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - } - - @Test - public void testValidateSale() { - UsVaV1 usVaV1 = new UsVaV1(); - - try { - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 1); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 2); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 0); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 0); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 2); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 0); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 1); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 2); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT, 1); - usVaV1.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsVaV1 usVaV1 = new UsVaV1(); - - try { - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 0); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 2); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usVaV1.setFieldValue(UsVaV1Field.TARGETED_ADVERTISING_OPT_OUT, 1); - usVaV1.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsVaV1 usVaV1 = new UsVaV1(); - - try { - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); - usVaV1.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); - - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 2); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 1); - usVaV1.encode(); - - - usVaV1.setFieldValue(UsVaV1Field.MSPA_OPT_OUT_OPTION_MODE, 0); - - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 0); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 1); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 0); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 1); - usVaV1.encode(); - - usVaV1.setFieldValue(UsVaV1Field.MSPA_SERVICE_PROVIDER_MODE, 2); - usVaV1.setFieldValue(UsVaV1Field.SALE_OPT_OUT_NOTICE, 2); - usVaV1.encode(); - } - - @Test - public void testDecode1() throws DecodingException { - UsVaV1 usVaV1 = new UsVaV1("BVWSSVY"); - - Assertions.assertEquals(1, usVaV1.getSharingNotice()); - Assertions.assertEquals(1, usVaV1.getSaleOptOutNotice()); - Assertions.assertEquals(1, usVaV1.getTargetedAdvertisingOptOutNotice()); - Assertions.assertEquals(1, usVaV1.getSaleOptOut()); - Assertions.assertEquals(1, usVaV1.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usVaV1.getSensitiveDataProcessing()); - Assertions.assertEquals(1, usVaV1.getKnownChildSensitiveDataConsents()); - Assertions.assertEquals(1, usVaV1.getMspaCoveredTransaction()); - Assertions.assertEquals(1, usVaV1.getMspaOptOutOptionMode()); - Assertions.assertEquals(2, usVaV1.getMspaServiceProviderMode()); - } - - @Test() - public void testDecodeGarbage() { - Assertions.assertThrows(DecodingException.class, () -> { - new UsVaV1("z").getMspaCoveredTransaction(); - }); - } -} From daffbe95a548ab2e61d3d874faa698791a6333d3 Mon Sep 17 00:00:00 2001 From: chuff Date: Mon, 4 Nov 2024 08:34:48 -0700 Subject: [PATCH 30/41] Post release version bump (#64) * 3.2.1 * 3.2.2-SNAPSHOT --------- Co-authored-by: Chad Huff --- iabgpp-encoder/pom.xml | 2 +- iabgpp-extras-jackson/pom.xml | 4 ++-- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index bbfffad3..1f5c9ed5 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.1-SNAPSHOT + 3.2.2-SNAPSHOT iabgpp-encoder diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index bb1659db..76761eaa 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.2.1-SNAPSHOT + 3.2.2-SNAPSHOT iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.2.1-SNAPSHOT + 3.2.2-SNAPSHOT diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index 90cced1a..43702aa2 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.1-SNAPSHOT + 3.2.2-SNAPSHOT iabgpp-extras diff --git a/pom.xml b/pom.xml index d8bc78ed..ba8fee13 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.2.1-SNAPSHOT + 3.2.2-SNAPSHOT IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From 6d8bf7769c0ead4f6fa0b32cd6484498cfbec8e1 Mon Sep 17 00:00:00 2001 From: iabsxhxl Date: Tue, 18 Mar 2025 00:23:07 +0530 Subject: [PATCH 31/41] 3.2.2 --- iabgpp-encoder/pom.xml | 2 +- iabgpp-extras-jackson/pom.xml | 4 ++-- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index 1f5c9ed5..99f7defd 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.2-SNAPSHOT + 3.2.2 iabgpp-encoder diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index 76761eaa..b9daf845 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.2.2-SNAPSHOT + 3.2.2 iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.2.2-SNAPSHOT + 3.2.2 diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index 43702aa2..5b2af868 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.2-SNAPSHOT + 3.2.2 iabgpp-extras diff --git a/pom.xml b/pom.xml index ba8fee13..8a2aa91a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.2.2-SNAPSHOT + 3.2.2 IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From 408ad34f69ad6031c8303e15910d7928056af940 Mon Sep 17 00:00:00 2001 From: iabsxhxl Date: Tue, 18 Mar 2025 00:25:30 +0530 Subject: [PATCH 32/41] 3.2.3-SNAPSHOT --- iabgpp-encoder/pom.xml | 2 +- iabgpp-extras-jackson/pom.xml | 4 ++-- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index 99f7defd..f7f25486 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.2 + 3.2.3-SNAPSHOT iabgpp-encoder diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index b9daf845..5467e6b0 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.2.2 + 3.2.3-SNAPSHOT iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.2.2 + 3.2.3-SNAPSHOT diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index 5b2af868..0fc7a4f8 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.2 + 3.2.3-SNAPSHOT iabgpp-extras diff --git a/pom.xml b/pom.xml index 8a2aa91a..4a6d0211 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.2.2 + 3.2.3-SNAPSHOT IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From bff66954fc8584c671f28ecf462fdb51594ecafd Mon Sep 17 00:00:00 2001 From: chuff Date: Tue, 18 Mar 2025 07:28:40 -0600 Subject: [PATCH 33/41] Tx fl or mt (#57) * lazy decoding * java 8 compatible gppmodel tests * rename missed multistate usp* methods to us* * lazier decoding * lazier decoding * tests for null and empty string constructor arguments * validation * fix typo * remove redundant validate call * default validate * remove empty validate method from header core segment * fix usct validator * 3.1.1 * 3.1.2-SNAPSHOT * tcfca publisher restrictions and disclosed vendors * deprecate multi-state usp* methods * substring error handling * remove deprecated usp methods * remove deprecated usp methods * remove deprecated usp methods * cleanup validators * Better decoding exception messaging * remove unused classes * Update README * add support for the old headerless tcfeuv2 strings * encodeSection fix * encodeSection lazy fix * tcfeu pub restrictions fix * pub restrictions getters * tcfeu pub restirctions fix * cleanup * pub restrictions fix * optimize bitstring padding * 3.2.0 * 3.2.1-SNAPSHOT * fl mt or tx --------- Co-authored-by: chad --- iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index 430a60ca..63a718e6 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -267,7 +267,7 @@ public UsOr getUsOrSection() { public UsTx getUsTxSection() { return (UsTx) getSection(UsTx.NAME); } - + public List getSectionIds() { if (!this.decoded) { this.sections = this.decodeModel(this.encodedString); From d3d5017cd721e0a9d52ab7080d0f48e6be96db82 Mon Sep 17 00:00:00 2001 From: naveenjr7 Date: Tue, 18 Mar 2025 18:58:57 +0530 Subject: [PATCH 34/41] Update AbstractLazilyEncodableSection.java (#61) --- .../iab/gpp/encoder/section/AbstractLazilyEncodableSection.java | 1 + 1 file changed, 1 insertion(+) diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractLazilyEncodableSection.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractLazilyEncodableSection.java index 5e97e144..1f31a592 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractLazilyEncodableSection.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/AbstractLazilyEncodableSection.java @@ -65,6 +65,7 @@ public void setFieldValue(String fieldName, Object value) { for(EncodableSegment segment : segments) { if(segment.hasField(fieldName)) { segment.setFieldValue(fieldName, value); + this.dirty = true; return; } } From 8da3fe6ca144281d84aedff260f9d1aeb26e3592 Mon Sep 17 00:00:00 2001 From: chuff Date: Sat, 22 Mar 2025 07:28:30 -0600 Subject: [PATCH 35/41] DE IA NE NH NJ TN MSPA USNAT (#65) * DE IA NE NH NJ TN * remove validation * usnat backwards compatibility --------- Co-authored-by: Chad Huff --- .../java/com/iab/gpp/encoder/GppModel.java | 138 +++++++++++--- .../com/iab/gpp/encoder/field/UsDeField.java | 48 +++++ .../com/iab/gpp/encoder/field/UsIaField.java | 48 +++++ .../com/iab/gpp/encoder/field/UsNeField.java | 48 +++++ .../com/iab/gpp/encoder/field/UsNhField.java | 48 +++++ .../com/iab/gpp/encoder/field/UsNjField.java | 48 +++++ .../com/iab/gpp/encoder/field/UsTnField.java | 48 +++++ .../com/iab/gpp/encoder/section/Sections.java | 6 + .../com/iab/gpp/encoder/section/UsDe.java | 142 +++++++++++++++ .../com/iab/gpp/encoder/section/UsIa.java | 141 +++++++++++++++ .../com/iab/gpp/encoder/section/UsNe.java | 141 +++++++++++++++ .../com/iab/gpp/encoder/section/UsNh.java | 142 +++++++++++++++ .../com/iab/gpp/encoder/section/UsNj.java | 142 +++++++++++++++ .../com/iab/gpp/encoder/section/UsTn.java | 141 +++++++++++++++ .../gpp/encoder/segment/UsDeCoreSegment.java | 98 ++++++++++ .../gpp/encoder/segment/UsDeGpcSegment.java | 60 +++++++ .../gpp/encoder/segment/UsIaCoreSegment.java | 97 ++++++++++ .../gpp/encoder/segment/UsIaGpcSegment.java | 60 +++++++ .../gpp/encoder/segment/UsNatCoreSegment.java | 16 +- .../gpp/encoder/segment/UsNeCoreSegment.java | 97 ++++++++++ .../gpp/encoder/segment/UsNeGpcSegment.java | 60 +++++++ .../gpp/encoder/segment/UsNhCoreSegment.java | 96 ++++++++++ .../gpp/encoder/segment/UsNhGpcSegment.java | 60 +++++++ .../gpp/encoder/segment/UsNjCoreSegment.java | 96 ++++++++++ .../gpp/encoder/segment/UsNjGpcSegment.java | 60 +++++++ .../gpp/encoder/segment/UsTnCoreSegment.java | 96 ++++++++++ .../gpp/encoder/segment/UsTnGpcSegment.java | 60 +++++++ .../com/iab/gpp/encoder/GppModelTest.java | 86 ++++++++- .../com/iab/gpp/encoder/section/UsDeTest.java | 170 ++++++++++++++++++ .../com/iab/gpp/encoder/section/UsIaTest.java | 170 ++++++++++++++++++ .../iab/gpp/encoder/section/UsNatTest.java | 28 +-- .../com/iab/gpp/encoder/section/UsNeTest.java | 170 ++++++++++++++++++ .../com/iab/gpp/encoder/section/UsNhTest.java | 170 ++++++++++++++++++ .../com/iab/gpp/encoder/section/UsNjTest.java | 170 ++++++++++++++++++ .../com/iab/gpp/encoder/section/UsTnTest.java | 170 ++++++++++++++++++ 35 files changed, 3324 insertions(+), 47 deletions(-) create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsDeField.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsIaField.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNeField.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNhField.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNjField.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsTnField.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsDe.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsIa.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNe.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNh.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNj.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsTn.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsDeCoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsDeGpcSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsIaCoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsIaGpcSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNeCoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNeGpcSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNhCoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNhGpcSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNjCoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNjGpcSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTnCoreSegment.java create mode 100644 iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTnGpcSegment.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsDeTest.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsIaTest.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNeTest.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNhTest.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNjTest.java create mode 100644 iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTnTest.java diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index 63a718e6..22a239c0 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -18,10 +18,16 @@ import com.iab.gpp.encoder.section.UsCa; import com.iab.gpp.encoder.section.UsCo; import com.iab.gpp.encoder.section.UsCt; +import com.iab.gpp.encoder.section.UsDe; import com.iab.gpp.encoder.section.UsFl; +import com.iab.gpp.encoder.section.UsIa; import com.iab.gpp.encoder.section.UsMt; import com.iab.gpp.encoder.section.UsNat; +import com.iab.gpp.encoder.section.UsNe; +import com.iab.gpp.encoder.section.UsNh; +import com.iab.gpp.encoder.section.UsNj; import com.iab.gpp.encoder.section.UsOr; +import com.iab.gpp.encoder.section.UsTn; import com.iab.gpp.encoder.section.UsTx; import com.iab.gpp.encoder.section.UsUt; import com.iab.gpp.encoder.section.UsVa; @@ -31,10 +37,10 @@ public class GppModel { private Map sections = new HashMap<>(); private String encodedString; - + private boolean dirty = false; private boolean decoded = true; - + public GppModel() { } @@ -53,7 +59,7 @@ public void setFieldValue(String sectionName, String fieldName, Object value) { this.dirty = false; this.decoded = true; } - + EncodableSection section = null; if (!this.sections.containsKey(sectionName)) { if (sectionName.equals(TcfCaV1.NAME)) { @@ -95,6 +101,24 @@ public void setFieldValue(String sectionName, String fieldName, Object value) { } else if (sectionName.equals(UsTx.NAME)) { section = new UsTx(); this.sections.put(UsTx.NAME, section); + } else if (sectionName.equals(UsDe.NAME)) { + section = new UsDe(); + this.sections.put(UsDe.NAME, section); + } else if (sectionName.equals(UsIa.NAME)) { + section = new UsIa(); + this.sections.put(UsIa.NAME, section); + } else if (sectionName.equals(UsNe.NAME)) { + section = new UsNe(); + this.sections.put(UsNe.NAME, section); + } else if (sectionName.equals(UsNh.NAME)) { + section = new UsNh(); + this.sections.put(UsNh.NAME, section); + } else if (sectionName.equals(UsNj.NAME)) { + section = new UsNj(); + this.sections.put(UsNj.NAME, section); + } else if (sectionName.equals(UsTn.NAME)) { + section = new UsTn(); + this.sections.put(UsTn.NAME, section); } } else { section = this.sections.get(sectionName); @@ -118,7 +142,7 @@ public Object getFieldValue(String sectionName, String fieldName) { this.dirty = false; this.decoded = true; } - + if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).getFieldValue(fieldName); } else { @@ -136,7 +160,7 @@ public boolean hasField(String sectionName, String fieldName) { this.dirty = false; this.decoded = true; } - + if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).hasField(fieldName); } else { @@ -154,7 +178,7 @@ public boolean hasSection(String sectionName) { this.dirty = false; this.decoded = true; } - + return this.sections.containsKey(sectionName); } @@ -164,7 +188,7 @@ public HeaderV1 getHeader() { this.dirty = false; this.decoded = true; } - + HeaderV1 header = new HeaderV1(); try { header.setFieldValue("SectionIds", this.getSectionIds()); @@ -184,7 +208,7 @@ public EncodableSection getSection(String sectionName) { this.dirty = false; this.decoded = true; } - + if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName); } else { @@ -202,7 +226,7 @@ public void deleteSection(String sectionName) { this.dirty = false; this.decoded = true; } - + if (this.sections.containsKey(sectionName)) { this.sections.remove(sectionName); this.dirty = true; @@ -251,30 +275,54 @@ public UsUt getUsUtSection() { public UsCt getUsCtSection() { return (UsCt) getSection(UsCt.NAME); } - + public UsFl getUsFlSection() { return (UsFl) getSection(UsFl.NAME); } - + public UsMt getUsMtSection() { return (UsMt) getSection(UsMt.NAME); } - + public UsOr getUsOrSection() { return (UsOr) getSection(UsOr.NAME); } - + public UsTx getUsTxSection() { return (UsTx) getSection(UsTx.NAME); } - + + public UsDe getUsDeSection() { + return (UsDe) getSection(UsDe.NAME); + } + + public UsIa getUsIaSection() { + return (UsIa) getSection(UsIa.NAME); + } + + public UsNe getUsNeSection() { + return (UsNe) getSection(UsNe.NAME); + } + + public UsNh getUsNhSection() { + return (UsNh) getSection(UsNh.NAME); + } + + public UsNj getUsNjSection() { + return (UsNj) getSection(UsNj.NAME); + } + + public UsTn getUsTnSection() { + return (UsTn) getSection(UsTn.NAME); + } + public List getSectionIds() { if (!this.decoded) { this.sections = this.decodeModel(this.encodedString); this.dirty = false; this.decoded = true; } - + List sectionIds = new ArrayList<>(); for (int i = 0; i < Sections.SECTION_ORDER.size(); i++) { String sectionName = Sections.SECTION_ORDER.get(i); @@ -311,14 +359,14 @@ protected String encodeModel(Map sections) { } protected Map decodeModel(String str) { - if(str == null || str.isEmpty() || str.startsWith("D")) { + if (str == null || str.isEmpty() || str.startsWith("D")) { Map sections = new HashMap<>(); - - if(str != null && !str.isEmpty()) { + + if (str != null && !str.isEmpty()) { String[] encodedSections = str.split("~"); HeaderV1 header = new HeaderV1(encodedSections[0]); sections.put(HeaderV1.NAME, header); - + @SuppressWarnings("unchecked") List sectionIds = (List) header.getFieldValue("SectionIds"); for (int i = 0; i < sectionIds.size(); i++) { @@ -361,12 +409,30 @@ protected Map decodeModel(String str) { } else if (sectionIds.get(i).equals(UsTx.ID)) { UsTx section = new UsTx(encodedSections[i + 1]); sections.put(UsTx.NAME, section); + } else if (sectionIds.get(i).equals(UsDe.ID)) { + UsDe section = new UsDe(encodedSections[i + 1]); + sections.put(UsDe.NAME, section); + } else if (sectionIds.get(i).equals(UsIa.ID)) { + UsIa section = new UsIa(encodedSections[i + 1]); + sections.put(UsIa.NAME, section); + } else if (sectionIds.get(i).equals(UsNe.ID)) { + UsNe section = new UsNe(encodedSections[i + 1]); + sections.put(UsNe.NAME, section); + } else if (sectionIds.get(i).equals(UsNh.ID)) { + UsNh section = new UsNh(encodedSections[i + 1]); + sections.put(UsNh.NAME, section); + } else if (sectionIds.get(i).equals(UsNj.ID)) { + UsNj section = new UsNj(encodedSections[i + 1]); + sections.put(UsNj.NAME, section); + } else if (sectionIds.get(i).equals(UsTn.ID)) { + UsTn section = new UsTn(encodedSections[i + 1]); + sections.put(UsTn.NAME, section); } } } - + return sections; - } else if(str.startsWith("C")) { + } else if (str.startsWith("C")) { // old tcfeu only string Map sections = new HashMap<>(); @@ -393,7 +459,7 @@ public String encodeSection(String sectionName) { this.dirty = false; this.decoded = true; } - + if (this.sections.containsKey(sectionName)) { return this.sections.get(sectionName).encode(); } else { @@ -447,6 +513,24 @@ public void decodeSection(String sectionName, String encodedString) { } else if (sectionName.equals(UsTx.NAME)) { section = new UsTx(); this.sections.put(UsTx.NAME, section); + }else if (sectionName.equals(UsDe.NAME)) { + section = new UsDe(); + this.sections.put(UsDe.NAME, section); + }else if (sectionName.equals(UsIa.NAME)) { + section = new UsIa(); + this.sections.put(UsIa.NAME, section); + }else if (sectionName.equals(UsNe.NAME)) { + section = new UsNe(); + this.sections.put(UsNe.NAME, section); + }else if (sectionName.equals(UsNh.NAME)) { + section = new UsNh(); + this.sections.put(UsNh.NAME, section); + }else if (sectionName.equals(UsNj.NAME)) { + section = new UsNj(); + this.sections.put(UsNj.NAME, section); + }else if (sectionName.equals(UsTn.NAME)) { + section = new UsTn(); + this.sections.put(UsTn.NAME, section); } } else { section = this.sections.get(sectionName); @@ -456,7 +540,7 @@ public void decodeSection(String sectionName, String encodedString) { section.decode(encodedString); } } - + public String encode() { if (this.encodedString == null || this.encodedString.isEmpty() || this.dirty) { this.encodedString = encodeModel(this.sections); @@ -466,12 +550,12 @@ public String encode() { return this.encodedString; } - + public void decode(String encodedString) { this.encodedString = encodedString; this.dirty = false; this.decoded = false; } - - -} \ No newline at end of file + + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsDeField.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsDeField.java new file mode 100644 index 00000000..2979f9b6 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsDeField.java @@ -0,0 +1,48 @@ +package com.iab.gpp.encoder.field; + +import java.util.Arrays; +import java.util.List; + +public class UsDeField { + + public static String VERSION = "Version"; + public static String PROCESSING_NOTICE = "ProcessingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String ADDITIONAL_DATA_PROCESSING_CONSENT = "AdditionalDataProcessingConsent"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; + public static String GPC = "Gpc"; + + //@formatter:off + public static List USDE_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsDeField.VERSION, + UsDeField.PROCESSING_NOTICE, + UsDeField.SALE_OPT_OUT_NOTICE, + UsDeField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsDeField.SALE_OPT_OUT, + UsDeField.TARGETED_ADVERTISING_OPT_OUT, + UsDeField.SENSITIVE_DATA_PROCESSING, + UsDeField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsDeField.ADDITIONAL_DATA_PROCESSING_CONSENT, + UsDeField.MSPA_COVERED_TRANSACTION, + UsDeField.MSPA_OPT_OUT_OPTION_MODE, + UsDeField.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USDE_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsDeField.GPC_SEGMENT_TYPE, + UsDeField.GPC + }); + //@formatter:on +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsIaField.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsIaField.java new file mode 100644 index 00000000..f0c8d523 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsIaField.java @@ -0,0 +1,48 @@ +package com.iab.gpp.encoder.field; + +import java.util.Arrays; +import java.util.List; + +public class UsIaField { + + public static String VERSION = "Version"; + public static String PROCESSING_NOTICE = "ProcessingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SENSITIVE_DATA_OPT_OUT_NOTICE = "SensitiveDataOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; + public static String GPC = "Gpc"; + + //@formatter:off + public static List USIA_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsIaField.VERSION, + UsIaField.PROCESSING_NOTICE, + UsIaField.SALE_OPT_OUT_NOTICE, + UsIaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsIaField.SENSITIVE_DATA_OPT_OUT_NOTICE, + UsIaField.SALE_OPT_OUT, + UsIaField.TARGETED_ADVERTISING_OPT_OUT, + UsIaField.SENSITIVE_DATA_PROCESSING, + UsIaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsIaField.MSPA_COVERED_TRANSACTION, + UsIaField.MSPA_OPT_OUT_OPTION_MODE, + UsIaField.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USIA_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsIaField.GPC_SEGMENT_TYPE, + UsIaField.GPC + }); + //@formatter:on +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNeField.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNeField.java new file mode 100644 index 00000000..a4479a87 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNeField.java @@ -0,0 +1,48 @@ +package com.iab.gpp.encoder.field; + +import java.util.Arrays; +import java.util.List; + +public class UsNeField { + + public static String VERSION = "Version"; + public static String PROCESSING_NOTICE = "ProcessingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String ADDITIONAL_DATA_PROCESSING_CONSENT = "AdditionalDataProcessingConsent"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; + public static String GPC = "Gpc"; + + //@formatter:off + public static List USNE_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsNeField.VERSION, + UsNeField.PROCESSING_NOTICE, + UsNeField.SALE_OPT_OUT_NOTICE, + UsNeField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsNeField.SALE_OPT_OUT, + UsNeField.TARGETED_ADVERTISING_OPT_OUT, + UsNeField.SENSITIVE_DATA_PROCESSING, + UsNeField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsNeField.ADDITIONAL_DATA_PROCESSING_CONSENT, + UsNeField.MSPA_COVERED_TRANSACTION, + UsNeField.MSPA_OPT_OUT_OPTION_MODE, + UsNeField.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USNE_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsNeField.GPC_SEGMENT_TYPE, + UsNeField.GPC + }); + //@formatter:on +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNhField.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNhField.java new file mode 100644 index 00000000..8381dc9b --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNhField.java @@ -0,0 +1,48 @@ +package com.iab.gpp.encoder.field; + +import java.util.Arrays; +import java.util.List; + +public class UsNhField { + + public static String VERSION = "Version"; + public static String PROCESSING_NOTICE = "ProcessingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String ADDITIONAL_DATA_PROCESSING_CONSENT = "AdditionalDataProcessingConsent"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; + public static String GPC = "Gpc"; + + //@formatter:off + public static List USNH_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsNhField.VERSION, + UsNhField.PROCESSING_NOTICE, + UsNhField.SALE_OPT_OUT_NOTICE, + UsNhField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsNhField.SALE_OPT_OUT, + UsNhField.TARGETED_ADVERTISING_OPT_OUT, + UsNhField.SENSITIVE_DATA_PROCESSING, + UsNhField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsNhField.ADDITIONAL_DATA_PROCESSING_CONSENT, + UsNhField.MSPA_COVERED_TRANSACTION, + UsNhField.MSPA_OPT_OUT_OPTION_MODE, + UsNhField.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USNH_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsNhField.GPC_SEGMENT_TYPE, + UsNhField.GPC + }); + //@formatter:on +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNjField.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNjField.java new file mode 100644 index 00000000..2acba850 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsNjField.java @@ -0,0 +1,48 @@ +package com.iab.gpp.encoder.field; + +import java.util.Arrays; +import java.util.List; + +public class UsNjField { + + public static String VERSION = "Version"; + public static String PROCESSING_NOTICE = "ProcessingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String ADDITIONAL_DATA_PROCESSING_CONSENT = "AdditionalDataProcessingConsent"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; + public static String GPC = "Gpc"; + + //@formatter:off + public static List USNJ_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsNjField.VERSION, + UsNjField.PROCESSING_NOTICE, + UsNjField.SALE_OPT_OUT_NOTICE, + UsNjField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsNjField.SALE_OPT_OUT, + UsNjField.TARGETED_ADVERTISING_OPT_OUT, + UsNjField.SENSITIVE_DATA_PROCESSING, + UsNjField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsNjField.ADDITIONAL_DATA_PROCESSING_CONSENT, + UsNjField.MSPA_COVERED_TRANSACTION, + UsNjField.MSPA_OPT_OUT_OPTION_MODE, + UsNjField.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USNJ_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsNjField.GPC_SEGMENT_TYPE, + UsNjField.GPC + }); + //@formatter:on +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsTnField.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsTnField.java new file mode 100644 index 00000000..7ef8c75d --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/field/UsTnField.java @@ -0,0 +1,48 @@ +package com.iab.gpp.encoder.field; + +import java.util.Arrays; +import java.util.List; + +public class UsTnField { + + public static String VERSION = "Version"; + public static String PROCESSING_NOTICE = "ProcessingNotice"; + public static String SALE_OPT_OUT_NOTICE = "SaleOptOutNotice"; + public static String TARGETED_ADVERTISING_OPT_OUT_NOTICE = "TargetedAdvertisingOptOutNotice"; + public static String SALE_OPT_OUT = "SaleOptOut"; + public static String TARGETED_ADVERTISING_OPT_OUT = "TargetedAdvertisingOptOut"; + public static String SENSITIVE_DATA_PROCESSING = "SensitiveDataProcessing"; + public static String KNOWN_CHILD_SENSITIVE_DATA_CONSENTS = "KnownChildSensitiveDataConsents"; + public static String ADDITIONAL_DATA_PROCESSING_CONSENT = "AdditionalDataProcessingConsent"; + public static String MSPA_COVERED_TRANSACTION = "MspaCoveredTransaction"; + public static String MSPA_OPT_OUT_OPTION_MODE = "MspaOptOutOptionMode"; + public static String MSPA_SERVICE_PROVIDER_MODE = "MspaServiceProviderMode"; + + public static String GPC_SEGMENT_TYPE = "GpcSegmentType"; + public static String GPC_SEGMENT_INCLUDED = "GpcSegmentIncluded"; + public static String GPC = "Gpc"; + + //@formatter:off + public static List USTN_CORE_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsTnField.VERSION, + UsTnField.PROCESSING_NOTICE, + UsTnField.SALE_OPT_OUT_NOTICE, + UsTnField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + UsTnField.SALE_OPT_OUT, + UsTnField.TARGETED_ADVERTISING_OPT_OUT, + UsTnField.SENSITIVE_DATA_PROCESSING, + UsTnField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + UsTnField.ADDITIONAL_DATA_PROCESSING_CONSENT, + UsTnField.MSPA_COVERED_TRANSACTION, + UsTnField.MSPA_OPT_OUT_OPTION_MODE, + UsTnField.MSPA_SERVICE_PROVIDER_MODE + }); + //@formatter:on + + //@formatter:off + public static List USTN_GPC_SEGMENT_FIELD_NAMES = Arrays.asList(new String[] { + UsTnField.GPC_SEGMENT_TYPE, + UsTnField.GPC + }); + //@formatter:on +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java index 7a867374..976805d3 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/Sections.java @@ -28,6 +28,12 @@ public class Sections { SECTION_ID_NAME_MAP.put(UsMt.ID, UsMt.NAME); SECTION_ID_NAME_MAP.put(UsOr.ID, UsOr.NAME); SECTION_ID_NAME_MAP.put(UsTx.ID, UsTx.NAME); + SECTION_ID_NAME_MAP.put(UsDe.ID, UsDe.NAME); + SECTION_ID_NAME_MAP.put(UsIa.ID, UsIa.NAME); + SECTION_ID_NAME_MAP.put(UsNe.ID, UsNe.NAME); + SECTION_ID_NAME_MAP.put(UsNh.ID, UsNh.NAME); + SECTION_ID_NAME_MAP.put(UsNj.ID, UsNj.NAME); + SECTION_ID_NAME_MAP.put(UsTn.ID, UsTn.NAME); SECTION_ORDER = new ArrayList(SECTION_ID_NAME_MAP.keySet()).stream().sorted() .map(id -> SECTION_ID_NAME_MAP.get(id)).collect(Collectors.toList()); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsDe.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsDe.java new file mode 100644 index 00000000..82538ee7 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsDe.java @@ -0,0 +1,142 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.field.UsDeField; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsDeCoreSegment; +import com.iab.gpp.encoder.segment.UsDeGpcSegment; + +public class UsDe extends AbstractLazilyEncodableSection { + + public static int ID = 17; + public static int VERSION = 1; + public static String NAME = "usde"; + + public UsDe() { + super(); + } + + public UsDe(String encodedString) { + super(); + decode(encodedString); + } + + @Override + public int getId() { + return UsDe.ID; + } + + @Override + public String getName() { + return UsDe.NAME; + } + + @Override + public int getVersion() { + return UsDe.VERSION; + } + + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsDeCoreSegment()); + segments.add(new UsDeGpcSegment()); + return segments; + } + + @Override + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if (encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if (encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if (encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsDeField.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsDeField.GPC_SEGMENT_INCLUDED, false); + } + } + + return segments; + } + + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if (!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if (segments.size() >= 2 && segments.get(1).getFieldValue(UsDeField.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); + } + + + public Integer getProcessingNotice() { + return (Integer) this.getFieldValue(UsDeField.PROCESSING_NOTICE); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.getFieldValue(UsDeField.SALE_OPT_OUT_NOTICE); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.getFieldValue(UsDeField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + } + + public Integer getSaleOptOut() { + return (Integer) this.getFieldValue(UsDeField.SALE_OPT_OUT); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.getFieldValue(UsDeField.TARGETED_ADVERTISING_OPT_OUT); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.getFieldValue(UsDeField.SENSITIVE_DATA_PROCESSING); + } + + @SuppressWarnings("unchecked") + public List getKnownChildSensitiveDataConsents() { + return (List) this.getFieldValue(UsDeField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + } + + public Integer getAdditionalDataProcessingConsent() { + return (Integer) this.getFieldValue(UsDeField.ADDITIONAL_DATA_PROCESSING_CONSENT); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.getFieldValue(UsDeField.MSPA_COVERED_TRANSACTION); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.getFieldValue(UsDeField.MSPA_OPT_OUT_OPTION_MODE); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.getFieldValue(UsDeField.MSPA_SERVICE_PROVIDER_MODE); + } + + public Integer getGpcSegmentType() { + return (Integer) this.getFieldValue(UsDeField.GPC_SEGMENT_TYPE); + } + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.getFieldValue(UsDeField.GPC_SEGMENT_INCLUDED); + } + + public Boolean getGpc() { + return (Boolean) this.getFieldValue(UsDeField.GPC); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsIa.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsIa.java new file mode 100644 index 00000000..a3ab88e3 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsIa.java @@ -0,0 +1,141 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.field.UsIaField; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsIaCoreSegment; +import com.iab.gpp.encoder.segment.UsIaGpcSegment; + +public class UsIa extends AbstractLazilyEncodableSection { + + public static int ID = 18; + public static int VERSION = 1; + public static String NAME = "usia"; + + public UsIa() { + super(); + } + + public UsIa(String encodedString) { + super(); + decode(encodedString); + } + + @Override + public int getId() { + return UsIa.ID; + } + + @Override + public String getName() { + return UsIa.NAME; + } + + @Override + public int getVersion() { + return UsIa.VERSION; + } + + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsIaCoreSegment()); + segments.add(new UsIaGpcSegment()); + return segments; + } + + @Override + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if (encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if (encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if (encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsIaField.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsIaField.GPC_SEGMENT_INCLUDED, false); + } + } + + return segments; + } + + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if (!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if (segments.size() >= 2 && segments.get(1).getFieldValue(UsIaField.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); + } + + + public Integer getProcessingNotice() { + return (Integer) this.getFieldValue(UsIaField.PROCESSING_NOTICE); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.getFieldValue(UsIaField.SALE_OPT_OUT_NOTICE); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.getFieldValue(UsIaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + } + + public Integer getSensitiveDataOptOutNotice() { + return (Integer) this.getFieldValue(UsIaField.SENSITIVE_DATA_OPT_OUT_NOTICE); + } + + public Integer getSaleOptOut() { + return (Integer) this.getFieldValue(UsIaField.SALE_OPT_OUT); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.getFieldValue(UsIaField.TARGETED_ADVERTISING_OPT_OUT); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.getFieldValue(UsIaField.SENSITIVE_DATA_PROCESSING); + } + + public Integer getKnownChildSensitiveDataConsents() { + return (Integer) this.getFieldValue(UsIaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.getFieldValue(UsIaField.MSPA_COVERED_TRANSACTION); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.getFieldValue(UsIaField.MSPA_OPT_OUT_OPTION_MODE); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.getFieldValue(UsIaField.MSPA_SERVICE_PROVIDER_MODE); + } + + public Integer getGpcSegmentType() { + return (Integer) this.getFieldValue(UsIaField.GPC_SEGMENT_TYPE); + } + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.getFieldValue(UsIaField.GPC_SEGMENT_INCLUDED); + } + + public Boolean getGpc() { + return (Boolean) this.getFieldValue(UsIaField.GPC); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNe.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNe.java new file mode 100644 index 00000000..e8b7b882 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNe.java @@ -0,0 +1,141 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.field.UsNeField; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsNeCoreSegment; +import com.iab.gpp.encoder.segment.UsNeGpcSegment; + +public class UsNe extends AbstractLazilyEncodableSection { + + public static int ID = 19; + public static int VERSION = 1; + public static String NAME = "usne"; + + public UsNe() { + super(); + } + + public UsNe(String encodedString) { + super(); + decode(encodedString); + } + + @Override + public int getId() { + return UsNe.ID; + } + + @Override + public String getName() { + return UsNe.NAME; + } + + @Override + public int getVersion() { + return UsNe.VERSION; + } + + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsNeCoreSegment()); + segments.add(new UsNeGpcSegment()); + return segments; + } + + @Override + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if(encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if(encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsNeField.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsNeField.GPC_SEGMENT_INCLUDED, false); + } + } + + return segments; + } + + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if(!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsNeField.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); + } + + + public Integer getProcessingNotice() { + return (Integer) this.getFieldValue(UsNeField.PROCESSING_NOTICE); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.getFieldValue(UsNeField.SALE_OPT_OUT_NOTICE); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.getFieldValue(UsNeField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + } + + public Integer getSaleOptOut() { + return (Integer) this.getFieldValue(UsNeField.SALE_OPT_OUT); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.getFieldValue(UsNeField.TARGETED_ADVERTISING_OPT_OUT); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.getFieldValue(UsNeField.SENSITIVE_DATA_PROCESSING); + } + + public Integer getKnownChildSensitiveDataConsents() { + return (Integer) this.getFieldValue(UsNeField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + } + + public Integer getAdditionalDataProcessingConsent() { + return (Integer) this.getFieldValue(UsNeField.ADDITIONAL_DATA_PROCESSING_CONSENT); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.getFieldValue(UsNeField.MSPA_COVERED_TRANSACTION); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.getFieldValue(UsNeField.MSPA_OPT_OUT_OPTION_MODE); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.getFieldValue(UsNeField.MSPA_SERVICE_PROVIDER_MODE); + } + + public Integer getGpcSegmentType() { + return (Integer) this.getFieldValue(UsNeField.GPC_SEGMENT_TYPE); + } + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.getFieldValue(UsNeField.GPC_SEGMENT_INCLUDED); + } + + public Boolean getGpc() { + return (Boolean) this.getFieldValue(UsNeField.GPC); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNh.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNh.java new file mode 100644 index 00000000..7bf40fe2 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNh.java @@ -0,0 +1,142 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.field.UsNhField; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsNhCoreSegment; +import com.iab.gpp.encoder.segment.UsNhGpcSegment; + +public class UsNh extends AbstractLazilyEncodableSection { + + public static int ID = 20; + public static int VERSION = 1; + public static String NAME = "usnh"; + + public UsNh() { + super(); + } + + public UsNh(String encodedString) { + super(); + decode(encodedString); + } + + @Override + public int getId() { + return UsNh.ID; + } + + @Override + public String getName() { + return UsNh.NAME; + } + + @Override + public int getVersion() { + return UsNh.VERSION; + } + + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsNhCoreSegment()); + segments.add(new UsNhGpcSegment()); + return segments; + } + + @Override + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if(encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if(encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsNhField.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsNhField.GPC_SEGMENT_INCLUDED, false); + } + } + + return segments; + } + + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if(!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsNhField.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); + } + + + public Integer getProcessingNotice() { + return (Integer) this.getFieldValue(UsNhField.PROCESSING_NOTICE); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.getFieldValue(UsNhField.SALE_OPT_OUT_NOTICE); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.getFieldValue(UsNhField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + } + + public Integer getSaleOptOut() { + return (Integer) this.getFieldValue(UsNhField.SALE_OPT_OUT); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.getFieldValue(UsNhField.TARGETED_ADVERTISING_OPT_OUT); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.getFieldValue(UsNhField.SENSITIVE_DATA_PROCESSING); + } + + @SuppressWarnings("unchecked") + public List getKnownChildSensitiveDataConsents() { + return (List) this.getFieldValue(UsNhField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + } + + public Integer getAdditionalDataProcessingConsent() { + return (Integer) this.getFieldValue(UsNhField.ADDITIONAL_DATA_PROCESSING_CONSENT); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.getFieldValue(UsNhField.MSPA_COVERED_TRANSACTION); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.getFieldValue(UsNhField.MSPA_OPT_OUT_OPTION_MODE); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.getFieldValue(UsNhField.MSPA_SERVICE_PROVIDER_MODE); + } + + public Integer getGpcSegmentType() { + return (Integer) this.getFieldValue(UsNhField.GPC_SEGMENT_TYPE); + } + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.getFieldValue(UsNhField.GPC_SEGMENT_INCLUDED); + } + + public Boolean getGpc() { + return (Boolean) this.getFieldValue(UsNhField.GPC); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNj.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNj.java new file mode 100644 index 00000000..f24e043f --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsNj.java @@ -0,0 +1,142 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.field.UsNjField; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsNjCoreSegment; +import com.iab.gpp.encoder.segment.UsNjGpcSegment; + +public class UsNj extends AbstractLazilyEncodableSection { + + public static int ID = 21; + public static int VERSION = 1; + public static String NAME = "usnj"; + + public UsNj() { + super(); + } + + public UsNj(String encodedString) { + super(); + decode(encodedString); + } + + @Override + public int getId() { + return UsNj.ID; + } + + @Override + public String getName() { + return UsNj.NAME; + } + + @Override + public int getVersion() { + return UsNj.VERSION; + } + + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsNjCoreSegment()); + segments.add(new UsNjGpcSegment()); + return segments; + } + + @Override + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if(encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if(encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsNjField.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsNjField.GPC_SEGMENT_INCLUDED, false); + } + } + + return segments; + } + + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if(!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsNjField.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); + } + + + public Integer getProcessingNotice() { + return (Integer) this.getFieldValue(UsNjField.PROCESSING_NOTICE); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.getFieldValue(UsNjField.SALE_OPT_OUT_NOTICE); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.getFieldValue(UsNjField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + } + + public Integer getSaleOptOut() { + return (Integer) this.getFieldValue(UsNjField.SALE_OPT_OUT); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.getFieldValue(UsNjField.TARGETED_ADVERTISING_OPT_OUT); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.getFieldValue(UsNjField.SENSITIVE_DATA_PROCESSING); + } + + @SuppressWarnings("unchecked") + public List getKnownChildSensitiveDataConsents() { + return (List) this.getFieldValue(UsNjField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + } + + public Integer getAdditionalDataProcessingConsent() { + return (Integer) this.getFieldValue(UsNjField.ADDITIONAL_DATA_PROCESSING_CONSENT); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.getFieldValue(UsNjField.MSPA_COVERED_TRANSACTION); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.getFieldValue(UsNjField.MSPA_OPT_OUT_OPTION_MODE); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.getFieldValue(UsNjField.MSPA_SERVICE_PROVIDER_MODE); + } + + public Integer getGpcSegmentType() { + return (Integer) this.getFieldValue(UsNjField.GPC_SEGMENT_TYPE); + } + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.getFieldValue(UsNjField.GPC_SEGMENT_INCLUDED); + } + + public Boolean getGpc() { + return (Boolean) this.getFieldValue(UsNjField.GPC); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsTn.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsTn.java new file mode 100644 index 00000000..2403f09d --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/section/UsTn.java @@ -0,0 +1,141 @@ +package com.iab.gpp.encoder.section; + +import java.util.ArrayList; +import java.util.List; +import com.iab.gpp.encoder.field.UsTnField; +import com.iab.gpp.encoder.segment.EncodableSegment; +import com.iab.gpp.encoder.segment.UsTnCoreSegment; +import com.iab.gpp.encoder.segment.UsTnGpcSegment; + +public class UsTn extends AbstractLazilyEncodableSection { + + public static int ID = 22; + public static int VERSION = 1; + public static String NAME = "ustn"; + + public UsTn() { + super(); + } + + public UsTn(String encodedString) { + super(); + decode(encodedString); + } + + @Override + public int getId() { + return UsTn.ID; + } + + @Override + public String getName() { + return UsTn.NAME; + } + + @Override + public int getVersion() { + return UsTn.VERSION; + } + + @Override + protected List initializeSegments() { + List segments = new ArrayList<>(); + segments.add(new UsTnCoreSegment()); + segments.add(new UsTnGpcSegment()); + return segments; + } + + @Override + protected List decodeSection(String encodedString) { + List segments = initializeSegments(); + + if(encodedString != null && !encodedString.isEmpty()) { + String[] encodedSegments = encodedString.split("\\."); + + if(encodedSegments.length > 0) { + segments.get(0).decode(encodedSegments[0]); + } + + if(encodedSegments.length > 1) { + segments.get(1).setFieldValue(UsTnField.GPC_SEGMENT_INCLUDED, true); + segments.get(1).decode(encodedSegments[1]); + } else { + segments.get(1).setFieldValue(UsTnField.GPC_SEGMENT_INCLUDED, false); + } + } + + return segments; + } + + @Override + protected String encodeSection(List segments) { + List encodedSegments = new ArrayList<>(); + + if(!segments.isEmpty()) { + encodedSegments.add(segments.get(0).encode()); + if(segments.size() >= 2 && segments.get(1).getFieldValue(UsTnField.GPC_SEGMENT_INCLUDED).equals(true)) { + encodedSegments.add(segments.get(1).encode()); + } + } + + return String.join(".", encodedSegments); + } + + + public Integer getProcessingNotice() { + return (Integer) this.getFieldValue(UsTnField.PROCESSING_NOTICE); + } + + public Integer getSaleOptOutNotice() { + return (Integer) this.getFieldValue(UsTnField.SALE_OPT_OUT_NOTICE); + } + + public Integer getTargetedAdvertisingOptOutNotice() { + return (Integer) this.getFieldValue(UsTnField.TARGETED_ADVERTISING_OPT_OUT_NOTICE); + } + + public Integer getSaleOptOut() { + return (Integer) this.getFieldValue(UsTnField.SALE_OPT_OUT); + } + + public Integer getTargetedAdvertisingOptOut() { + return (Integer) this.getFieldValue(UsTnField.TARGETED_ADVERTISING_OPT_OUT); + } + + @SuppressWarnings("unchecked") + public List getSensitiveDataProcessing() { + return (List) this.getFieldValue(UsTnField.SENSITIVE_DATA_PROCESSING); + } + + public Integer getKnownChildSensitiveDataConsents() { + return (Integer) this.getFieldValue(UsTnField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS); + } + + public Integer getAdditionalDataProcessingConsent() { + return (Integer) this.getFieldValue(UsTnField.ADDITIONAL_DATA_PROCESSING_CONSENT); + } + + public Integer getMspaCoveredTransaction() { + return (Integer) this.getFieldValue(UsTnField.MSPA_COVERED_TRANSACTION); + } + + public Integer getMspaOptOutOptionMode() { + return (Integer) this.getFieldValue(UsTnField.MSPA_OPT_OUT_OPTION_MODE); + } + + public Integer getMspaServiceProviderMode() { + return (Integer) this.getFieldValue(UsTnField.MSPA_SERVICE_PROVIDER_MODE); + } + + public Integer getGpcSegmentType() { + return (Integer) this.getFieldValue(UsTnField.GPC_SEGMENT_TYPE); + } + + public Boolean getGpcSegmentIncluded() { + return (Boolean) this.getFieldValue(UsTnField.GPC_SEGMENT_INCLUDED); + } + + public Boolean getGpc() { + return (Boolean) this.getFieldValue(UsTnField.GPC); + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsDeCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsDeCoreSegment.java new file mode 100644 index 00000000..a011faa0 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsDeCoreSegment.java @@ -0,0 +1,98 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsDeField; +import com.iab.gpp.encoder.field.UsVaField; +import com.iab.gpp.encoder.section.UsDe; + +public class UsDeCoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsDeCoreSegment() { + super(); + } + + public UsDeCoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsDeField.USDE_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsDeField.VERSION, new EncodableFixedInteger(6, UsDe.VERSION)); + fields.put(UsDeField.PROCESSING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsDeField.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsDeField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsDeField.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsDeField.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsDeField.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsVaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsDeField.ADDITIONAL_DATA_PROCESSING_CONSENT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsDeField.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsDeField.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsDeField.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if (encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsDeCoreSegment '" + encodedString + "'", e); + } + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsDeGpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsDeGpcSegment.java new file mode 100644 index 00000000..66fe0431 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsDeGpcSegment.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsDeField; + +public class UsDeGpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsDeGpcSegment() { + super(); + } + + public UsDeGpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsDeField.USDE_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsDeField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsDeField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsDeField.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsDeGpcSegment '" + encodedString + "'", e); + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsIaCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsIaCoreSegment.java new file mode 100644 index 00000000..9cd9a917 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsIaCoreSegment.java @@ -0,0 +1,97 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsIaField; +import com.iab.gpp.encoder.field.UsVaField; +import com.iab.gpp.encoder.section.UsIa; + +public class UsIaCoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsIaCoreSegment() { + super(); + } + + public UsIaCoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsIaField.USIA_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsIaField.VERSION, new EncodableFixedInteger(6, UsIa.VERSION)); + fields.put(UsIaField.PROCESSING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsIaField.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsIaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsIaField.SENSITIVE_DATA_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsIaField.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsIaField.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsIaField.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsVaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsIaField.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsIaField.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsIaField.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if (encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsIaCoreSegment '" + encodedString + "'", e); + } + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsIaGpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsIaGpcSegment.java new file mode 100644 index 00000000..12cb0bd6 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsIaGpcSegment.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsIaField; + +public class UsIaGpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsIaGpcSegment() { + super(); + } + + public UsIaGpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsIaField.USIA_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsIaField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsIaField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsIaField.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsIaGpcSegment '" + encodedString + "'", e); + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java index 6b148ea9..204ea2f3 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java @@ -67,9 +67,9 @@ protected EncodableBitStringFields initializeFields() { fields.put(UsNatField.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); fields.put(UsNatField.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); - fields.put(UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0)) + fields.put(UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0)) .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); fields.put(UsNatField.PERSONAL_DATA_CONSENTS, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); @@ -96,6 +96,15 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel } try { String bitString = base64UrlEncoder.decode(encodedString); + + // Necessary to maintain backwards compatibility when sensitive data processing changed from a + // length of 12 to 16 and known child sensitive data consents changed from a length of 2 to 3 in the + // DE, IA, NE, NH, NJ, TN release + if (bitString.length() == 66) { + bitString = + bitString.substring(0, 48) + "00000000" + bitString.substring(48, 52) + "00" + bitString.substring(52, 62); + } + bitStringEncoder.decode(bitString, getFieldNames(), fields); } catch (Exception e) { throw new DecodingException("Unable to decode UsNatCoreSegment '" + encodedString + "'", e); @@ -115,8 +124,7 @@ public void validate() { ((EncodableFixedInteger) fields.get(UsNatField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); Integer mspaServiceProviderMode = ((EncodableFixedInteger) fields.get(UsNatField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); - Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsNatField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); + Integer mspaOptOutOptionMode = ((EncodableFixedInteger) fields.get(UsNatField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); Integer sensitiveDataLimtUserNotice = ((EncodableFixedInteger) fields.get(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE)).getValue(); diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNeCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNeCoreSegment.java new file mode 100644 index 00000000..7a98c30f --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNeCoreSegment.java @@ -0,0 +1,97 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsNeField; +import com.iab.gpp.encoder.field.UsVaField; +import com.iab.gpp.encoder.section.UsNe; + +public class UsNeCoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsNeCoreSegment() { + super(); + } + + public UsNeCoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsNeField.USNE_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsNeField.VERSION, new EncodableFixedInteger(6, UsNe.VERSION)); + fields.put(UsNeField.PROCESSING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNeField.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNeField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNeField.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNeField.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNeField.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsVaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNeField.ADDITIONAL_DATA_PROCESSING_CONSENT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNeField.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNeField.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNeField.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if (encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsNeCoreSegment '" + encodedString + "'", e); + } + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNeGpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNeGpcSegment.java new file mode 100644 index 00000000..6d050371 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNeGpcSegment.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsNeField; + +public class UsNeGpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsNeGpcSegment() { + super(); + } + + public UsNeGpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsNeField.USNE_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsNeField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsNeField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsNeField.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsNeGpcSegment '" + encodedString + "'", e); + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNhCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNhCoreSegment.java new file mode 100644 index 00000000..76fedd66 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNhCoreSegment.java @@ -0,0 +1,96 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsNhField; +import com.iab.gpp.encoder.section.UsNh; + +public class UsNhCoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsNhCoreSegment() { + super(); + } + + public UsNhCoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsNhField.USNH_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsNhField.VERSION, new EncodableFixedInteger(6, UsNh.VERSION)); + fields.put(UsNhField.PROCESSING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNhField.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNhField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNhField.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNhField.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNhField.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsNhField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsNhField.ADDITIONAL_DATA_PROCESSING_CONSENT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNhField.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNhField.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNhField.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if (encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsNhCoreSegment '" + encodedString + "'", e); + } + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNhGpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNhGpcSegment.java new file mode 100644 index 00000000..86587dd0 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNhGpcSegment.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsNhField; + +public class UsNhGpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsNhGpcSegment() { + super(); + } + + public UsNhGpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsNhField.USNH_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsNhField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsNhField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsNhField.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsNhGpcSegment '" + encodedString + "'", e); + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNjCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNjCoreSegment.java new file mode 100644 index 00000000..e71fecc1 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNjCoreSegment.java @@ -0,0 +1,96 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsNjField; +import com.iab.gpp.encoder.section.UsNj; + +public class UsNjCoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsNjCoreSegment() { + super(); + } + + public UsNjCoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsNjField.USNJ_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsNjField.VERSION, new EncodableFixedInteger(6, UsNj.VERSION)); + fields.put(UsNjField.PROCESSING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNjField.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNjField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNjField.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNjField.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNjField.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsNjField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsNjField.ADDITIONAL_DATA_PROCESSING_CONSENT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNjField.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNjField.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsNjField.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if (encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsNjCoreSegment '" + encodedString + "'", e); + } + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNjGpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNjGpcSegment.java new file mode 100644 index 00000000..37ee7d34 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNjGpcSegment.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsNjField; + +public class UsNjGpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsNjGpcSegment() { + super(); + } + + public UsNjGpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsNjField.USNJ_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsNjField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsNjField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsNjField.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsNjGpcSegment '" + encodedString + "'", e); + } + } +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTnCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTnCoreSegment.java new file mode 100644 index 00000000..425f1305 --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTnCoreSegment.java @@ -0,0 +1,96 @@ +package com.iab.gpp.encoder.segment; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsTnField; +import com.iab.gpp.encoder.section.UsTn; + +public class UsTnCoreSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsTnCoreSegment() { + super(); + } + + public UsTnCoreSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsTnField.USTN_CORE_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; + } + } + return true; + }); + + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsTnField.VERSION, new EncodableFixedInteger(6, UsTn.VERSION)); + fields.put(UsTnField.PROCESSING_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTnField.SALE_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTnField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTnField.SALE_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTnField.TARGETED_ADVERTISING_OPT_OUT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTnField.SENSITIVE_DATA_PROCESSING, + new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsTnField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTnField.ADDITIONAL_DATA_PROCESSING_CONSENT, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTnField.MSPA_COVERED_TRANSACTION, + new EncodableFixedInteger(2, 1).withValidator(nonNullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTnField.MSPA_OPT_OUT_OPTION_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + fields.put(UsTnField.MSPA_SERVICE_PROVIDER_MODE, + new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if (encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsTnCoreSegment '" + encodedString + "'", e); + } + } + +} diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTnGpcSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTnGpcSegment.java new file mode 100644 index 00000000..f4a0b32c --- /dev/null +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTnGpcSegment.java @@ -0,0 +1,60 @@ +package com.iab.gpp.encoder.segment; + +import java.util.List; +import com.iab.gpp.encoder.base64.AbstractBase64UrlEncoder; +import com.iab.gpp.encoder.base64.CompressedBase64UrlEncoder; +import com.iab.gpp.encoder.bitstring.BitStringEncoder; +import com.iab.gpp.encoder.datatype.EncodableBoolean; +import com.iab.gpp.encoder.datatype.EncodableFixedInteger; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.field.EncodableBitStringFields; +import com.iab.gpp.encoder.field.UsTnField; + +public class UsTnGpcSegment extends AbstractLazilyEncodableSegment { + + private AbstractBase64UrlEncoder base64UrlEncoder = CompressedBase64UrlEncoder.getInstance(); + private BitStringEncoder bitStringEncoder = BitStringEncoder.getInstance(); + + public UsTnGpcSegment() { + super(); + } + + public UsTnGpcSegment(String encodedString) { + super(); + this.decode(encodedString); + } + + @Override + public List getFieldNames() { + return UsTnField.USTN_GPC_SEGMENT_FIELD_NAMES; + } + + @Override + protected EncodableBitStringFields initializeFields() { + EncodableBitStringFields fields = new EncodableBitStringFields(); + fields.put(UsTnField.GPC_SEGMENT_TYPE, new EncodableFixedInteger(2, 1)); + fields.put(UsTnField.GPC_SEGMENT_INCLUDED, new EncodableBoolean(true)); + fields.put(UsTnField.GPC, new EncodableBoolean(false)); + return fields; + } + + @Override + protected String encodeSegment(EncodableBitStringFields fields) { + String bitString = bitStringEncoder.encode(fields, getFieldNames()); + String encodedString = base64UrlEncoder.encode(bitString); + return encodedString; + } + + @Override + protected void decodeSegment(String encodedString, EncodableBitStringFields fields) { + if(encodedString == null || encodedString.isEmpty()) { + this.fields.reset(fields); + } + try { + String bitString = base64UrlEncoder.decode(encodedString); + bitStringEncoder.decode(bitString, getFieldNames(), fields); + } catch (Exception e) { + throw new DecodingException("Unable to decode UsTnGpcSegment '" + encodedString + "'", e); + } + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 8e83b800..9a6e9609 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -25,10 +25,16 @@ import com.iab.gpp.encoder.section.UsCa; import com.iab.gpp.encoder.section.UsCo; import com.iab.gpp.encoder.section.UsCt; +import com.iab.gpp.encoder.section.UsDe; import com.iab.gpp.encoder.section.UsFl; +import com.iab.gpp.encoder.section.UsIa; import com.iab.gpp.encoder.section.UsMt; import com.iab.gpp.encoder.section.UsNat; +import com.iab.gpp.encoder.section.UsNe; +import com.iab.gpp.encoder.section.UsNh; +import com.iab.gpp.encoder.section.UsNj; import com.iab.gpp.encoder.section.UsOr; +import com.iab.gpp.encoder.section.UsTn; import com.iab.gpp.encoder.section.UsTx; import com.iab.gpp.encoder.section.UsUt; import com.iab.gpp.encoder.section.UsVa; @@ -94,6 +100,12 @@ public void testEncodeDefaultAll() { Assertions.assertEquals(false, gppModel.hasSection(UsMt.NAME)); Assertions.assertEquals(false, gppModel.hasSection(UsOr.NAME)); Assertions.assertEquals(false, gppModel.hasSection(UsTx.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsDe.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsIa.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsNe.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsNh.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsNj.NAME)); + Assertions.assertEquals(false, gppModel.hasSection(UsTn.NAME)); gppModel.setFieldValue(TcfEuV2.NAME, TcfEuV2Field.VERSION, TcfEuV2.VERSION); gppModel.setFieldValue(TcfEuV2.NAME, TcfCaV1Field.CREATED, utcDateTime); @@ -112,6 +124,12 @@ public void testEncodeDefaultAll() { gppModel.setFieldValue(UsMt.NAME, UsMtField.VERSION, UsMt.VERSION); gppModel.setFieldValue(UsOr.NAME, UsOrField.VERSION, UsOr.VERSION); gppModel.setFieldValue(UsTx.NAME, UsTxField.VERSION, UsTx.VERSION); + gppModel.setFieldValue(UsDe.NAME, UsTxField.VERSION, UsTx.VERSION); + gppModel.setFieldValue(UsIa.NAME, UsTxField.VERSION, UsTx.VERSION); + gppModel.setFieldValue(UsNe.NAME, UsTxField.VERSION, UsTx.VERSION); + gppModel.setFieldValue(UsNh.NAME, UsTxField.VERSION, UsTx.VERSION); + gppModel.setFieldValue(UsNj.NAME, UsTxField.VERSION, UsTx.VERSION); + gppModel.setFieldValue(UsTn.NAME, UsTxField.VERSION, UsTx.VERSION); @@ -128,10 +146,16 @@ public void testEncodeDefaultAll() { Assertions.assertEquals(true, gppModel.hasSection(UsMt.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UsOr.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UsTx.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsDe.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsIa.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsNe.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsNh.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsNj.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsTn.NAME)); String gppString = gppModel.encode(); Assertions.assertEquals( - "DBACOZY~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAQA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA~BAAAAABA~BAAAAABA.QA~BAAAAAABAA.QA~BAAAAAQA.QA", + "DBACOdM~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAABA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA~BAAAAABA~BAAAAABA.QA~BAAAAAABAA.QA~BAAAAAQA.QA~BAAAAAABAA.QA~BAAAAAQA.QA~BAAAAAQA.QA~BAAAAABA.QA~BAAAAAAAQA.QA~BAAAAAQA.QA", gppString); } @@ -391,7 +415,7 @@ public void testDecodeDefaults() { @Test public void testDecodeDefaultsAll() { String gppString = - "DBACOaw~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAQA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA"; + "DBACOdM~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAABA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA~BAAAAABA~BAAAAABA.QA~BAAAAAABAA.QA~BAAAAAQA.QA~BAAAAAABAA.QA~BAAAAAQA.QA~BAAAAAQA.QA~BAAAAABA.QA~BAAAAAAAQA.QA~BAAAAAQA.QA"; GppModel gppModel = new GppModel(gppString); Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); @@ -403,6 +427,16 @@ public void testDecodeDefaultsAll() { Assertions.assertEquals(true, gppModel.hasSection(UsCo.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UsUt.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UsCt.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsFl.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsMt.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsOr.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsTx.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsDe.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsIa.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsNe.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsNh.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsNj.NAME)); + Assertions.assertEquals(true, gppModel.hasSection(UsTn.NAME)); } @Test @@ -676,6 +710,52 @@ public void testDecode4() { } + @Test + public void testDecode5() { + GppModel gppModel = new GppModel("DBABLA~BVQqAAAAAgA.QA"); + gppModel.getFieldValue(UsNat.NAME, UspV1Field.VERSION); + } + + @Test + public void testDecode6() { + GppModel gppModel = new GppModel("DBABLA~BAAAAAAAAQA.QA"); + gppModel.getFieldValue(UsNat.NAME, UspV1Field.VERSION); + Assertions.assertEquals(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + gppModel.getFieldValue(UsNat.NAME, UsNatField.SENSITIVE_DATA_PROCESSING)); + Assertions.assertEquals(Arrays.asList(0, 0, 0), + gppModel.getFieldValue(UsNat.NAME, UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS)); + } + + @Test + public void testDecode7() { + GppModel gppModel = new GppModel("DBABLA~BAAAAAAAAABA.QA"); + gppModel.getFieldValue(UsNat.NAME, UspV1Field.VERSION); + Assertions.assertEquals(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + gppModel.getFieldValue(UsNat.NAME, UsNatField.SENSITIVE_DATA_PROCESSING)); + Assertions.assertEquals(Arrays.asList(0, 0, 0), + gppModel.getFieldValue(UsNat.NAME, UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS)); + } + + @Test + public void testDecode8() { + GppModel gppModel = new GppModel("DBABLA~BAAAAAABEQA.QA"); + gppModel.getFieldValue(UsNat.NAME, UspV1Field.VERSION); + Assertions.assertEquals(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0), + gppModel.getFieldValue(UsNat.NAME, UsNatField.SENSITIVE_DATA_PROCESSING)); + Assertions.assertEquals(Arrays.asList(0, 1, 0), + gppModel.getFieldValue(UsNat.NAME, UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS)); + } + + @Test + public void testDecode9() { + GppModel gppModel = new GppModel("DBABLA~BAAAAAAAAQRA.QA"); + gppModel.getFieldValue(UsNat.NAME, UspV1Field.VERSION); + Assertions.assertEquals(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), + gppModel.getFieldValue(UsNat.NAME, UsNatField.SENSITIVE_DATA_PROCESSING)); + Assertions.assertEquals(Arrays.asList(0, 0, 1), + gppModel.getFieldValue(UsNat.NAME, UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS)); + } + @Test public void testConsistency() { GppModel fromObjectModel = new GppModel(); @@ -741,4 +821,6 @@ public void testDecodingEmptyString() { gppModel.setFieldValue("uspv1", UspV1Field.NOTICE, 'Y'); Assertions.assertEquals("DBABTA~1Y--", gppModel.encode()); } + + } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsDeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsDeTest.java new file mode 100644 index 00000000..30341616 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsDeTest.java @@ -0,0 +1,170 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsDeField; + +public class UsDeTest { + + @Test + public void testEncode1() { + UsDe usDe = new UsDe(); + Assertions.assertEquals("BAAAAAABAA.QA", usDe.encode()); + } + + @Test + public void testEncode2() { + UsDe usDe = new UsDe(); + + usDe.setFieldValue(UsDeField.PROCESSING_NOTICE, 1); + usDe.setFieldValue(UsDeField.SALE_OPT_OUT_NOTICE, 1); + usDe.setFieldValue(UsDeField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usDe.setFieldValue(UsDeField.SALE_OPT_OUT, 1); + usDe.setFieldValue(UsDeField.TARGETED_ADVERTISING_OPT_OUT, 1); + usDe.setFieldValue(UsDeField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0)); + usDe.setFieldValue(UsDeField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1, 0, 2, 1)); + usDe.setFieldValue(UsDeField.ADDITIONAL_DATA_PROCESSING_CONSENT, 1); + usDe.setFieldValue(UsDeField.MSPA_COVERED_TRANSACTION, 1); + usDe.setFieldValue(UsDeField.MSPA_OPT_OUT_OPTION_MODE, 1); + usDe.setFieldValue(UsDeField.MSPA_SERVICE_PROVIDER_MODE, 2); + usDe.setFieldValue(UsDeField.GPC, true); + + Assertions.assertEquals("BVWSSSSVYA.YA", usDe.encode()); + } + + @Test + public void testSetInvalidValues() { + UsDe usDe = new UsDe(); + + try { + usDe.setFieldValue(UsDeField.PROCESSING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usDe.setFieldValue(UsDeField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usDe.setFieldValue(UsDeField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usDe.setFieldValue(UsDeField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usDe.setFieldValue(UsDeField.TARGETED_ADVERTISING_OPT_OUT, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usDe.setFieldValue(UsDeField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usDe.setFieldValue(UsDeField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usDe.setFieldValue(UsDeField.ADDITIONAL_DATA_PROCESSING_CONSENT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usDe.setFieldValue(UsDeField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usDe.setFieldValue(UsDeField.MSPA_OPT_OUT_OPTION_MODE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usDe.setFieldValue(UsDeField.MSPA_SERVICE_PROVIDER_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + UsDe usDe = new UsDe(); + usDe.setFieldValue(UsDeField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAABAA", usDe.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsDe usDe = new UsDe("BVWSSSSVYA.YA"); + + Assertions.assertEquals(1, usDe.getProcessingNotice()); + Assertions.assertEquals(1, usDe.getSaleOptOutNotice()); + Assertions.assertEquals(1, usDe.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usDe.getSaleOptOut()); + Assertions.assertEquals(1, usDe.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0), usDe.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1), usDe.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usDe.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usDe.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usDe.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usDe.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usDe.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsDe usDe = new UsDe("BVWSSSSVYA"); + + Assertions.assertEquals(1, usDe.getProcessingNotice()); + Assertions.assertEquals(1, usDe.getSaleOptOutNotice()); + Assertions.assertEquals(1, usDe.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usDe.getSaleOptOut()); + Assertions.assertEquals(1, usDe.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0), usDe.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1), usDe.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usDe.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usDe.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usDe.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usDe.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usDe.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsDe("z").getProcessingNotice(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsIaTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsIaTest.java new file mode 100644 index 00000000..4171eac1 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsIaTest.java @@ -0,0 +1,170 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsIaField; + +public class UsIaTest { + + @Test + public void testEncode1() { + UsIa usIa = new UsIa(); + Assertions.assertEquals("BAAAAAQA.QA", usIa.encode()); + } + + @Test + public void testEncode2() { + UsIa usIa = new UsIa(); + + usIa.setFieldValue(UsIaField.PROCESSING_NOTICE, 1); + usIa.setFieldValue(UsIaField.SALE_OPT_OUT_NOTICE, 1); + usIa.setFieldValue(UsIaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usIa.setFieldValue(UsIaField.SENSITIVE_DATA_OPT_OUT_NOTICE, 1); + usIa.setFieldValue(UsIaField.SALE_OPT_OUT, 1); + usIa.setFieldValue(UsIaField.TARGETED_ADVERTISING_OPT_OUT, 1); + usIa.setFieldValue(UsIaField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usIa.setFieldValue(UsIaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); + usIa.setFieldValue(UsIaField.MSPA_COVERED_TRANSACTION, 1); + usIa.setFieldValue(UsIaField.MSPA_OPT_OUT_OPTION_MODE, 1); + usIa.setFieldValue(UsIaField.MSPA_SERVICE_PROVIDER_MODE, 2); + usIa.setFieldValue(UsIaField.GPC, true); + + Assertions.assertEquals("BVVkklWA.YA", usIa.encode()); + } + + @Test + public void testSetInvalidValues() { + UsIa usIa = new UsIa(); + + try { + usIa.setFieldValue(UsIaField.PROCESSING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usIa.setFieldValue(UsIaField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usIa.setFieldValue(UsIaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usIa.setFieldValue(UsIaField.SENSITIVE_DATA_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usIa.setFieldValue(UsIaField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usIa.setFieldValue(UsIaField.TARGETED_ADVERTISING_OPT_OUT, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usIa.setFieldValue(UsIaField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usIa.setFieldValue(UsIaField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usIa.setFieldValue(UsIaField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usIa.setFieldValue(UsIaField.MSPA_OPT_OUT_OPTION_MODE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usIa.setFieldValue(UsIaField.MSPA_SERVICE_PROVIDER_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + UsIa usIa = new UsIa(); + usIa.setFieldValue(UsIaField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAQA", usIa.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsIa usIa = new UsIa("BVVkklWA.YA"); + + Assertions.assertEquals(1, usIa.getProcessingNotice()); + Assertions.assertEquals(1, usIa.getSaleOptOutNotice()); + Assertions.assertEquals(1, usIa.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usIa.getSensitiveDataOptOutNotice()); + Assertions.assertEquals(1, usIa.getSaleOptOut()); + Assertions.assertEquals(1, usIa.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usIa.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usIa.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usIa.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usIa.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usIa.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usIa.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsIa usIa = new UsIa("BVVkklWA"); + + Assertions.assertEquals(1, usIa.getProcessingNotice()); + Assertions.assertEquals(1, usIa.getSaleOptOutNotice()); + Assertions.assertEquals(1, usIa.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usIa.getSensitiveDataOptOutNotice()); + Assertions.assertEquals(1, usIa.getSaleOptOut()); + Assertions.assertEquals(1, usIa.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usIa.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usIa.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usIa.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usIa.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usIa.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usIa.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsIa("z").getProcessingNotice(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java index 52c8f589..85ee7013 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java @@ -14,7 +14,7 @@ public class UsNatTest { public void testEncode1() { UsNat usNat = new UsNat(); - Assertions.assertEquals("BAAAAAAAAQA.QA", usNat.encode()); + Assertions.assertEquals("BAAAAAAAAABA.QA", usNat.encode()); } @Test @@ -30,15 +30,15 @@ public void testEncode2() { usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 1); usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 1); usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 1); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0)); - usNat.setFieldValue(UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2)); + usNat.setFieldValue(UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1, 0)); usNat.setFieldValue(UsNatField.PERSONAL_DATA_CONSENTS, 1); usNat.setFieldValue(UsNatField.MSPA_COVERED_TRANSACTION, 1); usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 1); usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); usNat.setFieldValue(UsNatField.GPC, true); - Assertions.assertEquals("BVVVkkkklWA.YA", usNat.encode()); + Assertions.assertEquals("BVVVkkkkkpFY.YA", usNat.encode()); } @Test @@ -575,15 +575,15 @@ public void testEncode3() { usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 1); usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 1); usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 1); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0)); - usNat.setFieldValue(UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1)); + usNat.setFieldValue(UsNatField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2)); + usNat.setFieldValue(UsNatField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1, 0)); usNat.setFieldValue(UsNatField.PERSONAL_DATA_CONSENTS, 1); usNat.setFieldValue(UsNatField.MSPA_COVERED_TRANSACTION, 1); usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 1); usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); usNat.setFieldValue(UsNatField.GPC, true); - Assertions.assertEquals("BVVVkkkklWA.YA", usNat.encode()); + Assertions.assertEquals("BVVVkkkkkpFY.YA", usNat.encode()); } @Test @@ -591,12 +591,12 @@ public void testEncodeWithGpcSegmentIncluded() { UsNat usNat = new UsNat(); usNat.setFieldValue(UsNatField.GPC_SEGMENT_INCLUDED, false); - Assertions.assertEquals("BAAAAAAAAQA", usNat.encode()); + Assertions.assertEquals("BAAAAAAAAABA", usNat.encode()); } @Test public void testDecode1() throws DecodingException { - UsNat usNat = new UsNat("BVVVkkkklWA.YA"); + UsNat usNat = new UsNat("BVVVkkkkkpFY.YA"); Assertions.assertEquals(1, usNat.getSharingNotice()); Assertions.assertEquals(1, usNat.getSaleOptOutNotice()); @@ -607,8 +607,8 @@ public void testDecode1() throws DecodingException { Assertions.assertEquals(1, usNat.getSaleOptOut()); Assertions.assertEquals(1, usNat.getSharingOptOut()); Assertions.assertEquals(1, usNat.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0), usNat.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(2, 1), usNat.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2), usNat.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usNat.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usNat.getPersonalDataConsents()); Assertions.assertEquals(1, usNat.getMspaCoveredTransaction()); Assertions.assertEquals(1, usNat.getMspaOptOutOptionMode()); @@ -618,7 +618,7 @@ public void testDecode1() throws DecodingException { @Test public void testDecodeWithGpcSegmentExcluded() throws DecodingException { - UsNat usNat = new UsNat("BVVVkkkklWA"); + UsNat usNat = new UsNat("BVVVkkkkkpFY"); Assertions.assertEquals(1, usNat.getSharingNotice()); Assertions.assertEquals(1, usNat.getSaleOptOutNotice()); @@ -629,8 +629,8 @@ public void testDecodeWithGpcSegmentExcluded() throws DecodingException { Assertions.assertEquals(1, usNat.getSaleOptOut()); Assertions.assertEquals(1, usNat.getSharingOptOut()); Assertions.assertEquals(1, usNat.getTargetedAdvertisingOptOut()); - Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0), usNat.getSensitiveDataProcessing()); - Assertions.assertEquals(Arrays.asList(2, 1), usNat.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2), usNat.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usNat.getKnownChildSensitiveDataConsents()); Assertions.assertEquals(1, usNat.getPersonalDataConsents()); Assertions.assertEquals(1, usNat.getMspaCoveredTransaction()); Assertions.assertEquals(1, usNat.getMspaOptOutOptionMode()); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNeTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNeTest.java new file mode 100644 index 00000000..e9e25743 --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNeTest.java @@ -0,0 +1,170 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsNeField; + +public class UsNeTest { + + @Test + public void testEncode1() { + UsNe usNe = new UsNe(); + Assertions.assertEquals("BAAAAAQA.QA", usNe.encode()); + } + + @Test + public void testEncode2() { + UsNe usNe = new UsNe(); + + usNe.setFieldValue(UsNeField.PROCESSING_NOTICE, 1); + usNe.setFieldValue(UsNeField.SALE_OPT_OUT_NOTICE, 1); + usNe.setFieldValue(UsNeField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNe.setFieldValue(UsNeField.SALE_OPT_OUT, 1); + usNe.setFieldValue(UsNeField.TARGETED_ADVERTISING_OPT_OUT, 1); + usNe.setFieldValue(UsNeField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usNe.setFieldValue(UsNeField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); + usNe.setFieldValue(UsNeField.ADDITIONAL_DATA_PROCESSING_CONSENT, 1); + usNe.setFieldValue(UsNeField.MSPA_COVERED_TRANSACTION, 1); + usNe.setFieldValue(UsNeField.MSPA_OPT_OUT_OPTION_MODE, 1); + usNe.setFieldValue(UsNeField.MSPA_SERVICE_PROVIDER_MODE, 2); + usNe.setFieldValue(UsNeField.GPC, true); + + Assertions.assertEquals("BVWSSVWA.YA", usNe.encode()); + } + + @Test + public void testSetInvalidValues() { + UsNe usNe = new UsNe(); + + try { + usNe.setFieldValue(UsNeField.PROCESSING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNe.setFieldValue(UsNeField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNe.setFieldValue(UsNeField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNe.setFieldValue(UsNeField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNe.setFieldValue(UsNeField.TARGETED_ADVERTISING_OPT_OUT, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNe.setFieldValue(UsNeField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNe.setFieldValue(UsNeField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNe.setFieldValue(UsNeField.ADDITIONAL_DATA_PROCESSING_CONSENT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNe.setFieldValue(UsNeField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNe.setFieldValue(UsNeField.MSPA_OPT_OUT_OPTION_MODE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNe.setFieldValue(UsNeField.MSPA_SERVICE_PROVIDER_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + UsNe usNe = new UsNe(); + usNe.setFieldValue(UsNeField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAQA", usNe.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsNe usNe = new UsNe("BVWSSVWA.YA"); + + Assertions.assertEquals(1, usNe.getProcessingNotice()); + Assertions.assertEquals(1, usNe.getSaleOptOutNotice()); + Assertions.assertEquals(1, usNe.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usNe.getSaleOptOut()); + Assertions.assertEquals(1, usNe.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usNe.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usNe.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNe.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usNe.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usNe.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usNe.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usNe.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsNe usNe = new UsNe("BVWSSVWA"); + + Assertions.assertEquals(1, usNe.getProcessingNotice()); + Assertions.assertEquals(1, usNe.getSaleOptOutNotice()); + Assertions.assertEquals(1, usNe.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usNe.getSaleOptOut()); + Assertions.assertEquals(1, usNe.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usNe.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usNe.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNe.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usNe.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usNe.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usNe.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usNe.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsNe("z").getProcessingNotice(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNhTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNhTest.java new file mode 100644 index 00000000..3211f9fc --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNhTest.java @@ -0,0 +1,170 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsNhField; + +public class UsNhTest { + + @Test + public void testEncode1() { + UsNh usNh = new UsNh(); + Assertions.assertEquals("BAAAAABA.QA", usNh.encode()); + } + + @Test + public void testEncode2() { + UsNh usNh = new UsNh(); + + usNh.setFieldValue(UsNhField.PROCESSING_NOTICE, 1); + usNh.setFieldValue(UsNhField.SALE_OPT_OUT_NOTICE, 1); + usNh.setFieldValue(UsNhField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNh.setFieldValue(UsNhField.SALE_OPT_OUT, 1); + usNh.setFieldValue(UsNhField.TARGETED_ADVERTISING_OPT_OUT, 1); + usNh.setFieldValue(UsNhField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usNh.setFieldValue(UsNhField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1, 0)); + usNh.setFieldValue(UsNhField.ADDITIONAL_DATA_PROCESSING_CONSENT, 1); + usNh.setFieldValue(UsNhField.MSPA_COVERED_TRANSACTION, 1); + usNh.setFieldValue(UsNhField.MSPA_OPT_OUT_OPTION_MODE, 1); + usNh.setFieldValue(UsNhField.MSPA_SERVICE_PROVIDER_MODE, 2); + usNh.setFieldValue(UsNhField.GPC, true); + + Assertions.assertEquals("BVWSSZFY.YA", usNh.encode()); + } + + @Test + public void testSetInvalidValues() { + UsNh usNh = new UsNh(); + + try { + usNh.setFieldValue(UsNhField.PROCESSING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNh.setFieldValue(UsNhField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNh.setFieldValue(UsNhField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNh.setFieldValue(UsNhField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNh.setFieldValue(UsNhField.TARGETED_ADVERTISING_OPT_OUT, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNh.setFieldValue(UsNhField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNh.setFieldValue(UsNhField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNh.setFieldValue(UsNhField.ADDITIONAL_DATA_PROCESSING_CONSENT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNh.setFieldValue(UsNhField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNh.setFieldValue(UsNhField.MSPA_OPT_OUT_OPTION_MODE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNh.setFieldValue(UsNhField.MSPA_SERVICE_PROVIDER_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + UsNh usNh = new UsNh(); + usNh.setFieldValue(UsNhField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAABA", usNh.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsNh usNh = new UsNh("BVWSSZFY.YA"); + + Assertions.assertEquals(1, usNh.getProcessingNotice()); + Assertions.assertEquals(1, usNh.getSaleOptOutNotice()); + Assertions.assertEquals(1, usNh.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usNh.getSaleOptOut()); + Assertions.assertEquals(1, usNh.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usNh.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usNh.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNh.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usNh.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usNh.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usNh.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usNh.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsNh usNh = new UsNh("BVWSSZFY"); + + Assertions.assertEquals(1, usNh.getProcessingNotice()); + Assertions.assertEquals(1, usNh.getSaleOptOutNotice()); + Assertions.assertEquals(1, usNh.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usNh.getSaleOptOut()); + Assertions.assertEquals(1, usNh.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usNh.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0), usNh.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNh.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usNh.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usNh.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usNh.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usNh.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsNh("z").getProcessingNotice(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNjTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNjTest.java new file mode 100644 index 00000000..afda60bb --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNjTest.java @@ -0,0 +1,170 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsNjField; + +public class UsNjTest { + + @Test + public void testEncode1() { + UsNj usNj = new UsNj(); + Assertions.assertEquals("BAAAAAAAQA.QA", usNj.encode()); + } + + @Test + public void testEncode2() { + UsNj usNj = new UsNj(); + + usNj.setFieldValue(UsNjField.PROCESSING_NOTICE, 1); + usNj.setFieldValue(UsNjField.SALE_OPT_OUT_NOTICE, 1); + usNj.setFieldValue(UsNjField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usNj.setFieldValue(UsNjField.SALE_OPT_OUT, 1); + usNj.setFieldValue(UsNjField.TARGETED_ADVERTISING_OPT_OUT, 1); + usNj.setFieldValue(UsNjField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 1)); + usNj.setFieldValue(UsNjField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(2, 1, 0, 2, 1)); + usNj.setFieldValue(UsNjField.ADDITIONAL_DATA_PROCESSING_CONSENT, 1); + usNj.setFieldValue(UsNjField.MSPA_COVERED_TRANSACTION, 1); + usNj.setFieldValue(UsNjField.MSPA_OPT_OUT_OPTION_MODE, 1); + usNj.setFieldValue(UsNjField.MSPA_SERVICE_PROVIDER_MODE, 2); + usNj.setFieldValue(UsNjField.GPC, true); + + Assertions.assertEquals("BVWSSRklWA.YA", usNj.encode()); + } + + @Test + public void testSetInvalidValues() { + UsNj usNj = new UsNj(); + + try { + usNj.setFieldValue(UsNjField.PROCESSING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNj.setFieldValue(UsNjField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNj.setFieldValue(UsNjField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNj.setFieldValue(UsNjField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNj.setFieldValue(UsNjField.TARGETED_ADVERTISING_OPT_OUT, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNj.setFieldValue(UsNjField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNj.setFieldValue(UsNjField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, Arrays.asList(1, 2, 3)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNj.setFieldValue(UsNjField.ADDITIONAL_DATA_PROCESSING_CONSENT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNj.setFieldValue(UsNjField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNj.setFieldValue(UsNjField.MSPA_OPT_OUT_OPTION_MODE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usNj.setFieldValue(UsNjField.MSPA_SERVICE_PROVIDER_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + UsNj usNj = new UsNj(); + usNj.setFieldValue(UsNjField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAAAQA", usNj.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsNj usNj = new UsNj("BVWSSRklWA.YA"); + + Assertions.assertEquals(1, usNj.getProcessingNotice()); + Assertions.assertEquals(1, usNj.getSaleOptOutNotice()); + Assertions.assertEquals(1, usNj.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usNj.getSaleOptOut()); + Assertions.assertEquals(1, usNj.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 1), usNj.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1), usNj.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNj.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usNj.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usNj.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usNj.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usNj.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsNj usNj = new UsNj("BVWSSRklWA"); + + Assertions.assertEquals(1, usNj.getProcessingNotice()); + Assertions.assertEquals(1, usNj.getSaleOptOutNotice()); + Assertions.assertEquals(1, usNj.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usNj.getSaleOptOut()); + Assertions.assertEquals(1, usNj.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1, 0, 1), usNj.getSensitiveDataProcessing()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1), usNj.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usNj.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usNj.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usNj.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usNj.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usNj.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsNj("z").getProcessingNotice(); + }); + } +} diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTnTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTnTest.java new file mode 100644 index 00000000..8d0cae7d --- /dev/null +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTnTest.java @@ -0,0 +1,170 @@ +package com.iab.gpp.encoder.section; + + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import com.iab.gpp.encoder.error.DecodingException; +import com.iab.gpp.encoder.error.ValidationException; +import com.iab.gpp.encoder.field.UsTnField; + +public class UsTnTest { + + @Test + public void testEncode1() { + UsTn usTn = new UsTn(); + Assertions.assertEquals("BAAAAAQA.QA", usTn.encode()); + } + + @Test + public void testEncode2() { + UsTn usTn = new UsTn(); + + usTn.setFieldValue(UsTnField.PROCESSING_NOTICE, 1); + usTn.setFieldValue(UsTnField.SALE_OPT_OUT_NOTICE, 1); + usTn.setFieldValue(UsTnField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); + usTn.setFieldValue(UsTnField.SALE_OPT_OUT, 1); + usTn.setFieldValue(UsTnField.TARGETED_ADVERTISING_OPT_OUT, 1); + usTn.setFieldValue(UsTnField.SENSITIVE_DATA_PROCESSING, Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1)); + usTn.setFieldValue(UsTnField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 1); + usTn.setFieldValue(UsTnField.ADDITIONAL_DATA_PROCESSING_CONSENT, 1); + usTn.setFieldValue(UsTnField.MSPA_COVERED_TRANSACTION, 1); + usTn.setFieldValue(UsTnField.MSPA_OPT_OUT_OPTION_MODE, 1); + usTn.setFieldValue(UsTnField.MSPA_SERVICE_PROVIDER_MODE, 2); + usTn.setFieldValue(UsTnField.GPC, true); + + Assertions.assertEquals("BVWSSVWA.YA", usTn.encode()); + } + + @Test + public void testSetInvalidValues() { + UsTn usTn = new UsTn(); + + try { + usTn.setFieldValue(UsTnField.PROCESSING_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTn.setFieldValue(UsTnField.SALE_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTn.setFieldValue(UsTnField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTn.setFieldValue(UsTnField.SALE_OPT_OUT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTn.setFieldValue(UsTnField.TARGETED_ADVERTISING_OPT_OUT, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTn.setFieldValue(UsTnField.SENSITIVE_DATA_PROCESSING, Arrays.asList(0, 1, 2, 3, 1, 2, 0, 1)); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTn.setFieldValue(UsTnField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTn.setFieldValue(UsTnField.ADDITIONAL_DATA_PROCESSING_CONSENT, 3); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTn.setFieldValue(UsTnField.MSPA_COVERED_TRANSACTION, 0); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTn.setFieldValue(UsTnField.MSPA_OPT_OUT_OPTION_MODE, 4); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + + try { + usTn.setFieldValue(UsTnField.MSPA_SERVICE_PROVIDER_MODE, -1); + Assertions.fail("Expected ValidationException"); + } catch (ValidationException e) { + + } + } + + @Test + public void testEncodeWithGpcSegmentExcluded() { + UsTn usTn = new UsTn(); + usTn.setFieldValue(UsTnField.GPC_SEGMENT_INCLUDED, false); + Assertions.assertEquals("BAAAAAQA", usTn.encode()); + } + + @Test + public void testDecode1() throws DecodingException { + UsTn usTn = new UsTn("BVWSSVWA.YA"); + + Assertions.assertEquals(1, usTn.getProcessingNotice()); + Assertions.assertEquals(1, usTn.getSaleOptOutNotice()); + Assertions.assertEquals(1, usTn.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usTn.getSaleOptOut()); + Assertions.assertEquals(1, usTn.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usTn.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usTn.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usTn.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usTn.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usTn.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usTn.getMspaServiceProviderMode()); + Assertions.assertEquals(true, usTn.getGpc()); + } + + @Test + public void testDecodeWithGpcSegmentExcluded() throws DecodingException { + UsTn usTn = new UsTn("BVWSSVWA"); + + Assertions.assertEquals(1, usTn.getProcessingNotice()); + Assertions.assertEquals(1, usTn.getSaleOptOutNotice()); + Assertions.assertEquals(1, usTn.getTargetedAdvertisingOptOutNotice()); + Assertions.assertEquals(1, usTn.getSaleOptOut()); + Assertions.assertEquals(1, usTn.getTargetedAdvertisingOptOut()); + Assertions.assertEquals(Arrays.asList(2, 1, 0, 2, 1, 0, 2, 1), usTn.getSensitiveDataProcessing()); + Assertions.assertEquals(1, usTn.getKnownChildSensitiveDataConsents()); + Assertions.assertEquals(1, usTn.getAdditionalDataProcessingConsent()); + Assertions.assertEquals(1, usTn.getMspaCoveredTransaction()); + Assertions.assertEquals(1, usTn.getMspaOptOutOptionMode()); + Assertions.assertEquals(2, usTn.getMspaServiceProviderMode()); + Assertions.assertEquals(false, usTn.getGpcSegmentIncluded()); + } + + @Test() + public void testDecodeGarbage() { + Assertions.assertThrows(DecodingException.class, () -> { + new UsTn("z").getProcessingNotice(); + }); + } +} From 03dcbfc852984468c60d103abacd2572703791d8 Mon Sep 17 00:00:00 2001 From: chuff Date: Tue, 25 Mar 2025 09:02:52 -0600 Subject: [PATCH 36/41] remove validation (#66) * remove validation * fix lazy decoding in decodeSection --------- Co-authored-by: Chad Huff --- .../java/com/iab/gpp/encoder/GppModel.java | 7 + .../gpp/encoder/segment/UsCaCoreSegment.java | 112 +---- .../gpp/encoder/segment/UsCoCoreSegment.java | 77 +--- .../gpp/encoder/segment/UsCtCoreSegment.java | 72 --- .../gpp/encoder/segment/UsFlCoreSegment.java | 73 ---- .../gpp/encoder/segment/UsMtCoreSegment.java | 72 --- .../gpp/encoder/segment/UsNatCoreSegment.java | 132 ------ .../gpp/encoder/segment/UsOrCoreSegment.java | 72 --- .../gpp/encoder/segment/UsTxCoreSegment.java | 72 --- .../gpp/encoder/segment/UsUtCoreSegment.java | 72 --- .../gpp/encoder/segment/UsVaCoreSegment.java | 72 --- .../com/iab/gpp/encoder/section/UsCaTest.java | 341 --------------- .../com/iab/gpp/encoder/section/UsCoTest.java | 259 ----------- .../com/iab/gpp/encoder/section/UsCtTest.java | 258 ----------- .../com/iab/gpp/encoder/section/UsFlTest.java | 257 ----------- .../com/iab/gpp/encoder/section/UsMtTest.java | 258 ----------- .../iab/gpp/encoder/section/UsNatTest.java | 409 ------------------ .../com/iab/gpp/encoder/section/UsOrTest.java | 258 ----------- .../com/iab/gpp/encoder/section/UsTxTest.java | 258 ----------- .../com/iab/gpp/encoder/section/UsUtTest.java | 257 ----------- .../com/iab/gpp/encoder/section/UsVaTest.java | 259 +---------- 21 files changed, 19 insertions(+), 3628 deletions(-) diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index 22a239c0..a85a5e25 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -472,6 +472,12 @@ public void decodeSection(int sectionId, String encodedString) { } public void decodeSection(String sectionName, String encodedString) { + if (!this.decoded) { + this.sections = this.decodeModel(this.encodedString); + this.dirty = false; + this.decoded = true; + } + EncodableSection section = null; if (!this.sections.containsKey(sectionName)) { if (sectionName.equals(TcfEuV2.NAME)) { @@ -538,6 +544,7 @@ public void decodeSection(String sectionName, String encodedString) { if (section != null) { section.decode(encodedString); + this.dirty = true; } } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaCoreSegment.java index 19cebffd..25584c00 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaCoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCaCoreSegment.java @@ -9,7 +9,6 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCaField; import com.iab.gpp.encoder.section.UsCa; @@ -35,16 +34,16 @@ public List getFieldNames() { @Override protected EncodableBitStringFields initializeFields() { - Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); - Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); - Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { - for (int n : l) { - if (n < 0 || n > 2) { - return false; - } + Predicate nullableBooleanAsTwoBitIntegerValidator = (n -> n >= 0 && n <= 2); + Predicate nonNullableBooleanAsTwoBitIntegerValidator = (n -> n >= 1 && n <= 2); + Predicate> nullableBooleanAsTwoBitIntegerListValidator = (l -> { + for (int n : l) { + if (n < 0 || n > 2) { + return false; } - return true; - }); + } + return true; + }); EncodableBitStringFields fields = new EncodableBitStringFields(); fields.put(UsCaField.VERSION, new EncodableFixedInteger(6, UsCa.VERSION)); @@ -94,97 +93,4 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel } } - @Override - public void validate() { - Integer sharingOptOutNotice = ((EncodableFixedInteger) fields.get(UsCaField.SHARING_OPT_OUT_NOTICE)).getValue(); - Integer sharingOptOut = ((EncodableFixedInteger) fields.get(UsCaField.SHARING_OPT_OUT)).getValue(); - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCaField.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCaField.SALE_OPT_OUT)).getValue(); - Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsCaField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); - Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsCaField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); - Integer sensitiveDataLimtUserNotice = - ((EncodableFixedInteger) fields.get(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE)).getValue(); - - if (sharingOptOutNotice == 0) { - if (sharingOptOut != 0) { - throw new ValidationException( - "Invalid usca sharing notice / opt out combination: {" + sharingOptOutNotice + " / " + sharingOptOut + "}"); - } - } else if (sharingOptOutNotice == 1) { - if (sharingOptOut != 1 && sharingOptOut != 2) { - throw new ValidationException( - "Invalid usca sharing notice / opt out combination: {" + sharingOptOutNotice + " / " + sharingOptOut + "}"); - } - } else if (sharingOptOutNotice == 2) { - if (sharingOptOut != 1) { - throw new ValidationException( - "Invalid usca sharing notice / opt out combination: {" + sharingOptOutNotice + " / " + sharingOptOut + "}"); - } - } - - if (saleOptOutNotice == 0) { - if (saleOptOut != 0) { - throw new ValidationException( - "Invalid usca sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException( - "Invalid usca sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException( - "Invalid usca sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } - - if (mspaServiceProviderMode == 0) { - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usca mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - - if (sharingOptOutNotice != 0) { - throw new ValidationException("Invalid usca mspa service provider mode / sharing opt out notice combination: {" - + mspaServiceProviderMode + " / " + sharingOptOutNotice + "}"); - } - - if (sensitiveDataLimtUserNotice != 0) { - throw new ValidationException( - "Invalid usca mspa service provider mode / sensitive data limit use notice combination: {" - + mspaServiceProviderMode + " / " + sensitiveDataLimtUserNotice + "}"); - } - } else if (mspaServiceProviderMode == 1) { - if (mspaOptOutOptionMode != 2) { - throw new ValidationException("Invalid usca mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); - } - - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usca mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - - if (sharingOptOutNotice != 0) { - throw new ValidationException("Invalid usca mspa service provider mode / sharing opt out notice combination: {" - + mspaServiceProviderMode + " / " + sharingOptOutNotice + "}"); - } - - if (sensitiveDataLimtUserNotice != 0) { - throw new ValidationException( - "Invalid usca mspa service provider mode / sensitive data limit use notice combination: {" - + mspaServiceProviderMode + " / " + sensitiveDataLimtUserNotice + "}"); - } - } else if (mspaServiceProviderMode == 2) { - if (mspaOptOutOptionMode != 1) { - throw new ValidationException("Invalid usca mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); - } - } - } - - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoCoreSegment.java index 16ef9cd1..1f6c14c7 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoCoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCoCoreSegment.java @@ -9,7 +9,6 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCoField; import com.iab.gpp.encoder.section.UsCo; @@ -58,9 +57,8 @@ protected EncodableBitStringFields initializeFields() { new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); fields.put(UsCoField.TARGETED_ADVERTISING_OPT_OUT, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); - fields.put(UsCoField.SENSITIVE_DATA_PROCESSING, - new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0)) - .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); + fields.put(UsCoField.SENSITIVE_DATA_PROCESSING, new EncodableFixedIntegerList(2, Arrays.asList(0, 0, 0, 0, 0, 0, 0)) + .withValidator(nullableBooleanAsTwoBitIntegerListValidator)); fields.put(UsCoField.KNOWN_CHILD_SENSITIVE_DATA_CONSENTS, new EncodableFixedInteger(2, 0).withValidator(nullableBooleanAsTwoBitIntegerValidator)); fields.put(UsCoField.MSPA_COVERED_TRANSACTION, @@ -92,75 +90,4 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel } } - @Override - public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCoField.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCoField.SALE_OPT_OUT)).getValue(); - Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); - Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsCoField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); - Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsCoField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); - Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsCoField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); - - if (saleOptOutNotice == 0) { - if (saleOptOut != 0) { - throw new ValidationException( - "Invalid usco sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException( - "Invalid usco sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException( - "Invalid usco sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } - - if (targetedAdvertisingOptOutNotice == 0) { - if (targetedAdvertisingOptOut != 0) { - throw new ValidationException("Invalid usco targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException("Invalid usco targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException("Invalid usco targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } - - if (mspaServiceProviderMode == 0) { - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usco mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 1) { - if (mspaOptOutOptionMode != 2) { - throw new ValidationException("Invalid usco mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); - } - - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usco mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 2) { - if (mspaOptOutOptionMode != 1) { - throw new ValidationException("Invalid usco mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); - } - } - } - - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtCoreSegment.java index 7b9504e7..066ad749 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtCoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsCtCoreSegment.java @@ -9,7 +9,6 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsCtField; import com.iab.gpp.encoder.section.UsCt; @@ -92,75 +91,4 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel } } - @Override - public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsCtField.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsCtField.SALE_OPT_OUT)).getValue(); - Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); - Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsCtField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); - Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsCtField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); - Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsCtField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); - - if (saleOptOutNotice == 0) { - if (saleOptOut != 0) { - throw new ValidationException( - "Invalid usct sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException( - "Invalid usct sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException( - "Invalid usct sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } - - if (targetedAdvertisingOptOutNotice == 0) { - if (targetedAdvertisingOptOut != 0) { - throw new ValidationException("Invalid usct targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException("Invalid usct targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException("Invalid usct targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } - - if (mspaServiceProviderMode == 0) { - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usct mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 1) { - if (mspaOptOutOptionMode != 2) { - throw new ValidationException("Invalid usct mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); - } - - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usct mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 2) { - if (mspaOptOutOptionMode != 1) { - throw new ValidationException("Invalid usct mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); - } - } - } - - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsFlCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsFlCoreSegment.java index 4402c94c..02c480aa 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsFlCoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsFlCoreSegment.java @@ -9,7 +9,6 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsFlField; import com.iab.gpp.encoder.section.UsFl; @@ -93,76 +92,4 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel throw new DecodingException("Unable to decode UsFlCoreSegment '" + encodedString + "'", e); } } - - @Override - public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsFlField.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsFlField.SALE_OPT_OUT)).getValue(); - Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); - Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsFlField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); - Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsFlField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); - Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsFlField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); - - if (saleOptOutNotice == 0) { - if (saleOptOut != 0) { - throw new ValidationException( - "Invalid usfl sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException( - "Invalid usfl sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException( - "Invalid usfl sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } - - if (targetedAdvertisingOptOutNotice == 0) { - if (targetedAdvertisingOptOut != 0) { - throw new ValidationException("Invalid usfl targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException("Invalid usfl targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException("Invalid usfl targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } - - if (mspaServiceProviderMode == 0) { - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usfl mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 1) { - if (mspaOptOutOptionMode != 2) { - throw new ValidationException("Invalid usfl mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); - } - - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usfl mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 2) { - if (mspaOptOutOptionMode != 1) { - throw new ValidationException("Invalid usfl mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); - } - } - } - - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsMtCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsMtCoreSegment.java index 716ee444..4daa1872 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsMtCoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsMtCoreSegment.java @@ -9,7 +9,6 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsMtField; import com.iab.gpp.encoder.section.UsMt; @@ -94,75 +93,4 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel } } - @Override - public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsMtField.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsMtField.SALE_OPT_OUT)).getValue(); - Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); - Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsMtField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); - Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsMtField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); - Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsMtField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); - - if (saleOptOutNotice == 0) { - if (saleOptOut != 0) { - throw new ValidationException( - "Invalid usmt sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException( - "Invalid usmt sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException( - "Invalid usmt sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } - - if (targetedAdvertisingOptOutNotice == 0) { - if (targetedAdvertisingOptOut != 0) { - throw new ValidationException("Invalid usmt targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException("Invalid usmt targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException("Invalid usmt targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } - - if (mspaServiceProviderMode == 0) { - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usmt mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 1) { - if (mspaOptOutOptionMode != 2) { - throw new ValidationException("Invalid usmt mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); - } - - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usmt mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 2) { - if (mspaOptOutOptionMode != 1) { - throw new ValidationException("Invalid usmt mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); - } - } - } - - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java index 204ea2f3..6c7a7945 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsNatCoreSegment.java @@ -9,7 +9,6 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsNatField; import com.iab.gpp.encoder.section.UsNat; @@ -111,135 +110,4 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel } } - @Override - public void validate() { - Integer sharingNotice = ((EncodableFixedInteger) fields.get(UsNatField.SHARING_NOTICE)).getValue(); - Integer sharingOptOutNotice = ((EncodableFixedInteger) fields.get(UsNatField.SHARING_OPT_OUT_NOTICE)).getValue(); - Integer sharingOptOut = ((EncodableFixedInteger) fields.get(UsNatField.SHARING_OPT_OUT)).getValue(); - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsNatField.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsNatField.SALE_OPT_OUT)).getValue(); - Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); - Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsNatField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); - Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsNatField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); - Integer mspaOptOutOptionMode = ((EncodableFixedInteger) fields.get(UsNatField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); - Integer sensitiveDataLimtUserNotice = - ((EncodableFixedInteger) fields.get(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE)).getValue(); - - if (sharingNotice == 0) { - if (sharingOptOut != 0) { - throw new ValidationException( - "Invalid usnat sharing notice / opt out combination: {" + sharingNotice + " / " + sharingOptOut + "}"); - } - } else if (sharingNotice == 1) { - if (sharingOptOut != 1 && sharingOptOut != 2) { - throw new ValidationException( - "Invalid usnat sharing notice / opt out combination: {" + sharingNotice + " / " + sharingOptOut + "}"); - } - } else if (sharingNotice == 2) { - if (sharingOptOut != 1) { - throw new ValidationException( - "Invalid usnat sharing notice / opt out combination: {" + sharingNotice + " / " + sharingOptOut + "}"); - } - } - - if (sharingOptOutNotice == 0) { - if (sharingOptOut != 0) { - throw new ValidationException("Invalid usnat sharing notice / opt out combination: {" + sharingOptOutNotice - + " / " + sharingOptOut + "}"); - } - } else if (sharingOptOutNotice == 1) { - if (sharingOptOut != 1 && sharingOptOut != 2) { - throw new ValidationException("Invalid usnat sharing notice / opt out combination: {" + sharingOptOutNotice - + " / " + sharingOptOut + "}"); - } - } else if (sharingOptOutNotice == 2) { - if (sharingOptOut != 1) { - throw new ValidationException("Invalid usnat sharing notice / opt out combination: {" + sharingOptOutNotice - + " / " + sharingOptOut + "}"); - } - } - - if (saleOptOutNotice == 0) { - if (saleOptOut != 0) { - throw new ValidationException( - "Invalid usnat sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException( - "Invalid usnat sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException( - "Invalid usnat sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } - - if (targetedAdvertisingOptOutNotice == 0) { - if (targetedAdvertisingOptOut != 0) { - throw new ValidationException("Invalid usnat targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException("Invalid usnat targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException("Invalid usnat targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } - - if (mspaServiceProviderMode == 0) { - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usnat mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - - if (sharingOptOutNotice != 0) { - throw new ValidationException("Invalid usnat mspa service provider mode / sharing opt out notice combination: {" - + mspaServiceProviderMode + " / " + sharingOptOutNotice + "}"); - } - - if (sensitiveDataLimtUserNotice != 0) { - throw new ValidationException( - "Invalid usnat mspa service provider mode / sensitive data limit use notice combination: {" - + mspaServiceProviderMode + " / " + sensitiveDataLimtUserNotice + "}"); - } - } else if (mspaServiceProviderMode == 1) { - if (mspaOptOutOptionMode != 2) { - throw new ValidationException("Invalid usnat mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); - } - - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usnat mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - - if (sharingOptOutNotice != 0) { - throw new ValidationException("Invalid usnat mspa service provider mode / sharing opt out notice combination: {" - + mspaServiceProviderMode + " / " + sharingOptOutNotice + "}"); - } - - if (sensitiveDataLimtUserNotice != 0) { - throw new ValidationException( - "Invalid usnat mspa service provider mode / sensitive data limit use notice combination: {" - + mspaServiceProviderMode + " / " + sensitiveDataLimtUserNotice + "}"); - } - } else if (mspaServiceProviderMode == 2) { - if (mspaOptOutOptionMode != 1) { - throw new ValidationException("Invalid usnat mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); - } - } - } - - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrCoreSegment.java index 97d64b41..c09ebd15 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrCoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsOrCoreSegment.java @@ -9,7 +9,6 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsOrField; import com.iab.gpp.encoder.section.UsOr; @@ -94,75 +93,4 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel } } - @Override - public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsOrField.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsOrField.SALE_OPT_OUT)).getValue(); - Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); - Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsOrField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); - Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsOrField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); - Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsOrField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); - - if (saleOptOutNotice == 0) { - if (saleOptOut != 0) { - throw new ValidationException( - "Invalid usor sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException( - "Invalid usor sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException( - "Invalid usor sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } - - if (targetedAdvertisingOptOutNotice == 0) { - if (targetedAdvertisingOptOut != 0) { - throw new ValidationException("Invalid usor targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException("Invalid usor targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException("Invalid usor targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } - - if (mspaServiceProviderMode == 0) { - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usor mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 1) { - if (mspaOptOutOptionMode != 2) { - throw new ValidationException("Invalid usor mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); - } - - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usor mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 2) { - if (mspaOptOutOptionMode != 1) { - throw new ValidationException("Invalid usor mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); - } - } - } - - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxCoreSegment.java index 224f1b99..53463d20 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxCoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsTxCoreSegment.java @@ -9,7 +9,6 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsTxField; import com.iab.gpp.encoder.field.UsVaField; @@ -95,75 +94,4 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel } } - @Override - public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsTxField.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsTxField.SALE_OPT_OUT)).getValue(); - Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); - Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsTxField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); - Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsTxField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); - Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsTxField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); - - if (saleOptOutNotice == 0) { - if (saleOptOut != 0) { - throw new ValidationException( - "Invalid ustx sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException( - "Invalid ustx sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException( - "Invalid ustx sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } - - if (targetedAdvertisingOptOutNotice == 0) { - if (targetedAdvertisingOptOut != 0) { - throw new ValidationException("Invalid ustx targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException("Invalid ustx targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException("Invalid ustx targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } - - if (mspaServiceProviderMode == 0) { - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid ustx mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 1) { - if (mspaOptOutOptionMode != 2) { - throw new ValidationException("Invalid ustx mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); - } - - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid ustx mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 2) { - if (mspaOptOutOptionMode != 1) { - throw new ValidationException("Invalid ustx mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); - } - } - } - - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtCoreSegment.java index 6126c3cb..1b394443 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtCoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsUtCoreSegment.java @@ -9,7 +9,6 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsUtField; import com.iab.gpp.encoder.section.UsUt; @@ -94,75 +93,4 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel } } - @Override - public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsUtField.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsUtField.SALE_OPT_OUT)).getValue(); - Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); - Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsUtField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); - Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsUtField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); - Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsUtField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); - - if (saleOptOutNotice == 0) { - if (saleOptOut != 0) { - throw new ValidationException( - "Invalid usut sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException( - "Invalid usut sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException( - "Invalid usut sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } - - if (targetedAdvertisingOptOutNotice == 0) { - if (targetedAdvertisingOptOut != 0) { - throw new ValidationException("Invalid usut targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException("Invalid usut targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException("Invalid usut targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } - - if (mspaServiceProviderMode == 0) { - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usut mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 1) { - if (mspaOptOutOptionMode != 2) { - throw new ValidationException("Invalid usut mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); - } - - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usut mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 2) { - if (mspaOptOutOptionMode != 1) { - throw new ValidationException("Invalid usut mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); - } - } - } - - } diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaCoreSegment.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaCoreSegment.java index e39316e7..cb57fb92 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaCoreSegment.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/segment/UsVaCoreSegment.java @@ -9,7 +9,6 @@ import com.iab.gpp.encoder.datatype.EncodableFixedInteger; import com.iab.gpp.encoder.datatype.EncodableFixedIntegerList; import com.iab.gpp.encoder.error.DecodingException; -import com.iab.gpp.encoder.error.ValidationException; import com.iab.gpp.encoder.field.EncodableBitStringFields; import com.iab.gpp.encoder.field.UsVaField; import com.iab.gpp.encoder.section.UsVa; @@ -92,75 +91,4 @@ protected void decodeSegment(String encodedString, EncodableBitStringFields fiel } } - @Override - public void validate() { - Integer saleOptOutNotice = ((EncodableFixedInteger) fields.get(UsVaField.SALE_OPT_OUT_NOTICE)).getValue(); - Integer saleOptOut = ((EncodableFixedInteger) fields.get(UsVaField.SALE_OPT_OUT)).getValue(); - Integer targetedAdvertisingOptOutNotice = - ((EncodableFixedInteger) fields.get(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE)).getValue(); - Integer targetedAdvertisingOptOut = - ((EncodableFixedInteger) fields.get(UsVaField.TARGETED_ADVERTISING_OPT_OUT)).getValue(); - Integer mspaServiceProviderMode = - ((EncodableFixedInteger) fields.get(UsVaField.MSPA_SERVICE_PROVIDER_MODE)).getValue(); - Integer mspaOptOutOptionMode = - ((EncodableFixedInteger) fields.get(UsVaField.MSPA_OPT_OUT_OPTION_MODE)).getValue(); - - if (saleOptOutNotice == 0) { - if (saleOptOut != 0) { - throw new ValidationException( - "Invalid usva sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException( - "Invalid usva sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } else if (saleOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException( - "Invalid usva sale notice / opt out combination: {" + saleOptOutNotice + " / " + saleOptOut + "}"); - } - } - - if (targetedAdvertisingOptOutNotice == 0) { - if (targetedAdvertisingOptOut != 0) { - throw new ValidationException("Invalid usva targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 1) { - if (saleOptOut != 1 && saleOptOut != 2) { - throw new ValidationException("Invalid usva targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } else if (targetedAdvertisingOptOutNotice == 2) { - if (saleOptOut != 1) { - throw new ValidationException("Invalid usva targeted advertising notice / opt out combination: {" - + targetedAdvertisingOptOutNotice + " / " + targetedAdvertisingOptOut + "}"); - } - } - - if (mspaServiceProviderMode == 0) { - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usva mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 1) { - if (mspaOptOutOptionMode != 2) { - throw new ValidationException("Invalid usva mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaServiceProviderMode + "}"); - } - - if (saleOptOutNotice != 0) { - throw new ValidationException("Invalid usva mspa service provider mode / sale opt out notice combination: {" - + mspaServiceProviderMode + " / " + saleOptOutNotice + "}"); - } - } else if (mspaServiceProviderMode == 2) { - if (mspaOptOutOptionMode != 1) { - throw new ValidationException("Invalid usva mspa service provider / opt out option modes combination: {" - + mspaServiceProviderMode + " / " + mspaOptOutOptionMode + "}"); - } - } - } - - } diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaTest.java index ae73963e..6dcc3fcc 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCaTest.java @@ -139,347 +139,6 @@ public void testSetInvalidValues() { } } - @Test - public void testValidateSharing() { - UsCa usCa = new UsCa(); - - try { - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 1); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 2); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 0); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 0); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 2); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 0); - usCa.encode(); - - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 1); - usCa.encode(); - - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 2); - usCa.encode(); - - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT, 1); - usCa.encode(); - } - - @Test - public void testValidateSale() { - UsCa usCa = new UsCa(); - - try { - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 1); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 2); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 0); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 0); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 2); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 0); - usCa.encode(); - - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 1); - usCa.encode(); - - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 2); - usCa.encode(); - - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT, 1); - usCa.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsCa usCa = new UsCa(); - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 0); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 1); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 0); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 2); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usCa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 0); - usCa.encode(); - - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 1); - usCa.encode(); - - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 2); - usCa.encode(); - - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 2); - usCa.encode(); - - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 1); - usCa.encode(); - - - usCa.setFieldValue(UsCaField.MSPA_OPT_OUT_OPTION_MODE, 0); - - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usCa.encode(); - - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usCa.encode(); - - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 0); - usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usCa.encode(); - - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 1); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 1); - usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usCa.encode(); - - usCa.setFieldValue(UsCaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCa.setFieldValue(UsCaField.SALE_OPT_OUT_NOTICE, 2); - usCa.setFieldValue(UsCaField.SHARING_OPT_OUT_NOTICE, 2); - usCa.setFieldValue(UsCaField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usCa.encode(); - } - @Test public void testEncodeWithGpcSegmentExcluded() { diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoTest.java index 470536ea..59488ff1 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCoTest.java @@ -111,265 +111,6 @@ public void testSetInvalidValues() { } - @Test - public void testValidateSale() { - UsCo usCo = new UsCo(); - - try { - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 1); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 2); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 0); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 0); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 2); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 0); - usCo.encode(); - - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 1); - usCo.encode(); - - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 2); - usCo.encode(); - - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT, 1); - usCo.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsCo usCo = new UsCo(); - - try { - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 1); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 2); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 0); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 0); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 2); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 0); - usCo.encode(); - - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 1); - usCo.encode(); - - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 2); - usCo.encode(); - - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCo.setFieldValue(UsCoField.TARGETED_ADVERTISING_OPT_OUT, 1); - usCo.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsCo usCo = new UsCo(); - - try { - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 0); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 1); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 0); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 2); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - - try { - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); - usCo.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); - - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 0); - usCo.encode(); - - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 1); - usCo.encode(); - - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 2); - usCo.encode(); - - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 2); - usCo.encode(); - - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 1); - usCo.encode(); - - - usCo.setFieldValue(UsCoField.MSPA_OPT_OUT_OPTION_MODE, 0); - - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); - usCo.encode(); - - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); - usCo.encode(); - - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 0); - usCo.encode(); - - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 1); - usCo.encode(); - - usCo.setFieldValue(UsCoField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCo.setFieldValue(UsCoField.SALE_OPT_OUT_NOTICE, 2); - usCo.encode(); - } - @Test public void testEncodeWithGpcSegmentExcluded() { UsCo usCo = new UsCo(); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtTest.java index e23aec4a..03ea9f9b 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsCtTest.java @@ -110,264 +110,6 @@ public void testSetInvalidValues() { } } - @Test - public void testValidateSale() { - UsCt usCt = new UsCt(); - - try { - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 1); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 2); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 0); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 0); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 2); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 0); - usCt.encode(); - - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 1); - usCt.encode(); - - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 2); - usCt.encode(); - - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT, 1); - usCt.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsCt usCt = new UsCt(); - - try { - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 1); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 2); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 0); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 0); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 2); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 0); - usCt.encode(); - - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 1); - usCt.encode(); - - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 2); - usCt.encode(); - - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usCt.setFieldValue(UsCtField.TARGETED_ADVERTISING_OPT_OUT, 1); - usCt.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsCt usCt = new UsCt(); - - try { - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 0); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 1); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 0); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 2); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); - usCt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); - - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 0); - usCt.encode(); - - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 1); - usCt.encode(); - - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 2); - usCt.encode(); - - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 2); - usCt.encode(); - - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 1); - usCt.encode(); - - - usCt.setFieldValue(UsCtField.MSPA_OPT_OUT_OPTION_MODE, 0); - - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); - usCt.encode(); - - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); - usCt.encode(); - - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 0); - usCt.encode(); - - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 1); - usCt.encode(); - - usCt.setFieldValue(UsCtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usCt.setFieldValue(UsCtField.SALE_OPT_OUT_NOTICE, 2); - usCt.encode(); - } - @Test public void testEncodeWithGpcSegmentExcluded() { UsCt usCt = new UsCt(); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsFlTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsFlTest.java index 2feba5f0..3882d962 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsFlTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsFlTest.java @@ -124,263 +124,6 @@ public void testSetInvalidValues() { } - @Test - public void testValidateSale() { - UsFl usFl = new UsFl(); - - try { - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 1); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 2); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 0); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 0); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 2); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 0); - usFl.encode(); - - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 1); - usFl.encode(); - - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 2); - usFl.encode(); - - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT, 1); - usFl.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsFl usFl = new UsFl(); - - try { - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 1); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 2); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 0); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 0); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 2); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 0); - usFl.encode(); - - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 1); - usFl.encode(); - - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 2); - usFl.encode(); - - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usFl.setFieldValue(UsFlField.TARGETED_ADVERTISING_OPT_OUT, 1); - usFl.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsFl usFl = new UsFl(); - - try { - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); - usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 0); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); - usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 1); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); - usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 0); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); - usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 2); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); - usFl.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); - - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); - usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 0); - usFl.encode(); - - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); - usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 1); - usFl.encode(); - - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); - usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 2); - usFl.encode(); - - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); - usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 2); - usFl.encode(); - - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); - usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 1); - usFl.encode(); - - - usFl.setFieldValue(UsFlField.MSPA_OPT_OUT_OPTION_MODE, 0); - - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 0); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); - usFl.encode(); - - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 1); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); - usFl.encode(); - - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 0); - usFl.encode(); - - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 1); - usFl.encode(); - - usFl.setFieldValue(UsFlField.MSPA_SERVICE_PROVIDER_MODE, 2); - usFl.setFieldValue(UsFlField.SALE_OPT_OUT_NOTICE, 2); - usFl.encode(); - } - @Test public void testDecode1() throws DecodingException { UsFl usFl = new UsFl("BVWSSZlY"); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsMtTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsMtTest.java index 2708ed2f..aaceb049 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsMtTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsMtTest.java @@ -118,264 +118,6 @@ public void testSetInvalidValues() { } } - @Test - public void testValidateSale() { - UsMt usMt = new UsMt(); - - try { - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 1); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 2); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 0); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 0); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 2); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 0); - usMt.encode(); - - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 1); - usMt.encode(); - - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 2); - usMt.encode(); - - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT, 1); - usMt.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsMt usMt = new UsMt(); - - try { - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 1); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 2); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 0); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 0); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 2); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 0); - usMt.encode(); - - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 1); - usMt.encode(); - - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 2); - usMt.encode(); - - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usMt.setFieldValue(UsMtField.TARGETED_ADVERTISING_OPT_OUT, 1); - usMt.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsMt usMt = new UsMt(); - - try { - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 0); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 1); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 0); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 2); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); - usMt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); - - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 0); - usMt.encode(); - - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 1); - usMt.encode(); - - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 2); - usMt.encode(); - - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 2); - usMt.encode(); - - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 1); - usMt.encode(); - - - usMt.setFieldValue(UsMtField.MSPA_OPT_OUT_OPTION_MODE, 0); - - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); - usMt.encode(); - - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); - usMt.encode(); - - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 0); - usMt.encode(); - - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 1); - usMt.encode(); - - usMt.setFieldValue(UsMtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usMt.setFieldValue(UsMtField.SALE_OPT_OUT_NOTICE, 2); - usMt.encode(); - } - @Test public void testEncodeWithGpcSegmentExcluded() { UsMt usMt = new UsMt(); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java index 85ee7013..67029545 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsNatTest.java @@ -153,415 +153,6 @@ public void testSetInvalidValues() { } - @Test - public void testValidateSharing() { - UsNat usNat = new UsNat(); - - try { - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 1); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 0); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 0); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 0); - usNat.encode(); - - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 1); - usNat.encode(); - - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 2); - usNat.encode(); - - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT, 1); - usNat.encode(); - } - - @Test - public void testValidateSale() { - UsNat usNat = new UsNat(); - - try { - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 1); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 0); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 0); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 0); - usNat.encode(); - - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 1); - usNat.encode(); - - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 2); - usNat.encode(); - - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT, 1); - usNat.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsNat usNat = new UsNat(); - - try { - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 1); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 0); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 0); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 0); - usNat.encode(); - - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 1); - usNat.encode(); - - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 2); - usNat.encode(); - - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usNat.setFieldValue(UsNatField.TARGETED_ADVERTISING_OPT_OUT, 1); - usNat.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsNat usNat = new UsNat(); - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); - usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 0); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); - usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 1); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); - usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 0); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); - usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usNat.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); - usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 0); - usNat.encode(); - - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); - usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 1); - usNat.encode(); - - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); - usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 2); - usNat.encode(); - - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); - usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 2); - usNat.encode(); - - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); - usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 1); - usNat.encode(); - - - usNat.setFieldValue(UsNatField.MSPA_OPT_OUT_OPTION_MODE, 0); - - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 0); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usNat.encode(); - - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 1); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usNat.encode(); - - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 0); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 0); - usNat.encode(); - - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 1); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 1); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 1); - usNat.encode(); - - usNat.setFieldValue(UsNatField.MSPA_SERVICE_PROVIDER_MODE, 2); - usNat.setFieldValue(UsNatField.SALE_OPT_OUT_NOTICE, 2); - usNat.setFieldValue(UsNatField.SHARING_OPT_OUT_NOTICE, 2); - usNat.setFieldValue(UsNatField.SENSITIVE_DATA_LIMIT_USE_NOTICE, 2); - usNat.encode(); - } - - @Test public void testEncode3() { UsNat usNat = new UsNat(); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsOrTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsOrTest.java index 4f386f49..34c310b5 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsOrTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsOrTest.java @@ -118,264 +118,6 @@ public void testSetInvalidValues() { } } - @Test - public void testValidateSale() { - UsOr usOr = new UsOr(); - - try { - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 1); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 2); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 0); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 0); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 2); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 0); - usOr.encode(); - - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 1); - usOr.encode(); - - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 2); - usOr.encode(); - - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT, 1); - usOr.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsOr usOr = new UsOr(); - - try { - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 1); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 2); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 0); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 0); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 2); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 0); - usOr.encode(); - - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 1); - usOr.encode(); - - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 2); - usOr.encode(); - - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usOr.setFieldValue(UsOrField.TARGETED_ADVERTISING_OPT_OUT, 1); - usOr.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsOr usOr = new UsOr(); - - try { - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); - usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 0); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); - usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 1); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); - usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 0); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); - usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 2); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); - usOr.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); - - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); - usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 0); - usOr.encode(); - - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); - usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 1); - usOr.encode(); - - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); - usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 2); - usOr.encode(); - - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); - usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 2); - usOr.encode(); - - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); - usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 1); - usOr.encode(); - - - usOr.setFieldValue(UsOrField.MSPA_OPT_OUT_OPTION_MODE, 0); - - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 0); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); - usOr.encode(); - - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 1); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); - usOr.encode(); - - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 0); - usOr.encode(); - - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 1); - usOr.encode(); - - usOr.setFieldValue(UsOrField.MSPA_SERVICE_PROVIDER_MODE, 2); - usOr.setFieldValue(UsOrField.SALE_OPT_OUT_NOTICE, 2); - usOr.encode(); - } - @Test public void testEncodeWithGpcSegmentExcluded() { UsOr usOr = new UsOr(); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTxTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTxTest.java index bc3c345a..4609feed 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTxTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsTxTest.java @@ -118,264 +118,6 @@ public void testSetInvalidValues() { } } - @Test - public void testValidateSale() { - UsTx usTx = new UsTx(); - - try { - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 1); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 2); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 0); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 0); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 2); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 0); - usTx.encode(); - - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 1); - usTx.encode(); - - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 2); - usTx.encode(); - - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT, 1); - usTx.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsTx usTx = new UsTx(); - - try { - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 1); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 2); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 0); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 0); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 2); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 0); - usTx.encode(); - - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 1); - usTx.encode(); - - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 2); - usTx.encode(); - - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usTx.setFieldValue(UsTxField.TARGETED_ADVERTISING_OPT_OUT, 1); - usTx.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsTx usTx = new UsTx(); - - try { - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); - usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 0); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); - usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 1); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); - usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 0); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); - usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 2); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); - usTx.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); - - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); - usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 0); - usTx.encode(); - - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); - usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 1); - usTx.encode(); - - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); - usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 2); - usTx.encode(); - - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); - usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 2); - usTx.encode(); - - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); - usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 1); - usTx.encode(); - - - usTx.setFieldValue(UsTxField.MSPA_OPT_OUT_OPTION_MODE, 0); - - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 0); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); - usTx.encode(); - - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 1); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); - usTx.encode(); - - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 0); - usTx.encode(); - - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 1); - usTx.encode(); - - usTx.setFieldValue(UsTxField.MSPA_SERVICE_PROVIDER_MODE, 2); - usTx.setFieldValue(UsTxField.SALE_OPT_OUT_NOTICE, 2); - usTx.encode(); - } - @Test public void testEncodeWithGpcSegmentExcluded() { UsTx usTx = new UsTx(); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtTest.java index dda8a6cc..f95b88f0 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsUtTest.java @@ -118,263 +118,6 @@ public void testSetInvalidValues() { } - @Test - public void testValidateSale() { - UsUt usUt = new UsUt(); - - try { - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 1); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 2); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 0); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 0); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 2); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 0); - usUt.encode(); - - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 1); - usUt.encode(); - - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 2); - usUt.encode(); - - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT, 1); - usUt.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsUt usUt = new UsUt(); - - try { - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 1); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 2); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 0); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 0); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 2); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 0); - usUt.encode(); - - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 1); - usUt.encode(); - - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 2); - usUt.encode(); - - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usUt.setFieldValue(UsUtField.TARGETED_ADVERTISING_OPT_OUT, 1); - usUt.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsUt usUt = new UsUt(); - - try { - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 0); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 1); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 0); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 2); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); - usUt.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); - - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 0); - usUt.encode(); - - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 1); - usUt.encode(); - - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 2); - usUt.encode(); - - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 2); - usUt.encode(); - - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 1); - usUt.encode(); - - - usUt.setFieldValue(UsUtField.MSPA_OPT_OUT_OPTION_MODE, 0); - - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 0); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); - usUt.encode(); - - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 1); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); - usUt.encode(); - - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 0); - usUt.encode(); - - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 1); - usUt.encode(); - - usUt.setFieldValue(UsUtField.MSPA_SERVICE_PROVIDER_MODE, 2); - usUt.setFieldValue(UsUtField.SALE_OPT_OUT_NOTICE, 2); - usUt.encode(); - } - @Test public void testDecode1() throws DecodingException { UsUt usUt = new UsUt("BVVkklWA"); diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaTest.java index 6d8f3d22..346e0ca6 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/section/UsVaTest.java @@ -116,263 +116,6 @@ public void testSetInvalidValues() { } - @Test - public void testValidateSale() { - UsVa usVa = new UsVa(); - - try { - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 1); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 2); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 0); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 0); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 2); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 0); - usVa.encode(); - - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 1); - usVa.encode(); - - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 2); - usVa.encode(); - - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT, 1); - usVa.encode(); - } - - @Test - public void testValidateTargetedAdvertising() { - UsVa usVa = new UsVa(); - - try { - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 1); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 2); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 0); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 0); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 2); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 0); - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 0); - usVa.encode(); - - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 1); - usVa.encode(); - - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 1); - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 2); - usVa.encode(); - - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT_NOTICE, 2); - usVa.setFieldValue(UsVaField.TARGETED_ADVERTISING_OPT_OUT, 1); - usVa.encode(); - } - - @Test - public void testValidateMspaServiceProviderMode() { - UsVa usVa = new UsVa(); - - try { - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 0); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 1); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 0); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 2); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - - try { - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - try { - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); - usVa.encode(); - Assertions.fail("Expected ValidationException"); - } catch (ValidationException e) { - - } - - - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); - - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 0); - usVa.encode(); - - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 1); - usVa.encode(); - - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 2); - usVa.encode(); - - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 2); - usVa.encode(); - - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 1); - usVa.encode(); - - - usVa.setFieldValue(UsVaField.MSPA_OPT_OUT_OPTION_MODE, 0); - - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 0); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); - usVa.encode(); - - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 1); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); - usVa.encode(); - - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 0); - usVa.encode(); - - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 1); - usVa.encode(); - - usVa.setFieldValue(UsVaField.MSPA_SERVICE_PROVIDER_MODE, 2); - usVa.setFieldValue(UsVaField.SALE_OPT_OUT_NOTICE, 2); - usVa.encode(); - } - @Test public void testDecode1() throws DecodingException { UsVa usVa = new UsVa("BVWSSVY"); @@ -388,7 +131,7 @@ public void testDecode1() throws DecodingException { Assertions.assertEquals(1, usVa.getMspaOptOutOptionMode()); Assertions.assertEquals(2, usVa.getMspaServiceProviderMode()); } - + @Test() public void testDecodeGarbage() { Assertions.assertThrows(DecodingException.class, () -> { From d8fa7f5546c930cce528b50392041bda1d2f3f01 Mon Sep 17 00:00:00 2001 From: iabsxhxl Date: Tue, 25 Mar 2025 20:53:51 +0530 Subject: [PATCH 37/41] 3.2.3 --- iabgpp-encoder/pom.xml | 2 +- iabgpp-extras-jackson/pom.xml | 4 ++-- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index f7f25486..144937a7 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.3-SNAPSHOT + 3.2.3 iabgpp-encoder diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index 5467e6b0..66c85d78 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.2.3-SNAPSHOT + 3.2.3 iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.2.3-SNAPSHOT + 3.2.3 diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index 0fc7a4f8..7a23b5df 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.3-SNAPSHOT + 3.2.3 iabgpp-extras diff --git a/pom.xml b/pom.xml index 4a6d0211..126155fa 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.2.3-SNAPSHOT + 3.2.3 IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From a5a6ed5f72a4f46e7d219ca3b63b5e638988d415 Mon Sep 17 00:00:00 2001 From: iabsxhxl Date: Tue, 25 Mar 2025 20:56:11 +0530 Subject: [PATCH 38/41] 3.2.4-SNAPSHOT --- iabgpp-encoder/pom.xml | 2 +- iabgpp-extras-jackson/pom.xml | 4 ++-- iabgpp-extras/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iabgpp-encoder/pom.xml b/iabgpp-encoder/pom.xml index 144937a7..e8d49a10 100644 --- a/iabgpp-encoder/pom.xml +++ b/iabgpp-encoder/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.3 + 3.2.4-SNAPSHOT iabgpp-encoder diff --git a/iabgpp-extras-jackson/pom.xml b/iabgpp-extras-jackson/pom.xml index 66c85d78..1924b0f5 100644 --- a/iabgpp-extras-jackson/pom.xml +++ b/iabgpp-extras-jackson/pom.xml @@ -7,7 +7,7 @@ iabgpp-core com.iabgpp - 3.2.3 + 3.2.4-SNAPSHOT iabgpp-extras-jackson @@ -24,7 +24,7 @@ com.iabgpp iabgpp-extras - 3.2.3 + 3.2.4-SNAPSHOT diff --git a/iabgpp-extras/pom.xml b/iabgpp-extras/pom.xml index 7a23b5df..ffa646af 100644 --- a/iabgpp-extras/pom.xml +++ b/iabgpp-extras/pom.xml @@ -7,7 +7,7 @@ com.iabgpp iabgpp-core - 3.2.3 + 3.2.4-SNAPSHOT iabgpp-extras diff --git a/pom.xml b/pom.xml index 126155fa..02dc8f63 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iabgpp iabgpp-core - 3.2.3 + 3.2.4-SNAPSHOT IAB GPP Core Library https://github.com/IABTechLabs/iabtcf-java Encode and decode consent information with the IAB GPP v3.0. From eb6e8c76a71c75b59ba075334853459c334008e0 Mon Sep 17 00:00:00 2001 From: aitsxhxl <111370634+aitsxhxl@users.noreply.github.com> Date: Wed, 2 Apr 2025 21:59:49 +0530 Subject: [PATCH 39/41] Added GitHub Actions workflow file for iabgpp-java version release --- .github/workflows/main.yml | 86 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..0a6ad10c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,86 @@ +name: IABGPP-Java Release + +on: + workflow_dispatch: + inputs: + version: + description: 'The release version (e.g., 3.x.x)' + required: true + default: '' + +jobs: + release: + runs-on: ubuntu-latest + steps: + # Checkout the repository with full history for tagging + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + # Set up Java (assuming Java 11, adjust if different) + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + + # Import GPG secret key for signing + - name: Import GPG key + run: | + echo "${{ secrets.GPG_SECRET_KEY }}" > secret_key.asc + gpg --import --no-tty --batch secret_key.asc || { echo "GPG import failed"; cat secret_key.asc; exit 1; } + gpg --list-secret-keys + + # Generate settings.xml with Maven repository credentials + - name: Create settings.xml + run: | + mkdir -p ~/.m2 + cat > ~/.m2/settings.xml << EOF + + ~/.m2 false false org.sonatype.plugins sonatype-nexus-snapshots TiW/t45q ${{ secrets.SONATYPE_PWD }} sonatype-nexus-staging TiW/t45q ${{ secrets.SONATYPE_PWD_STAGING }} + + EOF + + # Pull latest changes from master + - name: Pull latest changes + run: git pull origin master + + # Set the release version in pom.xml + - name: Set release version + run: mvn versions:set -DnewVersion=${{ github.event.inputs.version }} -DgenerateBackupPoms=false + + # Build and deploy the release + - name: Deploy release + run: | + echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf + echo "use-agent" >> ~/.gnupg/gpg.conf + export GPG_TTY=$(tty || echo /dev/tty) + mvn clean deploy --settings ~/.m2/settings.xml -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" -Prelease -Dmaven.javadoc.skip=true + + # Commit the release version and create a tag + - name: Commit and tag release + run: | + git config user.email "mayank@iabtechlab.com" + git config user.name "Mayank Mishra" + git add . + git commit -m "${{ github.event.inputs.version }}" + git tag "${{ github.event.inputs.version }}" + + # Set the next snapshot version + - name: Set next snapshot version + run: mvn versions:set -DnextSnapshot=true -DgenerateBackupPoms=false + + # Commit the snapshot version + - name: Commit snapshot version + run: | + git add . + git commit -m "${{ github.event.inputs.version }}-SNAPSHOT" + + # Push commits and tags to GitHub + - name: Push changes + run: | + git status + git push; git push --tags + env: + GITHUB_TOKEN: ${{secrets.PAT}} From d4c0c9daecaa815aa4629149c19f8eba1113f9b5 Mon Sep 17 00:00:00 2001 From: Chad Huff Date: Fri, 25 Apr 2025 10:04:47 -0600 Subject: [PATCH 40/41] Fail if gpp string doesnt start with DB --- .../src/main/java/com/iab/gpp/encoder/GppModel.java | 2 +- .../test/java/com/iab/gpp/encoder/GppModelTest.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java index a85a5e25..b4f8cba3 100644 --- a/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java +++ b/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/GppModel.java @@ -359,7 +359,7 @@ protected String encodeModel(Map sections) { } protected Map decodeModel(String str) { - if (str == null || str.isEmpty() || str.startsWith("D")) { + if (str == null || str.isEmpty() || str.startsWith("DB")) { Map sections = new HashMap<>(); if (str != null && !str.isEmpty()) { diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 9a6e9609..9bd62929 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -821,6 +821,15 @@ public void testDecodingEmptyString() { gppModel.setFieldValue("uspv1", UspV1Field.NOTICE, 'Y'); Assertions.assertEquals("DBABTA~1Y--", gppModel.encode()); } - - + + @Test + public void testDecodingExceptionValidStringButNotGPP() { + try { + GppModel gppModel = new GppModel("DP48G0AP48G0AEsACCPLAkEgAAAAAEPgAB5YAAAQaQD2F2K2kKFkPCmQWYAQBCijYEAhQAAAAkCBIAAgAUgQAgFIIAgAIFAAAAAAAAAQEgCQAAQABAAAIACgAAAAAAIAAAAAAAQQAAAAAIAAAAAAAAEAAAAAAAQAAAAIAABEhCAAQQAEAAAAAAAQAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAgAA"); + gppModel.getHeader().getName(); + Assertions.fail("Expected LazyDecodingException"); + } catch (DecodingException e) { + + } + } } From 020135d640fd55bb8dcd0c172985bfa112b9fa6b Mon Sep 17 00:00:00 2001 From: Chad Huff Date: Tue, 24 Jun 2025 08:49:29 -0600 Subject: [PATCH 41/41] fix merge conflict --- .../com/iab/gpp/encoder/GppModelTest.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java index 2686f618..d1890a59 100644 --- a/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java +++ b/iabgpp-encoder/src/test/java/com/iab/gpp/encoder/GppModelTest.java @@ -69,20 +69,6 @@ public void testEncodeDefault() { } - @Test - public void testDecodingException() { - Assertions.assertThrows(DecodingException.class, () -> { - new GppModel("invalid gpp string").getHeader(); - }); - } - - @Test() - public void testDecodeGarbage() { - Assertions.assertThrows(DecodingException.class, () -> { - new GppModel("z").getUsCtSection(); - }); - } - @Test public void testEncodeDefaultAll() { GppModel gppModel = new GppModel(); @@ -132,7 +118,6 @@ public void testEncodeDefaultAll() { gppModel.setFieldValue(UsTn.NAME, UsTxField.VERSION, UsTx.VERSION); - Assertions.assertEquals(true, gppModel.hasSection(TcfEuV2.NAME)); Assertions.assertEquals(true, gppModel.hasSection(TcfCaV1.NAME)); Assertions.assertEquals(true, gppModel.hasSection(UspV1.NAME)); @@ -155,8 +140,9 @@ public void testEncodeDefaultAll() { String gppString = gppModel.encode(); Assertions.assertEquals( - "DBACOdM~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAABA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA~BAAAAABA~BAAAAABA.QA~BAAAAAABAA.QA~BAAAAAQA.QA~BAAAAAABAA.QA~BAAAAAQA.QA~BAAAAAQA.QA~BAAAAABA.QA~BAAAAAAAQA.QA~BAAAAAQA.QA", - gppString); + "DBACOdM~CPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA~BPSG_8APSG_8AAAAAAENAACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA~1---~BAAAAAAAAABA.QA~BAAAAABA.QA~BAAAABA~BAAAAEA.QA~BAAAAAQA~BAAAAAEA.QA~BAAAAABA~BAAAAABA.QA~BAAAAAABAA.QA~BAAAAAQA.QA~BAAAAAABAA.QA~BAAAAAQA.QA~BAAAAAQA.QA~BAAAAABA.QA~BAAAAAAAQA.QA~BAAAAAQA.QA", + gppString); + } @Test public void testDecodingException() {