Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
70de190
New Adapter: ResetDigital
bruno-siira Feb 5, 2024
dd48470
Fix to have the a bid forced on testing
bruno-siira Feb 7, 2024
32551fc
Merge branch 'prebid:master' into master
bruno-siira Feb 7, 2024
125124b
Merge branch 'prebid:master' into master
bruno-siira Feb 9, 2024
5c56e12
Test changes
bruno-siira Feb 9, 2024
fe4ff39
Merge branch 'prebid:master' into master
bruno-siira Feb 13, 2024
664614f
Merge branch 'master' of https://github.com/bruno-siira/prebid-server
bruno-siira Feb 13, 2024
0b44384
Merge branch 'prebid:master' into master
bruno-siira Feb 21, 2024
0775c72
Merge branch 'master' of https://github.com/bruno-siira/prebid-server
bruno-siira Feb 26, 2024
20fa856
Add file
bruno-siira Feb 28, 2024
33f4603
Added schema for adapter
bruno-siira Feb 28, 2024
e468217
Merge branch 'prebid:master' into master
bruno-siira Mar 17, 2024
b8ca566
Unused builder removed
bruno-siira Mar 18, 2024
2de7781
Fix to lack of builder
bruno-siira Mar 24, 2024
eb067f7
Change of data on export
bruno-siira Mar 26, 2024
86206d7
no need to include `required` if its empty
bruno-siira Apr 14, 2024
3fc5455
Resolving https://github.com/prebid/prebid-server/pull/3452
BrunoJacinto May 14, 2024
3762676
Merge branch 'prebid:master' into master
bruno-siira Jun 20, 2024
989c565
New Adapter: ResetDigital #3766
bruno-siira Jul 3, 2024
39905ed
Fix naming
bruno-siira Jul 5, 2024
4482bc9
Fix naming of Var
bruno-siira Jul 5, 2024
d426e8a
Fix PR New Adapter: ResetDigital #3766
bruno-siira Jul 9, 2024
ac2fc01
Fix New Adapter: ResetDigital #3766
bruno-siira Jul 9, 2024
52a6794
Fix multiple comments
bruno-siira Jul 16, 2024
9626103
New tests
bruno-siira Jul 18, 2024
dea6cf7
Fix http.StatusBadRequest and non http.StatusOK codes should not be e…
bruno-siira Jul 24, 2024
5cfe0ae
Not running tests at this momment
bruno-siira Aug 16, 2024
ece8152
Update with help of Xandr Team
bruno-siira Aug 29, 2024
baa553c
Simplify Tests
bruno-siira Aug 29, 2024
ecc90bb
PR of functioning version
bruno-siira Sep 10, 2024
0d54a8d
Added Video and removed unwanted data
bruno-siira Sep 29, 2024
660dba7
created mock test
ogbonnaEmmanuel Oct 25, 2024
5f70f11
delete fake_test.json
ogbonnaEmmanuel Oct 31, 2024
613317a
Merge pull request #1 from ogbonnaEmmanuel/master
dirk-rd Oct 31, 2024
a083c03
Adding support for audio media type and a corresponding simple-audio.…
dirk-rd Nov 3, 2024
bc7caaf
Fix slice append syntax.
dirk-rd Nov 4, 2024
4569e97
Removed zero check for bid response and moved HTTP headers into separ…
dirk-rd Nov 4, 2024
0bc2aeb
Adding test case for missing currency to improve test coverage percen…
dirk-rd Nov 4, 2024
d212d91
Merge pull request #2 from bruno-siira/add-audio
bruno-siira Nov 4, 2024
cff2442
New Adapter: ResetDigital
bruno-siira Feb 5, 2024
44bee69
Fix to have the a bid forced on testing
bruno-siira Feb 7, 2024
96fde76
Test changes
bruno-siira Feb 9, 2024
6e08b5d
Add file
bruno-siira Feb 28, 2024
ec4005d
Added schema for adapter
bruno-siira Feb 28, 2024
fd3ec0d
Unused builder removed
bruno-siira Mar 18, 2024
8bca6ad
Fix to lack of builder
bruno-siira Mar 24, 2024
278be3f
Change of data on export
bruno-siira Mar 26, 2024
56a77a0
no need to include `required` if its empty
bruno-siira Apr 14, 2024
f0e2574
Resolving https://github.com/prebid/prebid-server/pull/3452
BrunoJacinto May 14, 2024
0e365ce
New Adapter: ResetDigital #3766
bruno-siira Jul 3, 2024
f2d3afc
Fix naming
bruno-siira Jul 5, 2024
d6e24d0
Fix naming of Var
bruno-siira Jul 5, 2024
eceef87
Fix PR New Adapter: ResetDigital #3766
bruno-siira Jul 9, 2024
e86d017
Fix New Adapter: ResetDigital #3766
bruno-siira Jul 9, 2024
baa974f
Fix multiple comments
bruno-siira Jul 16, 2024
73c3fe0
New tests
bruno-siira Jul 18, 2024
246010f
Fix http.StatusBadRequest and non http.StatusOK codes should not be e…
bruno-siira Jul 24, 2024
cff5817
Not running tests at this momment
bruno-siira Aug 16, 2024
5ab5517
Update with help of Xandr Team
bruno-siira Aug 29, 2024
d3df8f2
Simplify Tests
bruno-siira Aug 29, 2024
c1795b8
PR of functioning version
bruno-siira Sep 10, 2024
1665bc9
Added Video and removed unwanted data
bruno-siira Sep 29, 2024
0f6f5b1
created mock test
ogbonnaEmmanuel Oct 25, 2024
27863db
delete fake_test.json
ogbonnaEmmanuel Oct 31, 2024
f0da5d7
Adding support for audio media type and a corresponding simple-audio.…
dirk-rd Nov 3, 2024
6c745fb
Fix slice append syntax.
dirk-rd Nov 4, 2024
56b03f1
Removed zero check for bid response and moved HTTP headers into separ…
dirk-rd Nov 4, 2024
21eecdd
Adding test case for missing currency to improve test coverage percen…
dirk-rd Nov 4, 2024
dcd9dad
COmmit
bruno-siira Nov 4, 2024
2584c6b
Changing the version to V3
bruno-siira Nov 4, 2024
123cb13
Renaming test JSON files
dirk-rd Nov 21, 2024
4950da1
Deleting errant -vv file
dirk-rd Nov 21, 2024
cc06d05
Simplying HTML test markup.
dirk-rd Nov 21, 2024
330d84f
Reverting unnecessary changes.
dirk-rd Nov 25, 2024
17cf6c8
Adding test cases via JSON to increase coverage.
dirk-rd Dec 1, 2024
5b44280
Removing keys with null values.
dirk-rd Dec 1, 2024
ee3546c
Removing unnecessary keys and fixing redirect URL.
dirk-rd Dec 1, 2024
2ecc9a8
Ignore test coverage output.
dirk-rd Dec 1, 2024
0a4d9bc
Remove unnecessary test case.
dirk-rd Dec 1, 2024
b93dca3
Formattting; removed comments; simplified GetMediaTypeForImp.
dirk-rd Dec 1, 2024
ef65f7b
Merge branch 'prebid:master' into master
dirk-rd Dec 2, 2024
6bac6cd
Merge pull request #3 from bruno-siira/pr-review-comments-11-13-24
dirk-rd Dec 4, 2024
62f74c1
Move line to restore alpha order.
dirk-rd Dec 22, 2024
4a0ec3f
Removing error return value that is no longer used.
dirk-rd Dec 22, 2024
11c824f
Removing .gitignore file.
dirk-rd Dec 22, 2024
905485d
Adding required file paras_test.go to test for (in)valid parameters.
dirk-rd Dec 22, 2024
0623316
Merge pull request #4 from bruno-siira/pr-review-comments-12-16-24
dirk-rd Dec 22, 2024
e82c838
Refactoring MakeBids() for single bid request and updating JSON tests…
dirk-rd Jan 10, 2025
a96efc8
Uncomment bid count validation.
dirk-rd Jan 10, 2025
8ed4059
Merge pull request #5 from bruno-siira/pr-review-comments-12-16-24
dirk-rd Jan 10, 2025
415d551
Adding JSON test cases to achieve coverage for various error conditions.
dirk-rd Jan 25, 2025
f0a4ad4
Removing superfluous inline comments.
dirk-rd Jan 25, 2025
fe2c572
Merge pull request #6 from bruno-siira/pr-review-comments-1-24-25
dirk-rd Jan 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 38 additions & 24 deletions adapters/resetdigital/resetdigital.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,51 +207,65 @@ func processDataFromRequest(requestData *openrtb2.BidRequest, imp openrtb2.Imp,
}

