Skip to content

Commit

Permalink
[STRATCONN-5445] - Fixes process consent casing in DV360 Actions (#2712)
Browse files Browse the repository at this point in the history
* [STRATCONN-5445] - Change process_consent -> processConsent

* update tests

* fix test - create copy of mockdata

* Add field comment
  • Loading branch information
varadarajan-tw authored Feb 4, 2025
1 parent 25682fd commit 3940246
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ describe('shared', () => {
})

it('should return an array of UserOperation objects with Android Advertising ID', () => {
oneMockPayload.mobile_advertising_id = '3b6e47b314374ba2b3c9446e4d0cd1e5'

const results = assembleRawOps(oneMockPayload, 'remove')
const mockPayload = {
...oneMockPayload,
mobile_advertising_id: '3b6e47b314374ba2b3c9446e4d0cd1e5'
}
const results = assembleRawOps(mockPayload, 'remove')
expect(results).toEqual([
{
UserId: 'CAESEHIV8HXNp0pFdHgi2rElMfk',
Expand Down Expand Up @@ -199,6 +201,10 @@ describe('shared', () => {
it('should create an UpdateUsersDataRequest object with the correct number of operations', () => {
const r = createUpdateRequest(manyMockPayloads, 'add')
expect(r.ops.length).toEqual(5)
expect(r.processConsent).toEqual(true)
expect(r.toJsonString()).toMatchInlineSnapshot(
`"{\\"ops\\":[{\\"userId\\":\\"CAESEHIV8HXNp0pFdHgi2rElMfk\\",\\"userIdType\\":\\"GOOGLE_USER_ID\\",\\"userListId\\":\\"456\\",\\"delete\\":false},{\\"userId\\":\\"3b6e47b3-1437-4ba2-b3c9-446e4d0cd1e5\\",\\"userIdType\\":\\"IDFA\\",\\"userListId\\":\\"456\\",\\"delete\\":false},{\\"userId\\":\\"my-anon-id-42\\",\\"userIdType\\":\\"PARTNER_PROVIDED_ID\\",\\"userListId\\":\\"456\\",\\"delete\\":false},{\\"userId\\":\\"my-anon-id-43\\",\\"userIdType\\":\\"PARTNER_PROVIDED_ID\\",\\"userListId\\":\\"456\\",\\"delete\\":false},{\\"userId\\":\\"XNp0pFdHgi2rElMfk\\",\\"userIdType\\":\\"GOOGLE_USER_ID\\",\\"userListId\\":\\"456\\",\\"delete\\":false}],\\"processConsent\\":true}"`
)
})

it('should throw an error when unable to create UpdateUsersDataRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,15 @@ export class UpdateUsersDataRequest extends Message<UpdateUsersDataRequest> {
static readonly typeName = 'UpdateUsersDataRequest'
static readonly fields: FieldList = proto2.util.newFieldList(() => [
{ no: 1, name: 'ops', kind: 'message', T: UserDataOperation, repeated: true },
{ no: 2, name: 'send_notifications', kind: 'scalar', T: 8 /* ScalarType.BOOL */, opt: true, default: false }
{ no: 2, name: 'send_notifications', kind: 'scalar', T: 8 /* ScalarType.BOOL */, opt: true, default: false },
{
no: 3,
name: 'process_consent',
kind: 'scalar',
T: 8 /* ScalarType.BOOL */,
opt: true,
default: false
}
])

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UpdateUsersDataRequest {
Expand All @@ -451,7 +459,12 @@ export class UpdateUsersDataRequest extends Message<UpdateUsersDataRequest> {
return proto2.util.equals(UpdateUsersDataRequest, a, b)
}

process_consent: boolean = false
/**
* https://developers.google.com/authorized-buyers/rtb/bulk-uploader#process_consent_in_bulk_upload_request
*
* @generated from field: optional bool process_consent = 3 [default = true];
*/
processConsent: boolean = false
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export const createUpdateRequest = (
})

// Backed by deletion and suppression features in Segment.
updateRequest.process_consent = true
updateRequest.processConsent = true

return updateRequest
}
Expand Down

0 comments on commit 3940246

Please sign in to comment.