@@ -15,16 +15,10 @@ import org.prebid.server.functional.model.request.amp.AmpRequest
1515import org.prebid.server.functional.model.request.auction.Activity
1616import org.prebid.server.functional.model.request.auction.ActivityRule
1717import org.prebid.server.functional.model.request.auction.AllowActivities
18- import org.prebid.server.functional.model.request.auction.BidRequest
1918import org.prebid.server.functional.model.request.auction.Condition
20- import org.prebid.server.functional.model.request.auction.Data
2119import org.prebid.server.functional.model.request.auction.Device
22- import org.prebid.server.functional.model.request.auction.Eid
2320import org.prebid.server.functional.model.request.auction.Geo
2421import org.prebid.server.functional.model.request.auction.RegsExt
25- import org.prebid.server.functional.model.request.auction.User
26- import org.prebid.server.functional.model.request.auction.UserExt
27- import org.prebid.server.functional.model.request.auction.UserExtData
2822import org.prebid.server.functional.service.PrebidServerException
2923import org.prebid.server.functional.util.PBSUtils
3024import org.prebid.server.functional.util.privacy.gpp.UsCaV1Consent
@@ -87,6 +81,7 @@ import static org.prebid.server.functional.model.request.auction.PrivacyModule.I
8781import static org.prebid.server.functional.model.request.auction.PrivacyModule.IAB_US_CUSTOM_LOGIC
8882import static org.prebid.server.functional.model.request.auction.PrivacyModule.IAB_US_GENERAL
8983import static org.prebid.server.functional.model.request.auction.TraceLevel.VERBOSE
84+ import static org.prebid.server.functional.model.response.auction.ErrorType.PREBID
9085import static org.prebid.server.functional.util.privacy.model.State.ALABAMA
9186import static org.prebid.server.functional.util.privacy.model.State.ONTARIO
9287
@@ -1114,6 +1109,59 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec {
11141109 ]
11151110 }
11161111
1112+ def " PBS auction call when privacy module contain invalid GPP string should remove UFPD fields in request" () {
1113+ given : " Default Generic BidRequests with UFPD fields and account id"
1114+ def accountId = PBSUtils . randomNumber as String
1115+ def bidRequest = getBidRequestWithPersonalData(accountId). tap {
1116+ regs. gppSid = [US_NAT_V1 . intValue]
1117+ regs. gpp = INVALID_GPP_STRING
1118+ }
1119+
1120+ and : " Activities set for transmitUfpd with rejecting privacy regulation"
1121+ def rule = new ActivityRule (). tap {
1122+ it. privacyRegulation = [IAB_US_GENERAL ]
1123+ }
1124+
1125+ def activities = AllowActivities . getDefaultAllowActivities(TRANSMIT_UFPD , Activity . getDefaultActivity([rule]))
1126+
1127+ and : " Account gpp configuration"
1128+ def accountGppConfig = new AccountGppConfig (code : IAB_US_GENERAL , enabled : true )
1129+
1130+ and : " Existed account with privacy regulation setup"
1131+ def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig])
1132+ accountDao. save(account)
1133+
1134+ when : " PBS processes auction requests"
1135+ def response= activityPbsService. sendAuctionRequest(bidRequest)
1136+
1137+ then : " Generic bidder request should have empty UFPD fields"
1138+ def bidderRequest = bidder. getBidderRequest(bidRequest. id)
1139+ verifyAll {
1140+ ! bidderRequest. device. didsha1
1141+ ! bidderRequest. device. didmd5
1142+ ! bidderRequest. device. dpidsha1
1143+ ! bidderRequest. device. ifa
1144+ ! bidderRequest. device. macsha1
1145+ ! bidderRequest. device. macmd5
1146+ ! bidderRequest. device. dpidmd5
1147+ ! bidderRequest. user. id
1148+ ! bidderRequest. user. buyeruid
1149+ ! bidderRequest. user. yob
1150+ ! bidderRequest. user. gender
1151+ ! bidderRequest. user. data
1152+ ! bidderRequest. user. ext
1153+ }
1154+
1155+ and : " Generic bidder request should have data in EIDS fields"
1156+ assert bidderRequest. user. eids == bidRequest. user. eids
1157+
1158+ and : " Response should not contain any warnings"
1159+ assert ! response. ext. warnings
1160+
1161+ and : " Response should not contain any errors"
1162+ assert ! response. ext. errors
1163+ }
1164+
11171165 def " PBS auction call when request have different gpp consent but match and rejecting should remove UFPD fields in request" () {
11181166 given : " Default Generic BidRequests with UFPD fields and account id"
11191167 def accountId = PBSUtils . randomNumber as String
@@ -2387,6 +2435,69 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec {
23872435 ]
23882436 }
23892437
2438+ def " PBS amp call when privacy module contain invalid GPP string should remove UFPD fields in request" () {
2439+ given : " Default Generic BidRequest with UFPD fields field and account id"
2440+ def accountId = PBSUtils . randomNumber as String
2441+ def ampStoredRequest = getBidRequestWithPersonalData(accountId)
2442+
2443+ and : " amp request with link to account"
2444+ def ampRequest = AmpRequest . defaultAmpRequest. tap {
2445+ it. account = accountId
2446+ it. gppSid = US_NAT_V1 . value
2447+ it. consentString = INVALID_GPP_STRING
2448+ it. consentType = GPP
2449+ }
2450+
2451+ and : " Activities set for transmitUfpd with allowing privacy regulation"
2452+ def rule = new ActivityRule (). tap {
2453+ it. privacyRegulation = [IAB_US_GENERAL ]
2454+ }
2455+
2456+ def activities = AllowActivities . getDefaultAllowActivities(TRANSMIT_UFPD , Activity . getDefaultActivity([rule]))
2457+
2458+ and : " Account gpp configuration"
2459+ def accountGppConfig = new AccountGppConfig (code : IAB_US_GENERAL , enabled : true )
2460+
2461+ and : " Existed account with privacy regulation setup"
2462+ def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig])
2463+ accountDao. save(account)
2464+
2465+ and : " Stored request in DB"
2466+ def storedRequest = StoredRequest . getStoredRequest(ampRequest, ampStoredRequest)
2467+ storedRequestDao. save(storedRequest)
2468+
2469+ when : " PBS processes amp request"
2470+ def response = activityPbsService. sendAmpRequest(ampRequest)
2471+
2472+ then : " Generic bidder request should have empty UFPD fields"
2473+ def bidderRequest = bidder. getBidderRequest(ampStoredRequest. id)
2474+ verifyAll {
2475+ ! bidderRequest. device. didsha1
2476+ ! bidderRequest. device. didmd5
2477+ ! bidderRequest. device. dpidsha1
2478+ ! bidderRequest. device. ifa
2479+ ! bidderRequest. device. macsha1
2480+ ! bidderRequest. device. macmd5
2481+ ! bidderRequest. device. dpidmd5
2482+ ! bidderRequest. user. id
2483+ ! bidderRequest. user. buyeruid
2484+ ! bidderRequest. user. yob
2485+ ! bidderRequest. user. gender
2486+ ! bidderRequest. user. data
2487+ ! bidderRequest. user. ext
2488+ }
2489+
2490+ and : " Generic bidder request should have data in EIDS fields"
2491+ assert bidderRequest. user. eids == ampStoredRequest. user. eids
2492+
2493+ and : " Response should not contain any warnings"
2494+ assert ! response. ext. warnings
2495+
2496+ and : " Response should contain amp error"
2497+ assert response. ext?. errors[PREBID ]* . code == [999 ]
2498+ assert response. ext?. errors[PREBID ]* . message == [" Amp request parameter consent_string has invalid format: $INVALID_GPP_STRING " ]
2499+ }
2500+
23902501 def " PBS amp call when request have different gpp consent but match and rejecting should remove UFPD fields in request" () {
23912502 given : " Default Generic BidRequest with UFPD fields field and account id"
23922503 def accountId = PBSUtils . randomNumber as String
0 commit comments