func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) {
// Return early if the response contains no content
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I suggest removing all of the comments in this function to tighten this up. IMO your code is self explanatory now. You can leave it of course if you think it will benefit your developers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

if adapters.IsResponseStatusCodeNoContent(responseData) {
return nil, nil
}

// Check for errors in the response status code
if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil {
return nil, []error{err}
}

// Parse the response body into a single bid response
var response resetDigitalBidResponse
if err := json.Unmarshal(responseData.Body, &response); err != nil {
return nil, []error{err}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please achieve code coverage of this error case by adding a supplemental JSON test (e.g. malformed-response.json) that contains a malformed response body. This can be achieved by simply setting your mock response body to a string instead of an object.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp))
// Ensure there is exactly one bid in the response
if len(response.Bids) != 1 {
return nil, []error{fmt.Errorf("expected exactly one bid in the response, but got %d", len(response.Bids))}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please achieve code coverage of this error case by adding a supplemental JSON test (e.g. multiple-bids.json) that contains more than one bid.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

// Extract the single bid
resetDigitalBid := &response.Bids[0]

var errs []error
requestImps := make(map[string]openrtb2.Imp)
for _, imp := range request.Imp {
requestImps[imp.ID] = imp
// Map the incoming impression to its ID for media type determination
requestImp, found := findRequestImpByID(request.Imp, resetDigitalBid.ImpID)
if !found {
return nil, []error{fmt.Errorf("no matching impression found for ImpID %s", resetDigitalBid.ImpID)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please achieve code coverage of this error case by adding a supplemental JSON test (e.g. imp-id-mismatch.json) with a bid response imp id that does not match the bid request imp id.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

for i := range response.Bids {
resetDigitalBid := &response.Bids[i]
// Convert the bid into an OpenRTB bid
bid, err := getBidFromResponse(resetDigitalBid)
if err != nil {
return nil, []error{err}
}

bid, err := getBidFromResponse(resetDigitalBid)
if bid == nil {
errs = append(errs, err)
continue
}
// Determine the bid type based on the impression
bidType := GetMediaTypeForImp(requestImp)

bidType := GetMediaTypeForImp(requestImps[bid.ImpID])
// Construct the bidder response
bidResponse := adapters.NewBidderResponseWithBidsCapacity(1)
bidResponse.Currency = "USD" // Default currency
bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
Bid: bid,
BidType: bidType,
Seat: openrtb_ext.BidderName(resetDigitalBid.Seat),
})

b := &adapters.TypedBid{
Bid: bid,
BidType: bidType,
Seat: openrtb_ext.BidderName(resetDigitalBid.Seat),
}
bidResponse.Bids = append(bidResponse.Bids, b)
}
return bidResponse, nil
}

if len(request.Cur) == 0 {
bidResponse.Currency = "USD"
// findRequestImpByID searches for an impression by its ID in the list of impressions
func findRequestImpByID(imps []openrtb2.Imp, impID string) (openrtb2.Imp, bool) {
for _, imp := range imps {
if imp.ID == impID {
return imp, true
}
}

return bidResponse, errs
return openrtb2.Imp{}, false
}

func getBidFromResponse(bidResponse *resetDigitalBid) (*openrtb2.Bid, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@
"comparison": "literal"
}
],
"expectedBidResponses": [{}]
"expectedBidResponses": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@
"comparison": "literal"
}
],
"expectedBidResponses": [{}]
"expectedBidResponses": []
}
Loading