Skip to content

Commit

Permalink
Amp: update consented providers settings support (prebid#3590)
Browse files Browse the repository at this point in the history
  • Loading branch information
And1sS authored and sergseven committed Dec 23, 2024
1 parent 02cec96 commit a339ea7
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ private static User createUser(ConsentParam consentParam, String addtlConsent) {

final ExtUser extUser = consentedProvidersSettings != null
? ExtUser.builder()
.deprecatedConsentedProvidersSettings(consentedProvidersSettings)
.consentedProvidersSettings(consentedProvidersSettings)
.build()
: null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ public class ExtUser extends FlexibleExtension {

/**
* Defines the contract for bidrequest.user.ext.ConsentedProvidersSettings
* <p>
* TODO: Remove after PBS 4.0
*/
@Deprecated(forRemoval = true)
@JsonProperty("ConsentedProvidersSettings")
ConsentedProvidersSettings deprecatedConsentedProvidersSettings;

ConsentedProvidersSettings consentedProvidersSettings;

@JsonIgnore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1277,10 +1277,12 @@ public void shouldReturnBidRequestWithProvidersSettingsContainsAddtlConsentIfPar
final BidRequest result = target.fromRequest(routingContext, 0L).result().getBidRequest();

// then
final ConsentedProvidersSettings settings = ConsentedProvidersSettings.of("someConsent");
assertThat(result.getUser())
.isEqualTo(User.builder()
.ext(ExtUser.builder()
.consentedProvidersSettings(ConsentedProvidersSettings.of("someConsent"))
.deprecatedConsentedProvidersSettings(settings)
.consentedProvidersSettings(settings)
.build())
.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void makeHttpRequestsShouldUseProperEndpoints() {
public void makeHttpRequestsShouldProperProcessConsentedProvidersSetting() {
// given
final ExtUser extUser = ExtUser.builder()
.consentedProvidersSettings(ConsentedProvidersSettings.of("1~10.20.90"))
.deprecatedConsentedProvidersSettings(ConsentedProvidersSettings.of("1~10.20.90"))
.build();

final BidRequest bidRequest = givenBidRequest(bidRequestBuilder -> bidRequestBuilder
Expand Down Expand Up @@ -145,7 +145,7 @@ public void makeHttpRequestsShouldProperProcessConsentedProvidersSetting() {
public void makeHttpRequestsShouldProperProcessConsentedProvidersSettingWithMultipleTilda() {
// given
final ExtUser extUser = ExtUser.builder()
.consentedProvidersSettings(ConsentedProvidersSettings.of("1~10.20.90~anything"))
.deprecatedConsentedProvidersSettings(ConsentedProvidersSettings.of("1~10.20.90~anything"))
.build();

final BidRequest bidRequest = givenBidRequest(bidRequestBuilder -> bidRequestBuilder
Expand Down Expand Up @@ -174,7 +174,7 @@ public void makeHttpRequestsShouldProperProcessConsentedProvidersSettingWithMult
public void makeHttpRequestsShouldReturnUserExtIfConsentedProvidersIsNotProvided() {
// given
final ExtUser extUser = ExtUser.builder()
.consentedProvidersSettings(ConsentedProvidersSettings.of(null))
.deprecatedConsentedProvidersSettings(ConsentedProvidersSettings.of(null))
.build();

final BidRequest bidRequest = givenBidRequest(bidRequestBuilder ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
"ext": {
"ConsentedProvidersSettings": {
"consented_providers": "someConsent"
},
"consented_providers_settings": {
"consented_providers": "someConsent"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
"ext": {
"ConsentedProvidersSettings": {
"consented_providers": "someConsent"
},
"consented_providers_settings": {
"consented_providers": "someConsent"
}
}
},
Expand Down

0 comments on commit a339ea7

Please sign in to comment.